diff --git a/gradle.properties b/gradle.properties index 152fc83c..5f999b23 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.5 - yarn_mappings=1.16.5+build.4 - loader_version=0.11.1 - fabric_version=0.30.3+1.16 - + minecraft_version=20w46a + yarn_mappings=20w46a+build.15 + loader_version=0.10.8 + fabric_version=0.26.0+1.17 + # 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.2.5 + version=4.3 release=SNAPSHOT # Dependencies - modmenu_version=1.14.+ - kirin_version=1.7.1-1.16.5 - hd_skins_version=6.3.3-1.16.3 - mson_version=1.2.2-1.16.5-1.16 + modmenu_version=1.12.+ + kirin_version=1.8-20w46a-SNAPSHOT + hd_skins_version=6.4-20w46a-SNAPSHOT + mson_version=1.3.1-20w46a-SNAPSHOT diff --git a/src/main/java/com/minelittlepony/client/mixin/MixinItemRenderer.java b/src/main/java/com/minelittlepony/client/mixin/MixinItemRenderer.java index 7ef83240..97130d0b 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 = "getDirectItemGlintConsumer(" + VertexConsumerProvider + RenderLayer + Boolean + Boolean + ")" + VertexConsumer, at = @At("HEAD"), cancellable = true) + @Inject(method = "getItemGlintConsumer(" + 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/mixin/MixinSkullBlockEntityRenderer.java b/src/main/java/com/minelittlepony/client/mixin/MixinSkullBlockEntityRenderer.java index 577c88e1..ba6b3480 100644 --- a/src/main/java/com/minelittlepony/client/mixin/MixinSkullBlockEntityRenderer.java +++ b/src/main/java/com/minelittlepony/client/mixin/MixinSkullBlockEntityRenderer.java @@ -2,8 +2,10 @@ package com.minelittlepony.client.mixin; import net.minecraft.block.SkullBlock; import net.minecraft.block.entity.SkullBlockEntity; +import net.minecraft.client.render.RenderLayer; import net.minecraft.client.render.VertexConsumerProvider; import net.minecraft.client.render.block.entity.BlockEntityRenderer; +import net.minecraft.client.render.block.entity.SkullBlockEntityModel; import net.minecraft.client.render.block.entity.SkullBlockEntityRenderer; import net.minecraft.client.util.math.MatrixStack; import net.minecraft.util.math.Direction; @@ -12,6 +14,7 @@ import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; import com.minelittlepony.client.render.blockentity.skull.PonySkullRenderer; import com.mojang.authlib.GameProfile; @@ -19,26 +22,43 @@ import com.mojang.authlib.GameProfile; import javax.annotation.Nullable; @Mixin(SkullBlockEntityRenderer.class) -abstract class MixinSkullBlockEntityRenderer extends BlockEntityRenderer { - - MixinSkullBlockEntityRenderer() { super(null); } - - @Inject(method = "render(" +abstract class MixinSkullBlockEntityRenderer implements BlockEntityRenderer { + @Inject(method = "method_32161(" + "Lnet/minecraft/util/math/Direction;" + "F" - + "Lnet/minecraft/block/SkullBlock$SkullType;" - + "Lcom/mojang/authlib/GameProfile;" + "F" + "Lnet/minecraft/client/util/math/MatrixStack;" + "Lnet/minecraft/client/render/VertexConsumerProvider;" + "I" + + "Lnet/minecraft/client/render/block/entity/SkullBlockEntityModel;" + + "Lnet/minecraft/client/render/RenderLayer;" + ")V", at = @At("HEAD"), cancellable = true) - private static void onRender(@Nullable Direction direction, float angle, - SkullBlock.SkullType skullType, @Nullable GameProfile profile, float poweredTicks, + private static void onMethod_32161(@Nullable Direction direction, + float angle, float poweredTicks, MatrixStack stack, VertexConsumerProvider renderContext, int lightUv, + SkullBlockEntityModel model, RenderLayer layer, CallbackInfo info) { - if (!info.isCancelled() && PonySkullRenderer.renderPonySkull(direction, angle, skullType, profile, poweredTicks, stack, renderContext, lightUv)) { + + if (PonySkullRenderer.INSTANCE == null) { + return; + } + + if (!info.isCancelled() && PonySkullRenderer.INSTANCE.renderSkull(direction, angle, poweredTicks, stack, renderContext, layer, lightUv)) { info.cancel(); } } + + @Inject(method = "method_3578(" + + "Lnet/minecraft/block/SkullBlock$SkullType;" + + "Lcom/mojang/authlib/GameProfile;" + + ")Lnet/minecraft/client/render/RenderLayer;", at = @At("HEAD"), cancellable = true) + private static void onMethod_3578(SkullBlock.SkullType skullType, @Nullable GameProfile profile, CallbackInfoReturnable info) { + if (info.isCancelled() || PonySkullRenderer.INSTANCE == null) { + return; + } + RenderLayer result = PonySkullRenderer.INSTANCE.getRenderLayer(skullType, profile); + if (result != null) { + info.setReturnValue(result); + } + } } diff --git a/src/main/java/com/minelittlepony/client/model/AbstractPonyModel.java b/src/main/java/com/minelittlepony/client/model/AbstractPonyModel.java index 2dec0543..e4437ff8 100644 --- a/src/main/java/com/minelittlepony/client/model/AbstractPonyModel.java +++ b/src/main/java/com/minelittlepony/client/model/AbstractPonyModel.java @@ -8,7 +8,6 @@ import com.minelittlepony.client.model.armour.ArmourWrapper; import com.minelittlepony.client.transform.PonyTransformation; import com.minelittlepony.model.BodyPart; import com.minelittlepony.model.armour.IEquestrianArmour; -import com.minelittlepony.mson.api.ModelContext; import com.minelittlepony.mson.api.model.MsonPart; import net.minecraft.client.model.ModelPart; @@ -30,20 +29,12 @@ public abstract class AbstractPonyModel extends ClientPo protected ModelPart neck; - @Override - public void init(ModelContext context) { - super.init(context); - context.findByName("left_sleeve", leftSleeve); - context.findByName("right_sleeve", rightSleeve); + public AbstractPonyModel(ModelPart tree) { + super(tree); - context.findByName("left_pant_leg", leftPantLeg); - context.findByName("right_pant_leg", rightPantLeg); - - context.findByName("jacket", jacket); - - upperTorso = context.findByName("upper_torso"); - upperTorsoOverlay = context.findByName("saddle"); - neck = context.findByName("neck"); + upperTorso = tree.getChild("upper_torso"); + upperTorsoOverlay = tree.getChild("saddle"); + neck = tree.getChild("neck"); } @Override @@ -133,10 +124,10 @@ public abstract class AbstractPonyModel extends ClientPo head.setPivot(1, 2, sneaking ? -1 : 1); - ((MsonPart)rightArm).shift(0, 2, 6); - ((MsonPart)leftArm).shift(0, 2, 6); - ((MsonPart)rightLeg).shift(0, 2, -8); - ((MsonPart)leftLeg).shift(0, 2, -8); + ((MsonPart)(Object)rightArm).shift(0, 2, 6); + ((MsonPart)(Object)leftArm).shift(0, 2, 6); + ((MsonPart)(Object)rightLeg).shift(0, 2, -8); + ((MsonPart)(Object)leftLeg).shift(0, 2, -8); } protected void ponySit() { @@ -199,13 +190,13 @@ public abstract class AbstractPonyModel extends ClientPo } private void animateWears() { - leftSleeve.copyPositionAndRotation(leftArm); - rightSleeve.copyPositionAndRotation(rightArm); - leftPantLeg.copyPositionAndRotation(leftLeg); - rightPantLeg.copyPositionAndRotation(rightLeg); - jacket.copyPositionAndRotation(torso); - helmet.copyPositionAndRotation(head); - upperTorsoOverlay.copyPositionAndRotation(upperTorso); + leftSleeve.copyTransform(leftArm); + rightSleeve.copyTransform(rightArm); + leftPantLeg.copyTransform(leftLeg); + rightPantLeg.copyTransform(rightLeg); + jacket.copyTransform(torso); + helmet.copyTransform(head); + upperTorsoOverlay.copyTransform(upperTorso); } /** @@ -456,6 +447,11 @@ public abstract class AbstractPonyModel extends ClientPo case THROW_SPEAR: arm.pitch = ROTATE_90 * 2; break; + case SPYGLASS: + // TODO: SPYGLASS + break; + default: + break; } } @@ -565,7 +561,7 @@ public abstract class AbstractPonyModel extends ClientPo renderStage(BodyPart.HEAD, stack, vertices, overlayUv, lightUv, red, green, blue, alpha, this::renderHead); renderStage(BodyPart.LEGS, stack, vertices, overlayUv, lightUv, red, green, blue, alpha, this::renderLegs); - if (textureHeight == 64 && getMetadata().getRace() != Race.SEAPONY) { + if (getMetadata().getRace() != Race.SEAPONY) { renderStage(BodyPart.LEGS, stack, vertices, overlayUv, lightUv, red, green, blue, alpha, this::renderSleeves); renderStage(BodyPart.BODY, stack, vertices, overlayUv, lightUv, red, green, blue, alpha, this::renderVest); } diff --git a/src/main/java/com/minelittlepony/client/model/ClientPonyModel.java b/src/main/java/com/minelittlepony/client/model/ClientPonyModel.java index f7601a0b..a3906665 100644 --- a/src/main/java/com/minelittlepony/client/model/ClientPonyModel.java +++ b/src/main/java/com/minelittlepony/client/model/ClientPonyModel.java @@ -4,6 +4,7 @@ import net.minecraft.client.model.ModelPart; import net.minecraft.client.render.entity.model.BipedEntityModel; import net.minecraft.entity.LivingEntity; import net.minecraft.util.Arm; +import net.minecraft.util.Hand; import com.minelittlepony.model.capabilities.fabric.PonyModelPrepareCallback; import com.minelittlepony.api.pony.IPony; @@ -33,6 +34,15 @@ public abstract class ClientPonyModel extends MsonPlayer */ protected IPonyData metadata = PonyData.NULL; + public ClientPonyModel(ModelPart tree) { + super(tree); + } + + protected Arm getPreferredArm(T livingEntity) { + Arm arm = livingEntity.getMainArm(); + return livingEntity.preferredHand == Hand.MAIN_HAND ? arm : arm.getOpposite(); + } + @Override public void updateLivingState(T entity, IPony pony, EquineRenderManager.Mode mode) { child = entity.isBaby(); diff --git a/src/main/java/com/minelittlepony/client/model/DJPon3EarsModel.java b/src/main/java/com/minelittlepony/client/model/DJPon3EarsModel.java index ea978acc..cd239cfc 100644 --- a/src/main/java/com/minelittlepony/client/model/DJPon3EarsModel.java +++ b/src/main/java/com/minelittlepony/client/model/DJPon3EarsModel.java @@ -1,16 +1,12 @@ package com.minelittlepony.client.model; +import net.minecraft.client.model.ModelPart; import net.minecraft.client.render.entity.model.SkullEntityModel; -import com.minelittlepony.mson.api.model.BoxBuilder; - public class DJPon3EarsModel extends SkullEntityModel { - public DJPon3EarsModel() { - super(24, 0, 64, 64); - ((BoxBuilder.ContentAccessor)skull).cubes().clear(); - skull.addCuboid(-9, -13, -1, 6, 6, 1, 0); - skull.addCuboid(3, -13, -1, 6, 6, 1, 0); + public DJPon3EarsModel(ModelPart tree) { + super(tree); } public void setVisible(boolean show) { diff --git a/src/main/java/com/minelittlepony/client/model/ModelType.java b/src/main/java/com/minelittlepony/client/model/ModelType.java index c99bfe45..c14a1b42 100644 --- a/src/main/java/com/minelittlepony/client/model/ModelType.java +++ b/src/main/java/com/minelittlepony/client/model/ModelType.java @@ -1,6 +1,7 @@ package com.minelittlepony.client.model; import net.minecraft.client.model.Model; +import net.minecraft.client.model.ModelPart; import net.minecraft.entity.LivingEntity; import net.minecraft.entity.mob.VexEntity; import net.minecraft.util.Identifier; @@ -27,6 +28,7 @@ import com.minelittlepony.client.model.entity.race.PegasusModel; import com.minelittlepony.client.model.entity.race.SeaponyModel; import com.minelittlepony.client.model.entity.race.UnicornModel; import com.minelittlepony.client.model.entity.race.ZebraModel; +import com.minelittlepony.client.model.gear.AbstractGear; import com.minelittlepony.client.model.gear.ChristmasHat; import com.minelittlepony.client.model.gear.Muffin; import com.minelittlepony.client.model.gear.SaddleBags; @@ -43,8 +45,7 @@ import javax.annotation.Nullable; import java.util.HashMap; import java.util.Map; -import java.util.function.Function; -import java.util.function.Supplier; +import java.util.function.BiFunction; import java.util.stream.Stream; public final class ModelType { @@ -52,6 +53,8 @@ public final class ModelType { private static final Map> PLAYER_MODELS = new HashMap<>(); private static final Map> GEAR_MODELS = new HashMap<>(); + public static final ModelKey DJ_PON_3 = register("dj_pon_three", DJPon3EarsModel::new); + public static final ModelKey> VILLAGER = register("villager", VillagerPonyModel::new); public static final ModelKey WITCH = register("witch", WitchPonyModel::new); public static final ModelKey> ZOMBIE = register("zombie", ZomponyModel::new); @@ -91,25 +94,25 @@ public final class ModelType { public static final PlayerModelKey> CHANGEDLING = registerPlayer("reformed_changeling", Race.CHANGEDLING, ChangelingModel::new); public static final PlayerModelKey> ZEBRA = registerPlayer("zebra", Race.ZEBRA, ZebraModel::new); - static PlayerModelKey registerPlayer(String name, Race race, Function constructor) { + static PlayerModelKey registerPlayer(String name, Race race, BiFunction constructor) { return registerPlayer(name, race, constructor, PlayerPonyRenderer::new); } @SuppressWarnings("unchecked") - static PlayerModelKey registerPlayer(String name, Race race, Function constructor, PlayerModelKey.RendererFactory rendererFactory) { + static PlayerModelKey registerPlayer(String name, Race race, BiFunction constructor, PlayerModelKey.RendererFactory rendererFactory) { return (PlayerModelKey)PLAYER_MODELS.computeIfAbsent(race, r -> { return new PlayerModelKey<>(name, constructor, rendererFactory); }); } @SuppressWarnings("unchecked") - static ModelKey registerGear(String name, Wearable wearable, Supplier constructor) { + static ModelKey registerGear(String name, Wearable wearable, MsonModel.Factory constructor) { return (ModelKey)GEAR_MODELS.computeIfAbsent(wearable, w -> { return Mson.getInstance().registerModel(new Identifier("minelittlepony", "gear/" + name), constructor); }); } - static ModelKey register(String name, Supplier constructor) { + static ModelKey register(String name, MsonModel.Factory constructor) { return Mson.getInstance().registerModel(new Identifier("minelittlepony", name), constructor); } diff --git a/src/main/java/com/minelittlepony/client/model/PlayerModelKey.java b/src/main/java/com/minelittlepony/client/model/PlayerModelKey.java index fe813b50..9f07863b 100644 --- a/src/main/java/com/minelittlepony/client/model/PlayerModelKey.java +++ b/src/main/java/com/minelittlepony/client/model/PlayerModelKey.java @@ -1,8 +1,9 @@ package com.minelittlepony.client.model; import net.minecraft.client.model.Model; +import net.minecraft.client.model.ModelPart; import net.minecraft.client.network.AbstractClientPlayerEntity; -import net.minecraft.client.render.entity.EntityRenderDispatcher; +import net.minecraft.client.render.entity.EntityRendererFactory; import net.minecraft.client.render.entity.PlayerEntityRenderer; import net.minecraft.entity.LivingEntity; import net.minecraft.util.Identifier; @@ -11,6 +12,7 @@ import com.minelittlepony.mson.api.ModelKey; import com.minelittlepony.mson.api.Mson; import com.minelittlepony.mson.api.MsonModel; +import java.util.function.BiFunction; import java.util.function.Function; public class PlayerModelKey { @@ -20,11 +22,11 @@ public class PlayerModelKey private final RendererFactory rendererFactory; - PlayerModelKey(String name, Function modelFactory, RendererFactory rendererFactory) { + PlayerModelKey(String name, BiFunction modelFactory, RendererFactory rendererFactory) { this.rendererFactory = rendererFactory; - steveKey = Mson.getInstance().registerModel(new Identifier("minelittlepony", "races/steve/" + name), () -> modelFactory.apply(false)); - alexKey = Mson.getInstance().registerModel(new Identifier("minelittlepony", "races/alex/" + name), () -> modelFactory.apply(true)); + steveKey = Mson.getInstance().registerModel(new Identifier("minelittlepony", "races/steve/" + name), tree -> modelFactory.apply(tree, false)); + alexKey = Mson.getInstance().registerModel(new Identifier("minelittlepony", "races/alex/" + name), tree -> modelFactory.apply(tree, true)); } public ModelKey getKey(boolean slimArms) { @@ -32,13 +34,13 @@ public class PlayerModelKey } @SuppressWarnings("unchecked") - public Function getRendererFactory(boolean slimArms) { + public Function getRendererFactory(boolean slimArms) { return d -> rendererFactory.create(d, slimArms, (ModelKey>)getKey(slimArms)); } public interface RendererFactory { PlayerEntityRenderer create( - EntityRenderDispatcher dispatcher, + EntityRendererFactory.Context context, boolean slim, ModelKey> key ); diff --git a/src/main/java/com/minelittlepony/client/model/PonyElytra.java b/src/main/java/com/minelittlepony/client/model/PonyElytra.java index 6e0678e3..d71683b2 100644 --- a/src/main/java/com/minelittlepony/client/model/PonyElytra.java +++ b/src/main/java/com/minelittlepony/client/model/PonyElytra.java @@ -7,25 +7,22 @@ import net.minecraft.entity.LivingEntity; import net.minecraft.util.math.Vec3d; import com.google.common.collect.ImmutableList; -import com.minelittlepony.mson.api.ModelContext; -import com.minelittlepony.mson.api.MsonModel; import static com.minelittlepony.model.PonyModelConstants.*; /** * Modified from ModelElytra. */ -public class PonyElytra extends AnimalModel implements MsonModel { +public class PonyElytra extends AnimalModel { public boolean isSneaking; - private ModelPart rightWing; - private ModelPart leftWing; + private final ModelPart rightWing; + private final ModelPart leftWing; - @Override - public void init(ModelContext context) { - rightWing = context.findByName("right_wing"); - leftWing = context.findByName("left_wing"); + public PonyElytra(ModelPart tree) { + rightWing = tree.getChild("right_wing"); + leftWing = tree.getChild("left_wing"); } @Override diff --git a/src/main/java/com/minelittlepony/client/model/PonySkullModel.java b/src/main/java/com/minelittlepony/client/model/PonySkullModel.java index e5adf72a..5e467e6c 100644 --- a/src/main/java/com/minelittlepony/client/model/PonySkullModel.java +++ b/src/main/java/com/minelittlepony/client/model/PonySkullModel.java @@ -11,10 +11,10 @@ import com.minelittlepony.mson.api.MsonModel; import net.minecraft.client.model.ModelPart; import net.minecraft.client.render.VertexConsumer; -import net.minecraft.client.render.entity.model.SkullOverlayEntityModel; +import net.minecraft.client.render.entity.model.SkullEntityModel; import net.minecraft.client.util.math.MatrixStack; -public class PonySkullModel extends SkullOverlayEntityModel implements MsonModel, ICapitated { +public class PonySkullModel extends SkullEntityModel implements MsonModel, ICapitated { private PonySnout snout; @@ -26,9 +26,12 @@ public class PonySkullModel extends SkullOverlayEntityModel implements MsonModel public IPonyData metadata = PonyData.NULL; + public PonySkullModel(ModelPart tree) { + super(tree); + } + @Override public void init(ModelContext context) { - context.findByName("skull", skull); hair = context.findByName("hair"); snout = context.findByName("snout"); horn = context.findByName("horn"); diff --git a/src/main/java/com/minelittlepony/client/model/armour/ArmourWrapper.java b/src/main/java/com/minelittlepony/client/model/armour/ArmourWrapper.java index e0ea4f0b..e0ed358a 100644 --- a/src/main/java/com/minelittlepony/client/model/armour/ArmourWrapper.java +++ b/src/main/java/com/minelittlepony/client/model/armour/ArmourWrapper.java @@ -6,15 +6,14 @@ import com.minelittlepony.api.pony.IPonyData; import com.minelittlepony.client.model.ModelType; import com.minelittlepony.model.armour.ArmourLayer; import com.minelittlepony.model.armour.IEquestrianArmour; - -import java.util.function.Supplier; +import com.minelittlepony.mson.api.MsonModel; public class ArmourWrapper implements IEquestrianArmour> { private final PonyArmourModel outerLayer; private final PonyArmourModel innerLayer; - public ArmourWrapper(Supplier> supplier) { + public ArmourWrapper(MsonModel.Factory> supplier) { outerLayer = ModelType.ARMOUR_OUTER.createModel(supplier); innerLayer = ModelType.ARMOUR_INNER.createModel(supplier); } diff --git a/src/main/java/com/minelittlepony/client/model/armour/PonyArmourModel.java b/src/main/java/com/minelittlepony/client/model/armour/PonyArmourModel.java index b775fb67..1a8fd7e4 100644 --- a/src/main/java/com/minelittlepony/client/model/armour/PonyArmourModel.java +++ b/src/main/java/com/minelittlepony/client/model/armour/PonyArmourModel.java @@ -10,7 +10,6 @@ import com.minelittlepony.client.model.AbstractPonyModel; import com.minelittlepony.model.IModel; import com.minelittlepony.model.armour.ArmourVariant; import com.minelittlepony.model.armour.IArmour; -import com.minelittlepony.mson.api.ModelContext; public class PonyArmourModel extends AbstractPonyModel implements IArmour { @@ -21,16 +20,11 @@ public class PonyArmourModel extends AbstractPonyModel extends AbstractPonyModel mainModel = (BipedEntityModel)model; - head.copyPositionAndRotation(mainModel.head); - helmet.copyPositionAndRotation(mainModel.helmet); + head.copyTransform(mainModel.head); + helmet.copyTransform(mainModel.helmet); - torso.copyPositionAndRotation(mainModel.torso); - rightArm.copyPositionAndRotation(mainModel.rightArm); - leftArm.copyPositionAndRotation(mainModel.leftArm); - rightLeg.copyPositionAndRotation(mainModel.rightLeg); - leftLeg.copyPositionAndRotation(mainModel.leftLeg); + torso.copyTransform(mainModel.torso); + rightArm.copyTransform(mainModel.rightArm); + leftArm.copyTransform(mainModel.leftArm); + rightLeg.copyTransform(mainModel.rightLeg); + leftLeg.copyTransform(mainModel.leftLeg); - steveLeftLeg.copyPositionAndRotation(mainModel.leftLeg); - steveRightLeg.copyPositionAndRotation(mainModel.rightLeg); + steveLeftLeg.copyTransform(mainModel.leftLeg); + steveRightLeg.copyTransform(mainModel.rightLeg); } } diff --git a/src/main/java/com/minelittlepony/client/model/entity/BreezieModel.java b/src/main/java/com/minelittlepony/client/model/entity/BreezieModel.java index 691eac80..25f50e30 100644 --- a/src/main/java/com/minelittlepony/client/model/entity/BreezieModel.java +++ b/src/main/java/com/minelittlepony/client/model/entity/BreezieModel.java @@ -1,36 +1,30 @@ package com.minelittlepony.client.model.entity; import net.minecraft.client.model.ModelPart; +import net.minecraft.client.render.entity.model.BipedEntityModel; import net.minecraft.entity.LivingEntity; import net.minecraft.util.Arm; +import net.minecraft.util.Hand; import net.minecraft.util.math.MathHelper; import com.google.common.collect.ImmutableList; import com.google.common.collect.Iterables; -import com.minelittlepony.mson.api.ModelContext; -import com.minelittlepony.mson.api.MsonModel; import com.minelittlepony.mson.api.model.MsonPart; -import com.minelittlepony.mson.api.model.biped.MsonBiped; import static com.minelittlepony.model.PonyModelConstants.PI; -public class BreezieModel extends MsonBiped implements MsonModel { +public class BreezieModel extends BipedEntityModel { private ModelPart neck; private ModelPart leftWing; private ModelPart rightWing; - public BreezieModel() { - textureHeight = 64; - } - - @Override - public void init(ModelContext context) { - super.init(context); - neck = context.findByName("neck"); - leftWing = context.findByName("left_wing"); - rightWing = context.findByName("right_wing"); + public BreezieModel(ModelPart tree) { + super(tree); + neck = tree.getChild("neck"); + leftWing = tree.getChild("left_wing"); + rightWing = tree.getChild("right_wing"); } @Override @@ -53,16 +47,16 @@ public class BreezieModel extends MsonBiped implement leftArm.pitch = MathHelper.cos(move * 0.6662F) * swing; leftArm.roll = 0; - ((MsonPart)rightArm).rotate(swing * MathHelper.cos(move * 0.6662F + PI), 0, 0); - ((MsonPart)leftLeg) .rotate(swing * MathHelper.cos(move * 0.6662F + PI) * 1.4F, 0, 0); - ((MsonPart)rightLeg).rotate(swing * MathHelper.cos(move * 0.6662F) * 1.4F, 0, 0); + ((MsonPart)(Object)rightArm).rotate(swing * MathHelper.cos(move * 0.6662F + PI), 0, 0); + ((MsonPart)(Object)leftLeg) .rotate(swing * MathHelper.cos(move * 0.6662F + PI) * 1.4F, 0, 0); + ((MsonPart)(Object)rightLeg).rotate(swing * MathHelper.cos(move * 0.6662F) * 1.4F, 0, 0); if (riding) { leftArm.pitch += -PI / 5; rightArm.pitch += -PI / 5; - rotateLegRiding((MsonPart)leftLeg, -1); - rotateLegRiding((MsonPart)rightLeg, 1); + rotateLegRiding((MsonPart)(Object)leftLeg, -1); + rotateLegRiding((MsonPart)(Object)rightLeg, 1); } rotateArm(leftArm, leftArmPose, 1); @@ -98,6 +92,12 @@ public class BreezieModel extends MsonBiped implement } } + private Arm getPreferredArm(T livingEntity) { + Arm arm = livingEntity.getMainArm(); + return livingEntity.preferredHand == Hand.MAIN_HAND ? arm : arm.getOpposite(); + } + + protected void rotateLegRiding(MsonPart leg, float factor) { leg.rotate(-1.4137167F, factor * PI / 10, factor * 0.07853982F); } diff --git a/src/main/java/com/minelittlepony/client/model/entity/EnderStallionModel.java b/src/main/java/com/minelittlepony/client/model/entity/EnderStallionModel.java index 4142b169..ecd7be2d 100644 --- a/src/main/java/com/minelittlepony/client/model/entity/EnderStallionModel.java +++ b/src/main/java/com/minelittlepony/client/model/entity/EnderStallionModel.java @@ -6,8 +6,6 @@ import net.minecraft.client.util.math.MatrixStack; import net.minecraft.entity.mob.EndermanEntity; import net.minecraft.util.math.MathHelper; -import com.minelittlepony.mson.api.ModelContext; - public class EnderStallionModel extends SkeleponyModel { public boolean isCarrying; @@ -16,18 +14,13 @@ public class EnderStallionModel extends SkeleponyModel { public boolean isAlicorn; public boolean isBoss; - private ModelPart leftHorn; - private ModelPart rightHorn; + private final ModelPart leftHorn; + private final ModelPart rightHorn; - public EnderStallionModel() { - super(); - } - - @Override - public void init(ModelContext context) { - super.init(context); - leftHorn = context.findByName("left_horn"); - rightHorn = context.findByName("right_horn"); + public EnderStallionModel(ModelPart tree) { + super(tree); + leftHorn = tree.getChild("left_horn"); + rightHorn = tree.getChild("right_horn"); } @Override diff --git a/src/main/java/com/minelittlepony/client/model/entity/GuardianPonyModel.java b/src/main/java/com/minelittlepony/client/model/entity/GuardianPonyModel.java index fd18208b..8800f419 100644 --- a/src/main/java/com/minelittlepony/client/model/entity/GuardianPonyModel.java +++ b/src/main/java/com/minelittlepony/client/model/entity/GuardianPonyModel.java @@ -11,7 +11,12 @@ import com.minelittlepony.client.model.IPonyMixinModel; import com.minelittlepony.client.model.entity.race.SeaponyModel; public class GuardianPonyModel extends GuardianEntityModel implements IPonyMixinModel.Caster, ModelPart> { - private final SeaponyModel mixin = new SeaponyModel<>(); + private final SeaponyModel mixin; + + public GuardianPonyModel(ModelPart tree) { + super(getTexturedModelData().createModel()); + mixin = new SeaponyModel<>(tree); + } @Override public void setAngles(GuardianEntity entity, float move, float swing, float ticks, float headYaw, float headPitch) { diff --git a/src/main/java/com/minelittlepony/client/model/entity/IllagerPonyModel.java b/src/main/java/com/minelittlepony/client/model/entity/IllagerPonyModel.java index c005be55..e33fe5ed 100644 --- a/src/main/java/com/minelittlepony/client/model/entity/IllagerPonyModel.java +++ b/src/main/java/com/minelittlepony/client/model/entity/IllagerPonyModel.java @@ -9,8 +9,8 @@ import com.minelittlepony.client.model.entity.race.AlicornModel; public class IllagerPonyModel extends AlicornModel { - public IllagerPonyModel() { - super(false); + public IllagerPonyModel(ModelPart tree) { + super(tree, false); } @Override diff --git a/src/main/java/com/minelittlepony/client/model/entity/ParaspriteModel.java b/src/main/java/com/minelittlepony/client/model/entity/ParaspriteModel.java index 2af3fc90..68a51732 100644 --- a/src/main/java/com/minelittlepony/client/model/entity/ParaspriteModel.java +++ b/src/main/java/com/minelittlepony/client/model/entity/ParaspriteModel.java @@ -7,10 +7,7 @@ import net.minecraft.client.render.entity.model.EntityModel; import net.minecraft.client.util.math.MatrixStack; import net.minecraft.entity.passive.StriderEntity; -import com.minelittlepony.mson.api.ModelContext; -import com.minelittlepony.mson.api.MsonModel; - -public class ParaspriteModel extends EntityModel implements MsonModel { +public class ParaspriteModel extends EntityModel { private ModelPart body; private ModelPart leftWing; @@ -18,18 +15,13 @@ public class ParaspriteModel extends EntityModel implements MsonM private ModelPart saddle; - public ParaspriteModel() { + public ParaspriteModel(ModelPart tree) { super(RenderLayer::getEntityTranslucent); child = false; - textureHeight = 64; - } - - @Override - public void init(ModelContext context) { - body = context.findByName("body"); - saddle = context.findByName("saddle"); - leftWing = context.findByName("leftWing"); - rightWing = context.findByName("rightWing"); + body = tree.getChild("body"); + saddle = tree.getChild("saddle"); + leftWing = tree.getChild("leftWing"); + rightWing = tree.getChild("rightWing"); } @Override @@ -48,7 +40,7 @@ public class ParaspriteModel extends EntityModel implements MsonM body.yaw = headYaw * 0.017453292F; body.pitch = headPitch * 0.017453292F; } - saddle.copyPositionAndRotation(body); + saddle.copyTransform(body); float sin = (float)Math.sin(ticks) / 2; float cos = (float)Math.cos(ticks) / 3; 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 f09123f1..0e9ca81b 100644 --- a/src/main/java/com/minelittlepony/client/model/entity/PiglinPonyModel.java +++ b/src/main/java/com/minelittlepony/client/model/entity/PiglinPonyModel.java @@ -8,20 +8,18 @@ import net.minecraft.util.math.MathHelper; import com.minelittlepony.api.pony.IPony; import com.minelittlepony.client.render.EquineRenderManager; -import com.minelittlepony.mson.api.ModelContext; public class PiglinPonyModel extends ZomponyModel { private PiglinActivity activity; - private ModelPart leftFlap; - private ModelPart rightFlap; + private final ModelPart leftFlap; + private final ModelPart rightFlap; - @Override - public void init(ModelContext context) { - super.init(context); - leftFlap = context.findByName("left_flap"); - rightFlap = context.findByName("right_flap"); + public PiglinPonyModel(ModelPart tree) { + super(tree); + leftFlap = tree.getChild("left_flap"); + rightFlap = tree.getChild("right_flap"); } @Override diff --git a/src/main/java/com/minelittlepony/client/model/entity/PillagerPonyModel.java b/src/main/java/com/minelittlepony/client/model/entity/PillagerPonyModel.java index 6c8a92da..4d4aa654 100644 --- a/src/main/java/com/minelittlepony/client/model/entity/PillagerPonyModel.java +++ b/src/main/java/com/minelittlepony/client/model/entity/PillagerPonyModel.java @@ -1,5 +1,6 @@ package com.minelittlepony.client.model.entity; +import net.minecraft.client.model.ModelPart; import net.minecraft.entity.mob.IllagerEntity; import net.minecraft.entity.mob.PillagerEntity; import net.minecraft.util.Arm; @@ -8,8 +9,8 @@ import com.minelittlepony.client.model.entity.race.ChangelingModel; public class PillagerPonyModel extends ChangelingModel { - public PillagerPonyModel() { - super(false); + public PillagerPonyModel(ModelPart tree) { + super(tree, false); } @Override diff --git a/src/main/java/com/minelittlepony/client/model/entity/SkeleponyModel.java b/src/main/java/com/minelittlepony/client/model/entity/SkeleponyModel.java index 819ff58f..92e62daa 100644 --- a/src/main/java/com/minelittlepony/client/model/entity/SkeleponyModel.java +++ b/src/main/java/com/minelittlepony/client/model/entity/SkeleponyModel.java @@ -1,6 +1,7 @@ package com.minelittlepony.client.model.entity; import net.minecraft.entity.mob.WitherSkeletonEntity; +import net.minecraft.client.model.ModelPart; import net.minecraft.client.render.VertexConsumer; import net.minecraft.client.util.math.MatrixStack; import net.minecraft.entity.mob.HostileEntity; @@ -18,8 +19,8 @@ public class SkeleponyModel extends AlicornModel imp public boolean isWithered; - public SkeleponyModel() { - super(false); + public SkeleponyModel(ModelPart tree) { + super(tree, false); } @Override diff --git a/src/main/java/com/minelittlepony/client/model/entity/VillagerPonyModel.java b/src/main/java/com/minelittlepony/client/model/entity/VillagerPonyModel.java index 04e3c8ea..b87a5159 100644 --- a/src/main/java/com/minelittlepony/client/model/entity/VillagerPonyModel.java +++ b/src/main/java/com/minelittlepony/client/model/entity/VillagerPonyModel.java @@ -20,14 +20,16 @@ import com.minelittlepony.mson.api.ModelContext; public class VillagerPonyModel extends AlicornModel implements ModelWithHat { - private ModelPart apron; - private ModelPart trinket; + private final ModelPart apron; + private final ModelPart trinket; private IPart batWings; private IPart batEars; - public VillagerPonyModel() { - super(false); + public VillagerPonyModel(ModelPart tree) { + super(tree, false); + apron = tree.getChild("apron"); + trinket = tree.getChild("trinket"); } @Override @@ -35,8 +37,6 @@ public class VillagerPonyModel e super.init(context); batWings = context.findByName("bat_wings"); batEars = context.findByName("bat_ears"); - apron = context.findByName("apron"); - trinket = context.findByName("trinket"); } @Override diff --git a/src/main/java/com/minelittlepony/client/model/entity/WitchPonyModel.java b/src/main/java/com/minelittlepony/client/model/entity/WitchPonyModel.java index ff1c669f..d77c4140 100644 --- a/src/main/java/com/minelittlepony/client/model/entity/WitchPonyModel.java +++ b/src/main/java/com/minelittlepony/client/model/entity/WitchPonyModel.java @@ -1,5 +1,6 @@ package com.minelittlepony.client.model.entity; +import net.minecraft.client.model.ModelPart; import net.minecraft.entity.mob.WitchEntity; import net.minecraft.util.math.MathHelper; @@ -10,8 +11,8 @@ import com.minelittlepony.client.render.EquineRenderManager; public class WitchPonyModel extends ZebraModel { - public WitchPonyModel() { - super(false); + public WitchPonyModel(ModelPart tree) { + super(tree, false); } @Override diff --git a/src/main/java/com/minelittlepony/client/model/entity/ZomponyModel.java b/src/main/java/com/minelittlepony/client/model/entity/ZomponyModel.java index a6cf6e51..ecee8248 100644 --- a/src/main/java/com/minelittlepony/client/model/entity/ZomponyModel.java +++ b/src/main/java/com/minelittlepony/client/model/entity/ZomponyModel.java @@ -4,6 +4,7 @@ import com.minelittlepony.client.model.IMobModel; import com.minelittlepony.client.model.entity.race.AlicornModel; import com.minelittlepony.mson.api.model.MsonPart; +import net.minecraft.client.model.ModelPart; import net.minecraft.entity.mob.HostileEntity; import net.minecraft.util.math.MathHelper; @@ -11,8 +12,8 @@ public class ZomponyModel extends AlicornModel extends AlicornModel implements IMobModel { + public ZomponyVillagerModel(ModelPart tree) { + super(tree); + } + @Override protected void rotateLegs(float move, float swing, float ticks, ZombieVillagerEntity entity) { super.rotateLegs(move, swing, ticks, entity); @@ -15,10 +20,10 @@ public class ZomponyVillagerModel extends VillagerPonyModel extends UnicornModel implem private IPart wings; - public AlicornModel(boolean smallArms) { - super(smallArms); + public AlicornModel(ModelPart tree, boolean smallArms) { + super(tree, smallArms); } @Override diff --git a/src/main/java/com/minelittlepony/client/model/entity/race/ChangelingModel.java b/src/main/java/com/minelittlepony/client/model/entity/race/ChangelingModel.java index e78d1169..eda44883 100644 --- a/src/main/java/com/minelittlepony/client/model/entity/race/ChangelingModel.java +++ b/src/main/java/com/minelittlepony/client/model/entity/race/ChangelingModel.java @@ -1,12 +1,13 @@ package com.minelittlepony.client.model.entity.race; +import net.minecraft.client.model.ModelPart; import net.minecraft.entity.LivingEntity; import net.minecraft.util.math.MathHelper; public class ChangelingModel extends AlicornModel { - public ChangelingModel(boolean smallArms) { - super(smallArms); + public ChangelingModel(ModelPart tree, boolean smallArms) { + super(tree, smallArms); } @Override 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 b2f2b4fc..d3a0dc8a 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 @@ -5,6 +5,7 @@ import com.minelittlepony.client.model.part.PonySnout; import com.minelittlepony.model.IPart; import com.minelittlepony.mson.api.ModelContext; +import net.minecraft.client.model.ModelPart; import net.minecraft.client.render.VertexConsumer; import net.minecraft.client.util.math.MatrixStack; import net.minecraft.entity.LivingEntity; @@ -17,7 +18,8 @@ public class EarthPonyModel extends AbstractPonyModel protected PonySnout snout; protected IPart ears; - public EarthPonyModel(boolean smallArms) { + public EarthPonyModel(ModelPart tree, boolean smallArms) { + super(tree); this.smallArms = smallArms; } diff --git a/src/main/java/com/minelittlepony/client/model/entity/race/PegasusModel.java b/src/main/java/com/minelittlepony/client/model/entity/race/PegasusModel.java index 0ef82ac7..197f6da5 100644 --- a/src/main/java/com/minelittlepony/client/model/entity/race/PegasusModel.java +++ b/src/main/java/com/minelittlepony/client/model/entity/race/PegasusModel.java @@ -4,6 +4,7 @@ import com.minelittlepony.model.IPart; import com.minelittlepony.model.IPegasus; import com.minelittlepony.mson.api.ModelContext; +import net.minecraft.client.model.ModelPart; import net.minecraft.client.render.VertexConsumer; import net.minecraft.client.util.math.MatrixStack; import net.minecraft.entity.LivingEntity; @@ -12,8 +13,8 @@ public class PegasusModel extends EarthPonyModel impl private IPart wings; - public PegasusModel(boolean smallArms) { - super(smallArms); + public PegasusModel(ModelPart tree, boolean smallArms) { + super(tree, smallArms); } @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 89f3b286..064dcb7b 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 @@ -6,7 +6,6 @@ import com.minelittlepony.api.pony.IPony; import com.minelittlepony.client.model.armour.ArmourWrapper; import com.minelittlepony.model.BodyPart; import com.minelittlepony.model.armour.IEquestrianArmour; -import com.minelittlepony.mson.api.ModelContext; import net.minecraft.client.model.ModelPart; import net.minecraft.client.render.VertexConsumer; @@ -16,28 +15,22 @@ import net.minecraft.util.math.MathHelper; public class SeaponyModel extends UnicornModel { - private ModelPart bodyCenter; + private final ModelPart bodyCenter; - private ModelPart leftFin; - private ModelPart centerFin; - private ModelPart rightFin; + private final ModelPart leftFin; + private final ModelPart centerFin; + private final ModelPart rightFin; - public SeaponyModel(boolean smallArms) { - super(smallArms); - textureHeight = 64; + public SeaponyModel(ModelPart tree, boolean smallArms) { + super(tree, smallArms); + bodyCenter = tree.getChild("abdomin"); + leftFin = tree.getChild("left_fin"); + rightFin = tree.getChild("right_fin"); + centerFin = tree.getChild("center_fin"); } - public SeaponyModel() { - this(false); - } - - @Override - public void init(ModelContext context) { - super.init(context); - bodyCenter = context.findByName("abdomin"); - leftFin = context.findByName("left_fin"); - rightFin = context.findByName("right_fin"); - centerFin = context.findByName("center_fin"); + public SeaponyModel(ModelPart tree) { + this(tree, false); } @Override @@ -155,6 +148,10 @@ public class SeaponyModel extends UnicornModel { class Armour extends PonyArmourModel { + public Armour(ModelPart tree) { + super(tree); + } + @Override public void showBoots() { rightArm.visible = true; diff --git a/src/main/java/com/minelittlepony/client/model/entity/race/UnicornModel.java b/src/main/java/com/minelittlepony/client/model/entity/race/UnicornModel.java index 51b9b3b6..d6adb201 100644 --- a/src/main/java/com/minelittlepony/client/model/entity/race/UnicornModel.java +++ b/src/main/java/com/minelittlepony/client/model/entity/race/UnicornModel.java @@ -18,21 +18,21 @@ import net.minecraft.util.math.MathHelper; */ public class UnicornModel extends EarthPonyModel implements IUnicorn { - protected ModelPart unicornArmRight; - protected ModelPart unicornArmLeft; + protected final ModelPart unicornArmRight; + protected final ModelPart unicornArmLeft; protected UnicornHorn horn; - public UnicornModel(boolean smallArms) { - super(smallArms); + public UnicornModel(ModelPart tree, boolean smallArms) { + super(tree, smallArms); + unicornArmRight = tree.getChild("right_cast"); + unicornArmLeft = tree.getChild("left_cast"); } @Override public void init(ModelContext context) { super.init(context); horn = context.findByName("horn"); - unicornArmRight = context.findByName("right_cast"); - unicornArmLeft = context.findByName("left_cast"); } @Override @@ -47,8 +47,8 @@ public class UnicornModel extends EarthPonyModel impl protected void rotateLegs(float move, float swing, float ticks, T entity) { super.rotateLegs(move, swing, ticks, entity); - ((MsonPart)unicornArmRight).rotate(0, 0, 0).around(-7, 12, -2); - ((MsonPart)unicornArmLeft).rotate(0, 0, 0).around(-7, 12, -2); + ((MsonPart)(Object)unicornArmRight).rotate(0, 0, 0).around(-7, 12, -2); + ((MsonPart)(Object)unicornArmLeft).rotate(0, 0, 0).around(-7, 12, -2); } @Override diff --git a/src/main/java/com/minelittlepony/client/model/entity/race/ZebraModel.java b/src/main/java/com/minelittlepony/client/model/entity/race/ZebraModel.java index 41b61fb7..594fb5c2 100644 --- a/src/main/java/com/minelittlepony/client/model/entity/race/ZebraModel.java +++ b/src/main/java/com/minelittlepony/client/model/entity/race/ZebraModel.java @@ -1,5 +1,6 @@ package com.minelittlepony.client.model.entity.race; +import net.minecraft.client.model.ModelPart; import net.minecraft.client.util.math.MatrixStack; import net.minecraft.entity.LivingEntity; @@ -10,8 +11,8 @@ import com.minelittlepony.model.armour.IEquestrianArmour; public class ZebraModel extends EarthPonyModel { - public ZebraModel(boolean useSmallArms) { - super(useSmallArms); + public ZebraModel(ModelPart tree, boolean useSmallArms) { + super(tree, useSmallArms); } @Override @@ -26,6 +27,10 @@ public class ZebraModel extends EarthPonyModel { } class Armour extends PonyArmourModel { + public Armour(ModelPart tree) { + super(tree); + } + @Override public void transform(BodyPart part, MatrixStack stack) { applyLongNeck(part, stack); diff --git a/src/main/java/com/minelittlepony/client/model/gear/AbstractGear.java b/src/main/java/com/minelittlepony/client/model/gear/AbstractGear.java index 0e938355..b63e7254 100644 --- a/src/main/java/com/minelittlepony/client/model/gear/AbstractGear.java +++ b/src/main/java/com/minelittlepony/client/model/gear/AbstractGear.java @@ -7,20 +7,17 @@ import net.minecraft.client.render.VertexConsumer; import net.minecraft.client.util.math.MatrixStack; import com.minelittlepony.model.gear.IGear; -import com.minelittlepony.mson.api.MsonModel; import java.util.ArrayList; import java.util.List; import java.util.UUID; -public abstract class AbstractGear extends Model implements IGear, MsonModel { +public abstract class AbstractGear extends Model implements IGear { private final List parts = new ArrayList<>(); public AbstractGear() { super(RenderLayer::getEntitySolid); - textureWidth = 64; - textureHeight = 64; } public void addPart(ModelPart t) { diff --git a/src/main/java/com/minelittlepony/client/model/gear/ChristmasHat.java b/src/main/java/com/minelittlepony/client/model/gear/ChristmasHat.java index 47c3d9ea..2d71c027 100644 --- a/src/main/java/com/minelittlepony/client/model/gear/ChristmasHat.java +++ b/src/main/java/com/minelittlepony/client/model/gear/ChristmasHat.java @@ -11,7 +11,6 @@ import com.minelittlepony.api.pony.meta.Wearable; import com.minelittlepony.common.util.Color; import com.minelittlepony.model.BodyPart; import com.minelittlepony.model.IModel; -import com.minelittlepony.mson.api.ModelContext; import java.util.Calendar; import java.util.UUID; @@ -34,15 +33,14 @@ public class ChristmasHat extends AbstractGear { private static final Identifier TEXTURE = new Identifier("minelittlepony", "textures/models/antlers.png"); - private ModelPart left; - private ModelPart right; + private final ModelPart left; + private final ModelPart right; private int tint; - @Override - public void init(ModelContext context) { - left = context.findByName("left"); - right = context.findByName("right"); + public ChristmasHat(ModelPart tree) { + left = tree.getChild("left"); + right = tree.getChild("right"); } @Override diff --git a/src/main/java/com/minelittlepony/client/model/gear/Muffin.java b/src/main/java/com/minelittlepony/client/model/gear/Muffin.java index 4c9984fa..95ab5fbf 100644 --- a/src/main/java/com/minelittlepony/client/model/gear/Muffin.java +++ b/src/main/java/com/minelittlepony/client/model/gear/Muffin.java @@ -1,5 +1,6 @@ package com.minelittlepony.client.model.gear; +import net.minecraft.client.model.ModelPart; import net.minecraft.entity.Entity; import net.minecraft.util.Identifier; @@ -7,15 +8,13 @@ import com.minelittlepony.api.pony.meta.Wearable; import com.minelittlepony.model.BodyPart; import com.minelittlepony.model.IModel; import com.minelittlepony.model.gear.IStackable; -import com.minelittlepony.mson.api.ModelContext; public class Muffin extends AbstractGear implements IStackable { private static final Identifier TEXTURE = new Identifier("minelittlepony", "textures/models/muffin.png"); - @Override - public void init(ModelContext context) { - addPart(context.findByName("crown")); + public Muffin(ModelPart tree) { + addPart(tree.getChild("crown")); } @Override diff --git a/src/main/java/com/minelittlepony/client/model/gear/SaddleBags.java b/src/main/java/com/minelittlepony/client/model/gear/SaddleBags.java index e56f9ea3..4a45f1c9 100644 --- a/src/main/java/com/minelittlepony/client/model/gear/SaddleBags.java +++ b/src/main/java/com/minelittlepony/client/model/gear/SaddleBags.java @@ -5,7 +5,6 @@ import com.minelittlepony.api.pony.meta.Wearable; import com.minelittlepony.model.BodyPart; import com.minelittlepony.model.IModel; import com.minelittlepony.model.IPegasus; -import com.minelittlepony.mson.api.ModelContext; import java.util.UUID; @@ -20,10 +19,10 @@ public class SaddleBags extends AbstractGear { public static final Identifier TEXTURE = new Identifier("minelittlepony", "textures/models/saddlebags.png"); - private ModelPart leftBag; - private ModelPart rightBag; + private final ModelPart leftBag; + private final ModelPart rightBag; - private ModelPart strap; + private final ModelPart strap; private boolean hangLow = false; @@ -31,11 +30,10 @@ public class SaddleBags extends AbstractGear { private IModel model; - @Override - public void init(ModelContext context) { - strap = context.findByName("strap"); - leftBag = context.findByName("left_bag"); - rightBag = context.findByName("right_bag"); + public SaddleBags(ModelPart tree) { + strap = tree.getChild("strap"); + leftBag = tree.getChild("left_bag"); + rightBag = tree.getChild("right_bag"); } @Override diff --git a/src/main/java/com/minelittlepony/client/model/gear/Stetson.java b/src/main/java/com/minelittlepony/client/model/gear/Stetson.java index 5fc14296..f4c3fd9d 100644 --- a/src/main/java/com/minelittlepony/client/model/gear/Stetson.java +++ b/src/main/java/com/minelittlepony/client/model/gear/Stetson.java @@ -1,5 +1,6 @@ package com.minelittlepony.client.model.gear; +import net.minecraft.client.model.ModelPart; import net.minecraft.entity.Entity; import net.minecraft.util.Identifier; @@ -7,14 +8,12 @@ import com.minelittlepony.api.pony.meta.Wearable; import com.minelittlepony.model.BodyPart; import com.minelittlepony.model.IModel; import com.minelittlepony.model.gear.IStackable; -import com.minelittlepony.mson.api.ModelContext; public class Stetson extends AbstractGear implements IStackable { private static final Identifier TEXTURE = new Identifier("minelittlepony", "textures/models/stetson.png"); - @Override - public void init(ModelContext context) { - addPart(context.findByName("rim")); + public Stetson(ModelPart tree) { + addPart(tree.getChild("rim")); } @Override diff --git a/src/main/java/com/minelittlepony/client/model/gear/WitchHat.java b/src/main/java/com/minelittlepony/client/model/gear/WitchHat.java index 53f69ba7..cab695c1 100644 --- a/src/main/java/com/minelittlepony/client/model/gear/WitchHat.java +++ b/src/main/java/com/minelittlepony/client/model/gear/WitchHat.java @@ -1,5 +1,6 @@ package com.minelittlepony.client.model.gear; +import net.minecraft.client.model.ModelPart; import net.minecraft.entity.Entity; import net.minecraft.util.Identifier; @@ -7,15 +8,13 @@ import com.minelittlepony.api.pony.meta.Wearable; import com.minelittlepony.model.BodyPart; import com.minelittlepony.model.IModel; import com.minelittlepony.model.gear.IStackable; -import com.minelittlepony.mson.api.ModelContext; public class WitchHat extends AbstractGear implements IStackable { private static final Identifier WITCH_TEXTURES = new Identifier("textures/entity/witch.png"); - @Override - public void init(ModelContext context) { - addPart(context.findByName("hat")); + public WitchHat(ModelPart tree) { + addPart(tree.getChild("hat")); } @Override diff --git a/src/main/java/com/minelittlepony/client/model/part/BatWings.java b/src/main/java/com/minelittlepony/client/model/part/BatWings.java index 26d82b07..887337b3 100644 --- a/src/main/java/com/minelittlepony/client/model/part/BatWings.java +++ b/src/main/java/com/minelittlepony/client/model/part/BatWings.java @@ -1,6 +1,7 @@ package com.minelittlepony.client.model.part; import net.minecraft.client.model.Model; +import net.minecraft.client.model.ModelPart; import net.minecraft.client.render.VertexConsumer; import net.minecraft.client.util.math.MatrixStack; @@ -10,6 +11,10 @@ import java.util.UUID; public class BatWings extends PegasusWings { + public BatWings(ModelPart tree) { + super(tree); + } + @Override public void renderPart(MatrixStack stack, VertexConsumer vertices, int overlayUv, int lightUv, float red, float green, float blue, float alpha, UUID interpolatorId) { stack.push(); @@ -21,6 +26,11 @@ public class BatWings extends PegasusWings { } public static class Wing extends PegasusWings.Wing { + + public Wing(ModelPart tree) { + super(tree); + } + @Override public void rotateWalking(float swing) { folded.yaw = swing * 0.05F; diff --git a/src/main/java/com/minelittlepony/client/model/part/PegasusWings.java b/src/main/java/com/minelittlepony/client/model/part/PegasusWings.java index 3f761fc1..92d286d1 100644 --- a/src/main/java/com/minelittlepony/client/model/part/PegasusWings.java +++ b/src/main/java/com/minelittlepony/client/model/part/PegasusWings.java @@ -23,6 +23,10 @@ public class PegasusWings implements IPart, MsonMode protected Wing legacyWing; + public PegasusWings(ModelPart tree) { + + } + @Override public void init(ModelContext context) { pegasus = context.getModel(); @@ -89,6 +93,10 @@ public class PegasusWings implements IPart, MsonMode protected ModelPart extended; protected ModelPart folded; + public Wing(ModelPart tree) { + + } + @Override public void init(ModelContext context) { pegasus = context.getModel(); diff --git a/src/main/java/com/minelittlepony/client/model/part/PonyEars.java b/src/main/java/com/minelittlepony/client/model/part/PonyEars.java index eae39c7c..5feeaffd 100644 --- a/src/main/java/com/minelittlepony/client/model/part/PonyEars.java +++ b/src/main/java/com/minelittlepony/client/model/part/PonyEars.java @@ -7,24 +7,26 @@ import net.minecraft.client.util.math.MatrixStack; import com.minelittlepony.model.IPart; import com.minelittlepony.mson.api.ModelContext; import com.minelittlepony.mson.api.MsonModel; -import com.minelittlepony.mson.api.model.BoxBuilder.ContentAccessor; +import com.minelittlepony.mson.api.model.PartBuilder; import java.util.UUID; public class PonyEars implements IPart, MsonModel { - private ModelPart right; private ModelPart left; + public PonyEars(ModelPart tree) { + + } @Override public void init(ModelContext context) { right = context.findByName("right"); left = context.findByName("left"); - ContentAccessor head = context.getContext(); - head.children().add(right); - head.children().add(left); + PartBuilder head = context.getContext(); + head.addChild("right_ear", right); + head.addChild("left_ear", left); } @Override diff --git a/src/main/java/com/minelittlepony/client/model/part/PonySnout.java b/src/main/java/com/minelittlepony/client/model/part/PonySnout.java index 40e42d28..19449172 100644 --- a/src/main/java/com/minelittlepony/client/model/part/PonySnout.java +++ b/src/main/java/com/minelittlepony/client/model/part/PonySnout.java @@ -10,7 +10,7 @@ import com.minelittlepony.model.IPart; import com.minelittlepony.mson.api.ModelContext; import com.minelittlepony.mson.api.MsonModel; import com.minelittlepony.mson.api.model.MsonPart; -import com.minelittlepony.mson.api.model.BoxBuilder.ContentAccessor; +import com.minelittlepony.mson.api.model.PartBuilder; import java.util.UUID; @@ -21,19 +21,23 @@ public class PonySnout implements IPart, MsonModel { private ModelPart mare; private ModelPart stallion; + public PonySnout(ModelPart tree) { + + } + @Override public void init(ModelContext context) { mare = context.findByName("mare"); stallion = context.findByName("stallion"); - ContentAccessor head = context.getContext(); - head.children().add(mare); - head.children().add(stallion); + PartBuilder head = context.getContext(); + head.addChild("mare", mare); + head.addChild("stallion", stallion); } public void rotate(float x, float y, float z) { - ((MsonPart)mare).rotate(x, y, z); - ((MsonPart)stallion).rotate(x, y, z); + ((MsonPart)(Object)mare).rotate(x, y, z); + ((MsonPart)(Object)stallion).rotate(x, y, z); } @Override diff --git a/src/main/java/com/minelittlepony/client/model/part/PonyTail.java b/src/main/java/com/minelittlepony/client/model/part/PonyTail.java index 6e14d144..2995c02a 100644 --- a/src/main/java/com/minelittlepony/client/model/part/PonyTail.java +++ b/src/main/java/com/minelittlepony/client/model/part/PonyTail.java @@ -10,6 +10,9 @@ import com.minelittlepony.model.IPart; import com.minelittlepony.mson.api.ModelContext; import com.minelittlepony.mson.api.MsonModel; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; import java.util.UUID; import java.util.concurrent.ExecutionException; @@ -20,12 +23,16 @@ public class PonyTail implements IPart, MsonModel { private int tailStop = 0; + private final List segments = new ArrayList<>(); + + public PonyTail(ModelPart tree) { + + } + @Override public void init(ModelContext context) { theModel = context.getModel(); - tail = new ModelPart(theModel); - try { int segments = context.getLocals().getValue("segments").get().intValue(); @@ -33,13 +40,16 @@ public class PonyTail implements IPart, MsonModel { for (int i = 0; i < segments; i++) { Segment segment = subContext.findByName("segment_" + i); + segment.tail = this; segment.index = i; - tail.addChild(segment); + this.segments.add(segment); } } catch (InterruptedException | ExecutionException e) { throw new RuntimeException(e); } + + tail = new ModelPart(new ArrayList<>(), new HashMap<>()); } @Override @@ -90,29 +100,28 @@ public class PonyTail implements IPart, MsonModel { @Override public void renderPart(MatrixStack stack, VertexConsumer vertices, int overlayUv, int lightUv, float red, float green, float blue, float alpha, UUID interpolatorId) { - tail.render(stack, vertices, overlayUv, lightUv, red, green, blue, alpha); + stack.push(); + tail.rotate(stack); + + segments.forEach(segment -> segment.render(stack, vertices, overlayUv, lightUv, red, green, blue, alpha)); + + stack.pop(); } - public static class Segment extends ModelPart implements MsonModel { - + public static class Segment implements MsonModel { public PonyTail tail; public int index; - public Segment(ModelContext context) { - super(context.getModel()); + private final ModelPart tree; + + public Segment(ModelPart tree) { + this.tree = tree; } - @Override - public void init(ModelContext context) { - tail = context.getContext(); - context.findByName("segment", this); - } - - @Override public void render(MatrixStack stack, VertexConsumer renderContext, int overlayUv, int lightUv, float red, float green, float blue, float alpha) { if (index < tail.tailStop) { - super.render(stack, renderContext, overlayUv, lightUv, red, green, blue, alpha); + tree.render(stack, renderContext, overlayUv, lightUv, red, green, blue, alpha); } } } diff --git a/src/main/java/com/minelittlepony/client/model/part/SeaponyTail.java b/src/main/java/com/minelittlepony/client/model/part/SeaponyTail.java index c30736cd..1eb99a91 100644 --- a/src/main/java/com/minelittlepony/client/model/part/SeaponyTail.java +++ b/src/main/java/com/minelittlepony/client/model/part/SeaponyTail.java @@ -23,6 +23,10 @@ public class SeaponyTail implements IPart, MsonModel { private IPonyModel model; + public SeaponyTail(ModelPart tree) { + + } + @Override public void init(ModelContext context) { model = context.getModel(); diff --git a/src/main/java/com/minelittlepony/client/model/part/UnicornHorn.java b/src/main/java/com/minelittlepony/client/model/part/UnicornHorn.java index 79b3da9a..6e445031 100644 --- a/src/main/java/com/minelittlepony/client/model/part/UnicornHorn.java +++ b/src/main/java/com/minelittlepony/client/model/part/UnicornHorn.java @@ -24,6 +24,10 @@ public class UnicornHorn implements IPart, MsonModel { protected boolean visible = true; + public UnicornHorn(ModelPart tree) { + + } + @Override public void init(ModelContext context) { horn = context.findByName("bone"); diff --git a/src/main/java/com/minelittlepony/client/pony/Pony.java b/src/main/java/com/minelittlepony/client/pony/Pony.java index ce0382b9..8aaa0202 100644 --- a/src/main/java/com/minelittlepony/client/pony/Pony.java +++ b/src/main/java/com/minelittlepony/client/pony/Pony.java @@ -71,7 +71,7 @@ public class Pony implements IPony { public boolean isFlying(LivingEntity entity) { return !(isOnGround(entity) || entity.hasVehicle() - || (entity.isClimbing() && !(entity instanceof PlayerEntity && ((PlayerEntity)entity).abilities.allowFlying)) + || (entity.isClimbing() && !(entity instanceof PlayerEntity && ((PlayerEntity)entity).getAbilities().allowFlying)) || entity.isSubmergedInWater() || entity.isSleeping()); } diff --git a/src/main/java/com/minelittlepony/client/render/MagicGlow.java b/src/main/java/com/minelittlepony/client/render/MagicGlow.java index dab00107..2ad4ccd9 100644 --- a/src/main/java/com/minelittlepony/client/render/MagicGlow.java +++ b/src/main/java/com/minelittlepony/client/render/MagicGlow.java @@ -2,6 +2,7 @@ package com.minelittlepony.client.render; import net.minecraft.client.render.RenderLayer; import net.minecraft.client.render.RenderPhase; +import net.minecraft.client.render.VertexFormat; import net.minecraft.client.render.VertexFormats; import net.minecraft.util.Identifier; @@ -24,7 +25,7 @@ public class MagicGlow extends RenderPhase { RenderSystem.defaultBlendFunc(); }); - private static final RenderLayer MAGIC = RenderLayer.of("mlp_magic_glow", VertexFormats.POSITION_COLOR_TEXTURE_LIGHT_NORMAL, 7, 256, RenderLayer.MultiPhaseParameters.builder() + private static final RenderLayer MAGIC = RenderLayer.of("mlp_magic_glow", VertexFormats.POSITION_COLOR_TEXTURE_LIGHT_NORMAL, VertexFormat.DrawMode.QUADS, 256, RenderLayer.MultiPhaseParameters.builder() .texture(NO_TEXTURE) .writeMaskState(COLOR_MASK) .transparency(LIGHTNING_TRANSPARENCY) @@ -37,7 +38,7 @@ public class MagicGlow extends RenderPhase { } public static RenderLayer getTintedTexturedLayer(Identifier texture, float red, float green, float blue, float alpha) { - return RenderLayer.of("mlp_tint_layer", VertexFormats.POSITION_COLOR_TEXTURE_OVERLAY_LIGHT_NORMAL, 7, 256, true, true, RenderLayer.MultiPhaseParameters.builder() + return RenderLayer.of("mlp_tint_layer", VertexFormats.POSITION_COLOR_TEXTURE_OVERLAY_LIGHT_NORMAL, VertexFormat.DrawMode.QUADS, 256, true, true, RenderLayer.MultiPhaseParameters.builder() .texture(new Color(texture, red, green, blue, alpha)) .writeMaskState(COLOR_MASK) .alpha(ONE_TENTH_ALPHA) diff --git a/src/main/java/com/minelittlepony/client/render/PonyRenderDispatcher.java b/src/main/java/com/minelittlepony/client/render/PonyRenderDispatcher.java index 67274eb9..486d5c2d 100644 --- a/src/main/java/com/minelittlepony/client/render/PonyRenderDispatcher.java +++ b/src/main/java/com/minelittlepony/client/render/PonyRenderDispatcher.java @@ -15,6 +15,7 @@ import com.minelittlepony.mson.api.Mson; import net.minecraft.client.MinecraftClient; import net.minecraft.client.render.entity.EntityRenderDispatcher; import net.minecraft.client.render.entity.EntityRenderer; +import net.minecraft.client.render.entity.EntityRendererFactory; import net.minecraft.client.render.entity.model.EntityModel; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityType; @@ -71,7 +72,7 @@ public class PonyRenderDispatcher { * @param The entity type */ @SuppressWarnings("unchecked") - void switchRenderer(boolean state, EntityType type, Function> factory) { + void switchRenderer(boolean state, EntityType type, Function> factory) { if (state) { if (!renderMap.containsKey(type)) { renderMap.put(type, ((MixinEntityRenderDispatcher)MinecraftClient.getInstance().getEntityRenderDispatcher()).getEntityRenderers().get(type)); diff --git a/src/main/java/com/minelittlepony/client/render/blockentity/skull/PonySkull.java b/src/main/java/com/minelittlepony/client/render/blockentity/skull/PonySkull.java index 5df54b61..93cc7ae5 100644 --- a/src/main/java/com/minelittlepony/client/render/blockentity/skull/PonySkull.java +++ b/src/main/java/com/minelittlepony/client/render/blockentity/skull/PonySkull.java @@ -2,6 +2,7 @@ package com.minelittlepony.client.render.blockentity.skull; import com.minelittlepony.client.SkinsProxy; import com.minelittlepony.client.model.DJPon3EarsModel; +import com.minelittlepony.client.model.ModelType; import com.minelittlepony.settings.PonyConfig; import com.minelittlepony.settings.PonyLevel; import com.mojang.authlib.GameProfile; @@ -16,7 +17,7 @@ import javax.annotation.Nullable; public class PonySkull extends AbstractPonySkull { - private final DJPon3EarsModel deadMau5 = new DJPon3EarsModel(); + private final DJPon3EarsModel deadMau5 = ModelType.DJ_PON_3.createModel(); @Override public boolean canRender(PonyConfig config) { diff --git a/src/main/java/com/minelittlepony/client/render/blockentity/skull/PonySkullRenderer.java b/src/main/java/com/minelittlepony/client/render/blockentity/skull/PonySkullRenderer.java index b3f5b823..171f1821 100644 --- a/src/main/java/com/minelittlepony/client/render/blockentity/skull/PonySkullRenderer.java +++ b/src/main/java/com/minelittlepony/client/render/blockentity/skull/PonySkullRenderer.java @@ -14,9 +14,10 @@ import com.mojang.authlib.GameProfile; import net.minecraft.block.SkullBlock; import net.minecraft.block.entity.BlockEntityType; import net.minecraft.client.render.OverlayTexture; +import net.minecraft.client.render.RenderLayer; import net.minecraft.client.render.VertexConsumer; import net.minecraft.client.render.VertexConsumerProvider; -import net.minecraft.client.render.block.entity.BlockEntityRenderDispatcher; +import net.minecraft.client.render.block.entity.BlockEntityRendererFactory; import net.minecraft.client.render.block.entity.SkullBlockEntityRenderer; import net.minecraft.client.util.math.MatrixStack; import net.minecraft.util.Identifier; @@ -31,7 +32,7 @@ import javax.annotation.Nullable; */ public class PonySkullRenderer extends SkullBlockEntityRenderer { - private static PonySkullRenderer INSTANCE; + public static PonySkullRenderer INSTANCE; public static void resolve(boolean ponySkulls) { Mson.getInstance().getEntityRendererRegistry().registerBlockRenderer(BlockEntityType.SKULL, @@ -39,6 +40,9 @@ public class PonySkullRenderer extends SkullBlockEntityRenderer { ); } + private ISkull selectedSkull; + private Identifier selectedSkin; + private final Map skullMap = Util.make(Maps.newHashMap(), (skullMap) -> { skullMap.put(SkullBlock.Type.SKELETON, new MobSkull(SkeleponyRenderer.SKELETON, MobRenderers.SKELETON)); skullMap.put(SkullBlock.Type.WITHER_SKELETON, new MobSkull(SkeleponyRenderer.WITHER, MobRenderers.SKELETON)); @@ -46,34 +50,36 @@ public class PonySkullRenderer extends SkullBlockEntityRenderer { skullMap.put(SkullBlock.Type.PLAYER, new PonySkull()); }); - public PonySkullRenderer(BlockEntityRenderDispatcher dispatcher) { - super(dispatcher); - + public PonySkullRenderer(BlockEntityRendererFactory.Context context) { + super(context); INSTANCE = this; } - public static boolean renderPonySkull(@Nullable Direction direction, float angle, - SkullBlock.SkullType skullType, @Nullable GameProfile profile, float poweredTicks, - MatrixStack stack, VertexConsumerProvider renderContext, int lightUv) { - if (INSTANCE != null) { - return INSTANCE.renderSkull(direction, angle, skullType, profile, poweredTicks, stack, renderContext, lightUv); - } - return false; - } - - boolean renderSkull(@Nullable Direction direction, float angle, - SkullBlock.SkullType skullType, @Nullable GameProfile profile, float poweredTicks, - MatrixStack stack, VertexConsumerProvider renderContext, int lightUv) { + public RenderLayer getRenderLayer(SkullBlock.SkullType skullType, @Nullable GameProfile profile) { + selectedSkull = null; + selectedSkin = null; ISkull skull = skullMap.get(skullType); if (skull == null || !skull.canRender(MineLittlePony.getInstance().getConfig())) { + return null; + } + + selectedSkull = skull; + selectedSkin = skull.getSkinResource(profile); + return LevitatingItemRenderer.getRenderLayer(selectedSkin); + } + + public boolean renderSkull(@Nullable Direction direction, + float angle, float poweredTicks, + MatrixStack stack, VertexConsumerProvider renderContext, RenderLayer layer, + int lightUv) { + + if (selectedSkull == null || !selectedSkull.canRender(MineLittlePony.getInstance().getConfig())) { return false; } - Identifier skin = skull.getSkinResource(profile); - - skull.bindPony(MineLittlePony.getInstance().getManager().getPony(skin)); + selectedSkull.bindPony(MineLittlePony.getInstance().getManager().getPony(selectedSkin)); stack.push(); @@ -81,10 +87,10 @@ public class PonySkullRenderer extends SkullBlockEntityRenderer { stack.scale(-1, -1, 1); - VertexConsumer vertices = renderContext.getBuffer(LevitatingItemRenderer.getRenderLayer(skin)); + VertexConsumer vertices = renderContext.getBuffer(layer); - skull.setAngles(angle, poweredTicks); - skull.render(stack, vertices, lightUv, OverlayTexture.DEFAULT_UV, 1, 1, 1, 1); + selectedSkull.setAngles(angle, poweredTicks); + selectedSkull.render(stack, vertices, lightUv, OverlayTexture.DEFAULT_UV, 1, 1, 1, 1); stack.pop(); diff --git a/src/main/java/com/minelittlepony/client/render/entity/EnderStallionRenderer.java b/src/main/java/com/minelittlepony/client/render/entity/EnderStallionRenderer.java index 99e572c3..57346f73 100644 --- a/src/main/java/com/minelittlepony/client/render/entity/EnderStallionRenderer.java +++ b/src/main/java/com/minelittlepony/client/render/entity/EnderStallionRenderer.java @@ -9,7 +9,7 @@ import com.minelittlepony.client.render.entity.feature.GlowingEyesFeature.IGlowi import net.minecraft.block.BlockState; import net.minecraft.client.render.VertexConsumerProvider; -import net.minecraft.client.render.entity.EntityRenderDispatcher; +import net.minecraft.client.render.entity.EntityRendererFactory; import net.minecraft.client.render.entity.feature.StuckArrowsFeatureRenderer; import net.minecraft.client.util.math.MatrixStack; import net.minecraft.entity.mob.EndermanEntity; @@ -25,14 +25,14 @@ public class EnderStallionRenderer extends PonyRenderer(this)); + addFeature(new StuckArrowsFeatureRenderer<>(context, this)); addFeature(new GlowingEyesFeature<>(this)); } diff --git a/src/main/java/com/minelittlepony/client/render/entity/ParaspriteRenderer.java b/src/main/java/com/minelittlepony/client/render/entity/ParaspriteRenderer.java index 0e7fdb2b..7e41afd3 100644 --- a/src/main/java/com/minelittlepony/client/render/entity/ParaspriteRenderer.java +++ b/src/main/java/com/minelittlepony/client/render/entity/ParaspriteRenderer.java @@ -1,6 +1,6 @@ package com.minelittlepony.client.render.entity; -import net.minecraft.client.render.entity.EntityRenderDispatcher; +import net.minecraft.client.render.entity.EntityRendererFactory; import net.minecraft.client.render.entity.MobEntityRenderer; import net.minecraft.client.render.entity.feature.SaddleFeatureRenderer; import net.minecraft.client.util.math.MatrixStack; @@ -17,8 +17,8 @@ public class ParaspriteRenderer extends MobEntityRenderer(this, ModelType.PARASPRITE.createModel(), SADDLE)); } 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 8950bde8..8b0ce0be 100644 --- a/src/main/java/com/minelittlepony/client/render/entity/PlayerPonyRenderer.java +++ b/src/main/java/com/minelittlepony/client/render/entity/PlayerPonyRenderer.java @@ -28,7 +28,7 @@ import net.minecraft.client.MinecraftClient; import net.minecraft.client.network.AbstractClientPlayerEntity; import net.minecraft.client.render.Frustum; import net.minecraft.client.render.VertexConsumerProvider; -import net.minecraft.client.render.entity.EntityRenderDispatcher; +import net.minecraft.client.render.entity.EntityRendererFactory; import net.minecraft.client.render.entity.PlayerEntityRenderer; import net.minecraft.client.render.entity.feature.FeatureRenderer; import net.minecraft.client.render.entity.feature.StuckArrowsFeatureRenderer; @@ -44,25 +44,25 @@ public class PlayerPonyRenderer extends PlayerEntityRenderer implements IPonyRen protected final EquineRenderManager> manager = new EquineRenderManager<>(this); - public PlayerPonyRenderer(EntityRenderDispatcher dispatcher, boolean slim, ModelKey> key) { - super(dispatcher, slim); + public PlayerPonyRenderer(EntityRendererFactory.Context context, boolean slim, ModelKey> key) { + super(context, slim); this.model = manager.setModel(key).getBody(); - addLayers(); + addLayers(context); } - protected void addLayers() { + protected void addLayers(EntityRendererFactory.Context context) { features.clear(); addLayer(new DJPon3Feature<>(this)); addLayer(new ArmourFeature<>(this)); - addFeature(new StuckArrowsFeatureRenderer<>(this)); - addLayer(new SkullFeature<>(this)); + addFeature(new StuckArrowsFeatureRenderer<>(context, this)); + addLayer(new SkullFeature<>(this, context.getModelLoader())); addLayer(new ElytraFeature<>(this)); addLayer(new GlowingItemFeature<>(this)); addLayer(new CapeFeature<>(this)); - addLayer(new PassengerFeature<>(this)); + addLayer(new PassengerFeature<>(this, context)); addLayer(new GearFeature<>(this)); } diff --git a/src/main/java/com/minelittlepony/client/render/entity/PlayerSeaponyRenderer.java b/src/main/java/com/minelittlepony/client/render/entity/PlayerSeaponyRenderer.java index d5a59f7d..9752ebf9 100644 --- a/src/main/java/com/minelittlepony/client/render/entity/PlayerSeaponyRenderer.java +++ b/src/main/java/com/minelittlepony/client/render/entity/PlayerSeaponyRenderer.java @@ -10,7 +10,7 @@ import com.minelittlepony.mson.api.ModelKey; import com.minelittlepony.util.MathUtil; import net.minecraft.client.network.AbstractClientPlayerEntity; -import net.minecraft.client.render.entity.EntityRenderDispatcher; +import net.minecraft.client.render.entity.EntityRendererFactory; import net.minecraft.particle.ParticleTypes; import net.minecraft.util.Identifier; @@ -19,8 +19,8 @@ public class PlayerSeaponyRenderer extends PlayerPonyRenderer { private final ModelWrapper> seapony; private final ModelWrapper> normalPony; - public PlayerSeaponyRenderer(EntityRenderDispatcher manager, boolean slim, ModelKey> key) { - super(manager, slim, key); + public PlayerSeaponyRenderer(EntityRendererFactory.Context context, boolean slim, ModelKey> key) { + super(context, slim, key); normalPony = new ModelWrapper<>(ModelType.>getPlayerModel(Race.UNICORN).getKey(slim)); seapony = this.manager.getModelWrapper(); 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 0496d6a1..a80a9f87 100644 --- a/src/main/java/com/minelittlepony/client/render/entity/PonyPiglinRenderer.java +++ b/src/main/java/com/minelittlepony/client/render/entity/PonyPiglinRenderer.java @@ -1,6 +1,6 @@ package com.minelittlepony.client.render.entity; -import net.minecraft.client.render.entity.EntityRenderDispatcher; +import net.minecraft.client.render.entity.EntityRendererFactory; import net.minecraft.client.util.math.MatrixStack; import net.minecraft.entity.EntityType; import net.minecraft.entity.mob.AbstractPiglinEntity; @@ -22,8 +22,8 @@ public class PonyPiglinRenderer extends PonyRenderer.Caster protected EquineRenderManager manager = new EquineRenderManager<>(this); - public PonyRenderer(EntityRenderDispatcher dispatcher, ModelKey key) { - super(dispatcher, null, 0.5F); + public PonyRenderer(EntityRendererFactory.Context context, ModelKey key) { + super(context, null, 0.5F); this.model = manager.setModel(key).getBody(); - addLayers(); + addLayers(context); } - protected void addLayers() { + protected void addLayers(EntityRendererFactory.Context context) { addFeature(new ArmourFeature<>(this)); addFeature(createItemHoldingLayer()); //addFeature(new StuckArrowsFeatureRenderer<>(this)); - addFeature(new SkullFeature<>(this)); + addFeature(new SkullFeature<>(this, context.getModelLoader())); addFeature(new ElytraFeature<>(this)); addFeature(new GearFeature<>(this)); } @@ -130,8 +130,8 @@ public abstract class PonyRenderer public abstract static class Caster & IUnicorn> extends PonyRenderer { - public Caster(EntityRenderDispatcher manager, ModelKey key) { - super(manager, key); + public Caster(EntityRendererFactory.Context context, ModelKey key) { + super(context, key); } @Override @@ -143,16 +143,16 @@ public abstract class PonyRenderer public abstract static class Proxy & IPonyModel> extends PonyRenderer { @SuppressWarnings({"rawtypes", "unchecked"}) - public Proxy(List exportedLayers, EntityRenderDispatcher manager, ModelKey key) { - super(manager, key); + public Proxy(List exportedLayers, EntityRendererFactory.Context context, ModelKey key) { + super(context, key); exportedLayers.addAll(features); } @Override - protected void addLayers() { + protected void addLayers(EntityRendererFactory.Context context) { features.clear(); - super.addLayers(); + super.addLayers(context); } public final Identifier getTextureFor(T entity) { diff --git a/src/main/java/com/minelittlepony/client/render/entity/PonyStandRenderer.java b/src/main/java/com/minelittlepony/client/render/entity/PonyStandRenderer.java index 90e43cc4..01e18d41 100644 --- a/src/main/java/com/minelittlepony/client/render/entity/PonyStandRenderer.java +++ b/src/main/java/com/minelittlepony/client/render/entity/PonyStandRenderer.java @@ -2,13 +2,14 @@ package com.minelittlepony.client.render.entity; import net.minecraft.client.render.VertexConsumerProvider; import net.minecraft.client.render.entity.ArmorStandEntityRenderer; -import net.minecraft.client.render.entity.EntityRenderDispatcher; +import net.minecraft.client.render.entity.EntityRendererFactory; import net.minecraft.client.render.entity.feature.ArmorFeatureRenderer; import net.minecraft.client.render.entity.feature.ElytraFeatureRenderer; import net.minecraft.client.render.entity.feature.FeatureRendererContext; import net.minecraft.client.render.entity.feature.HeadFeatureRenderer; import net.minecraft.client.render.entity.feature.HeldItemFeatureRenderer; import net.minecraft.client.render.entity.model.ArmorStandArmorEntityModel; +import net.minecraft.client.render.entity.model.EntityModelLayers; import net.minecraft.client.util.math.MatrixStack; import net.minecraft.entity.EquipmentSlot; import net.minecraft.entity.decoration.ArmorStandEntity; @@ -23,21 +24,24 @@ import com.minelittlepony.model.armour.ArmourLayer; public class PonyStandRenderer extends ArmorStandEntityRenderer { - public PonyStandRenderer(EntityRenderDispatcher entityRenderDispatcher) { - super(entityRenderDispatcher); + public PonyStandRenderer(EntityRendererFactory.Context context) { + super(context); features.clear(); - addFeature(new Armour(this)); + addFeature(new Armour(this, context)); addFeature(new HeldItemFeatureRenderer<>(this)); - addFeature(new ElytraFeatureRenderer<>(this)); - addFeature(new HeadFeatureRenderer<>(this)); + addFeature(new ElytraFeatureRenderer<>(this, context.getModelLoader())); + addFeature(new HeadFeatureRenderer<>(this, context.getModelLoader())); } class Armour extends ArmorFeatureRenderer { private final ModelWrapper> pony = new ModelWrapper<>(ModelType.EARTH_PONY.getKey(false)); - public Armour(FeatureRendererContext context) { - super(context, new ArmorStandArmorEntityModel(0.5F), new ArmorStandArmorEntityModel(1)); + public Armour(FeatureRendererContext renderer, EntityRendererFactory.Context context) { + super(renderer, + new ArmorStandArmorEntityModel(context.getPart(EntityModelLayers.ARMOR_STAND_INNER_ARMOR)), + new ArmorStandArmorEntityModel(context.getPart(EntityModelLayers.ARMOR_STAND_OUTER_ARMOR)) + ); pony.apply(new PonyData(Race.EARTH)); } diff --git a/src/main/java/com/minelittlepony/client/render/entity/SeaponyRenderer.java b/src/main/java/com/minelittlepony/client/render/entity/SeaponyRenderer.java index a842a136..094ee31f 100644 --- a/src/main/java/com/minelittlepony/client/render/entity/SeaponyRenderer.java +++ b/src/main/java/com/minelittlepony/client/render/entity/SeaponyRenderer.java @@ -11,7 +11,7 @@ import com.minelittlepony.client.render.entity.feature.GlowingItemFeature; import com.mojang.blaze3d.systems.RenderSystem; import net.minecraft.client.render.VertexConsumerProvider; -import net.minecraft.client.render.entity.EntityRenderDispatcher; +import net.minecraft.client.render.entity.EntityRendererFactory; import net.minecraft.client.render.entity.GuardianEntityRenderer; import net.minecraft.client.util.math.MatrixStack; import net.minecraft.entity.EntityDimensions; @@ -25,11 +25,11 @@ public class SeaponyRenderer extends GuardianEntityRenderer { private final Proxy ponyRenderer; - public SeaponyRenderer(EntityRenderDispatcher manager) { - super(manager); + public SeaponyRenderer(EntityRendererFactory.Context context) { + super(context); features.clear(); - ponyRenderer = new Proxy(features, manager, ModelType.GUARDIAN) { + ponyRenderer = new Proxy(features, context, ModelType.GUARDIAN) { @Override public Identifier findTexture(GuardianEntity entity) { return SEAPONY; @@ -71,8 +71,8 @@ public class SeaponyRenderer extends GuardianEntityRenderer { public static class Elder extends SeaponyRenderer { - public Elder(EntityRenderDispatcher manager) { - super(manager); + public Elder(EntityRendererFactory.Context context) { + super(context); } @Override diff --git a/src/main/java/com/minelittlepony/client/render/entity/SkeleponyRenderer.java b/src/main/java/com/minelittlepony/client/render/entity/SkeleponyRenderer.java index 3bbe9779..7f6f840d 100644 --- a/src/main/java/com/minelittlepony/client/render/entity/SkeleponyRenderer.java +++ b/src/main/java/com/minelittlepony/client/render/entity/SkeleponyRenderer.java @@ -6,7 +6,7 @@ import com.minelittlepony.client.render.entity.feature.HeldItemFeature; import com.minelittlepony.client.render.entity.feature.GlowingItemFeature; import com.minelittlepony.client.render.entity.feature.StrayClothingFeature; -import net.minecraft.client.render.entity.EntityRenderDispatcher; +import net.minecraft.client.render.entity.EntityRendererFactory; import net.minecraft.client.util.math.MatrixStack; import net.minecraft.entity.mob.AbstractSkeletonEntity; import net.minecraft.entity.mob.StrayEntity; @@ -19,8 +19,8 @@ public class SkeleponyRenderer extends public static final Identifier WITHER = new Identifier("minelittlepony", "textures/entity/skeleton/skeleton_wither_pony.png"); public static final Identifier STRAY = new Identifier("minelittlepony", "textures/entity/skeleton/stray_pony.png"); - public SkeleponyRenderer(EntityRenderDispatcher manager) { - super(manager, ModelType.SKELETON); + public SkeleponyRenderer(EntityRendererFactory.Context context) { + super(context, ModelType.SKELETON); } @Override @@ -35,8 +35,8 @@ public class SkeleponyRenderer extends public static class Stray extends SkeleponyRenderer { - public Stray(EntityRenderDispatcher manager) { - super(manager); + public Stray(EntityRendererFactory.Context context) { + super(context); addFeature(new StrayClothingFeature<>(this)); } @@ -48,8 +48,8 @@ public class SkeleponyRenderer extends public static class Wither extends SkeleponyRenderer { - public Wither(EntityRenderDispatcher manager) { - super(manager); + public Wither(EntityRendererFactory.Context context) { + super(context); } @Override diff --git a/src/main/java/com/minelittlepony/client/render/entity/VexRenderer.java b/src/main/java/com/minelittlepony/client/render/entity/VexRenderer.java index 72aae701..4ed1e3fc 100644 --- a/src/main/java/com/minelittlepony/client/render/entity/VexRenderer.java +++ b/src/main/java/com/minelittlepony/client/render/entity/VexRenderer.java @@ -1,7 +1,7 @@ package com.minelittlepony.client.render.entity; import net.minecraft.client.render.entity.BipedEntityRenderer; -import net.minecraft.client.render.entity.EntityRenderDispatcher; +import net.minecraft.client.render.entity.EntityRendererFactory; import net.minecraft.client.util.math.MatrixStack; import net.minecraft.entity.mob.VexEntity; import net.minecraft.util.Identifier; @@ -17,8 +17,8 @@ public class VexRenderer extends BipedEntityRenderer { private static final Identifier WITCH_TEXTURES = new Identifier("minelittlepony", "textures/entity/witch_pony.png"); - public WitchRenderer(EntityRenderDispatcher manager) { - super(manager, ModelType.WITCH); + public WitchRenderer(EntityRendererFactory.Context context) { + super(context, ModelType.WITCH); } @Override diff --git a/src/main/java/com/minelittlepony/client/render/entity/ZomponyRenderer.java b/src/main/java/com/minelittlepony/client/render/entity/ZomponyRenderer.java index 9c94ab5f..0200ad3c 100644 --- a/src/main/java/com/minelittlepony/client/render/entity/ZomponyRenderer.java +++ b/src/main/java/com/minelittlepony/client/render/entity/ZomponyRenderer.java @@ -1,6 +1,6 @@ package com.minelittlepony.client.render.entity; -import net.minecraft.client.render.entity.EntityRenderDispatcher; +import net.minecraft.client.render.entity.EntityRendererFactory; import net.minecraft.client.util.math.MatrixStack; import net.minecraft.entity.mob.DrownedEntity; import net.minecraft.entity.mob.GiantEntity; @@ -17,8 +17,8 @@ public class ZomponyRenderer extends PonyRenderer.C public static final Identifier HUSK = new Identifier("minelittlepony", "textures/entity/zombie/husk_pony.png"); public static final Identifier DROWNED = new Identifier("minelittlepony", "textures/entity/zombie/drowned_pony.png"); - public ZomponyRenderer(EntityRenderDispatcher manager) { - super(manager, ModelType.ZOMBIE); + public ZomponyRenderer(EntityRendererFactory.Context context) { + super(context, ModelType.ZOMBIE); } @Override @@ -28,8 +28,8 @@ public class ZomponyRenderer extends PonyRenderer.C public static class Drowned extends ZomponyRenderer { - public Drowned(EntityRenderDispatcher manager) { - super(manager); + public Drowned(EntityRendererFactory.Context context) { + super(context); } @Override @@ -40,8 +40,8 @@ public class ZomponyRenderer extends PonyRenderer.C public static class Husk extends ZomponyRenderer { - public Husk(EntityRenderDispatcher manager) { - super(manager); + public Husk(EntityRendererFactory.Context context) { + super(context); } @Override @@ -59,8 +59,8 @@ public class ZomponyRenderer extends PonyRenderer.C public static class Giant extends PonyRenderer.Caster> { - public Giant(EntityRenderDispatcher manager) { - super(manager, ModelType.ZOMBIE); + public Giant(EntityRendererFactory.Context context) { + super(context, ModelType.ZOMBIE); } @Override diff --git a/src/main/java/com/minelittlepony/client/render/entity/feature/DJPon3Feature.java b/src/main/java/com/minelittlepony/client/render/entity/feature/DJPon3Feature.java index dd4a2299..76d063b8 100644 --- a/src/main/java/com/minelittlepony/client/render/entity/feature/DJPon3Feature.java +++ b/src/main/java/com/minelittlepony/client/render/entity/feature/DJPon3Feature.java @@ -8,13 +8,14 @@ import net.minecraft.client.render.entity.model.EntityModel; import net.minecraft.client.util.math.MatrixStack; import com.minelittlepony.client.model.IPonyModel; +import com.minelittlepony.client.model.ModelType; import com.minelittlepony.client.model.DJPon3EarsModel; import com.minelittlepony.client.render.IPonyRenderContext; import com.minelittlepony.model.BodyPart; public class DJPon3Feature & IPonyModel> extends AbstractPonyFeature { - private final DJPon3EarsModel deadMau5 = new DJPon3EarsModel(); + private final DJPon3EarsModel deadMau5 = ModelType.DJ_PON_3.createModel(); public DJPon3Feature(IPonyRenderContext context) { super(context); diff --git a/src/main/java/com/minelittlepony/client/render/entity/feature/PassengerFeature.java b/src/main/java/com/minelittlepony/client/render/entity/feature/PassengerFeature.java index 16ef612d..7d46c7b5 100644 --- a/src/main/java/com/minelittlepony/client/render/entity/feature/PassengerFeature.java +++ b/src/main/java/com/minelittlepony/client/render/entity/feature/PassengerFeature.java @@ -3,7 +3,9 @@ package com.minelittlepony.client.render.entity.feature; import net.minecraft.client.render.OverlayTexture; import net.minecraft.client.render.VertexConsumer; import net.minecraft.client.render.VertexConsumerProvider; +import net.minecraft.client.render.entity.EntityRendererFactory; import net.minecraft.client.render.entity.ParrotEntityRenderer; +import net.minecraft.client.render.entity.model.EntityModelLayers; import net.minecraft.client.render.entity.model.ParrotEntityModel; import net.minecraft.client.util.math.MatrixStack; import net.minecraft.client.util.math.Vector3f; @@ -20,10 +22,11 @@ import java.util.Optional; public class PassengerFeature> extends AbstractPonyFeature { - private final ParrotEntityModel model = new ParrotEntityModel(); + private final ParrotEntityModel model; - public PassengerFeature(IPonyRenderContext context) { - super(context); + public PassengerFeature(IPonyRenderContext renderer, EntityRendererFactory.Context context) { + super(renderer); + model = new ParrotEntityModel(context.getPart(EntityModelLayers.PARROT)); } @Override diff --git a/src/main/java/com/minelittlepony/client/render/entity/feature/SkullFeature.java b/src/main/java/com/minelittlepony/client/render/entity/feature/SkullFeature.java index ca463ae5..7f0105e4 100644 --- a/src/main/java/com/minelittlepony/client/render/entity/feature/SkullFeature.java +++ b/src/main/java/com/minelittlepony/client/render/entity/feature/SkullFeature.java @@ -6,13 +6,19 @@ import com.minelittlepony.client.render.IPonyRenderContext; import com.minelittlepony.model.BodyPart; import com.mojang.authlib.GameProfile; +import java.util.Map; + import net.minecraft.block.AbstractSkullBlock; +import net.minecraft.block.SkullBlock; import net.minecraft.block.SkullBlock.SkullType; import net.minecraft.block.entity.SkullBlockEntity; import net.minecraft.client.MinecraftClient; +import net.minecraft.client.render.RenderLayer; import net.minecraft.client.render.VertexConsumerProvider; +import net.minecraft.client.render.block.entity.SkullBlockEntityModel; import net.minecraft.client.render.block.entity.SkullBlockEntityRenderer; import net.minecraft.client.render.entity.model.EntityModel; +import net.minecraft.client.render.entity.model.EntityModelLoader; import net.minecraft.client.render.model.json.ModelTransformation; import net.minecraft.client.util.math.MatrixStack; import net.minecraft.client.util.math.Vector3f; @@ -28,8 +34,11 @@ import net.minecraft.village.VillagerDataContainer; public class SkullFeature & IPonyModel> extends AbstractPonyFeature { - public SkullFeature(IPonyRenderContext renderPony) { + private final Map headModels; + + public SkullFeature(IPonyRenderContext renderPony, EntityModelLoader entityModelLoader) { super(renderPony); + headModels = SkullBlockEntityRenderer.getModels(entityModelLoader); } @Override @@ -94,9 +103,11 @@ public class SkullFeature & IPo } } - SkullType type = ((AbstractSkullBlock) ((BlockItem) itemstack.getItem()).getBlock()).getSkullType(); - stack.translate(-0.5, 0, -0.5); - SkullBlockEntityRenderer.render(null, 180, type, profile, limbDistance, stack, renderContext, lightUv); + SkullType type = ((AbstractSkullBlock) ((BlockItem) itemstack.getItem()).getBlock()).getSkullType(); + SkullBlockEntityModel skullBlockEntityModel = (SkullBlockEntityModel)this.headModels.get(type); + RenderLayer renderLayer = SkullBlockEntityRenderer.method_3578(type, profile); + + SkullBlockEntityRenderer.method_32161(null, 180, f, stack, renderContext, lightUv, skullBlockEntityModel, renderLayer); } } diff --git a/src/main/java/com/minelittlepony/client/render/entity/npc/AbstractNpcRenderer.java b/src/main/java/com/minelittlepony/client/render/entity/npc/AbstractNpcRenderer.java index f933c0c6..2410a58b 100644 --- a/src/main/java/com/minelittlepony/client/render/entity/npc/AbstractNpcRenderer.java +++ b/src/main/java/com/minelittlepony/client/render/entity/npc/AbstractNpcRenderer.java @@ -1,7 +1,7 @@ package com.minelittlepony.client.render.entity.npc; import net.minecraft.client.model.ModelPart; -import net.minecraft.client.render.entity.EntityRenderDispatcher; +import net.minecraft.client.render.entity.EntityRendererFactory; import net.minecraft.client.render.entity.model.ModelWithHat; import net.minecraft.entity.mob.MobEntity; import net.minecraft.util.Identifier; @@ -23,8 +23,8 @@ abstract class AbstractNpcRenderer< private final String entityType; - public AbstractNpcRenderer(EntityRenderDispatcher manager, ModelKey key, String type, TextureSupplier formatter) { - super(manager, key); + public AbstractNpcRenderer(EntityRendererFactory.Context context, ModelKey key, String type, TextureSupplier formatter) { + super(context, key); entityType = type; baseTextures = new PonyTextures<>(formatter); diff --git a/src/main/java/com/minelittlepony/client/render/entity/npc/IllagerPonyRenderer.java b/src/main/java/com/minelittlepony/client/render/entity/npc/IllagerPonyRenderer.java index eab4167d..55f8fd57 100644 --- a/src/main/java/com/minelittlepony/client/render/entity/npc/IllagerPonyRenderer.java +++ b/src/main/java/com/minelittlepony/client/render/entity/npc/IllagerPonyRenderer.java @@ -7,7 +7,7 @@ import com.minelittlepony.client.render.entity.PonyRenderer; import com.minelittlepony.client.render.entity.feature.HeldItemFeature; import net.minecraft.client.render.VertexConsumerProvider; -import net.minecraft.client.render.entity.EntityRenderDispatcher; +import net.minecraft.client.render.entity.EntityRendererFactory; import net.minecraft.client.util.math.MatrixStack; import net.minecraft.entity.mob.EvokerEntity; import net.minecraft.entity.mob.IllagerEntity; @@ -23,8 +23,8 @@ public abstract class IllagerPonyRenderer extends PonyR public static final Identifier EVOKER = new Identifier("minelittlepony", "textures/entity/illager/evoker_pony.png"); public static final Identifier VINDICATOR = new Identifier("minelittlepony", "textures/entity/illager/vindicator_pony.png"); - public IllagerPonyRenderer(EntityRenderDispatcher manager) { - super(manager, ModelType.ILLAGER); + public IllagerPonyRenderer(EntityRendererFactory.Context context) { + super(context, ModelType.ILLAGER); } @Override @@ -40,8 +40,8 @@ public abstract class IllagerPonyRenderer extends PonyR public static class Vindicator extends IllagerPonyRenderer { - public Vindicator(EntityRenderDispatcher manager) { - super(manager); + public Vindicator(EntityRendererFactory.Context context) { + super(context); } @@ -53,8 +53,8 @@ public abstract class IllagerPonyRenderer extends PonyR public static class Evoker extends IllagerPonyRenderer { - public Evoker(EntityRenderDispatcher manager) { - super(manager); + public Evoker(EntityRendererFactory.Context context) { + super(context); } @Override @@ -65,8 +65,8 @@ public abstract class IllagerPonyRenderer extends PonyR public static class Illusionist extends IllagerPonyRenderer { - public Illusionist(EntityRenderDispatcher manager) { - super(manager); + public Illusionist(EntityRendererFactory.Context context) { + super(context); } @Override diff --git a/src/main/java/com/minelittlepony/client/render/entity/npc/PillagerRenderer.java b/src/main/java/com/minelittlepony/client/render/entity/npc/PillagerRenderer.java index 1f835634..fbe17e5c 100644 --- a/src/main/java/com/minelittlepony/client/render/entity/npc/PillagerRenderer.java +++ b/src/main/java/com/minelittlepony/client/render/entity/npc/PillagerRenderer.java @@ -1,6 +1,6 @@ package com.minelittlepony.client.render.entity.npc; -import net.minecraft.client.render.entity.EntityRenderDispatcher; +import net.minecraft.client.render.entity.EntityRendererFactory; import net.minecraft.entity.mob.PillagerEntity; import net.minecraft.util.Identifier; @@ -14,8 +14,8 @@ public class PillagerRenderer extends PonyRenderer FORMATTER = TextureSupplier.formatted("minelittlepony", "textures/entity/villager/%s.png"); - public VillagerPonyRenderer(EntityRenderDispatcher manager) { - super(manager, ModelType.VILLAGER, TYPE, FORMATTER); + public VillagerPonyRenderer(EntityRendererFactory.Context context) { + super(context, ModelType.VILLAGER, TYPE, FORMATTER); } @Override diff --git a/src/main/java/com/minelittlepony/client/render/entity/npc/ZomponyVillagerRenderer.java b/src/main/java/com/minelittlepony/client/render/entity/npc/ZomponyVillagerRenderer.java index ef182bae..eea1bf8a 100644 --- a/src/main/java/com/minelittlepony/client/render/entity/npc/ZomponyVillagerRenderer.java +++ b/src/main/java/com/minelittlepony/client/render/entity/npc/ZomponyVillagerRenderer.java @@ -3,7 +3,7 @@ package com.minelittlepony.client.render.entity.npc; import com.minelittlepony.client.model.ModelType; import com.minelittlepony.client.model.entity.ZomponyVillagerModel; -import net.minecraft.client.render.entity.EntityRenderDispatcher; +import net.minecraft.client.render.entity.EntityRendererFactory; import net.minecraft.client.util.math.MatrixStack; import net.minecraft.entity.mob.ZombieVillagerEntity; @@ -12,8 +12,8 @@ public class ZomponyVillagerRenderer extends AbstractNpcRenderer FORMATTER = TextureSupplier.formatted("minelittlepony", "textures/entity/zombie_villager/zombie_%s.png"); - public ZomponyVillagerRenderer(EntityRenderDispatcher manager) { - super(manager, ModelType.ZOMBIE_VILLAGER, TYPE, FORMATTER); + public ZomponyVillagerRenderer(EntityRendererFactory.Context context) { + super(context, ModelType.ZOMBIE_VILLAGER, TYPE, FORMATTER); } @Override diff --git a/src/main/java/com/minelittlepony/model/gear/IGear.java b/src/main/java/com/minelittlepony/model/gear/IGear.java index 6afb05ab..77f8bcb1 100644 --- a/src/main/java/com/minelittlepony/model/gear/IGear.java +++ b/src/main/java/com/minelittlepony/model/gear/IGear.java @@ -7,9 +7,8 @@ import com.minelittlepony.client.model.gear.IRenderContext; import com.minelittlepony.model.BodyPart; import com.minelittlepony.model.IModel; import com.minelittlepony.model.IPart; -import com.minelittlepony.mson.api.MsonModel; -public interface IGear extends IPart, MsonModel { +public interface IGear extends IPart { /** * Determines if this wearable can and is worn by the selected entity. diff --git a/src/main/resources/assets/minelittlepony/models/breezie.json b/src/main/resources/assets/minelittlepony/models/breezie.json index cf4a3bc4..01e3b83b 100644 --- a/src/main/resources/assets/minelittlepony/models/breezie.json +++ b/src/main/resources/assets/minelittlepony/models/breezie.json @@ -23,7 +23,7 @@ } ] }, - "helmet": { + "hat": { "children": [ { "center": [0, 0, -4], @@ -41,7 +41,7 @@ {"from": [0, 0, 0], "size": [2, 5, 2] } ] }, - "torso": { + "body": { "texture": {"u": 2, "v": 12}, "center": [-3, 2, -3], "rotate": [-30, 0, 0], diff --git a/src/main/resources/assets/minelittlepony/models/dj_pon_three.json b/src/main/resources/assets/minelittlepony/models/dj_pon_three.json new file mode 100644 index 00000000..daa45e8f --- /dev/null +++ b/src/main/resources/assets/minelittlepony/models/dj_pon_three.json @@ -0,0 +1,9 @@ +{ + "texture": {"w": 64, "h": 64}, + "head": { + "cubes": [ + { "from": [-9, -13, -1], "size": [ 6, 6, 1] }, + { "from": [ 3, 13, -1], "size": [ 6, 6, 1] } + ] + } +} diff --git a/src/main/resources/assets/minelittlepony/models/enderman.json b/src/main/resources/assets/minelittlepony/models/enderman.json index 20379dd6..3c4fb5f7 100644 --- a/src/main/resources/assets/minelittlepony/models/enderman.json +++ b/src/main/resources/assets/minelittlepony/models/enderman.json @@ -68,7 +68,7 @@ } ] }, - "helmet": { + "hat": { "texture": { "u": 32, "v": 0 }, "center": [0, 0, -2], "cubes": [ diff --git a/src/main/resources/assets/minelittlepony/models/skull.json b/src/main/resources/assets/minelittlepony/models/skull.json index c3b38a7d..602ef5a7 100644 --- a/src/main/resources/assets/minelittlepony/models/skull.json +++ b/src/main/resources/assets/minelittlepony/models/skull.json @@ -1,6 +1,6 @@ { "texture": {"w": 64, "h": 64}, - "skull": { + "head": { "cubes": [ {"from": [-4, -8, -4], "size": [8, 8, 8]} ], diff --git a/src/main/resources/assets/minelittlepony/models/steve_pony.json b/src/main/resources/assets/minelittlepony/models/steve_pony.json index f9880069..dad843b6 100644 --- a/src/main/resources/assets/minelittlepony/models/steve_pony.json +++ b/src/main/resources/assets/minelittlepony/models/steve_pony.json @@ -34,14 +34,14 @@ } ] }, - "helmet": { + "hat": { "texture": { "u": 32, "v": 0 }, "center": [ 0, 0, -2 ], "cubes": [ { "from": [-4, -6, -6], "size": [ 8, 8, 8], "stretch": 0.5 } ] }, - "torso": { + "body": { "texture": { "u": 16, "v": 16 }, "cubes": [ { "from": [-4, 4, -2], "size": [ 8, 8, 4] } @@ -253,7 +253,7 @@ } ] }, - "right_pant_leg": { + "right_pants": { "center": ["#arm_rotation_x_neg", 0, 0], "texture": { "u": 0, "v": 32 }, "cubes": [ @@ -264,7 +264,7 @@ } ] }, - "left_pant_leg": { + "left_pants": { "center": ["#arm_rotation_x", 0, 0], "texture": { "u": 0, "v": 48 }, "cubes": [