1.16.4 -> 20w46a

This commit is contained in:
Sollace 2020-11-26 15:41:15 +02:00
parent 9f2653ec89
commit baf4b2a754
76 changed files with 503 additions and 412 deletions

View file

@ -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

View file

@ -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<VertexConsumer> info) {
if (LevitatingItemRenderer.usesTransparency()) {
info.setReturnValue(provider.getBuffer(LevitatingItemRenderer.getRenderLayer()));

View file

@ -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<SkullBlockEntity> {
MixinSkullBlockEntityRenderer() { super(null); }
@Inject(method = "render("
abstract class MixinSkullBlockEntityRenderer implements BlockEntityRenderer<SkullBlockEntity> {
@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<RenderLayer> info) {
if (info.isCancelled() || PonySkullRenderer.INSTANCE == null) {
return;
}
RenderLayer result = PonySkullRenderer.INSTANCE.getRenderLayer(skullType, profile);
if (result != null) {
info.setReturnValue(result);
}
}
}

View file

@ -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<T extends LivingEntity> 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<T extends LivingEntity> 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<T extends LivingEntity> 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<T extends LivingEntity> 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<T extends LivingEntity> 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);
}

View file

@ -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<T extends LivingEntity> 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();

View file

@ -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) {

View file

@ -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<Race, PlayerModelKey<?, ?>> PLAYER_MODELS = new HashMap<>();
private static final Map<Wearable, ModelKey<? extends IGear>> GEAR_MODELS = new HashMap<>();
public static final ModelKey<DJPon3EarsModel> DJ_PON_3 = register("dj_pon_three", DJPon3EarsModel::new);
public static final ModelKey<VillagerPonyModel<?>> VILLAGER = register("villager", VillagerPonyModel::new);
public static final ModelKey<WitchPonyModel> WITCH = register("witch", WitchPonyModel::new);
public static final ModelKey<ZomponyModel<?>> ZOMBIE = register("zombie", ZomponyModel::new);
@ -91,25 +94,25 @@ public final class ModelType {
public static final PlayerModelKey<?, ChangelingModel<?>> CHANGEDLING = registerPlayer("reformed_changeling", Race.CHANGEDLING, ChangelingModel::new);
public static final PlayerModelKey<?, ZebraModel<?>> ZEBRA = registerPlayer("zebra", Race.ZEBRA, ZebraModel::new);
static <E extends LivingEntity, T extends Model & MsonModel> PlayerModelKey<E, T> registerPlayer(String name, Race race, Function<Boolean, T> constructor) {
static <E extends LivingEntity, T extends Model & MsonModel> PlayerModelKey<E, T> registerPlayer(String name, Race race, BiFunction<ModelPart, Boolean, T> constructor) {
return registerPlayer(name, race, constructor, PlayerPonyRenderer::new);
}
@SuppressWarnings("unchecked")
static <E extends LivingEntity, T extends Model & MsonModel> PlayerModelKey<E, T> registerPlayer(String name, Race race, Function<Boolean, T> constructor, PlayerModelKey.RendererFactory rendererFactory) {
static <E extends LivingEntity, T extends Model & MsonModel> PlayerModelKey<E, T> registerPlayer(String name, Race race, BiFunction<ModelPart, Boolean, T> constructor, PlayerModelKey.RendererFactory rendererFactory) {
return (PlayerModelKey<E, T>)PLAYER_MODELS.computeIfAbsent(race, r -> {
return new PlayerModelKey<>(name, constructor, rendererFactory);
});
}
@SuppressWarnings("unchecked")
static <T extends IGear> ModelKey<T> registerGear(String name, Wearable wearable, Supplier<T> constructor) {
static <T extends AbstractGear> ModelKey<T> registerGear(String name, Wearable wearable, MsonModel.Factory<T> constructor) {
return (ModelKey<T>)GEAR_MODELS.computeIfAbsent(wearable, w -> {
return Mson.getInstance().registerModel(new Identifier("minelittlepony", "gear/" + name), constructor);
});
}
static <T extends Model & MsonModel> ModelKey<T> register(String name, Supplier<T> constructor) {
static <T extends Model> ModelKey<T> register(String name, MsonModel.Factory<T> constructor) {
return Mson.getInstance().registerModel(new Identifier("minelittlepony", name), constructor);
}

View file

@ -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<T extends LivingEntity, M extends Model & MsonModel> {
@ -20,11 +22,11 @@ public class PlayerModelKey<T extends LivingEntity, M extends Model & MsonModel>
private final RendererFactory rendererFactory;
PlayerModelKey(String name, Function<Boolean, M> modelFactory, RendererFactory rendererFactory) {
PlayerModelKey(String name, BiFunction<ModelPart, Boolean, M> 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<M> getKey(boolean slimArms) {
@ -32,13 +34,13 @@ public class PlayerModelKey<T extends LivingEntity, M extends Model & MsonModel>
}
@SuppressWarnings("unchecked")
public Function<EntityRenderDispatcher, PlayerEntityRenderer> getRendererFactory(boolean slimArms) {
public Function<EntityRendererFactory.Context, PlayerEntityRenderer> getRendererFactory(boolean slimArms) {
return d -> rendererFactory.create(d, slimArms, (ModelKey<? extends ClientPonyModel<AbstractClientPlayerEntity>>)getKey(slimArms));
}
public interface RendererFactory {
PlayerEntityRenderer create(
EntityRenderDispatcher dispatcher,
EntityRendererFactory.Context context,
boolean slim,
ModelKey<? extends ClientPonyModel<AbstractClientPlayerEntity>> key
);

View file

@ -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<T extends LivingEntity> extends AnimalModel<T> implements MsonModel {
public class PonyElytra<T extends LivingEntity> extends AnimalModel<T> {
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

View file

@ -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<ModelPart> {
public class PonySkullModel extends SkullEntityModel implements MsonModel, ICapitated<ModelPart> {
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");

View file

@ -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<T extends LivingEntity> implements IEquestrianArmour<PonyArmourModel<T>> {
private final PonyArmourModel<T> outerLayer;
private final PonyArmourModel<T> innerLayer;
public ArmourWrapper(Supplier<PonyArmourModel<T>> supplier) {
public ArmourWrapper(MsonModel.Factory<PonyArmourModel<T>> supplier) {
outerLayer = ModelType.ARMOUR_OUTER.createModel(supplier);
innerLayer = ModelType.ARMOUR_INNER.createModel(supplier);
}

View file

@ -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<T extends LivingEntity> extends AbstractPonyModel<T> implements IArmour {
@ -21,16 +20,11 @@ public class PonyArmourModel<T extends LivingEntity> extends AbstractPonyModel<T
private ArmourVariant variant = ArmourVariant.NORMAL;
public PonyArmourModel() {
textureHeight = 32;
}
@Override
public void init(ModelContext context) {
super.init(context);
chestPiece = context.findByName("chestpiece");
steveRightLeg = context.findByName("steve_right_leg");
steveLeftLeg = context.findByName("steve_left_leg");
public PonyArmourModel(ModelPart tree) {
super(tree);
chestPiece = tree.getChild("chestpiece");
steveRightLeg = tree.getChild("steve_right_leg");
steveLeftLeg = tree.getChild("steve_left_leg");
}
@Override
@ -69,17 +63,17 @@ public class PonyArmourModel<T extends LivingEntity> extends AbstractPonyModel<T
if (model instanceof BipedEntityModel) {
@SuppressWarnings("unchecked")
BipedEntityModel<T> mainModel = (BipedEntityModel<T>)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);
}
}

View file

@ -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<T extends LivingEntity> extends MsonBiped<T> implements MsonModel {
public class BreezieModel<T extends LivingEntity> extends BipedEntityModel<T> {
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<T extends LivingEntity> extends MsonBiped<T> 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<T extends LivingEntity> extends MsonBiped<T> 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);
}

View file

@ -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<EndermanEntity> {
public boolean isCarrying;
@ -16,18 +14,13 @@ public class EnderStallionModel extends SkeleponyModel<EndermanEntity> {
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

View file

@ -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<GuardianEntity, SeaponyModel<GuardianEntity>, ModelPart> {
private final SeaponyModel<GuardianEntity> mixin = new SeaponyModel<>();
private final SeaponyModel<GuardianEntity> 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) {

View file

@ -9,8 +9,8 @@ import com.minelittlepony.client.model.entity.race.AlicornModel;
public class IllagerPonyModel<T extends IllagerEntity> extends AlicornModel<T> {
public IllagerPonyModel() {
super(false);
public IllagerPonyModel(ModelPart tree) {
super(tree, false);
}
@Override

View file

@ -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<StriderEntity> implements MsonModel {
public class ParaspriteModel extends EntityModel<StriderEntity> {
private ModelPart body;
private ModelPart leftWing;
@ -18,18 +15,13 @@ public class ParaspriteModel extends EntityModel<StriderEntity> 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<StriderEntity> 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;

View file

@ -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<HostileEntity> {
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

View file

@ -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<T extends PillagerEntity> extends ChangelingModel<T> {
public PillagerPonyModel() {
super(false);
public PillagerPonyModel(ModelPart tree) {
super(tree, false);
}
@Override

View file

@ -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<T extends HostileEntity> extends AlicornModel<T> imp
public boolean isWithered;
public SkeleponyModel() {
super(false);
public SkeleponyModel(ModelPart tree) {
super(tree, false);
}
@Override

View file

@ -20,14 +20,16 @@ import com.minelittlepony.mson.api.ModelContext;
public class VillagerPonyModel<T extends LivingEntity & VillagerDataContainer> extends AlicornModel<T> 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<T extends LivingEntity & VillagerDataContainer> e
super.init(context);
batWings = context.findByName("bat_wings");
batEars = context.findByName("bat_ears");
apron = context.findByName("apron");
trinket = context.findByName("trinket");
}
@Override

View file

@ -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<WitchEntity> {
public WitchPonyModel() {
super(false);
public WitchPonyModel(ModelPart tree) {
super(tree, false);
}
@Override

View file

@ -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<Zombie extends HostileEntity> extends AlicornModel<Zom
private boolean isPegasus;
public ZomponyModel() {
super(false);
public ZomponyModel(ModelPart tree) {
super(tree, false);
}
@Override
@ -28,10 +29,10 @@ public class ZomponyModel<Zombie extends HostileEntity> extends AlicornModel<Zom
if (isZombified(entity)) {
if (islookAngleRight(move)) {
rotateArmHolding(rightArm, 1, getSwingAmount(), ticks);
((MsonPart)rightArm).shift(0.5F, 1.5F, 3);
((MsonPart)(Object)rightArm).shift(0.5F, 1.5F, 3);
} else {
rotateArmHolding(leftArm, -1, getSwingAmount(), ticks);
((MsonPart)leftArm).shift(-0.5F, 1.5F, 3);
((MsonPart)(Object)leftArm).shift(-0.5F, 1.5F, 3);
}
}
}

View file

@ -1,5 +1,6 @@
package com.minelittlepony.client.model.entity;
import net.minecraft.client.model.ModelPart;
import net.minecraft.entity.mob.ZombieVillagerEntity;
import net.minecraft.util.math.MathHelper;
@ -8,6 +9,10 @@ import com.minelittlepony.mson.api.model.MsonPart;
public class ZomponyVillagerModel extends VillagerPonyModel<ZombieVillagerEntity> 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<ZombieVillagerEntity
if (rightArmPose == ArmPose.EMPTY) {
if (islookAngleRight(move)) {
rotateArmHolding(rightArm, 1, getSwingAmount(), ticks);
((MsonPart)rightArm).shift(0.5F, 1.5F, 3);
((MsonPart)(Object)rightArm).shift(0.5F, 1.5F, 3);
} else {
rotateArmHolding(leftArm, -1, getSwingAmount(), ticks);
((MsonPart)leftArm).shift(-0.5F, 1.5F, 3);
((MsonPart)(Object)leftArm).shift(-0.5F, 1.5F, 3);
}
}
}

View file

@ -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 AlicornModel<T extends LivingEntity> extends UnicornModel<T> implem
private IPart wings;
public AlicornModel(boolean smallArms) {
super(smallArms);
public AlicornModel(ModelPart tree, boolean smallArms) {
super(tree, smallArms);
}
@Override

View file

@ -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<T extends LivingEntity> extends AlicornModel<T> {
public ChangelingModel(boolean smallArms) {
super(smallArms);
public ChangelingModel(ModelPart tree, boolean smallArms) {
super(tree, smallArms);
}
@Override

View file

@ -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<T extends LivingEntity> extends AbstractPonyModel<T>
protected PonySnout snout;
protected IPart ears;
public EarthPonyModel(boolean smallArms) {
public EarthPonyModel(ModelPart tree, boolean smallArms) {
super(tree);
this.smallArms = smallArms;
}

View file

@ -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<T extends LivingEntity> extends EarthPonyModel<T> impl
private IPart wings;
public PegasusModel(boolean smallArms) {
super(smallArms);
public PegasusModel(ModelPart tree, boolean smallArms) {
super(tree, smallArms);
}
@Override

View file

@ -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<T extends LivingEntity> extends UnicornModel<T> {
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<T extends LivingEntity> extends UnicornModel<T> {
class Armour extends PonyArmourModel<T> {
public Armour(ModelPart tree) {
super(tree);
}
@Override
public void showBoots() {
rightArm.visible = true;

View file

@ -18,21 +18,21 @@ import net.minecraft.util.math.MathHelper;
*/
public class UnicornModel<T extends LivingEntity> extends EarthPonyModel<T> implements IUnicorn<ModelPart> {
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<T extends LivingEntity> extends EarthPonyModel<T> 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

View file

@ -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<T extends LivingEntity> extends EarthPonyModel<T> {
public ZebraModel(boolean useSmallArms) {
super(useSmallArms);
public ZebraModel(ModelPart tree, boolean useSmallArms) {
super(tree, useSmallArms);
}
@Override
@ -26,6 +27,10 @@ public class ZebraModel<T extends LivingEntity> extends EarthPonyModel<T> {
}
class Armour extends PonyArmourModel<T> {
public Armour(ModelPart tree) {
super(tree);
}
@Override
public void transform(BodyPart part, MatrixStack stack) {
applyLongNeck(part, stack);

View file

@ -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<ModelPart> parts = new ArrayList<>();
public AbstractGear() {
super(RenderLayer::getEntitySolid);
textureWidth = 64;
textureHeight = 64;
}
public void addPart(ModelPart t) {

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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<T extends Model & IPegasus> extends PegasusWings<T> {
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<T extends Model & IPegasus> extends PegasusWings<T> {
}
public static class Wing extends PegasusWings.Wing {
public Wing(ModelPart tree) {
super(tree);
}
@Override
public void rotateWalking(float swing) {
folded.yaw = swing * 0.05F;

View file

@ -23,6 +23,10 @@ public class PegasusWings<T extends Model & IPegasus> 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<T extends Model & IPegasus> implements IPart, MsonMode
protected ModelPart extended;
protected ModelPart folded;
public Wing(ModelPart tree) {
}
@Override
public void init(ModelContext context) {
pegasus = context.getModel();

View file

@ -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

View file

@ -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

View file

@ -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<Segment> 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);
}
}
}

View file

@ -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();

View file

@ -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");

View file

@ -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());
}

View file

@ -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)

View file

@ -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 <T> The entity type
*/
@SuppressWarnings("unchecked")
<T extends Entity, V extends T> void switchRenderer(boolean state, EntityType<V> type, Function<EntityRenderDispatcher, EntityRenderer<T>> factory) {
<T extends Entity, V extends T> void switchRenderer(boolean state, EntityType<V> type, Function<EntityRendererFactory.Context, EntityRenderer<T>> factory) {
if (state) {
if (!renderMap.containsKey(type)) {
renderMap.put(type, ((MixinEntityRenderDispatcher)MinecraftClient.getInstance().getEntityRenderDispatcher()).getEntityRenderers().get(type));

View file

@ -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) {

View file

@ -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<SkullBlock.SkullType, ISkull> 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();

View file

@ -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<EndermanEntity, EnderSta
private final Random rnd = new Random();
public EnderStallionRenderer(EntityRenderDispatcher manager) {
super(manager, ModelType.ENDERMAN);
public EnderStallionRenderer(EntityRendererFactory.Context context) {
super(context, ModelType.ENDERMAN);
}
@Override
protected void addLayers() {
protected void addLayers(EntityRendererFactory.Context context) {
addFeature(createItemHoldingLayer());
addFeature(new StuckArrowsFeatureRenderer<>(this));
addFeature(new StuckArrowsFeatureRenderer<>(context, this));
addFeature(new GlowingEyesFeature<>(this));
}

View file

@ -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<StriderEntity, Paraspr
private static final Identifier SADDLE = new Identifier("minelittlepony", "textures/entity/strider/strider_saddle_pony.png");
public ParaspriteRenderer(EntityRenderDispatcher dispatcher) {
super(dispatcher, ModelType.PARASPRITE.createModel(), 0.5F);
public ParaspriteRenderer(EntityRendererFactory.Context context) {
super(context, ModelType.PARASPRITE.createModel(), 0.5F);
addFeature(new SaddleFeatureRenderer<>(this, ModelType.PARASPRITE.createModel(), SADDLE));
}

View file

@ -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<AbstractClientPlayerEntity, ClientPonyModel<AbstractClientPlayerEntity>> manager = new EquineRenderManager<>(this);
public PlayerPonyRenderer(EntityRenderDispatcher dispatcher, boolean slim, ModelKey<? extends ClientPonyModel<AbstractClientPlayerEntity>> key) {
super(dispatcher, slim);
public PlayerPonyRenderer(EntityRendererFactory.Context context, boolean slim, ModelKey<? extends ClientPonyModel<AbstractClientPlayerEntity>> 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));
}

View file

@ -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<AbstractClientPlayerEntity, ClientPonyModel<AbstractClientPlayerEntity>> seapony;
private final ModelWrapper<AbstractClientPlayerEntity, ClientPonyModel<AbstractClientPlayerEntity>> normalPony;
public PlayerSeaponyRenderer(EntityRenderDispatcher manager, boolean slim, ModelKey<? extends ClientPonyModel<AbstractClientPlayerEntity>> key) {
super(manager, slim, key);
public PlayerSeaponyRenderer(EntityRendererFactory.Context context, boolean slim, ModelKey<? extends ClientPonyModel<AbstractClientPlayerEntity>> key) {
super(context, slim, key);
normalPony = new ModelWrapper<>(ModelType.<AbstractClientPlayerEntity, ClientPonyModel<AbstractClientPlayerEntity>>getPlayerModel(Race.UNICORN).getKey(slim));
seapony = this.manager.getModelWrapper();

View file

@ -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<HostileEntity, Pigli
map.put(EntityType.ZOMBIFIED_PIGLIN, new Identifier("minelittlepony", "textures/entity/piglin/zombified_piglin_pony.png"));
});
public PonyPiglinRenderer(EntityRenderDispatcher manager) {
super(manager, ModelType.PIGLIN);
public PonyPiglinRenderer(EntityRendererFactory.Context context) {
super(context, ModelType.PIGLIN);
}
@Override

View file

@ -20,7 +20,7 @@ import com.minelittlepony.mson.api.ModelKey;
import net.minecraft.client.model.ModelPart;
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.MobEntityRenderer;
import net.minecraft.client.render.entity.model.EntityModel;
import net.minecraft.client.render.entity.model.PlayerEntityModel;
@ -36,19 +36,19 @@ public abstract class PonyRenderer<T extends MobEntity, M extends EntityModel<T>
protected EquineRenderManager<T, M> manager = new EquineRenderManager<>(this);
public PonyRenderer(EntityRenderDispatcher dispatcher, ModelKey<? super M> key) {
super(dispatcher, null, 0.5F);
public PonyRenderer(EntityRendererFactory.Context context, ModelKey<? super M> 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<T extends MobEntity, M extends EntityModel<T>
public abstract static class Caster<T extends MobEntity, M extends ClientPonyModel<T> & IUnicorn<ModelPart>> extends PonyRenderer<T, M> {
public Caster(EntityRenderDispatcher manager, ModelKey<? super M> key) {
super(manager, key);
public Caster(EntityRendererFactory.Context context, ModelKey<? super M> key) {
super(context, key);
}
@Override
@ -143,16 +143,16 @@ public abstract class PonyRenderer<T extends MobEntity, M extends EntityModel<T>
public abstract static class Proxy<T extends MobEntity, M extends EntityModel<T> & IPonyModel<T>> extends PonyRenderer<T, M> {
@SuppressWarnings({"rawtypes", "unchecked"})
public Proxy(List exportedLayers, EntityRenderDispatcher manager, ModelKey<M> key) {
super(manager, key);
public Proxy(List exportedLayers, EntityRendererFactory.Context context, ModelKey<M> 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) {

View file

@ -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<ArmorStandEntity, ArmorStandArmorEntityModel, ArmorStandArmorEntityModel> {
private final ModelWrapper<ArmorStandEntity, EarthPonyModel<ArmorStandEntity>> pony = new ModelWrapper<>(ModelType.EARTH_PONY.getKey(false));
public Armour(FeatureRendererContext<ArmorStandEntity, ArmorStandArmorEntityModel> context) {
super(context, new ArmorStandArmorEntityModel(0.5F), new ArmorStandArmorEntityModel(1));
public Armour(FeatureRendererContext<ArmorStandEntity, ArmorStandArmorEntityModel> 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));
}

View file

@ -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<GuardianEntity, GuardianPonyModel> ponyRenderer;
public SeaponyRenderer(EntityRenderDispatcher manager) {
super(manager);
public SeaponyRenderer(EntityRendererFactory.Context context) {
super(context);
features.clear();
ponyRenderer = new Proxy<GuardianEntity, GuardianPonyModel>(features, manager, ModelType.GUARDIAN) {
ponyRenderer = new Proxy<GuardianEntity, GuardianPonyModel>(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

View file

@ -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<Skeleton extends AbstractSkeletonEntity> 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<Skeleton extends AbstractSkeletonEntity> extends
public static class Stray extends SkeleponyRenderer<StrayEntity> {
public Stray(EntityRenderDispatcher manager) {
super(manager);
public Stray(EntityRendererFactory.Context context) {
super(context);
addFeature(new StrayClothingFeature<>(this));
}
@ -48,8 +48,8 @@ public class SkeleponyRenderer<Skeleton extends AbstractSkeletonEntity> extends
public static class Wither extends SkeleponyRenderer<WitherSkeletonEntity> {
public Wither(EntityRenderDispatcher manager) {
super(manager);
public Wither(EntityRendererFactory.Context context) {
super(context);
}
@Override

View file

@ -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<VexEntity, BreezieModel<Vex
private static final Identifier VEX = new Identifier("minelittlepony", "textures/entity/illager/vex_pony.png");
private static final Identifier VEX_CHARGING = new Identifier("minelittlepony", "textures/entity/illager/vex_charging_pony.png");
public VexRenderer(EntityRenderDispatcher manager) {
super(manager, ModelType.BREEZIE.createModel(), 0.3F);
public VexRenderer(EntityRendererFactory.Context context) {
super(context, ModelType.BREEZIE.createModel(), 0.3F);
}
@Override

View file

@ -4,7 +4,7 @@ import com.minelittlepony.client.model.ModelType;
import com.minelittlepony.client.model.entity.WitchPonyModel;
import com.minelittlepony.client.render.entity.feature.HeldItemFeature;
import net.minecraft.client.render.entity.EntityRenderDispatcher;
import net.minecraft.client.render.entity.EntityRendererFactory;
import net.minecraft.client.render.model.json.ModelTransformation;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.client.util.math.Vector3f;
@ -17,8 +17,8 @@ public class WitchRenderer extends PonyRenderer<WitchEntity, WitchPonyModel> {
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

View file

@ -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<Zombie extends ZombieEntity> 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<Zombie extends ZombieEntity> extends PonyRenderer.C
public static class Drowned extends ZomponyRenderer<DrownedEntity> {
public Drowned(EntityRenderDispatcher manager) {
super(manager);
public Drowned(EntityRendererFactory.Context context) {
super(context);
}
@Override
@ -40,8 +40,8 @@ public class ZomponyRenderer<Zombie extends ZombieEntity> extends PonyRenderer.C
public static class Husk extends ZomponyRenderer<HuskEntity> {
public Husk(EntityRenderDispatcher manager) {
super(manager);
public Husk(EntityRendererFactory.Context context) {
super(context);
}
@Override
@ -59,8 +59,8 @@ public class ZomponyRenderer<Zombie extends ZombieEntity> extends PonyRenderer.C
public static class Giant extends PonyRenderer.Caster<GiantEntity, ZomponyModel<GiantEntity>> {
public Giant(EntityRenderDispatcher manager) {
super(manager, ModelType.ZOMBIE);
public Giant(EntityRendererFactory.Context context) {
super(context, ModelType.ZOMBIE);
}
@Override

View file

@ -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<T extends AbstractClientPlayerEntity, M extends EntityModel<T> & IPonyModel<T>> extends AbstractPonyFeature<T, M> {
private final DJPon3EarsModel deadMau5 = new DJPon3EarsModel();
private final DJPon3EarsModel deadMau5 = ModelType.DJ_PON_3.createModel();
public DJPon3Feature(IPonyRenderContext<T, M> context) {
super(context);

View file

@ -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<T extends PlayerEntity, M extends ClientPonyModel<T>> extends AbstractPonyFeature<T, M> {
private final ParrotEntityModel model = new ParrotEntityModel();
private final ParrotEntityModel model;
public PassengerFeature(IPonyRenderContext<T, M> context) {
super(context);
public PassengerFeature(IPonyRenderContext<T, M> renderer, EntityRendererFactory.Context context) {
super(renderer);
model = new ParrotEntityModel(context.getPart(EntityModelLayers.PARROT));
}
@Override

View file

@ -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<T extends LivingEntity, M extends EntityModel<T> & IPonyModel<T>> extends AbstractPonyFeature<T, M> {
public SkullFeature(IPonyRenderContext<T, M> renderPony) {
private final Map<SkullBlock.SkullType, SkullBlockEntityModel> headModels;
public SkullFeature(IPonyRenderContext<T, M> renderPony, EntityModelLoader entityModelLoader) {
super(renderPony);
headModels = SkullBlockEntityRenderer.getModels(entityModelLoader);
}
@Override
@ -94,9 +103,11 @@ public class SkullFeature<T extends LivingEntity, M extends EntityModel<T> & 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);
}
}

View file

@ -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<? super M> key, String type, TextureSupplier<String> formatter) {
super(manager, key);
public AbstractNpcRenderer(EntityRendererFactory.Context context, ModelKey<? super M> key, String type, TextureSupplier<String> formatter) {
super(context, key);
entityType = type;
baseTextures = new PonyTextures<>(formatter);

View file

@ -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<T extends IllagerEntity> 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<T extends IllagerEntity> extends PonyR
public static class Vindicator extends IllagerPonyRenderer<VindicatorEntity> {
public Vindicator(EntityRenderDispatcher manager) {
super(manager);
public Vindicator(EntityRendererFactory.Context context) {
super(context);
}
@ -53,8 +53,8 @@ public abstract class IllagerPonyRenderer<T extends IllagerEntity> extends PonyR
public static class Evoker extends IllagerPonyRenderer<EvokerEntity> {
public Evoker(EntityRenderDispatcher manager) {
super(manager);
public Evoker(EntityRendererFactory.Context context) {
super(context);
}
@Override
@ -65,8 +65,8 @@ public abstract class IllagerPonyRenderer<T extends IllagerEntity> extends PonyR
public static class Illusionist extends IllagerPonyRenderer<IllusionerEntity> {
public Illusionist(EntityRenderDispatcher manager) {
super(manager);
public Illusionist(EntityRendererFactory.Context context) {
super(context);
}
@Override

View file

@ -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<PillagerEntity, PillagerPonyM
private static final Identifier TEXTURES = new Identifier("minelittlepony", "textures/entity/illager/pillager_pony.png");
public PillagerRenderer(EntityRenderDispatcher manager) {
super(manager, ModelType.PILLAGER);
public PillagerRenderer(EntityRendererFactory.Context context) {
super(context, ModelType.PILLAGER);
}
@Override

View file

@ -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.client.util.math.MatrixStack;
import net.minecraft.entity.passive.WanderingTraderEntity;
import net.minecraft.util.Identifier;
@ -13,8 +13,8 @@ public class TraderRenderer extends PonyRenderer.Caster<WanderingTraderEntity, A
public static final Identifier TEXTURE = new Identifier("minelittlepony", "textures/entity/wandering_trader_pony.png");
public TraderRenderer(EntityRenderDispatcher manager) {
super(manager, ModelType.ALICORN.getKey(false));
public TraderRenderer(EntityRendererFactory.Context context) {
super(context, ModelType.ALICORN.getKey(false));
}
@Override

View file

@ -3,7 +3,7 @@ package com.minelittlepony.client.render.entity.npc;
import com.minelittlepony.client.model.ModelType;
import com.minelittlepony.client.model.entity.VillagerPonyModel;
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.passive.VillagerEntity;
@ -12,8 +12,8 @@ public class VillagerPonyRenderer extends AbstractNpcRenderer<VillagerEntity, Vi
private static final String TYPE = "villager";
private static final TextureSupplier<String> 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

View file

@ -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<ZombieVillagerE
private static final String TYPE = "zombie_villager";
private static final TextureSupplier<String> 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

View file

@ -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.

View file

@ -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],

View file

@ -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] }
]
}
}

View file

@ -68,7 +68,7 @@
}
]
},
"helmet": {
"hat": {
"texture": { "u": 32, "v": 0 },
"center": [0, 0, -2],
"cubes": [

View file

@ -1,6 +1,6 @@
{
"texture": {"w": 64, "h": 64},
"skull": {
"head": {
"cubes": [
{"from": [-4, -8, -4], "size": [8, 8, 8]}
],

View file

@ -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": [