Skip to content

Commit

Permalink
Update to Minecraft 1.19
Browse files Browse the repository at this point in the history
  • Loading branch information
doctor4t committed Jun 8, 2022
1 parent c6d6996 commit 0f3d8e3
Show file tree
Hide file tree
Showing 18 changed files with 80 additions and 232 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Rat's Mischief - Changelog:

### Rat's Mischief 1.3.8 - 1.19
- Updated to Minecraft 1.19
- Removed Ratify command, as well as Requiem and Origins compatibility

### Rat's Mischief 1.3.7 - 1.18.2
- Fixed being unable to start a world with origins installed

Expand Down
13 changes: 0 additions & 13 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -98,19 +98,6 @@ dependencies {
// Geckolib
modImplementation "software.bernie.geckolib:geckolib-fabric-${project.geckolib_version}"

// modCompileOnly "io.github.ladysnake:requiem-api:${requiem_version}"
// modCompileOnly "io.github.ladysnake:requiem-core:${requiem_version}"
// modCompileOnly "io.github.ladysnake:requiem:${requiem_version}"
// modCompileOnly "io.github.ladysnake:requiem:${requiem_version}"
//
// // Made available when Requiem is present
// modCompileOnly "io.github.ladysnake:PlayerAbilityLib:${pal_version}"
// modCompileOnly "dev.onyxstudios.cardinal-components-api:cardinal-components-base:4.+"
// modCompileOnly "dev.onyxstudios.cardinal-components-api:cardinal-components-entity:4.+"
//
modCompileOnly "com.github.apace100:origins-fabric:${origins_version}"
// modRuntimeOnly "com.github.apace100:origins-fabric:${origins_version}"

runtimeOnly "me.zeroeightsix:fiber:0.23.0-2"

testmodImplementation sourceSets.main.output
Expand Down
17 changes: 7 additions & 10 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,21 @@
org.gradle.jvmargs=-Xmx1G

# Fabric Properties
minecraft_version=1.18.2
yarn_mappings=1.18.2+build.2
loader_version=0.13.3
minecraft_version=1.19
yarn_mappings=1.19+build.1
loader_version=0.14.7

#Fabric api
fabric_version=0.48.0+1.18.2
fabric_version=0.55.3+1.19

# Mod Properties
mod_version = 1.3.7
mod_version = 1.3.8
maven_group = io.github.ladysnake
archives_base_name = ratsmischief

# Mod Depencencies
geckolib_version=1.18:3.0.32
requiem_version = 2.0.0-beta.7
geckolib_version=1.19:3.1.0
pal_version = 1.5.0
origins_version = 1.3.1

#Other Dependencies
findbugs_version = 3.0.2
Expand All @@ -29,8 +27,7 @@ apiguardian_version = 1.0.0
owners = Ladysnake
license_header = ARR
curseforge_id = 431787
curseforge_versions = 1.18.2
curseforge_versions = 1.19
cf_requirements = fabric-api; geckolib
cf_optionals = requiem
release_type = release
changelog_url = https://github.com/Ladysnake/Rats-Mischief/blob/main/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@
import ladysnake.ratsmischief.client.render.entity.RatEntityRenderer;
import ladysnake.ratsmischief.common.Mischief;
import net.fabricmc.api.ClientModInitializer;
import net.fabricmc.fabric.api.client.rendereregistry.v1.EntityRendererRegistry;
import net.fabricmc.fabric.api.client.rendering.v1.EntityRendererRegistry;
import net.fabricmc.fabric.api.object.builder.v1.client.model.FabricModelPredicateProviderRegistry;
import net.minecraft.util.Identifier;

public class MischiefClient implements ClientModInitializer {
@Override
public void onInitializeClient() {
EntityRendererRegistry.INSTANCE.register(Mischief.RAT, RatEntityRenderer::new);
EntityRendererRegistry.register(Mischief.RAT, RatEntityRenderer::new);

// model predicates
FabricModelPredicateProviderRegistry.register(new Identifier(Mischief.MODID + ":filled"), (itemStack, world, livingEntity, seed) -> itemStack.getOrCreateSubNbt(Mischief.MODID).getFloat("filled"));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
import net.minecraft.item.ItemStack;
import net.minecraft.item.Items;
import net.minecraft.text.Text;
import net.minecraft.text.TranslatableText;
import net.minecraft.util.Formatting;
import net.minecraft.util.Identifier;
import org.lwjgl.glfw.GLFW;
Expand All @@ -41,7 +40,7 @@ public class StaffCommandSelectionScreen extends Screen {
private static final Text SELECT_NEXT_TEXT;

static {
SELECT_NEXT_TEXT = new TranslatableText("debug.gamemodes.select_next", new Object[]{(new TranslatableText("debug.gamemodes.press_f4")).formatted(Formatting.AQUA)});
SELECT_NEXT_TEXT = Text.translatable("debug.gamemodes.select_next", new Object[]{(Text.translatable("debug.gamemodes.press_f4")).formatted(Formatting.AQUA)});
}

private final Optional<StaffCommandSelectionScreen.GameMode> currentGameMode = StaffCommandSelectionScreen.GameMode.of(this.getPreviousGameMode());
Expand Down Expand Up @@ -155,10 +154,10 @@ public boolean isPauseScreen() {

@Environment(EnvType.CLIENT)
private static enum GameMode {
CREATIVE(new TranslatableText("gameMode.creative"), "/gamemode creative", new ItemStack(Mischief.HARVEST_STAFF)),
SURVIVAL(new TranslatableText("gameMode.survival"), "/gamemode survival", new ItemStack(Mischief.COLLECTION_STAFF)),
ADVENTURE(new TranslatableText("gameMode.adventure"), "/gamemode adventure", new ItemStack(Mischief.LOVE_STAFF)),
SPECTATOR(new TranslatableText("gameMode.spectator"), "/gamemode spectator", new ItemStack(Items.BARRIER));
CREATIVE(Text.translatable("gameMode.creative"), "/gamemode creative", new ItemStack(Mischief.HARVEST_STAFF)),
SURVIVAL(Text.translatable("gameMode.survival"), "/gamemode survival", new ItemStack(Mischief.COLLECTION_STAFF)),
ADVENTURE(Text.translatable("gameMode.adventure"), "/gamemode adventure", new ItemStack(Mischief.LOVE_STAFF)),
SPECTATOR(Text.translatable("gameMode.spectator"), "/gamemode spectator", new ItemStack(Items.BARRIER));

protected static final StaffCommandSelectionScreen.GameMode[] VALUES = values();
protected static final int field_32316 = 5;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,16 @@
public class RatEntityModel extends AnimatedGeoModel<RatEntity> {
private static final Identifier MODEL_LOCATION = new Identifier(Mischief.MODID, "geo/entity/rat.geo.json");
private static final Identifier ANIMATION_LOCATION = new Identifier(Mischief.MODID, "animations/entity/rat.animation.json");

private static Identifier[] RAT_KID_TEXTURES;
private static final Identifier REMY_TEXTURE = new Identifier(Mischief.MODID, "textures/entity/named/remy.png");
private static Identifier[] RAT_KID_TEXTURES;

@Override
public Identifier getModelLocation(RatEntity rat) {
public Identifier getModelResource(RatEntity rat) {
return MODEL_LOCATION;
}

@Override
public Identifier getTextureLocation(RatEntity rat) {
public Identifier getTextureResource(RatEntity rat) {
if (RAT_KID_TEXTURES == null) {
RAT_KID_TEXTURES = new Identifier[16];
for (DyeColor color : DyeColor.values()) {
Expand All @@ -33,16 +32,15 @@ public Identifier getTextureLocation(RatEntity rat) {
}
if (rat.getRatType() == RatEntity.Type.RUSSIAN_BLUE && rat.hasCustomName() && rat.getCustomName().getString().equalsIgnoreCase("remy")) {
return REMY_TEXTURE;
}
else if (rat.getRatType() == RatEntity.Type.RAT_KID) {
} else if (rat.getRatType() == RatEntity.Type.RAT_KID) {
return RAT_KID_TEXTURES[rat.getRatColor().getId()];
} else {
return rat.getRatType().ratTexture;
}
}

@Override
public Identifier getAnimationFileLocation(RatEntity rat) {
public Identifier getAnimationResource(RatEntity rat) {
return ANIMATION_LOCATION;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,8 @@
import java.util.Locale;

public class ElytratFeatureRenderer extends GeoLayerRenderer<RatEntity> {
private static Identifier[] RAT_KID_TEXTURES;
private static final Identifier DEFAULT_ELYTRAT = new Identifier(Mischief.MODID, "textures/entity/elytrat.png");

private static Identifier[] RAT_KID_TEXTURES;
private final ElytratEntityRenderer elytratEntityRenderer;

public ElytratFeatureRenderer(IGeoRenderer<RatEntity> entityRendererIn, ElytratEntityRenderer elytratEntityRenderer) {
Expand All @@ -35,13 +34,12 @@ public void render(MatrixStack matrixStackIn, VertexConsumerProvider bufferIn, i
Identifier textureToUse = rat.getRatType().elytratTexture;
if (rat.getRatType() == RatEntity.Type.RAT_KID) {
textureToUse = RAT_KID_TEXTURES[rat.getRatColor().getId()];
}
else if (textureToUse == null) {
} else if (textureToUse == null) {
textureToUse = DEFAULT_ELYTRAT;
}

if (rat.isElytrat()) {
elytratEntityRenderer.render(getEntityModel().getModel(getEntityModel().getModelLocation(rat)),
elytratEntityRenderer.render(getEntityModel().getModel(getEntityModel().getModelResource(rat)),
rat,
partialTicks,
RenderLayer.getEntityCutout(textureToUse),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public void render(MatrixStack matrixStackIn, VertexConsumerProvider bufferIn, i
}
}
Identifier hatTexture = TEXTURES[ratEntity.getPartyHat().ordinal()];
partyHatEntityRenderer.render(getEntityModel().getModel(getEntityModel().getModelLocation(ratEntity)),
partyHatEntityRenderer.render(getEntityModel().getModel(getEntityModel().getModelResource(ratEntity)),
ratEntity,
partialTicks,
RenderLayer.getEntityCutout(hatTexture),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public RatEntityRenderer(EntityRendererFactory.Context context) {
public void renderEarly(RatEntity ratEntity, MatrixStack stackIn, float ticks, VertexConsumerProvider vertexConsumerProvider, VertexConsumer vertexBuilder, int packedLightIn, int packedOverlayIn, float red, float green, float blue, float partialTicks) {
this.itemStack = ratEntity.getEquippedStack(EquipmentSlot.MAINHAND);
this.vertexConsumerProvider = vertexConsumerProvider;
this.ratTexture = this.getTextureLocation(ratEntity);
this.ratTexture = this.getTexture(ratEntity);

super.renderEarly(ratEntity, stackIn, ticks, vertexConsumerProvider, vertexBuilder, packedLightIn, packedOverlayIn, red,
green, blue, partialTicks);
Expand Down
22 changes: 2 additions & 20 deletions src/main/java/ladysnake/ratsmischief/common/Mischief.java
Original file line number Diff line number Diff line change
@@ -1,23 +1,18 @@
package ladysnake.ratsmischief.common;

import ladysnake.ratsmischief.common.armormaterials.RatMaskArmorMaterial;
import ladysnake.ratsmischief.common.command.PlayerRatifyCommand;
import ladysnake.ratsmischief.common.command.PlayerUnratifyCommand;
import ladysnake.ratsmischief.common.compat.MischiefOriginsCompat;
import ladysnake.ratsmischief.common.entity.RatEntity;
import ladysnake.ratsmischief.common.item.RatPouchItem;
import ladysnake.ratsmischief.common.item.RatStaffItem;
import ladysnake.ratsmischief.common.village.MischiefTradeOffers;
import ladysnake.ratsmischief.common.world.RatSpawner;
import net.fabricmc.api.ModInitializer;
import net.fabricmc.fabric.api.command.v1.CommandRegistrationCallback;
import net.fabricmc.fabric.api.event.lifecycle.v1.ServerTickEvents;
import net.fabricmc.fabric.api.object.builder.v1.entity.FabricDefaultAttributeRegistry;
import net.fabricmc.fabric.api.object.builder.v1.entity.FabricEntityTypeBuilder;
import net.fabricmc.fabric.api.object.builder.v1.trade.TradeOfferHelper;
import net.fabricmc.loader.api.FabricLoader;
import net.minecraft.entity.*;
import net.minecraft.entity.decoration.painting.PaintingMotive;
import net.minecraft.entity.decoration.painting.PaintingVariant;
import net.minecraft.item.ArmorItem;
import net.minecraft.item.Item;
import net.minecraft.item.ItemGroup;
Expand Down Expand Up @@ -76,19 +71,6 @@ public void onInitialize() {
RAT = registerEntity("rat", FabricEntityTypeBuilder.createMob().entityFactory(RatEntity::new).spawnGroup(SpawnGroup.AMBIENT).dimensions(EntityDimensions.fixed(0.6F, 0.4F)).spawnRestriction(SpawnRestriction.Location.ON_GROUND, Heightmap.Type.MOTION_BLOCKING_NO_LEAVES, RatEntity::canMobSpawn).build());
FabricDefaultAttributeRegistry.register(RAT, RatEntity.createEntityAttributes());

// ratify and untratify commands
CommandRegistrationCallback.EVENT.register((commandDispatcher, b) ->
PlayerRatifyCommand.register(commandDispatcher)
);
CommandRegistrationCallback.EVENT.register((commandDispatcher, b) ->
PlayerUnratifyCommand.register(commandDispatcher)
);

// origins compat hack
if (FabricLoader.getInstance().isModLoaded("origins")) {
MischiefOriginsCompat.init();
}

// rat custom spawner
RatSpawner ratSpawner = new RatSpawner();
ServerTickEvents.END_WORLD_TICK.register(world -> {
Expand Down Expand Up @@ -116,7 +98,7 @@ public void onInitialize() {
ENTITY_RAT_BITE = Registry.register(Registry.SOUND_EVENT, ENTITY_RAT_BITE.getId(), ENTITY_RAT_BITE);

// rat kid painting
Registry.register(Registry.PAINTING_MOTIVE, new Identifier(MODID, "a_rat_in_time"), new PaintingMotive(64, 48));
Registry.register(Registry.PAINTING_VARIANT, new Identifier(MODID, "a_rat_in_time"), new PaintingVariant(64, 48));

TradeOfferHelper.registerWanderingTraderOffers(1, factories -> factories.add(new MischiefTradeOffers.SellItemFactory(Mischief.RAT_MASK, 40, 1, 3, 40)));
}
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

Loading

0 comments on commit 0f3d8e3

Please sign in to comment.