1.19.2 -> 1.19.3 (1.20)

This commit is contained in:
Sollace 2022-12-08 01:53:59 +00:00
parent 86f5a1d2dc
commit 9ca7e06075
25 changed files with 100 additions and 104 deletions

View file

@ -3,10 +3,10 @@ org.gradle.daemon=false
# Fabric Properties # Fabric Properties
# check these on https://fabricmc.net/develop # check these on https://fabricmc.net/develop
minecraft_version=1.19.2 minecraft_version=1.19.3-pre2
yarn_mappings=1.19.2+build.3 yarn_mappings=1.19.3-pre2+build.1
loader_version=0.14.9 loader_version=0.14.10
fabric_version=0.59.0+1.19.2 fabric_version=0.67.1+1.19.3
# Mod Properties # Mod Properties
group=com.minelittlepony group=com.minelittlepony
@ -15,12 +15,12 @@ org.gradle.daemon=false
description=Mine Little Pony turns players and mobs into ponies. Press F9 ingame to access settings. description=Mine Little Pony turns players and mobs into ponies. Press F9 ingame to access settings.
# Publishing # Publishing
minecraft_version_range=>=1.19 minecraft_version_range=>=1.19.3-pre1
modrinth_loader_type=fabric modrinth_loader_type=fabric
modrinth_project_id=JBjInUXM modrinth_project_id=JBjInUXM
# Dependencies # Dependencies
modmenu_version=4.0.6 modmenu_version=5.0.0-alpha.3
kirin_version=1.12.0 kirin_version=1.13.0-beta.1
hd_skins_version=6.6.0 hd_skins_version=6.7.0-beta.1
mson_version=1.6.1 mson_version=1.7.0-beta.1

View file

@ -1,19 +1,17 @@
package com.minelittlepony.api.model.armour; package com.minelittlepony.api.model.armour;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.registry.*;
import net.minecraft.util.Identifier; import net.minecraft.util.Identifier;
import net.minecraft.util.registry.Registry;
import net.minecraft.util.registry.RegistryKey;
import net.minecraft.util.registry.SimpleRegistry;
import com.mojang.serialization.Lifecycle; import com.mojang.serialization.Lifecycle;
public final class ArmourRegistry { public final class ArmourRegistry {
private ArmourRegistry() {} private ArmourRegistry() {}
static final Registry<IArmour<?>> REGISTRY = new SimpleRegistry<>(RegistryKey.ofRegistry(new Identifier("minelittlepony", "armour")), Lifecycle.stable(), null); static final Registry<IArmour<?>> REGISTRY = new SimpleRegistry<>(RegistryKey.ofRegistry(new Identifier("minelittlepony", "armour")), Lifecycle.stable());
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
public static <T extends IArmourModel> IArmour<T> getArmour(ItemStack stack, IArmour<T> fallback) { public static <T extends IArmourModel> IArmour<T> getArmour(ItemStack stack, IArmour<T> fallback) {
return (IArmour<T>)REGISTRY.getOrEmpty(Registry.ITEM.getId(stack.getItem())).orElse(fallback); return (IArmour<T>)REGISTRY.getOrEmpty(Registries.ITEM.getId(stack.getItem())).orElse(fallback);
} }
} }

View file

@ -1,7 +1,8 @@
package com.minelittlepony.api.model.armour; package com.minelittlepony.api.model.armour;
import net.minecraft.item.Item; import net.minecraft.item.Item;
import net.minecraft.util.registry.Registry; import net.minecraft.registry.Registries;
import net.minecraft.registry.Registry;
import org.jetbrains.annotations.Nullable; import org.jetbrains.annotations.Nullable;
@ -22,7 +23,7 @@ public interface IArmour<V extends IArmourModel> extends IModelWrapper {
* Only one registration per item allowed. * Only one registration per item allowed.
*/ */
public static <T extends IArmourModel> IArmour<T> register(IArmour<T> armour, Item item) { public static <T extends IArmourModel> IArmour<T> register(IArmour<T> armour, Item item) {
return Registry.register(ArmourRegistry.REGISTRY, Registry.ITEM.getId(item), armour); return Registry.register(ArmourRegistry.REGISTRY, Registries.ITEM.getId(item), armour);
} }
/** /**

View file

@ -130,7 +130,7 @@ public class MineLittlePony implements ClientModInitializer {
.setTextureSize(16, 16) .setTextureSize(16, 16)
.setSize(16, 16)) .setSize(16, 16))
.setTooltip("minelp.options.title", 0, 10); .setTooltip("minelp.options.title", 0, 10);
button.y = screen.height - y; // ModMenu button.setY(screen.height - y); // ModMenu
} }
} }
} }

View file

@ -7,15 +7,14 @@ import com.minelittlepony.api.pony.IPonyManager;
import com.minelittlepony.client.IPreviewModel; import com.minelittlepony.client.IPreviewModel;
import com.minelittlepony.client.MineLittlePony; import com.minelittlepony.client.MineLittlePony;
import com.minelittlepony.client.pony.Pony; import com.minelittlepony.client.pony.Pony;
import com.minelittlepony.hdskins.client.dummy.DummyPlayer; import com.minelittlepony.hdskins.client.dummy.*;
import com.minelittlepony.hdskins.client.dummy.TextureProxy;
/** /**
* Dummy model used for the skin uploading screen. * Dummy model used for the skin uploading screen.
*/ */
class DummyPony extends DummyPlayer implements IPreviewModel, ModelAttributes.Swimmer, IPonyManager.ForcedPony, Pony.RegistrationHandler { class DummyPony extends DummyPlayer implements IPreviewModel, ModelAttributes.Swimmer, IPonyManager.ForcedPony, Pony.RegistrationHandler {
public DummyPony(ClientWorld world, TextureProxy textures) { public DummyPony(ClientWorld world, PlayerSkins<?> textures) {
super(world, textures); super(world, textures);
} }
@ -26,12 +25,12 @@ class DummyPony extends DummyPlayer implements IPreviewModel, ModelAttributes.Sw
@Override @Override
public boolean isSubmergedInWater() { public boolean isSubmergedInWater() {
return getTextures().getSkinType() == MineLPHDSkins.seaponySkinType || super.isSubmergedInWater(); return getTextures().getPosture().getActiveSkinType() == MineLPHDSkins.seaponySkinType || super.isSubmergedInWater();
} }
@Override @Override
public String getModel() { public String getModel() {
if (getTextures().getSkinType() == MineLPHDSkins.seaponySkinType) { if (getTextures().getPosture().getActiveSkinType() == MineLPHDSkins.seaponySkinType) {
return getTextures().usesThinSkin() ? "slimseapony" : "seapony"; return getTextures().usesThinSkin() ? "slimseapony" : "seapony";
} }
return MineLittlePony.getInstance().getManager() return MineLittlePony.getInstance().getManager()

View file

@ -10,7 +10,6 @@ import com.minelittlepony.hdskins.client.SkinCacheClearCallback;
import com.minelittlepony.hdskins.client.ducks.ClientPlayerInfo; import com.minelittlepony.hdskins.client.ducks.ClientPlayerInfo;
import com.minelittlepony.hdskins.client.dummy.DummyPlayer; import com.minelittlepony.hdskins.client.dummy.DummyPlayer;
import com.minelittlepony.hdskins.client.gui.GuiSkins; import com.minelittlepony.hdskins.client.gui.GuiSkins;
import com.minelittlepony.hdskins.client.resources.LocalTexture;
import com.minelittlepony.hdskins.mixin.client.MixinClientPlayer; import com.minelittlepony.hdskins.mixin.client.MixinClientPlayer;
import com.minelittlepony.hdskins.profile.SkinType; import com.minelittlepony.hdskins.profile.SkinType;
@ -65,9 +64,7 @@ public class MineLPHDSkins extends SkinsProxy implements ClientModInitializer {
@Override @Override
public Identifier getSeaponySkin(EquineRenderManager<AbstractClientPlayerEntity, ClientPonyModel<AbstractClientPlayerEntity>> manager, AbstractClientPlayerEntity player) { public Identifier getSeaponySkin(EquineRenderManager<AbstractClientPlayerEntity, ClientPonyModel<AbstractClientPlayerEntity>> manager, AbstractClientPlayerEntity player) {
if (player instanceof DummyPlayer) { if (player instanceof DummyPlayer) {
LocalTexture tex = ((DummyPlayer)player).getTextures().get(seaponySkinType); return ((DummyPlayer)player).getTextures().get(seaponySkinType).getId();
Identifier id = tex.getId();
return id == null ? tex.getDefault() : id;
} else { } else {
ClientPlayerInfo info = (ClientPlayerInfo)((MixinClientPlayer)player).getBackingClientData(); ClientPlayerInfo info = (ClientPlayerInfo)((MixinClientPlayer)player).getBackingClientData();
Identifier tex = info.getSkins().getSkin(seaponySkinType); Identifier tex = info.getSkins().getSkin(seaponySkinType);

View file

@ -5,16 +5,18 @@ import net.minecraft.client.world.ClientWorld;
import net.minecraft.text.Text; import net.minecraft.text.Text;
import net.minecraft.util.Identifier; import net.minecraft.util.Identifier;
import org.jetbrains.annotations.Nullable;
import com.minelittlepony.api.pony.IPonyData; import com.minelittlepony.api.pony.IPonyData;
import com.minelittlepony.api.pony.TriggerPixelType; import com.minelittlepony.api.pony.TriggerPixelType;
import com.minelittlepony.client.MineLittlePony; import com.minelittlepony.client.MineLittlePony;
import com.minelittlepony.hdskins.client.dummy.DummyPlayer; import com.minelittlepony.common.client.gui.dimension.Bounds;
import com.minelittlepony.hdskins.client.dummy.PlayerPreview; import com.minelittlepony.hdskins.client.dummy.*;
import com.minelittlepony.hdskins.client.dummy.TextureProxy;
import com.minelittlepony.hdskins.profile.SkinType; import com.minelittlepony.hdskins.profile.SkinType;
import java.util.List; import java.util.List;
import java.util.Optional; import java.util.Optional;
import java.util.function.Consumer;
import java.util.stream.Collectors; import java.util.stream.Collectors;
class PonyPreview extends PlayerPreview { class PonyPreview extends PlayerPreview {
@ -23,7 +25,7 @@ class PonyPreview extends PlayerPreview {
public static final Identifier NO_SKIN_SEAPONY = new Identifier("minelittlepony", "textures/mob/noskin_seapony.png"); public static final Identifier NO_SKIN_SEAPONY = new Identifier("minelittlepony", "textures/mob/noskin_seapony.png");
@Override @Override
protected DummyPlayer createEntity(ClientWorld world, TextureProxy textures) { protected DummyPlayer createEntity(ClientWorld world, PlayerSkins<?> textures) {
return new DummyPony(world, textures); return new DummyPony(world, textures);
} }
@ -53,15 +55,15 @@ class PonyPreview extends PlayerPreview {
@Override @Override
public void renderWorldAndPlayer(Optional<DummyPlayer> thePlayer, public void renderWorldAndPlayer(Optional<DummyPlayer> thePlayer,
int frameLeft, int frameRight, int frameBottom, int frameTop, Bounds frame,
float xPos, float yPos, int horizon, int mouseX, int mouseY, int ticks, float partialTick, float scale, int horizon, int mouseX, int mouseY, int ticks, float partialTick, float scale,
MatrixStack matrices) { MatrixStack matrices, @Nullable Consumer<DummyPlayer> postAction) {
super.renderWorldAndPlayer(thePlayer, frameLeft, frameRight, frameBottom, frameTop, xPos, yPos, horizon, mouseX, mouseY, ticks, partialTick, scale, matrices); super.renderWorldAndPlayer(thePlayer, frame, horizon, mouseX, mouseY, ticks, partialTick, scale, matrices, postAction);
thePlayer.ifPresent(p -> { thePlayer.ifPresent(p -> {
IPonyData data = MineLittlePony.getInstance().getManager().getPony(p).getMetadata(); IPonyData data = MineLittlePony.getInstance().getManager().getPony(p).getMetadata();
int[] index = new int[1]; int[] index = new int[1];
data.getTriggerPixels().forEach((key, value) -> { data.getTriggerPixels().forEach((key, value) -> {
drawLegendBlock(matrices, index[0]++, frameLeft, frameTop, mouseX, mouseY, key, value); drawLegendBlock(matrices, index[0]++, frame.left, frame.top, mouseX, mouseY, key, value);
}); });
}); });
} }

View file

@ -17,7 +17,7 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
@Mixin(ClientPlayerEntity.class) @Mixin(ClientPlayerEntity.class)
abstract class MixinClientPlayerEntity extends AbstractClientPlayerEntity implements Pony.RegistrationHandler { abstract class MixinClientPlayerEntity extends AbstractClientPlayerEntity implements Pony.RegistrationHandler {
public MixinClientPlayerEntity() { super(null, null, null); } public MixinClientPlayerEntity() { super(null, null); }
private Pony pony; private Pony pony;

View file

@ -12,12 +12,10 @@ import com.minelittlepony.mson.util.PartUtil;
import net.minecraft.client.model.ModelPart; import net.minecraft.client.model.ModelPart;
import net.minecraft.client.render.VertexConsumer; import net.minecraft.client.render.VertexConsumer;
import net.minecraft.client.util.math.MatrixStack; import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.util.math.Vec3f;
import net.minecraft.entity.Entity; import net.minecraft.entity.Entity;
import net.minecraft.entity.LivingEntity; import net.minecraft.entity.LivingEntity;
import net.minecraft.util.Arm; import net.minecraft.util.Arm;
import net.minecraft.util.math.MathHelper; import net.minecraft.util.math.*;
/** /**
* Foundation class for all types of ponies. * Foundation class for all types of ponies.
@ -621,12 +619,12 @@ public abstract class AbstractPonyModel<T extends LivingEntity> extends ClientPo
@Override @Override
public void transform(BodyPart part, MatrixStack stack) { public void transform(BodyPart part, MatrixStack stack) {
if (attributes.isSleeping || attributes.isRiptide) { if (attributes.isSleeping || attributes.isRiptide) {
stack.multiply(Vec3f.POSITIVE_X.getDegreesQuaternion(90)); stack.multiply(RotationAxis.POSITIVE_X.rotationDegrees(90));
stack.multiply(Vec3f.POSITIVE_Y.getDegreesQuaternion(180)); stack.multiply(RotationAxis.POSITIVE_Y.rotationDegrees(180));
} }
if (part == BodyPart.HEAD) { if (part == BodyPart.HEAD) {
stack.multiply(Vec3f.POSITIVE_X.getDegreesQuaternion(attributes.motionPitch)); stack.multiply(RotationAxis.POSITIVE_X.rotationDegrees(attributes.motionPitch));
} }
PonyTransformation.forSize(getSize()).transform(this, part, stack); PonyTransformation.forSize(getSize()).transform(this, part, stack);

View file

@ -1,8 +1,7 @@
package com.minelittlepony.client.model; package com.minelittlepony.client.model;
import net.minecraft.client.model.ModelPart; import net.minecraft.client.model.ModelPart;
import net.minecraft.client.render.entity.model.BipedEntityModel; import net.minecraft.client.render.entity.model.*;
import net.minecraft.client.render.entity.model.ModelWithHat;
import net.minecraft.entity.LivingEntity; import net.minecraft.entity.LivingEntity;
import net.minecraft.util.Arm; import net.minecraft.util.Arm;
import net.minecraft.util.Hand; import net.minecraft.util.Hand;
@ -64,7 +63,7 @@ public abstract class ClientPonyModel<T extends LivingEntity> extends MsonPlayer
@Override @Override
public void copyAttributes(BipedEntityModel<T> other) { public void copyAttributes(BipedEntityModel<T> other) {
setAttributes(other); copyStateTo(other);
} }
@Override @Override
@ -116,8 +115,8 @@ public abstract class ClientPonyModel<T extends LivingEntity> extends MsonPlayer
* Copies this model's attributes into the passed model. * Copies this model's attributes into the passed model.
*/ */
@Override @Override
public void setAttributes(BipedEntityModel<T> model) { public void copyStateTo(EntityModel<T> model) {
super.setAttributes(model); super.copyStateTo(model);
if (model instanceof ClientPonyModel) { if (model instanceof ClientPonyModel) {
((ClientPonyModel<T>)model).attributes = attributes; ((ClientPonyModel<T>)model).attributes = attributes;

View file

@ -3,7 +3,8 @@ package com.minelittlepony.client.render;
import net.minecraft.client.render.Frustum; import net.minecraft.client.render.Frustum;
import net.minecraft.entity.LivingEntity; import net.minecraft.entity.LivingEntity;
import net.minecraft.util.math.Box; import net.minecraft.util.math.Box;
import net.minecraft.util.math.Matrix4f;
import org.joml.Matrix4f;
import com.minelittlepony.api.pony.IPony; import com.minelittlepony.api.pony.IPony;

View file

@ -13,7 +13,6 @@ import net.minecraft.client.render.VertexConsumerProvider;
import net.minecraft.client.render.item.ItemRenderer; import net.minecraft.client.render.item.ItemRenderer;
import net.minecraft.client.render.model.json.ModelTransformation; import net.minecraft.client.render.model.json.ModelTransformation;
import net.minecraft.client.util.math.MatrixStack; import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.util.math.Vec3f;
import net.minecraft.entity.LivingEntity; import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
@ -21,6 +20,7 @@ import net.minecraft.screen.PlayerScreenHandler;
import net.minecraft.util.Arm; import net.minecraft.util.Arm;
import net.minecraft.util.Identifier; import net.minecraft.util.Identifier;
import net.minecraft.util.UseAction; import net.minecraft.util.UseAction;
import net.minecraft.util.math.RotationAxis;
import net.minecraft.world.World; import net.minecraft.world.World;
public class LevitatingItemRenderer { public class LevitatingItemRenderer {
@ -140,8 +140,8 @@ public class LevitatingItemRenderer {
distanceChange); distanceChange);
if (!handHeldTool) { // bows have to point forwards if (!handHeldTool) { // bows have to point forwards
stack.multiply(Vec3f.POSITIVE_Y.getDegreesQuaternion(sign * -60 + floatAmount)); stack.multiply(RotationAxis.POSITIVE_Y.rotationDegrees(sign * -60 + floatAmount));
stack.multiply(Vec3f.POSITIVE_Z.getDegreesQuaternion(sign * 30 + driftAmount)); stack.multiply(RotationAxis.POSITIVE_Z.rotationDegrees(sign * 30 + driftAmount));
} }
} }
} }

View file

@ -18,7 +18,7 @@ public abstract class MagicGlow extends RenderPhase {
} }
private static final RenderLayer MAGIC = RenderLayer.of("mlp_magic_glow", VertexFormats.POSITION_COLOR_LIGHT, VertexFormat.DrawMode.QUADS, 256, RenderLayer.MultiPhaseParameters.builder() private static final RenderLayer MAGIC = RenderLayer.of("mlp_magic_glow", VertexFormats.POSITION_COLOR_LIGHT, VertexFormat.DrawMode.QUADS, 256, RenderLayer.MultiPhaseParameters.builder()
.shader(EYES_SHADER) .program(EYES_PROGRAM)
.writeMaskState(COLOR_MASK) .writeMaskState(COLOR_MASK)
.depthTest(LEQUAL_DEPTH_TEST) .depthTest(LEQUAL_DEPTH_TEST)
.transparency(LIGHTNING_TRANSPARENCY) .transparency(LIGHTNING_TRANSPARENCY)
@ -29,7 +29,7 @@ public abstract class MagicGlow extends RenderPhase {
private static final BiFunction<Identifier, Integer, RenderLayer> TINTED_LAYER = Util.memoize((texture, color) -> { private static final BiFunction<Identifier, Integer, RenderLayer> TINTED_LAYER = Util.memoize((texture, color) -> {
return RenderLayer.of("mlp_tint_layer", VertexFormats.POSITION_COLOR_TEXTURE_OVERLAY_LIGHT_NORMAL, VertexFormat.DrawMode.QUADS, 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 Colored(texture, color)) .texture(new Colored(texture, color))
.shader(EYES_SHADER) .program(EYES_PROGRAM)
.writeMaskState(COLOR_MASK) .writeMaskState(COLOR_MASK)
.depthTest(LEQUAL_DEPTH_TEST) .depthTest(LEQUAL_DEPTH_TEST)
.transparency(LIGHTNING_TRANSPARENCY) .transparency(LIGHTNING_TRANSPARENCY)

View file

@ -15,9 +15,10 @@ import net.minecraft.client.model.ModelPart;
import net.minecraft.client.render.VertexConsumer; import net.minecraft.client.render.VertexConsumer;
import net.minecraft.client.util.math.MatrixStack; import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.util.Identifier; import net.minecraft.util.Identifier;
import net.minecraft.util.math.Vec3f; import net.minecraft.util.math.RotationAxis;
import org.jetbrains.annotations.Nullable; import org.jetbrains.annotations.Nullable;
import org.joml.Vector3f;
public class MobSkull implements ISkull { public class MobSkull implements ISkull {
private final Identifier texture; private final Identifier texture;
@ -49,12 +50,12 @@ public class MobSkull implements ISkull {
@Override @Override
public void setAngles(float yaw, float animationProgress) { public void setAngles(float yaw, float animationProgress) {
Vec3f v = new Vec3f(0, -2, 1.99F); Vector3f v = new Vector3f(0, -2, 1.99F);
v.rotate(Vec3f.POSITIVE_Y.getDegreesQuaternion(yaw)); v.rotate(RotationAxis.POSITIVE_Y.rotationDegrees(yaw));
ModelPart head = ponyHead.get().getHead(); ModelPart head = ponyHead.get().getHead();
head.pivotX = v.getX(); head.pivotX = v.x;
head.pivotY = v.getY(); head.pivotY = v.y;
head.pivotZ = v.getZ(); head.pivotZ = v.z;
ponyHead.get().setVisible(true); ponyHead.get().setVisible(true);
ponyHead.get().setHeadRotation(animationProgress, yaw, 0); ponyHead.get().setHeadRotation(animationProgress, yaw, 0);
} }

View file

@ -18,10 +18,11 @@ import net.minecraft.client.render.VertexConsumer;
import net.minecraft.client.util.DefaultSkinHelper; import net.minecraft.client.util.DefaultSkinHelper;
import net.minecraft.client.util.math.MatrixStack; import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.util.Identifier; import net.minecraft.util.Identifier;
import net.minecraft.util.dynamic.DynamicSerializableUuid; import net.minecraft.util.Uuids;
import net.minecraft.util.math.Vec3f; import net.minecraft.util.math.RotationAxis;
import org.jetbrains.annotations.Nullable; import org.jetbrains.annotations.Nullable;
import org.joml.Vector3f;
public class PlayerPonySkull implements ISkull { public class PlayerPonySkull implements ISkull {
private AbstractPonyModel<?> ponyHead; private AbstractPonyModel<?> ponyHead;
@ -45,7 +46,7 @@ public class PlayerPonySkull implements ISkull {
return skin; return skin;
} }
return DefaultSkinHelper.getTexture(DynamicSerializableUuid.getUuidFromProfile(profile)); return DefaultSkinHelper.getTexture(Uuids.getUuidFromProfile(profile));
} }
return DefaultSkinHelper.getTexture(); return DefaultSkinHelper.getTexture();
@ -64,11 +65,11 @@ public class PlayerPonySkull implements ISkull {
@Override @Override
public void setAngles(float yaw, float animationProgress) { public void setAngles(float yaw, float animationProgress) {
Vec3f v = new Vec3f(0, -2, 2); Vector3f v = new Vector3f(0, -2, 2);
v.rotate(Vec3f.POSITIVE_Y.getDegreesQuaternion(yaw)); v.rotate(RotationAxis.POSITIVE_Y.rotationDegrees(yaw));
ponyHead.getHead().pivotX = v.getX(); ponyHead.getHead().pivotX = v.x;
ponyHead.getHead().pivotY = v.getY(); ponyHead.getHead().pivotY = v.y;
ponyHead.getHead().pivotZ = v.getZ(); ponyHead.getHead().pivotZ = v.z;
ponyHead.setVisible(true); ponyHead.setVisible(true);
ponyHead.setHeadRotation(animationProgress, yaw, 0); ponyHead.setHeadRotation(animationProgress, yaw, 0);
} }

View file

@ -34,11 +34,10 @@ import net.minecraft.client.render.entity.PlayerEntityRenderer;
import net.minecraft.client.render.entity.feature.*; import net.minecraft.client.render.entity.feature.*;
import net.minecraft.client.render.entity.model.*; import net.minecraft.client.render.entity.model.*;
import net.minecraft.client.util.math.MatrixStack; import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.util.math.Vec3f;
import net.minecraft.text.Text; import net.minecraft.text.Text;
import net.minecraft.util.Arm; import net.minecraft.util.Arm;
import net.minecraft.util.Identifier; import net.minecraft.util.Identifier;
import net.minecraft.util.math.MathHelper; import net.minecraft.util.math.*;
public class PlayerPonyRenderer extends PlayerEntityRenderer implements IPonyRenderContext<AbstractClientPlayerEntity, ClientPonyModel<AbstractClientPlayerEntity>> { public class PlayerPonyRenderer extends PlayerEntityRenderer implements IPonyRenderContext<AbstractClientPlayerEntity, ClientPonyModel<AbstractClientPlayerEntity>> {
@ -102,9 +101,9 @@ public class PlayerPonyRenderer extends PlayerEntityRenderer implements IPonyRen
float yaw = MathHelper.lerpAngleDegrees(tickDelta, entity.prevBodyYaw, entity.bodyYaw); float yaw = MathHelper.lerpAngleDegrees(tickDelta, entity.prevBodyYaw, entity.bodyYaw);
float l = entity.getWidth() / 2 * manager.getPony(entity).getMetadata().getSize().getScaleFactor(); float l = entity.getWidth() / 2 * manager.getPony(entity).getMetadata().getSize().getScaleFactor();
stack.multiply(Vec3f.NEGATIVE_Y.getDegreesQuaternion(yaw)); stack.multiply(RotationAxis.NEGATIVE_Y.rotationDegrees(yaw));
stack.translate(0, 0, -l); stack.translate(0, 0, -l);
stack.multiply(Vec3f.POSITIVE_Y.getDegreesQuaternion(yaw)); stack.multiply(RotationAxis.POSITIVE_Y.rotationDegrees(yaw));
} }
} }

View file

@ -7,7 +7,7 @@ import com.minelittlepony.client.render.entity.feature.HeldItemFeature;
import net.minecraft.client.render.entity.EntityRendererFactory; import net.minecraft.client.render.entity.EntityRendererFactory;
import net.minecraft.client.render.model.json.ModelTransformation; import net.minecraft.client.render.model.json.ModelTransformation;
import net.minecraft.client.util.math.MatrixStack; import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.util.math.Vec3f; import net.minecraft.util.math.RotationAxis;
import net.minecraft.entity.mob.WitchEntity; import net.minecraft.entity.mob.WitchEntity;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.util.Arm; import net.minecraft.util.Arm;
@ -27,7 +27,7 @@ public class WitchRenderer extends PonyRenderer<WitchEntity, WitchPonyModel> {
@Override @Override
protected void preItemRender(WitchEntity entity, ItemStack drop, ModelTransformation.Mode transform, Arm hand, MatrixStack stack) { protected void preItemRender(WitchEntity entity, ItemStack drop, ModelTransformation.Mode transform, Arm hand, MatrixStack stack) {
super.preItemRender(entity, drop, transform, hand, stack); super.preItemRender(entity, drop, transform, hand, stack);
stack.multiply(Vec3f.POSITIVE_X.getDegreesQuaternion(10)); stack.multiply(RotationAxis.POSITIVE_X.rotationDegrees(10));
} }
}; };
} }

View file

@ -26,7 +26,7 @@ public abstract class AbstractClothingFeature<T extends LivingEntity, M extends
public void render(MatrixStack stack, VertexConsumerProvider renderContext, int lightUv, T entity, float limbDistance, float limbAngle, float tickDelta, float age, float headYaw, float headPitch) { public void render(MatrixStack stack, VertexConsumerProvider renderContext, int lightUv, T entity, float limbDistance, float limbAngle, float tickDelta, float age, float headYaw, float headPitch) {
M overlayModel = getOverlayModel(); M overlayModel = getOverlayModel();
renderer.getModel().setAttributes(overlayModel); renderer.getModel().copyStateTo(overlayModel);
overlayModel.animateModel(entity, limbDistance, limbAngle, tickDelta); overlayModel.animateModel(entity, limbDistance, limbAngle, tickDelta);
overlayModel.setAngles(entity, limbDistance, limbAngle, age, headYaw, headPitch); overlayModel.setAngles(entity, limbDistance, limbAngle, age, headYaw, headPitch);

View file

@ -13,10 +13,9 @@ import net.minecraft.client.render.VertexConsumer;
import net.minecraft.client.render.VertexConsumerProvider; import net.minecraft.client.render.VertexConsumerProvider;
import net.minecraft.client.render.entity.PlayerModelPart; import net.minecraft.client.render.entity.PlayerModelPart;
import net.minecraft.client.util.math.MatrixStack; import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.util.math.Vec3f;
import net.minecraft.item.Items; import net.minecraft.item.Items;
import net.minecraft.util.math.*;
import net.minecraft.entity.EquipmentSlot; import net.minecraft.entity.EquipmentSlot;
import net.minecraft.util.math.MathHelper;
public class CapeFeature<M extends ClientPonyModel<AbstractClientPlayerEntity>> extends AbstractPonyFeature<AbstractClientPlayerEntity, M> { public class CapeFeature<M extends ClientPonyModel<AbstractClientPlayerEntity>> extends AbstractPonyFeature<AbstractClientPlayerEntity, M> {
@ -61,11 +60,11 @@ public class CapeFeature<M extends ClientPonyModel<AbstractClientPlayerEntity>>
float camera = MathHelper.lerp(tickDelta, player.prevStrideDistance, player.strideDistance); float camera = MathHelper.lerp(tickDelta, player.prevStrideDistance, player.strideDistance);
capeMotionY += MathHelper.sin(MathHelper.lerp(tickDelta, player.prevHorizontalSpeed, player.horizontalSpeed) * 6) * 32 * camera; capeMotionY += MathHelper.sin(MathHelper.lerp(tickDelta, player.prevHorizontalSpeed, player.horizontalSpeed) * 6) * 32 * camera;
stack.multiply(Vec3f.POSITIVE_X.getDegreesQuaternion(2 + capeMotionX / 12 + capeMotionY)); stack.multiply(RotationAxis.POSITIVE_X.rotationDegrees(2 + capeMotionX / 12 + capeMotionY));
stack.multiply(Vec3f.POSITIVE_Z.getDegreesQuaternion( diagMotion / 2)); stack.multiply(RotationAxis.POSITIVE_Z.rotationDegrees( diagMotion / 2));
stack.multiply(Vec3f.POSITIVE_Y.getDegreesQuaternion(-diagMotion / 2)); stack.multiply(RotationAxis.POSITIVE_Y.rotationDegrees(-diagMotion / 2));
stack.multiply(Vec3f.POSITIVE_Z.getDegreesQuaternion(180)); stack.multiply(RotationAxis.POSITIVE_Z.rotationDegrees(180));
stack.multiply(Vec3f.POSITIVE_X.getDegreesQuaternion(90)); stack.multiply(RotationAxis.POSITIVE_X.rotationDegrees(90));
VertexConsumer vertices = renderContext.getBuffer(RenderLayer.getEntitySolid(player.getCapeTexture())); VertexConsumer vertices = renderContext.getBuffer(RenderLayer.getEntitySolid(player.getCapeTexture()));
model.renderCape(stack, vertices, lightUv, OverlayTexture.DEFAULT_UV); model.renderCape(stack, vertices, lightUv, OverlayTexture.DEFAULT_UV);

View file

@ -11,12 +11,12 @@ import net.minecraft.client.render.entity.model.EntityModel;
import net.minecraft.client.render.entity.model.ModelWithArms; import net.minecraft.client.render.entity.model.ModelWithArms;
import net.minecraft.client.render.model.json.ModelTransformation; import net.minecraft.client.render.model.json.ModelTransformation;
import net.minecraft.client.util.math.MatrixStack; import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.util.math.Vec3f;
import net.minecraft.entity.LivingEntity; import net.minecraft.entity.LivingEntity;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.util.Arm; import net.minecraft.util.Arm;
import net.minecraft.util.Hand; import net.minecraft.util.Hand;
import net.minecraft.util.UseAction; import net.minecraft.util.UseAction;
import net.minecraft.util.math.RotationAxis;
public class HeldItemFeature<T extends LivingEntity, M extends EntityModel<T> & IPonyModel<T>> extends AbstractPonyFeature<T, M> { public class HeldItemFeature<T extends LivingEntity, M extends EntityModel<T> & IPonyModel<T>> extends AbstractPonyFeature<T, M> {
@ -85,9 +85,9 @@ public class HeldItemFeature<T extends LivingEntity, M extends EntityModel<T> &
} }
if (main == arm) { if (main == arm) {
stack.translate(left * -0.05F, 0.5F, 0.7F); stack.translate(left * -0.05F, 0.5F, 0.7F);
stack.multiply(Vec3f.POSITIVE_X.getDegreesQuaternion(-60)); stack.multiply(RotationAxis.POSITIVE_X.rotationDegrees(-60));
stack.multiply(Vec3f.POSITIVE_X.getDegreesQuaternion(-90)); stack.multiply(RotationAxis.POSITIVE_X.rotationDegrees(-90));
stack.multiply(Vec3f.POSITIVE_Y.getDegreesQuaternion(left * 180)); stack.multiply(RotationAxis.POSITIVE_Y.rotationDegrees(left * 180));
stack.translate(left * -0.2F, 0.125F, -1); stack.translate(left * -0.2F, 0.125F, -1);
return; return;
@ -98,8 +98,8 @@ public class HeldItemFeature<T extends LivingEntity, M extends EntityModel<T> &
stack.translate(left / 10, -0.2F, -0.5F); stack.translate(left / 10, -0.2F, -0.5F);
} }
stack.multiply(Vec3f.POSITIVE_X.getDegreesQuaternion(-90)); stack.multiply(RotationAxis.POSITIVE_X.rotationDegrees(-90));
stack.multiply(Vec3f.POSITIVE_Y.getDegreesQuaternion(left * 180)); stack.multiply(RotationAxis.POSITIVE_Y.rotationDegrees(left * 180));
stack.translate(left * -0.2F, 0.125F, -1); stack.translate(left * -0.2F, 0.125F, -1);
} }

View file

@ -8,8 +8,9 @@ import net.minecraft.client.render.entity.ParrotEntityRenderer;
import net.minecraft.client.render.entity.model.EntityModelLayers; import net.minecraft.client.render.entity.model.EntityModelLayers;
import net.minecraft.client.render.entity.model.ParrotEntityModel; import net.minecraft.client.render.entity.model.ParrotEntityModel;
import net.minecraft.client.util.math.MatrixStack; import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.util.math.Vec3f; import net.minecraft.util.math.RotationAxis;
import net.minecraft.entity.EntityType; import net.minecraft.entity.EntityType;
import net.minecraft.entity.passive.ParrotEntity;
import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.nbt.NbtCompound; import net.minecraft.nbt.NbtCompound;
import net.minecraft.util.Identifier; import net.minecraft.util.Identifier;
@ -42,7 +43,7 @@ public class PassengerFeature<T extends PlayerEntity, M extends ClientPonyModel<
private Optional<Identifier> getShoulderParrot(NbtCompound tag) { private Optional<Identifier> getShoulderParrot(NbtCompound tag) {
return EntityType.get(tag.getString("id")) return EntityType.get(tag.getString("id"))
.filter(p -> p == EntityType.PARROT) .filter(p -> p == EntityType.PARROT)
.map(type -> ParrotEntityRenderer.TEXTURES[tag.getInt("Variant")]); .map(type -> ParrotEntityRenderer.getTexture(ParrotEntity.Variant.byIndex(tag.getInt("Variant"))));
} }
private void renderShoulderParrot(MatrixStack stack, VertexConsumerProvider renderContext, int light, T entity, float limbDistance, float limbAngle, float headYaw, float headPitch, Identifier texture, int sigma) { private void renderShoulderParrot(MatrixStack stack, VertexConsumerProvider renderContext, int light, T entity, float limbDistance, float limbAngle, float headYaw, float headPitch, Identifier texture, int sigma) {
@ -54,7 +55,7 @@ public class PassengerFeature<T extends PlayerEntity, M extends ClientPonyModel<
sigma * 0.25, sigma * 0.25,
entity.isInSneakingPose() ? -0.9 : -1.2, entity.isInSneakingPose() ? -0.9 : -1.2,
0.45); 0.45);
stack.multiply(Vec3f.NEGATIVE_Z.getDegreesQuaternion(sigma * -5)); stack.multiply(RotationAxis.NEGATIVE_Z.rotationDegrees(sigma * -5));
VertexConsumer buffer = renderContext.getBuffer(model.getLayer(texture)); VertexConsumer buffer = renderContext.getBuffer(model.getLayer(texture));
model.poseOnShoulder(stack, buffer, light, OverlayTexture.DEFAULT_UV, limbDistance, limbAngle, headYaw, headPitch, entity.age); model.poseOnShoulder(stack, buffer, light, OverlayTexture.DEFAULT_UV, limbDistance, limbAngle, headYaw, headPitch, entity.age);

View file

@ -19,7 +19,7 @@ import net.minecraft.client.render.entity.model.EntityModel;
import net.minecraft.client.render.entity.model.EntityModelLoader; import net.minecraft.client.render.entity.model.EntityModelLoader;
import net.minecraft.client.render.model.json.ModelTransformation; import net.minecraft.client.render.model.json.ModelTransformation;
import net.minecraft.client.util.math.MatrixStack; import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.util.math.Vec3f; import net.minecraft.util.math.RotationAxis;
import net.minecraft.entity.EquipmentSlot; import net.minecraft.entity.EquipmentSlot;
import net.minecraft.entity.LivingEntity; import net.minecraft.entity.LivingEntity;
import net.minecraft.item.ArmorItem; import net.minecraft.item.ArmorItem;
@ -71,7 +71,7 @@ public class SkullFeature<T extends LivingEntity, M extends EntityModel<T> & IPo
} }
private void renderBlock(MatrixStack stack, VertexConsumerProvider renderContext, T entity, ItemStack itemstack, int lightUv) { private void renderBlock(MatrixStack stack, VertexConsumerProvider renderContext, T entity, ItemStack itemstack, int lightUv) {
stack.multiply(Vec3f.POSITIVE_Y.getDegreesQuaternion(180)); stack.multiply(RotationAxis.POSITIVE_Y.rotationDegrees(180));
stack.scale(0.625F, -0.625F, -0.625F); stack.scale(0.625F, -0.625F, -0.625F);
stack.translate(0, 0.6F, -0.21F); stack.translate(0, 0.6F, -0.21F);

View file

@ -9,10 +9,10 @@ import net.minecraft.client.render.entity.model.EntityModel;
import net.minecraft.client.render.entity.model.ModelWithHat; import net.minecraft.client.render.entity.model.ModelWithHat;
import net.minecraft.client.util.math.MatrixStack; import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.entity.LivingEntity; import net.minecraft.entity.LivingEntity;
import net.minecraft.registry.Registries;
import net.minecraft.util.Identifier; import net.minecraft.util.Identifier;
import net.minecraft.util.Util; import net.minecraft.util.Util;
import net.minecraft.util.math.MathHelper; import net.minecraft.util.math.MathHelper;
import net.minecraft.util.registry.Registry;
import net.minecraft.village.VillagerData; import net.minecraft.village.VillagerData;
import net.minecraft.village.VillagerDataContainer; import net.minecraft.village.VillagerDataContainer;
import net.minecraft.village.VillagerProfession; import net.minecraft.village.VillagerProfession;
@ -49,7 +49,7 @@ class NpcClothingFeature<
public static Identifier getClothingTexture(VillagerDataContainer entity, String entityType) { public static Identifier getClothingTexture(VillagerDataContainer entity, String entityType) {
VillagerProfession profession = entity.getVillagerData().getProfession(); VillagerProfession profession = entity.getVillagerData().getProfession();
return createTexture("minelittlepony", entityType, "profession", Registry.VILLAGER_PROFESSION.getId(profession)); return createTexture("minelittlepony", entityType, "profession", Registries.VILLAGER_PROFESSION.getId(profession));
} }
public static Identifier createTexture(String namespace, String entityType, String category, Identifier profession) { public static Identifier createTexture(String namespace, String entityType, String category, Identifier profession) {
@ -59,7 +59,7 @@ class NpcClothingFeature<
public Identifier createTexture(VillagerDataContainer entity, String category) { public Identifier createTexture(VillagerDataContainer entity, String category) {
VillagerProfession profession = entity.getVillagerData().getProfession(); VillagerProfession profession = entity.getVillagerData().getProfession();
return createTexture(category, Registry.VILLAGER_PROFESSION.getId(profession)); return createTexture(category, Registries.VILLAGER_PROFESSION.getId(profession));
} }
public Identifier createTexture(String category, Identifier identifier) { public Identifier createTexture(String category, Identifier identifier) {
@ -76,7 +76,7 @@ class NpcClothingFeature<
M entityModel = getContextModel(); M entityModel = getContextModel();
if (entity.isBaby() || data.getProfession() == VillagerProfession.NONE) { if (entity.isBaby() || data.getProfession() == VillagerProfession.NONE) {
Identifier typeSkin = createTexture("type", Registry.VILLAGER_TYPE.getId(data.getType())); Identifier typeSkin = createTexture("type", Registries.VILLAGER_TYPE.getId(data.getType()));
renderModel(entityModel, typeSkin, matrixStack, provider, i, entity, 1, 1, 1); renderModel(entityModel, typeSkin, matrixStack, provider, i, entity, 1, 1, 1);
} else { } else {
@ -89,8 +89,8 @@ class NpcClothingFeature<
VillagerProfession profession = data.getProfession(); VillagerProfession profession = data.getProfession();
int level = MathHelper.clamp(data.getLevel(), 1, LEVEL_TO_ID.size()); int level = MathHelper.clamp(data.getLevel(), 1, LEVEL_TO_ID.size());
Identifier typeId = Registry.VILLAGER_TYPE.getId(type); Identifier typeId = Registries.VILLAGER_TYPE.getId(type);
Identifier profId = Registry.VILLAGER_PROFESSION.getId(profession); Identifier profId = Registries.VILLAGER_PROFESSION.getId(profession);
Identifier key = new Identifier("minelittlepony", (typeId + "/" + profId + "/" + level).replace(':', '_')); Identifier key = new Identifier("minelittlepony", (typeId + "/" + profId + "/" + level).replace(':', '_'));
@ -105,7 +105,7 @@ class NpcClothingFeature<
List<Identifier> skins = new ArrayList<>(); List<Identifier> skins = new ArrayList<>();
skins.add(createTexture("type", typeId)); skins.add(createTexture("type", typeId));
skins.add(createTexture("profession", Registry.VILLAGER_PROFESSION.getId(profession))); skins.add(createTexture("profession", Registries.VILLAGER_PROFESSION.getId(profession)));
if (profession != VillagerProfession.NITWIT) { if (profession != VillagerProfession.NITWIT) {
skins.add(createTexture("profession_level", LEVEL_TO_ID.get(level))); skins.add(createTexture("profession_level", LEVEL_TO_ID.get(level)));
} }

View file

@ -1,7 +1,7 @@
package com.minelittlepony.client.transform; package com.minelittlepony.client.transform;
import net.minecraft.client.util.math.MatrixStack; import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.util.math.Vec3f; import net.minecraft.util.math.RotationAxis;
import com.minelittlepony.api.model.IModel; import com.minelittlepony.api.model.IModel;
@ -10,7 +10,7 @@ import net.minecraft.entity.LivingEntity;
public class PostureElytra implements PonyPosture<LivingEntity> { public class PostureElytra implements PonyPosture<LivingEntity> {
@Override @Override
public void transform(IModel model, LivingEntity entity, MatrixStack stack, double motionX, double motionY, double motionZ, float yaw, float ticks) { public void transform(IModel model, LivingEntity entity, MatrixStack stack, double motionX, double motionY, double motionZ, float yaw, float ticks) {
stack.multiply(Vec3f.POSITIVE_X.getDegreesQuaternion(90)); stack.multiply(RotationAxis.POSITIVE_X.rotationDegrees(90));
stack.translate(0, model.getAttributes().isCrouching ? 0.2F : -1, 0); stack.translate(0, model.getAttributes().isCrouching ? 0.2F : -1, 0);
} }
} }

View file

@ -5,7 +5,7 @@ import com.minelittlepony.common.util.animation.MotionCompositor;
import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.client.util.math.MatrixStack; import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.util.math.Vec3f; import net.minecraft.util.math.RotationAxis;
import net.minecraft.entity.LivingEntity; import net.minecraft.entity.LivingEntity;
public class PostureFlight extends MotionCompositor implements PonyPosture<PlayerEntity> { public class PostureFlight extends MotionCompositor implements PonyPosture<PlayerEntity> {
@ -22,7 +22,7 @@ public class PostureFlight extends MotionCompositor implements PonyPosture<Playe
roll = model.getMetadata().getInterpolator(player.getUuid()).interpolate("pegasusRoll", roll, 10); roll = model.getMetadata().getInterpolator(player.getUuid()).interpolate("pegasusRoll", roll, 10);
stack.multiply(Vec3f.POSITIVE_X.getDegreesQuaternion(model.getAttributes().motionPitch)); stack.multiply(RotationAxis.POSITIVE_X.rotationDegrees(model.getAttributes().motionPitch));
stack.multiply(Vec3f.POSITIVE_Z.getDegreesQuaternion(roll)); stack.multiply(RotationAxis.POSITIVE_Z.rotationDegrees(roll));
} }
} }