diff --git a/build.gradle b/build.gradle index 4fec1155..e8719289 100644 --- a/build.gradle +++ b/build.gradle @@ -57,7 +57,7 @@ dependencies { compileOnly "com.google.code.findbugs:jsr305:3.0.2" modApi fabricApi.module("fabric-api-base", project.fabric_version) - modApi fabricApi.module("fabric-events-lifecycle-v0", project.fabric_version) + modApi fabricApi.module("fabric-lifecycle-events-v1", project.fabric_version) modApi fabricApi.module("fabric-resource-loader-v0", project.fabric_version) modApi "com.minelittlepony:Kirin:${project.kirin_version}" diff --git a/gradle.properties b/gradle.properties index 1b3df2b8..ef0a81f4 100644 --- a/gradle.properties +++ b/gradle.properties @@ -3,21 +3,21 @@ org.gradle.daemon=false # Fabric Properties # check these on https://modmuss50.me/fabric.html - minecraft_version=1.16-rc1 - yarn_mappings=1.16-rc1+build.4:v2 - loader_version=0.8.8+build.202 - fabric_version=0.12.5+build.367-1.16 + minecraft_version=1.16.2 + yarn_mappings=1.16.2+build.19:v2 + loader_version=0.9.1+build.205 + fabric_version=0.18.0+build.397-1.16 # Mod Properties group=com.minelittlepony displayname=Mine Little Pony authors=Verdana, Rene_Z, Mumfrey, Killjoy1221, Sollace description=Mine Little Pony turns players and mobs into ponies. Press F9 ingame to access settings. - version=4.1.1 + version=4.2 release=SNAPSHOT # Dependencies modmenu_version=1.12.+ - kirin_version=1.6.4-1.16-rc1-1.16 - hd_skins_version=6.2-1.16-rc1-1.16 - mson_version=1.2-1.16-rc1-1.16 + kirin_version=1.7-1.16.2-SNAPSHOT + hd_skins_version=6.3-1.16.2-SNAPSHOT + mson_version=1.2.1-1.16-rc1-1.16 diff --git a/src/main/java/com/minelittlepony/client/MineLittlePony.java b/src/main/java/com/minelittlepony/client/MineLittlePony.java index e983759c..e9357277 100644 --- a/src/main/java/com/minelittlepony/client/MineLittlePony.java +++ b/src/main/java/com/minelittlepony/client/MineLittlePony.java @@ -89,7 +89,7 @@ public class MineLittlePony implements ClientModInitializer { } private void onClientReady(MinecraftClient client) { - renderManager.initialise(client.getEntityRenderManager()); + renderManager.initialise(client.getEntityRenderDispatcher()); } private void onTick(MinecraftClient client) { diff --git a/src/main/java/com/minelittlepony/client/mixin/MixinItemRenderer.java b/src/main/java/com/minelittlepony/client/mixin/MixinItemRenderer.java index 8ee4e197..5d3b9484 100644 --- a/src/main/java/com/minelittlepony/client/mixin/MixinItemRenderer.java +++ b/src/main/java/com/minelittlepony/client/mixin/MixinItemRenderer.java @@ -27,7 +27,7 @@ abstract class MixinItemRenderer { } } - @Inject(method = "method_29711(" + VertexConsumerProvider + RenderLayer + Boolean + Boolean + ")" + VertexConsumer, at = @At("HEAD"), cancellable = true) + @Inject(method = "getDirectGlintVertexConsumer(" + VertexConsumerProvider + RenderLayer + Boolean + Boolean + ")" + VertexConsumer, at = @At("HEAD"), cancellable = true) private static void onMethod_29711(VertexConsumerProvider provider, RenderLayer layer, boolean solide, boolean glint, CallbackInfoReturnable info) { if (LevitatingItemRenderer.usesTransparency()) { info.setReturnValue(provider.getBuffer(LevitatingItemRenderer.getRenderLayer())); diff --git a/src/main/java/com/minelittlepony/client/model/AbstractPonyModel.java b/src/main/java/com/minelittlepony/client/model/AbstractPonyModel.java index ea961060..cc2aee4c 100644 --- a/src/main/java/com/minelittlepony/client/model/AbstractPonyModel.java +++ b/src/main/java/com/minelittlepony/client/model/AbstractPonyModel.java @@ -128,7 +128,7 @@ public abstract class AbstractPonyModel extends ClientPo rightLeg.pitch = ROTATE_90; leftLeg.pitch = ROTATE_90; - head.setPivot(1, 2, isSneaking ? -1 : 1); + head.setPivot(1, 2, sneaking ? -1 : 1); ((MsonPart)rightArm).shift(0, 2, 6); ((MsonPart)leftArm).shift(0, 2, 6); @@ -461,7 +461,7 @@ public abstract class AbstractPonyModel extends ClientPo arm.yaw = head.yaw - 0.06F; arm.roll = MathHelper.cos(ticks * 0.09F) * 0.05F + 0.05F; - if (isSneaking) { + if (sneaking) { arm.pivotY += 4; } } @@ -602,7 +602,7 @@ public abstract class AbstractPonyModel extends ClientPo } protected void renderLegs(MatrixStack stack, VertexConsumer vertices, int overlayUv, int lightUv, float red, float green, float blue, float alpha) { - if (!isSneaking) { + if (!sneaking) { torso.rotate(stack); } diff --git a/src/main/java/com/minelittlepony/client/model/ClientPonyModel.java b/src/main/java/com/minelittlepony/client/model/ClientPonyModel.java index af43d2b5..a6678c15 100644 --- a/src/main/java/com/minelittlepony/client/model/ClientPonyModel.java +++ b/src/main/java/com/minelittlepony/client/model/ClientPonyModel.java @@ -36,7 +36,7 @@ public abstract class ClientPonyModel extends MsonPlayer public void updateLivingState(T entity, IPony pony, EquineRenderManager.Mode mode) { child = entity.isBaby(); attributes.updateLivingState(entity, pony, mode); - isSneaking = attributes.isCrouching; + sneaking = attributes.isCrouching; riding = attributes.isSitting; } diff --git a/src/main/java/com/minelittlepony/client/model/entity/PiglinPonyModel.java b/src/main/java/com/minelittlepony/client/model/entity/PiglinPonyModel.java index 73056805..8af39780 100644 --- a/src/main/java/com/minelittlepony/client/model/entity/PiglinPonyModel.java +++ b/src/main/java/com/minelittlepony/client/model/entity/PiglinPonyModel.java @@ -2,6 +2,7 @@ package com.minelittlepony.client.model.entity; import net.minecraft.client.model.ModelPart; import net.minecraft.entity.mob.HostileEntity; +import net.minecraft.entity.mob.PiglinActivity; import net.minecraft.entity.mob.PiglinEntity; import net.minecraft.util.math.MathHelper; @@ -11,7 +12,7 @@ import com.minelittlepony.mson.api.ModelContext; public class PiglinPonyModel extends ZomponyModel { - private PiglinEntity.Activity activity; + private PiglinActivity activity; private ModelPart leftFlap; private ModelPart rightFlap; @@ -33,15 +34,15 @@ public class PiglinPonyModel extends ZomponyModel { PiglinEntity piglinEntity = (PiglinEntity)entity; activity = piglinEntity.getActivity(); - if (activity == PiglinEntity.Activity.CROSSBOW_HOLD) { + if (activity == PiglinActivity.CROSSBOW_HOLD) { rightArmPose = ArmPose.CROSSBOW_HOLD; - } else if (activity == PiglinEntity.Activity.CROSSBOW_CHARGE) { + } else if (activity == PiglinActivity.CROSSBOW_CHARGE) { rightArmPose = ArmPose.CROSSBOW_CHARGE; - } else if (activity == PiglinEntity.Activity.ADMIRING_ITEM) { + } else if (activity == PiglinActivity.ADMIRING_ITEM) { leftArmPose = ArmPose.ITEM; } } else { - activity = PiglinEntity.Activity.DEFAULT; + activity = PiglinActivity.DEFAULT; } } @@ -49,7 +50,7 @@ public class PiglinPonyModel extends ZomponyModel { public void setAngles(HostileEntity entity, float move, float swing, float ticks, float headYaw, float headPitch) { super.setAngles(entity, move, swing, ticks, headYaw, headPitch); - if (activity == PiglinEntity.Activity.ADMIRING_ITEM) { + if (activity == PiglinActivity.ADMIRING_ITEM) { leftArm.yaw = 0.5F; leftArm.pitch = -1.9F; leftArm.pivotY += 4; diff --git a/src/main/java/com/minelittlepony/client/model/entity/race/EarthPonyModel.java b/src/main/java/com/minelittlepony/client/model/entity/race/EarthPonyModel.java index 138116f9..b2f2b4fc 100644 --- a/src/main/java/com/minelittlepony/client/model/entity/race/EarthPonyModel.java +++ b/src/main/java/com/minelittlepony/client/model/entity/race/EarthPonyModel.java @@ -34,7 +34,7 @@ public class EarthPonyModel extends AbstractPonyModel public void setAngles(T entity, float move, float swing, float ticks, float headYaw, float headPitch) { super.setAngles(entity, move, swing, ticks, headYaw, headPitch); snout.setGender(getMetadata().getGender()); - cape.pivotY = isSneaking ? 2 : riding ? -4 : 0; + cape.pivotY = sneaking ? 2 : riding ? -4 : 0; } @Override diff --git a/src/main/java/com/minelittlepony/client/model/entity/race/SeaponyModel.java b/src/main/java/com/minelittlepony/client/model/entity/race/SeaponyModel.java index ec623060..89f3b286 100644 --- a/src/main/java/com/minelittlepony/client/model/entity/race/SeaponyModel.java +++ b/src/main/java/com/minelittlepony/client/model/entity/race/SeaponyModel.java @@ -50,7 +50,7 @@ public class SeaponyModel extends UnicornModel { super.updateLivingState(entity, pony, mode); // Seaponies can't sneak, silly - isSneaking = false; + sneaking = false; attributes.isCrouching = false; } @@ -166,7 +166,7 @@ public class SeaponyModel extends UnicornModel { super.updateLivingState(entity, pony, mode); // Seaponies can't sneak, silly - isSneaking = false; + sneaking = false; } @Override diff --git a/src/main/java/com/minelittlepony/client/render/DebugBoundingBoxRenderer.java b/src/main/java/com/minelittlepony/client/render/DebugBoundingBoxRenderer.java index bb504ece..b471692f 100644 --- a/src/main/java/com/minelittlepony/client/render/DebugBoundingBoxRenderer.java +++ b/src/main/java/com/minelittlepony/client/render/DebugBoundingBoxRenderer.java @@ -20,7 +20,7 @@ public final class DebugBoundingBoxRenderer { MinecraftClient client = MinecraftClient.getInstance(); - if (!client.getEntityRenderManager().shouldRenderHitboxes() || entity.isInvisible() || client.hasReducedDebugInfo()) { + if (!client.getEntityRenderDispatcher().shouldRenderHitboxes() || entity.isInvisible() || client.hasReducedDebugInfo()) { return; } diff --git a/src/main/java/com/minelittlepony/client/render/MobRenderers.java b/src/main/java/com/minelittlepony/client/render/MobRenderers.java index e4db6c30..fb5a77cd 100644 --- a/src/main/java/com/minelittlepony/client/render/MobRenderers.java +++ b/src/main/java/com/minelittlepony/client/render/MobRenderers.java @@ -38,6 +38,7 @@ public final class MobRenderers { }); public static final MobRenderers PIGLIN = register("pigzombies", (state, pony) -> { pony.switchRenderer(state, EntityType.PIGLIN, PonyPiglinRenderer::new); + pony.switchRenderer(state, EntityType.PIGLIN_BRUTE, PonyPiglinRenderer::new); pony.switchRenderer(state, EntityType.ZOMBIFIED_PIGLIN, PonyPiglinRenderer::new); }); public static final MobRenderers SKELETON = register("skeletons", (state, pony) -> { diff --git a/src/main/java/com/minelittlepony/client/render/PonyRenderDispatcher.java b/src/main/java/com/minelittlepony/client/render/PonyRenderDispatcher.java index 1ecb8a81..67274eb9 100644 --- a/src/main/java/com/minelittlepony/client/render/PonyRenderDispatcher.java +++ b/src/main/java/com/minelittlepony/client/render/PonyRenderDispatcher.java @@ -74,7 +74,7 @@ public class PonyRenderDispatcher { void switchRenderer(boolean state, EntityType type, Function> factory) { if (state) { if (!renderMap.containsKey(type)) { - renderMap.put(type, ((MixinEntityRenderDispatcher)MinecraftClient.getInstance().getEntityRenderManager()).getEntityRenderers().get(type)); + renderMap.put(type, ((MixinEntityRenderDispatcher)MinecraftClient.getInstance().getEntityRenderDispatcher()).getEntityRenderers().get(type)); } Mson.getInstance().getEntityRendererRegistry().registerEntityRenderer(type, factory); } else { @@ -95,7 +95,7 @@ public class PonyRenderDispatcher { return null; } - EntityRenderer renderer = MinecraftClient.getInstance().getEntityRenderManager().getRenderer(entity); + EntityRenderer renderer = MinecraftClient.getInstance().getEntityRenderDispatcher().getRenderer(entity); if (renderer instanceof IPonyRenderContext) { return (IPonyRenderContext) renderer; diff --git a/src/main/java/com/minelittlepony/client/render/entity/PlayerPonyRenderer.java b/src/main/java/com/minelittlepony/client/render/entity/PlayerPonyRenderer.java index de51faa8..8950bde8 100644 --- a/src/main/java/com/minelittlepony/client/render/entity/PlayerPonyRenderer.java +++ b/src/main/java/com/minelittlepony/client/render/entity/PlayerPonyRenderer.java @@ -111,7 +111,7 @@ public class PlayerPonyRenderer extends PlayerEntityRenderer implements IPonyRen @Override public boolean shouldRender(AbstractClientPlayerEntity entity, Frustum camera, double camX, double camY, double camZ) { if (entity.isSleeping() && entity == MinecraftClient.getInstance().player) { - return MinecraftClient.getInstance().options.perspective != 0 + return !MinecraftClient.getInstance().options.getPerspective().isFirstPerson() && super.shouldRender(entity, camera, camX, camY, camZ); } return super.shouldRender(entity, manager.getFrustrum(entity, camera), camX, camY, camZ); diff --git a/src/main/java/com/minelittlepony/client/render/entity/PonyPiglinRenderer.java b/src/main/java/com/minelittlepony/client/render/entity/PonyPiglinRenderer.java index 3488e371..069d9275 100644 --- a/src/main/java/com/minelittlepony/client/render/entity/PonyPiglinRenderer.java +++ b/src/main/java/com/minelittlepony/client/render/entity/PonyPiglinRenderer.java @@ -1,16 +1,25 @@ package com.minelittlepony.client.render.entity; import net.minecraft.client.render.entity.EntityRenderDispatcher; +import net.minecraft.entity.EntityType; +import net.minecraft.entity.mob.AbstractPiglinEntity; import net.minecraft.entity.mob.HostileEntity; -import net.minecraft.entity.mob.PiglinEntity; import net.minecraft.util.Identifier; +import net.minecraft.util.Util; import com.minelittlepony.client.model.ModelType; import com.minelittlepony.client.model.entity.PiglinPonyModel; +import java.util.HashMap; +import java.util.Map; + public class PonyPiglinRenderer extends PonyRenderer.Caster { - public static final Identifier NORMAL = new Identifier("minelittlepony", "textures/entity/piglin/piglin_pony.png"); - public static final Identifier ZOMBIFIED = new Identifier("minelittlepony", "textures/entity/piglin/zombified_piglin_pony.png"); + + private static final Map, Identifier> TEXTURES = Util.make(new HashMap<>(), map -> { + map.put(EntityType.PIGLIN, new Identifier("minelittlepony", "textures/entity/piglin/piglin_pony.png")); + map.put(EntityType.PIGLIN_BRUTE, new Identifier("minelittlepony", "textures/entity/piglin/piglin_brute_pony.png")); + map.put(EntityType.ZOMBIFIED_PIGLIN, new Identifier("minelittlepony", "textures/entity/piglin/zombified_piglin_pony.png")); + }); public PonyPiglinRenderer(EntityRenderDispatcher manager) { super(manager, ModelType.PIGLIN); @@ -18,11 +27,11 @@ public class PonyPiglinRenderer extends PonyRenderer.Caster & IP @SuppressWarnings("unchecked") IArmourTextureResolver resolver = model instanceof IArmourTextureResolver ? (IArmourTextureResolver)model : (IArmourTextureResolver)DEFAULT; - boolean glint = itemstack.hasEnchantmentGlint(); + boolean glint = itemstack.hasGlint(); renderArmourPart(stack, renderContext, lightUv, glint, model, red, green, blue, resolver, layer, resolver.getArmourTexture(entity, itemstack, armorSlot, layer, null)); @@ -93,7 +93,7 @@ public class ArmourFeature & IP MatrixStack matrices, VertexConsumerProvider provider, int light, boolean glint, V model, float r, float g, float b, IArmourTextureResolver resolver, ArmourLayer layer, Identifier texture) { - VertexConsumer vertices = ItemRenderer.method_27952(provider, RenderLayer.getArmorCutoutNoCull(texture), false, glint); + VertexConsumer vertices = ItemRenderer.getArmorVertexConsumer(provider, RenderLayer.getArmorCutoutNoCull(texture), false, glint); model.setVariant(resolver.getArmourVariant(layer, texture)); model.render(matrices, vertices, light, OverlayTexture.DEFAULT_UV, r, g, b, 1); diff --git a/src/main/java/com/minelittlepony/client/render/entity/feature/ElytraFeature.java b/src/main/java/com/minelittlepony/client/render/entity/feature/ElytraFeature.java index 2554d975..d2661c1e 100644 --- a/src/main/java/com/minelittlepony/client/render/entity/feature/ElytraFeature.java +++ b/src/main/java/com/minelittlepony/client/render/entity/feature/ElytraFeature.java @@ -47,7 +47,7 @@ public class ElytraFeature & IP } elytra.setAngles(entity, limbDistance, limbAngle, age, headYaw, headPitch); - VertexConsumer vertexConsumer = ItemRenderer.method_29711(renderContext, modelElytra.getLayer(getElytraTexture(entity)), false, itemstack.hasEnchantmentGlint()); + VertexConsumer vertexConsumer = ItemRenderer.getDirectGlintVertexConsumer(renderContext, modelElytra.getLayer(getElytraTexture(entity)), false, itemstack.hasGlint()); modelElytra.render(stack, vertexConsumer, lightUv, OverlayTexture.DEFAULT_UV, 1, 1, 1, 1); stack.pop(); diff --git a/src/main/resources/fabric.mod.json b/src/main/resources/fabric.mod.json index 082e58d0..ac4cc7f6 100644 --- a/src/main/resources/fabric.mod.json +++ b/src/main/resources/fabric.mod.json @@ -32,7 +32,7 @@ "depends": { "fabricloader": ">=0.4.0", "fabric-api-base": ">=0.1.0", - "fabric-events-lifecycle-v0": ">=0.1.0", + "fabric-lifecycle-events-v1": ">=0.1.0", "fabric-resource-loader-v0": ">=0.1.0", "kirin": "*" },