mirror of
https://github.com/MineLittlePony/MineLittlePony.git
synced 2025-03-14 07:30:08 +01:00
Compare commits
10 commits
1.20.2
...
4.10.1+1.1
Author | SHA1 | Date | |
---|---|---|---|
|
528559d145 | ||
|
8a92376376 | ||
|
1564c20876 | ||
|
58206c52cd | ||
|
835b91e35b | ||
|
60a1012b68 | ||
|
d3a2d513cb | ||
|
2d6f0cce2e | ||
|
3b3b1740fe | ||
|
fe1fc94127 |
46 changed files with 221 additions and 165 deletions
|
@ -60,8 +60,15 @@ dependencies {
|
|||
include "com.minelittlepony:mson:${project.mson_version}"
|
||||
|
||||
modImplementation "com.minelittlepony:hdskins:${project.hd_skins_version}"
|
||||
// modImplementation "com.minelittlepony:bigpony:${project.bigpony_version}"
|
||||
modImplementation "com.terraformersmc:modmenu:${project.modmenu_version}"
|
||||
}
|
||||
// I blame you, Modmenu
|
||||
configurations.all {
|
||||
resolutionStrategy {
|
||||
force("net.fabricmc:fabric-loader:$loader_version")
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Imports the Background Ponies from the MLP Community Skin Pack
|
||||
|
|
|
@ -3,10 +3,10 @@ org.gradle.daemon=false
|
|||
|
||||
# Fabric Properties
|
||||
# check these on https://fabricmc.net/develop
|
||||
minecraft_version=1.20.1
|
||||
yarn_mappings=1.20.1+build.9
|
||||
loader_version=0.14.21
|
||||
fabric_version=0.85.0+1.20.1
|
||||
minecraft_version=1.19.2
|
||||
yarn_mappings=1.19.2+build.8
|
||||
loader_version=0.14.19
|
||||
fabric_version=0.76.0+1.19.2
|
||||
|
||||
# Mod Properties
|
||||
group=com.minelittlepony
|
||||
|
@ -15,12 +15,13 @@ org.gradle.daemon=false
|
|||
description=Mine Little Pony turns players and mobs into ponies. Press F9 ingame to access settings.
|
||||
|
||||
# Publishing
|
||||
minecraft_version_range=>=1.20.0
|
||||
minecraft_version_range=1.19.2
|
||||
modrinth_loader_type=fabric
|
||||
modrinth_project_id=JBjInUXM
|
||||
|
||||
# Dependencies
|
||||
modmenu_version=7.1.0
|
||||
kirin_version=1.15.2
|
||||
hd_skins_version=6.10.0+1.20
|
||||
mson_version=1.8.1
|
||||
modmenu_version=4.0.6
|
||||
kirin_version=1.15.2+1.19.2
|
||||
hd_skins_version=6.10.1+1.19.2
|
||||
bigpony_version=1.7.3
|
||||
mson_version=1.8.1+lts1.19.2
|
||||
|
|
|
@ -3,9 +3,9 @@ package com.minelittlepony.api.model;
|
|||
import net.minecraft.client.util.math.MatrixStack;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
|
||||
import com.minelittlepony.api.config.PonyConfig;
|
||||
import com.minelittlepony.api.pony.IPonyData;
|
||||
import com.minelittlepony.api.pony.meta.*;
|
||||
import com.minelittlepony.settings.PonyConfig;
|
||||
|
||||
public interface IModel {
|
||||
/**
|
||||
|
|
|
@ -3,6 +3,8 @@ package com.minelittlepony.api.model;
|
|||
import net.minecraft.client.render.VertexConsumer;
|
||||
import net.minecraft.client.util.math.MatrixStack;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
public interface IPart {
|
||||
/**
|
||||
* Sets the model's various rotation angles.
|
||||
|
@ -11,6 +13,13 @@ public interface IPart {
|
|||
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
default void setRotationAndAngles(boolean goingFast, UUID interpolatorId, float limbAngle, float limbSpeed, float bodySwing, float animationProgress) {
|
||||
Compat.attributes.isGoingFast = goingFast;
|
||||
Compat.attributes.interpolatorId = interpolatorId;
|
||||
setPartAngles(Compat.attributes, limbAngle, limbSpeed, bodySwing, animationProgress);
|
||||
}
|
||||
|
||||
/**
|
||||
* Renders this model component.
|
||||
*/
|
||||
|
@ -22,4 +31,14 @@ public interface IPart {
|
|||
default void setVisible(boolean visible, ModelAttributes attributes) {
|
||||
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
default void setVisible(boolean visible) {
|
||||
setVisible(visible, Compat.attributes);
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
class Compat {
|
||||
public static ModelAttributes attributes = new ModelAttributes();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -87,7 +87,7 @@ public class ModelAttributes {
|
|||
* Unique id of the interpolator used for this model.
|
||||
* Usually the UUID of the entity being rendered.
|
||||
*/
|
||||
private UUID interpolatorId = UUID.randomUUID();
|
||||
UUID interpolatorId = UUID.randomUUID();
|
||||
|
||||
/**
|
||||
* The actual, visible height of this model when rendered.
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
package com.minelittlepony.api.model.armour;
|
||||
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.registry.Registries;
|
||||
import net.minecraft.util.Identifier;
|
||||
import net.minecraft.util.registry.Registry;
|
||||
|
||||
import com.minelittlepony.client.model.armour.PonyArmourModel;
|
||||
import com.minelittlepony.mson.api.ModelKey;
|
||||
|
@ -14,11 +14,11 @@ public interface ArmorModelRegistry {
|
|||
static final Map<Identifier, Optional<ModelKey<PonyArmourModel<?>>>> REGISTRY = new HashMap<>();
|
||||
|
||||
public static Optional<ModelKey<PonyArmourModel<?>>> getModelKey(Item item, ArmourLayer layer) {
|
||||
Identifier id = Registries.ITEM.getId(item);
|
||||
Identifier id = Registry.ITEM.getId(item);
|
||||
if (id.getNamespace().equals("minecraft")) {
|
||||
return Optional.empty();
|
||||
}
|
||||
return REGISTRY.computeIfAbsent(id.withPath(p -> "models/armor/" + layer.name().toLowerCase(Locale.ROOT) + "_" + p + ".json"), i -> {
|
||||
return REGISTRY.computeIfAbsent(new Identifier(id.getNamespace(), "models/armor/" + layer.name().toLowerCase(Locale.ROOT) + "_" + id.getPath() + ".json"), i -> {
|
||||
return Optional.of(Mson.getInstance().registerModel(i, PonyArmourModel::new));
|
||||
}).filter(key -> key.getModelData().isPresent());
|
||||
}
|
||||
|
|
|
@ -1,20 +1,29 @@
|
|||
package com.minelittlepony.api.pony;
|
||||
|
||||
import net.minecraft.client.util.DefaultSkinHelper;
|
||||
import net.minecraft.util.Identifier;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import com.minelittlepony.client.MineLittlePony;
|
||||
import com.minelittlepony.settings.PonyLevel;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
public final class DefaultPonySkinHelper {
|
||||
public static final Identifier STEVE = new Identifier("minelittlepony", "textures/entity/player/wide/steve_pony.png");
|
||||
|
||||
private static final Map<Identifier, Identifier> SKINS = new HashMap<>();
|
||||
@Deprecated
|
||||
public static final Identifier ALEX = new Identifier("minelittlepony", "textures/entity/player/slim/alex_pony.png");
|
||||
|
||||
public static Identifier getPonySkin(Identifier original) {
|
||||
return SKINS.computeIfAbsent(original, DefaultPonySkinHelper::computePonySkin);
|
||||
return original.getPath().contains("steve") ? STEVE : ALEX;
|
||||
}
|
||||
|
||||
private static Identifier computePonySkin(Identifier original) {
|
||||
return new Identifier("minelittlepony", original.getPath().replace(".png", "_pony.png"));
|
||||
}
|
||||
@Deprecated
|
||||
public static Identifier getPonySkin(UUID profileId, boolean slimArms) {
|
||||
if (MineLittlePony.getInstance().getConfig().ponyLevel.get() != PonyLevel.PONIES) {
|
||||
return DefaultSkinHelper.getTexture(profileId);
|
||||
}
|
||||
boolean alex = (profileId.hashCode() & 1) == 1;
|
||||
return new Identifier("minelittlepony", "textures/entity/player/" + (slimArms ? "slim" : "wide") + "/" + (alex ? "alex" : "steve") + "_pony.png");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,11 +5,11 @@ import net.minecraft.util.Identifier;
|
|||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import com.google.common.collect.ComparisonChain;
|
||||
import com.minelittlepony.api.config.PonyConfig;
|
||||
import com.minelittlepony.api.pony.meta.Race;
|
||||
import com.minelittlepony.api.pony.meta.Size;
|
||||
import com.minelittlepony.settings.PonyConfig;
|
||||
|
||||
public interface IPony extends Comparable<IPony> {
|
||||
|
||||
/**
|
||||
* Gets the global pony manager instance.
|
||||
*/
|
||||
|
@ -46,12 +46,31 @@ public interface IPony extends Comparable<IPony> {
|
|||
}
|
||||
|
||||
/**
|
||||
* Returns true if and only if this metadata represents a pony that can cast magic.
|
||||
* @deprecated Replace with pony.race() when updating to 1.19.3 (minelp >=4.7.4)
|
||||
*/
|
||||
@Deprecated
|
||||
default Race getRace(boolean ignoreLevel) {
|
||||
return ignoreLevel ? metadata().getRace() : race();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if and only if this metadata represents a pony that can cast magic.
|
||||
*
|
||||
* @deprecated Replace with pony.metadata().hasMagic() when updating to 1.19.4 (minelp >=4.8.0)
|
||||
*/
|
||||
@Deprecated
|
||||
default boolean hasMagic() {
|
||||
return race().hasHorn() && metadata().getGlowColor() != 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated Replace with pony.race().hasWings() when updating to 1.19.3 (minelp >=4.7.4)
|
||||
*/
|
||||
@Deprecated
|
||||
default boolean canFly() {
|
||||
return race().hasWings();
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the texture used for rendering this pony.
|
||||
*/
|
||||
|
@ -62,6 +81,21 @@ public interface IPony extends Comparable<IPony> {
|
|||
*/
|
||||
IPonyData metadata();
|
||||
|
||||
/**
|
||||
* @deprecated Replace with pony.metadata() when updating to 1.19.3 (minelp >=4.7.4)
|
||||
*/
|
||||
@Deprecated
|
||||
default IPonyData getMetadata() {
|
||||
return metadata();
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated Replace with pony.metadata().getSize() when updating to 1.19.3 (minelp >=4.7.4)
|
||||
*/
|
||||
@Deprecated
|
||||
default Size getSize() {
|
||||
return metadata().getSize();
|
||||
}
|
||||
|
||||
@Override
|
||||
default int compareTo(@Nullable IPony o) {
|
||||
|
|
|
@ -8,7 +8,7 @@ import net.minecraft.block.BlockState;
|
|||
import net.minecraft.block.StairsBlock;
|
||||
import net.minecraft.entity.LivingEntity;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.registry.tag.FluidTags;
|
||||
import net.minecraft.tag.FluidTags;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
|
||||
|
@ -58,7 +58,7 @@ public final class PonyPosture {
|
|||
double offsetAmount = below.getBlock() instanceof StairsBlock ? 1 : 0.05;
|
||||
|
||||
Vec3d pos = entity.getPos();
|
||||
BlockPos blockpos = BlockPos.ofFloored(
|
||||
BlockPos blockpos = new BlockPos(
|
||||
pos.x,
|
||||
pos.y - offsetAmount,
|
||||
pos.z
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package com.minelittlepony.api.pony.meta;
|
||||
|
||||
import com.minelittlepony.api.config.PonyConfig;
|
||||
import com.minelittlepony.settings.PonyConfig;
|
||||
|
||||
/**
|
||||
* Represents the different model sizes that are possible.
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
package com.minelittlepony.client;
|
||||
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
import net.minecraft.client.gui.DrawContext;
|
||||
import net.minecraft.client.gui.screen.Screen;
|
||||
import net.minecraft.client.util.math.MatrixStack;
|
||||
import net.minecraft.text.*;
|
||||
|
||||
import com.minelittlepony.client.render.MobRenderers;
|
||||
|
@ -189,10 +189,10 @@ public class GuiPonySettings extends GameGui {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void render(DrawContext context, int mouseX, int mouseY, float partialTicks) {
|
||||
renderBackground(context);
|
||||
super.render(context, mouseX, mouseY, partialTicks);
|
||||
content.render(context, mouseX, mouseY, partialTicks);
|
||||
public void render(MatrixStack matrices, int mouseX, int mouseY, float partialTicks) {
|
||||
renderBackground(matrices);
|
||||
super.render(matrices, mouseX, mouseY, partialTicks);
|
||||
content.render(matrices, mouseX, mouseY, partialTicks);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package com.minelittlepony.client;
|
||||
|
||||
import com.minelittlepony.api.config.PonyConfig;
|
||||
import com.minelittlepony.api.pony.IPonyManager;
|
||||
import com.minelittlepony.api.pony.network.fabric.Channel;
|
||||
import com.minelittlepony.client.model.ModelType;
|
||||
import com.minelittlepony.client.pony.PonyManager;
|
||||
|
@ -14,6 +14,7 @@ import com.minelittlepony.common.event.ClientReadyCallback;
|
|||
import com.minelittlepony.common.event.ScreenInitCallback;
|
||||
import com.minelittlepony.common.event.SkinFilterCallback;
|
||||
import com.minelittlepony.common.util.GamePaths;
|
||||
import com.minelittlepony.settings.PonyConfig;
|
||||
|
||||
import net.fabricmc.api.ClientModInitializer;
|
||||
import net.fabricmc.fabric.api.client.event.lifecycle.v1.ClientTickEvents;
|
||||
|
@ -129,7 +130,7 @@ public class MineLittlePony implements ClientModInitializer {
|
|||
.setTextureSize(16, 16)
|
||||
.setSize(16, 16))
|
||||
.setTooltip("minelp.options.title", 0, 10);
|
||||
button.setY(screen.height - y); // ModMenu
|
||||
button.y = screen.height - y; // ModMenu
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -141,7 +142,7 @@ public class MineLittlePony implements ClientModInitializer {
|
|||
return config;
|
||||
}
|
||||
|
||||
public PonyManager getManager() {
|
||||
public IPonyManager getManager() {
|
||||
return ponyManager;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
package com.minelittlepony.client.hdskins;
|
||||
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
import net.minecraft.client.gui.DrawContext;
|
||||
import net.minecraft.client.gui.DrawableHelper;
|
||||
import net.minecraft.client.util.math.MatrixStack;
|
||||
import net.minecraft.text.Text;
|
||||
|
||||
import com.minelittlepony.api.pony.*;
|
||||
|
@ -23,30 +24,30 @@ class LegendOverlayWidget implements Carousel.Element, ITextContext {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void render(DummyPlayer player, DrawContext context, int mouseX, int mouseY) {
|
||||
public void render(DummyPlayer player, MatrixStack matrices, int mouseX, int mouseY) {
|
||||
IPonyData data = IPony.getManager().getPony(player).metadata();
|
||||
int[] index = new int[1];
|
||||
data.getTriggerPixels().forEach((key, value) -> {
|
||||
context.getMatrices().push();
|
||||
matrices.push();
|
||||
int i = index[0]++;
|
||||
int x = frame.left;
|
||||
int y = frame.top + (i * 10 + 20);
|
||||
context.getMatrices().translate(x, y, 1);
|
||||
drawLegendBlock(context, 0, 0, 0, mouseX - x, mouseY - y, key, value);
|
||||
context.getMatrices().pop();
|
||||
matrices.translate(x, y, 1);
|
||||
drawLegendBlock(matrices, 0, 0, 0, mouseX - x, mouseY - y, key, value);
|
||||
matrices.pop();
|
||||
});
|
||||
}
|
||||
|
||||
private void drawLegendBlock(DrawContext context, int index, int x, int y, int mouseX, int mouseY, String key, TriggerPixelType<?> value) {
|
||||
context.fill(0, 0, LEGEND_BLOCK_BOUNDS.width, LEGEND_BLOCK_BOUNDS.height, 0xFF003333);
|
||||
context.fill(1, 1, LEGEND_BLOCK_BOUNDS.width - 1, LEGEND_BLOCK_BOUNDS.height - 1, value.getColorCode() | 0xFF000000);
|
||||
private void drawLegendBlock(MatrixStack matrices, int index, int x, int y, int mouseX, int mouseY, String key, TriggerPixelType<?> value) {
|
||||
DrawableHelper.fill(matrices, 0, 0, LEGEND_BLOCK_BOUNDS.width, LEGEND_BLOCK_BOUNDS.height, 0xFF003333);
|
||||
DrawableHelper.fill(matrices, 1, 1, LEGEND_BLOCK_BOUNDS.width - 1, LEGEND_BLOCK_BOUNDS.height - 1, value.getColorCode() | 0xFF000000);
|
||||
|
||||
char symbol = value.name().charAt(0);
|
||||
if (symbol == '[') {
|
||||
symbol = key.charAt(0);
|
||||
}
|
||||
|
||||
context.drawTextWithShadow(getFont(), Text.literal(String.valueOf(symbol).toUpperCase()), 2, 1, 0xFFFFFFFF);
|
||||
DrawableHelper.drawTextWithShadow(matrices, getFont(), Text.literal(String.valueOf(symbol).toUpperCase()), 2, 1, 0xFFFFFFFF);
|
||||
|
||||
if (LEGEND_BLOCK_BOUNDS.contains(mouseX, mouseY)) {
|
||||
List<Text> lines = value.getOptions().stream().map(option -> {
|
||||
|
@ -64,7 +65,8 @@ class LegendOverlayWidget implements Carousel.Element, ITextContext {
|
|||
return color == 0 ? s : s.withColor(value.getColorCode());
|
||||
}));
|
||||
}
|
||||
context.drawTooltip(getFont(), lines, 2, 10);
|
||||
|
||||
MinecraftClient.getInstance().currentScreen.renderTooltip(matrices, lines, 2, 10);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -19,7 +19,7 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
|||
|
||||
@Mixin(ClientPlayerEntity.class)
|
||||
abstract class MixinClientPlayerEntity extends AbstractClientPlayerEntity implements EquineRenderManager.RegistrationHandler {
|
||||
public MixinClientPlayerEntity() { super(null, null); }
|
||||
public MixinClientPlayerEntity() { super(null, null, null); }
|
||||
|
||||
@Nullable
|
||||
private IPony pony;
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
package com.minelittlepony.client.mixin;
|
||||
|
||||
import com.minelittlepony.api.config.PonyLevel;
|
||||
import com.minelittlepony.api.pony.DefaultPonySkinHelper;
|
||||
import com.minelittlepony.api.pony.IPony;
|
||||
import com.minelittlepony.client.MineLittlePony;
|
||||
import com.minelittlepony.settings.PonyLevel;
|
||||
|
||||
import net.minecraft.client.util.DefaultSkinHelper;
|
||||
import net.minecraft.util.Identifier;
|
||||
|
|
|
@ -2,8 +2,8 @@ package com.minelittlepony.client.mixin;
|
|||
|
||||
import net.minecraft.client.render.*;
|
||||
import net.minecraft.client.util.math.MatrixStack;
|
||||
import net.minecraft.util.math.Matrix4f;
|
||||
|
||||
import org.joml.Matrix4f;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
|
|
|
@ -10,7 +10,7 @@ import org.jetbrains.annotations.Nullable;
|
|||
|
||||
import net.minecraft.client.render.item.HeldItemRenderer;
|
||||
import net.minecraft.client.render.VertexConsumerProvider;
|
||||
import net.minecraft.client.render.model.json.ModelTransformationMode;
|
||||
import net.minecraft.client.render.model.json.ModelTransformation;
|
||||
import net.minecraft.client.util.math.MatrixStack;
|
||||
import net.minecraft.entity.LivingEntity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
@ -22,7 +22,7 @@ abstract class MixinHeldItemRenderer {
|
|||
private static final String LivingEntity = "Lnet/minecraft/entity/LivingEntity;";
|
||||
private static final String MatrixStack = "Lnet/minecraft/client/util/math/MatrixStack;";
|
||||
private static final String ItemStack = "Lnet/minecraft/item/ItemStack;";
|
||||
private static final String Mode = "Lnet/minecraft/client/render/model/json/ModelTransformationMode;";
|
||||
private static final String Mode = "Lnet/minecraft/client/render/model/json/ModelTransformation$Mode;";
|
||||
private static final String VertexConsumerProvider = "Lnet/minecraft/client/render/VertexConsumerProvider;";
|
||||
private static final String World = "Lnet/minecraft/world/World;";
|
||||
private static final String ItemRenderer = "Lnet/minecraft/client/render/item/ItemRenderer;";
|
||||
|
@ -36,7 +36,7 @@ abstract class MixinHeldItemRenderer {
|
|||
private void redirectRenderItem(ItemRenderer target,
|
||||
@Nullable LivingEntity entity,
|
||||
ItemStack item,
|
||||
ModelTransformationMode transform,
|
||||
ModelTransformation.Mode transform,
|
||||
boolean left,
|
||||
MatrixStack stack,
|
||||
VertexConsumerProvider renderContext,
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package com.minelittlepony.client.mixin;
|
||||
|
||||
import net.minecraft.network.packet.Packet;
|
||||
import net.minecraft.network.Packet;
|
||||
import net.minecraft.network.listener.ServerPlayPacketListener;
|
||||
import net.minecraft.network.packet.c2s.play.PlayerMoveC2SPacket;
|
||||
|
||||
|
|
|
@ -5,9 +5,8 @@ import com.minelittlepony.client.HorseCam;
|
|||
import java.util.Set;
|
||||
|
||||
import net.minecraft.network.listener.ClientPlayPacketListener;
|
||||
import net.minecraft.network.packet.Packet;
|
||||
import net.minecraft.network.packet.s2c.play.PlayerPositionLookS2CPacket;
|
||||
import net.minecraft.network.packet.s2c.play.PositionFlag;
|
||||
import net.minecraft.network.Packet;
|
||||
|
||||
import org.spongepowered.asm.mixin.*;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
|
@ -19,12 +18,12 @@ abstract class MixinPlayerPositionLookS2CPacket implements Packet<ClientPlayPack
|
|||
@Shadow @Mutable
|
||||
private @Final float pitch;
|
||||
@Shadow
|
||||
private @Final Set<PositionFlag> flags;
|
||||
private @Final Set<PlayerPositionLookS2CPacket.Flag> flags;
|
||||
|
||||
@Inject(method = "apply(Lnet/minecraft/network/listener/ClientPlayPacketListener;)V",
|
||||
at = @At("HEAD"))
|
||||
private void onApply(ClientPlayPacketListener clientPlayPacketListener, CallbackInfo info) {
|
||||
if (!flags.contains(PositionFlag.Y_ROT)) {
|
||||
if (!flags.contains(PlayerPositionLookS2CPacket.Flag.Y_ROT)) {
|
||||
pitch = HorseCam.transformIncomingServerCameraAngle(pitch);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -579,7 +579,7 @@ public abstract class AbstractPonyModel<T extends LivingEntity> extends ClientPo
|
|||
}
|
||||
if (main == arm) {
|
||||
matrices.translate(left * -0.05F, 0.5F, 0.2F);
|
||||
matrices.multiply(RotationAxis.POSITIVE_X.rotationDegrees(-60));
|
||||
matrices.multiply(Vec3f.POSITIVE_X.getDegreesQuaternion(-60));
|
||||
|
||||
return;
|
||||
}
|
||||
|
@ -600,8 +600,8 @@ public abstract class AbstractPonyModel<T extends LivingEntity> extends ClientPo
|
|||
}
|
||||
|
||||
if (attributes.isSleeping || attributes.isRiptide) {
|
||||
stack.multiply(RotationAxis.POSITIVE_X.rotationDegrees(90));
|
||||
stack.multiply(RotationAxis.POSITIVE_Y.rotationDegrees(180));
|
||||
stack.multiply(Vec3f.POSITIVE_X.getDegreesQuaternion(90));
|
||||
stack.multiply(Vec3f.POSITIVE_Y.getDegreesQuaternion(180));
|
||||
}
|
||||
|
||||
if (attributes.isHorsey) {
|
||||
|
|
|
@ -9,6 +9,7 @@ import net.minecraft.util.Hand;
|
|||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import com.minelittlepony.api.model.ModelAttributes;
|
||||
import com.minelittlepony.api.model.IPart;
|
||||
import com.minelittlepony.api.model.fabric.PonyModelPrepareCallback;
|
||||
import com.minelittlepony.api.pony.IPony;
|
||||
import com.minelittlepony.api.pony.IPonyData;
|
||||
|
@ -48,6 +49,7 @@ public abstract class ClientPonyModel<T extends LivingEntity> extends MsonPlayer
|
|||
|
||||
@Override
|
||||
public void updateLivingState(T entity, IPony pony, ModelAttributes.Mode mode) {
|
||||
IPart.Compat.attributes = attributes;
|
||||
child = entity.isBaby();
|
||||
attributes.updateLivingState(entity, pony, mode);
|
||||
PonyModelPrepareCallback.EVENT.invoker().onPonyModelPrepared(entity, this, mode);
|
||||
|
|
|
@ -66,7 +66,7 @@ final class ModelKeyImpl<M extends Model> implements ModelKey<M>, LocalBlock {
|
|||
if (ctx instanceof RootContext) {
|
||||
((RootContext)ctx).setModel(t);
|
||||
}
|
||||
((MsonModel)t).init(ctx);
|
||||
((MsonModel)t).init((ModelView)ctx);
|
||||
}
|
||||
return t;
|
||||
})
|
||||
|
|
|
@ -7,15 +7,15 @@ import net.minecraft.entity.EquipmentSlot;
|
|||
import net.minecraft.item.ArmorItem;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NbtElement;
|
||||
import net.minecraft.registry.Registries;
|
||||
import net.minecraft.util.registry.Registry;
|
||||
import net.minecraft.util.Identifier;
|
||||
import com.google.common.base.Strings;
|
||||
import com.google.common.cache.Cache;
|
||||
import com.google.common.cache.CacheBuilder;
|
||||
import com.minelittlepony.api.config.PonyConfig;
|
||||
import com.minelittlepony.api.model.armour.ArmourLayer;
|
||||
import com.minelittlepony.api.model.armour.ArmourVariant;
|
||||
import com.minelittlepony.api.model.armour.IArmourTextureResolver;
|
||||
import com.minelittlepony.settings.PonyConfig;
|
||||
import com.minelittlepony.util.ResourceUtil;
|
||||
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
@ -53,7 +53,7 @@ public class DefaultArmourTextureResolver implements IArmourTextureResolver {
|
|||
public Identifier getTexture(LivingEntity entity, ItemStack stack, EquipmentSlot slot, ArmourLayer layer, @Nullable String type) {
|
||||
Identifier material = stack.getItem() instanceof ArmorItem armor
|
||||
? new Identifier(armor.getMaterial().getName())
|
||||
: Registries.ITEM.getId(stack.getItem());
|
||||
: Registry.ITEM.getId(stack.getItem());
|
||||
String custom = getCustom(stack);
|
||||
|
||||
try {
|
||||
|
|
|
@ -4,8 +4,7 @@ import net.minecraft.client.model.ModelPart;
|
|||
import net.minecraft.client.util.math.MatrixStack;
|
||||
import net.minecraft.entity.mob.WitchEntity;
|
||||
import net.minecraft.util.*;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
import net.minecraft.util.math.RotationAxis;
|
||||
import net.minecraft.util.math.*;
|
||||
|
||||
import com.minelittlepony.api.model.ModelAttributes;
|
||||
import com.minelittlepony.api.pony.IPony;
|
||||
|
@ -66,7 +65,7 @@ public class WitchPonyModel extends EarthPonyModel<WitchEntity> {
|
|||
@Override
|
||||
protected void positionheldItem(Arm arm, MatrixStack matrices) {
|
||||
super.positionheldItem(arm, matrices);
|
||||
matrices.multiply(RotationAxis.POSITIVE_X.rotationDegrees(10));
|
||||
matrices.multiply(Vec3f.POSITIVE_X.getDegreesQuaternion(10));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
package com.minelittlepony.client.pony;
|
||||
|
||||
import com.google.common.cache.*;
|
||||
import com.minelittlepony.api.config.PonyConfig;
|
||||
import com.minelittlepony.api.config.PonyLevel;
|
||||
import com.minelittlepony.api.pony.IPony;
|
||||
import com.minelittlepony.api.pony.IPonyManager;
|
||||
import com.minelittlepony.client.MineLittlePony;
|
||||
import com.minelittlepony.client.render.PonyRenderDispatcher;
|
||||
import com.minelittlepony.client.render.blockentity.skull.PonySkullRenderer;
|
||||
import com.minelittlepony.settings.PonyConfig;
|
||||
import com.minelittlepony.settings.PonyLevel;
|
||||
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
|
|
|
@ -3,8 +3,7 @@ package com.minelittlepony.client.render;
|
|||
import net.minecraft.client.render.Frustum;
|
||||
import net.minecraft.entity.LivingEntity;
|
||||
import net.minecraft.util.math.Box;
|
||||
|
||||
import org.joml.Matrix4f;
|
||||
import net.minecraft.util.math.Matrix4f;
|
||||
|
||||
import com.minelittlepony.client.PonyBounds;
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@ import org.jetbrains.annotations.Nullable;
|
|||
|
||||
import net.minecraft.client.render.*;
|
||||
import net.minecraft.client.render.item.ItemRenderer;
|
||||
import net.minecraft.client.render.model.json.ModelTransformationMode;
|
||||
import net.minecraft.client.render.model.json.ModelTransformation;
|
||||
import net.minecraft.client.util.math.MatrixStack;
|
||||
import net.minecraft.entity.LivingEntity;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
|
@ -17,15 +17,26 @@ import net.minecraft.item.ItemStack;
|
|||
import net.minecraft.screen.PlayerScreenHandler;
|
||||
import net.minecraft.util.Identifier;
|
||||
import net.minecraft.util.UseAction;
|
||||
import net.minecraft.util.math.RotationAxis;
|
||||
import net.minecraft.util.math.Vec3f;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class LevitatingItemRenderer {
|
||||
@Deprecated
|
||||
private static int COLOR;
|
||||
@Deprecated
|
||||
public static boolean isEnabled() {
|
||||
return false;
|
||||
}
|
||||
@Deprecated
|
||||
public static RenderLayer getRenderLayer(Identifier texture) {
|
||||
return MagicGlow.getColoured(texture, COLOR);
|
||||
}
|
||||
|
||||
private VertexConsumerProvider getProvider(IPony pony, VertexConsumerProvider renderContext) {
|
||||
final int color = pony.metadata().getGlowColor();
|
||||
return layer -> {
|
||||
Identifier texture = RenderLayerUtil.getTexture(layer).orElse(PlayerScreenHandler.BLOCK_ATLAS_TEXTURE);
|
||||
if (texture == ItemRenderer.ENTITY_ENCHANTMENT_GLINT || texture == ItemRenderer.ITEM_ENCHANTMENT_GLINT) {
|
||||
if (texture == ItemRenderer.ENCHANTED_ITEM_GLINT) {
|
||||
return renderContext.getBuffer(layer);
|
||||
}
|
||||
return renderContext.getBuffer(MagicGlow.getColoured(texture, color));
|
||||
|
@ -35,12 +46,14 @@ public class LevitatingItemRenderer {
|
|||
/**
|
||||
* Renders an item with a magical overlay.
|
||||
*/
|
||||
public void renderItem(ItemRenderer itemRenderer, @Nullable LivingEntity entity, ItemStack stack, ModelTransformationMode mode, boolean left, MatrixStack matrix, VertexConsumerProvider renderContext, @Nullable World world, int lightUv, int posLong) {
|
||||
public void renderItem(ItemRenderer itemRenderer, @Nullable LivingEntity entity, ItemStack stack, ModelTransformation.Mode mode, boolean left, MatrixStack matrix, VertexConsumerProvider renderContext, @Nullable World world, int lightUv, int posLong) {
|
||||
|
||||
if (entity instanceof PlayerEntity && (mode.isFirstPerson() || mode == ModelTransformationMode.THIRD_PERSON_LEFT_HAND || mode == ModelTransformationMode.THIRD_PERSON_RIGHT_HAND)) {
|
||||
if (entity instanceof PlayerEntity && (mode.isFirstPerson() || mode == ModelTransformation.Mode.THIRD_PERSON_LEFT_HAND || mode == ModelTransformation.Mode.THIRD_PERSON_RIGHT_HAND)) {
|
||||
|
||||
IPony pony = IPony.getManager().getPony((PlayerEntity)entity);
|
||||
|
||||
COLOR = pony.metadata().getGlowColor();
|
||||
|
||||
matrix.push();
|
||||
|
||||
boolean doMagic = MineLittlePony.getInstance().getConfig().fpsmagic.get() && pony.hasMagic();
|
||||
|
@ -96,8 +109,8 @@ public class LevitatingItemRenderer {
|
|||
distanceChange);
|
||||
|
||||
if (!handHeldTool) { // bows have to point forwards
|
||||
stack.multiply(RotationAxis.POSITIVE_Y.rotationDegrees(sign * -60 + floatAmount));
|
||||
stack.multiply(RotationAxis.POSITIVE_Z.rotationDegrees(sign * 30 + driftAmount));
|
||||
stack.multiply(Vec3f.POSITIVE_Y.getDegreesQuaternion(sign * -60 + floatAmount));
|
||||
stack.multiply(Vec3f.POSITIVE_Z.getDegreesQuaternion(sign * 30 + driftAmount));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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()
|
||||
.program(EYES_PROGRAM)
|
||||
.shader(EYES_SHADER)
|
||||
.writeMaskState(COLOR_MASK)
|
||||
.depthTest(LEQUAL_DEPTH_TEST)
|
||||
.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) -> {
|
||||
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))
|
||||
.program(EYES_PROGRAM)
|
||||
.shader(EYES_SHADER)
|
||||
.writeMaskState(COLOR_MASK)
|
||||
.depthTest(LEQUAL_DEPTH_TEST)
|
||||
.transparency(LIGHTNING_TRANSPARENCY)
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
package com.minelittlepony.client.render.blockentity.skull;
|
||||
|
||||
import com.google.common.base.Suppliers;
|
||||
import com.minelittlepony.api.config.PonyConfig;
|
||||
import com.minelittlepony.api.pony.IPony;
|
||||
import com.minelittlepony.client.model.AbstractPonyModel;
|
||||
import com.minelittlepony.client.render.MobRenderers;
|
||||
import com.minelittlepony.client.render.blockentity.skull.PonySkullRenderer.ISkull;
|
||||
import com.minelittlepony.mson.api.ModelKey;
|
||||
import com.minelittlepony.settings.PonyConfig;
|
||||
import com.mojang.authlib.GameProfile;
|
||||
|
||||
import java.util.function.Supplier;
|
||||
|
@ -15,10 +15,9 @@ import net.minecraft.client.model.ModelPart;
|
|||
import net.minecraft.client.render.VertexConsumer;
|
||||
import net.minecraft.client.util.math.MatrixStack;
|
||||
import net.minecraft.util.Identifier;
|
||||
import net.minecraft.util.math.RotationAxis;
|
||||
import net.minecraft.util.math.Vec3f;
|
||||
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.joml.Vector3f;
|
||||
|
||||
public class MobSkull implements ISkull {
|
||||
private final Identifier texture;
|
||||
|
@ -50,12 +49,12 @@ public class MobSkull implements ISkull {
|
|||
|
||||
@Override
|
||||
public void setAngles(float yaw, float animationProgress) {
|
||||
Vector3f v = new Vector3f(0, -2, 1.99F);
|
||||
v.rotate(RotationAxis.POSITIVE_Y.rotationDegrees(yaw));
|
||||
Vec3f v = new Vec3f(0, -2, 1.99F);
|
||||
v.rotate(Vec3f.POSITIVE_Y.getDegreesQuaternion(yaw));
|
||||
ModelPart head = ponyHead.get().getHead();
|
||||
head.pivotX = v.x;
|
||||
head.pivotY = v.y;
|
||||
head.pivotZ = v.z;
|
||||
head.pivotX = v.getX();
|
||||
head.pivotY = v.getY();
|
||||
head.pivotZ = v.getZ();
|
||||
ponyHead.get().setVisible(true);
|
||||
ponyHead.get().setHeadRotation(animationProgress, yaw, 0);
|
||||
}
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
package com.minelittlepony.client.render.blockentity.skull;
|
||||
|
||||
import com.minelittlepony.api.config.PonyConfig;
|
||||
import com.minelittlepony.api.config.PonyLevel;
|
||||
import com.minelittlepony.api.pony.IPony;
|
||||
import com.minelittlepony.api.pony.meta.Race;
|
||||
import com.minelittlepony.client.SkinsProxy;
|
||||
import com.minelittlepony.client.model.*;
|
||||
import com.minelittlepony.client.render.blockentity.skull.PonySkullRenderer.ISkull;
|
||||
import com.minelittlepony.settings.PonyConfig;
|
||||
import com.minelittlepony.settings.PonyLevel;
|
||||
import com.mojang.authlib.GameProfile;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
@ -16,11 +16,10 @@ import net.minecraft.client.render.VertexConsumer;
|
|||
import net.minecraft.client.util.DefaultSkinHelper;
|
||||
import net.minecraft.client.util.math.MatrixStack;
|
||||
import net.minecraft.util.Identifier;
|
||||
import net.minecraft.util.Uuids;
|
||||
import net.minecraft.util.math.RotationAxis;
|
||||
import net.minecraft.util.dynamic.DynamicSerializableUuid;
|
||||
import net.minecraft.util.math.Vec3f;
|
||||
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.joml.Vector3f;
|
||||
|
||||
public class PlayerPonySkull implements ISkull {
|
||||
private AbstractPonyModel<?> ponyHead;
|
||||
|
@ -46,7 +45,7 @@ public class PlayerPonySkull implements ISkull {
|
|||
return skin;
|
||||
}
|
||||
|
||||
return DefaultSkinHelper.getTexture(Uuids.getUuidFromProfile(profile));
|
||||
return DefaultSkinHelper.getTexture(DynamicSerializableUuid.getUuidFromProfile(profile));
|
||||
}
|
||||
|
||||
return DefaultSkinHelper.getTexture();
|
||||
|
@ -68,11 +67,11 @@ public class PlayerPonySkull implements ISkull {
|
|||
|
||||
@Override
|
||||
public void setAngles(float yaw, float animationProgress) {
|
||||
Vector3f v = new Vector3f(0, -2, 2);
|
||||
v.rotate(RotationAxis.POSITIVE_Y.rotationDegrees(yaw));
|
||||
ponyHead.getHead().pivotX = v.x;
|
||||
ponyHead.getHead().pivotY = v.y;
|
||||
ponyHead.getHead().pivotZ = v.z;
|
||||
Vec3f v = new Vec3f(0, -2, 2);
|
||||
v.rotate(Vec3f.POSITIVE_Y.getDegreesQuaternion(yaw));
|
||||
ponyHead.getHead().pivotX = v.getX();
|
||||
ponyHead.getHead().pivotY = v.getY();
|
||||
ponyHead.getHead().pivotZ = v.getZ();
|
||||
ponyHead.setVisible(true);
|
||||
ponyHead.setHeadRotation(animationProgress, yaw, 0);
|
||||
if (renderingEars) {
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
package com.minelittlepony.client.render.blockentity.skull;
|
||||
|
||||
import com.google.common.collect.Maps;
|
||||
import com.minelittlepony.api.config.PonyConfig;
|
||||
import com.minelittlepony.api.pony.IPony;
|
||||
import com.minelittlepony.client.MineLittlePony;
|
||||
import com.minelittlepony.client.model.ModelType;
|
||||
import com.minelittlepony.client.render.MobRenderers;
|
||||
import com.minelittlepony.client.render.entity.SkeleponyRenderer;
|
||||
import com.minelittlepony.client.render.entity.ZomponyRenderer;
|
||||
import com.minelittlepony.settings.PonyConfig;
|
||||
import com.mojang.authlib.GameProfile;
|
||||
|
||||
import net.minecraft.block.SkullBlock;
|
||||
|
|
|
@ -45,7 +45,7 @@ public abstract class AbstractPonyRenderer<T extends MobEntity, M extends Entity
|
|||
}
|
||||
|
||||
protected void addFeatures(EntityRendererFactory.Context context) {
|
||||
addFeature(new ArmourFeature<>(this, context.getModelManager()));
|
||||
addFeature(new ArmourFeature<>(this));
|
||||
addFeature(createHeldItemFeature(context));
|
||||
addFeature(new SkullFeature<>(this, context.getModelLoader()));
|
||||
addFeature(new ElytraFeature<>(this));
|
||||
|
|
|
@ -51,7 +51,7 @@ public class PlayerPonyRenderer extends PlayerEntityRenderer implements IPonyRen
|
|||
|| feature instanceof ElytraFeatureRenderer
|
||||
|| feature instanceof ShoulderParrotFeatureRenderer;
|
||||
});
|
||||
addLayer(new ArmourFeature<>(this, context.getModelManager()));
|
||||
addLayer(new ArmourFeature<>(this));
|
||||
addLayer(new HeldItemFeature(this, context.getHeldItemRenderer()));
|
||||
addLayer(new DJPon3Feature<>(this));
|
||||
addLayer(new CapeFeature<>(this));
|
||||
|
@ -86,9 +86,9 @@ public class PlayerPonyRenderer extends PlayerEntityRenderer implements IPonyRen
|
|||
float yaw = MathHelper.lerpAngleDegrees(tickDelta, entity.prevBodyYaw, entity.bodyYaw);
|
||||
float l = entity.getWidth() / 2 * manager.getPony(entity).metadata().getSize().getScaleFactor();
|
||||
|
||||
stack.multiply(RotationAxis.NEGATIVE_Y.rotationDegrees(yaw));
|
||||
stack.multiply(Vec3f.NEGATIVE_Y.getDegreesQuaternion(yaw));
|
||||
stack.translate(0, 0, -l);
|
||||
stack.multiply(RotationAxis.POSITIVE_Y.rotationDegrees(yaw));
|
||||
stack.multiply(Vec3f.POSITIVE_Y.getDegreesQuaternion(yaw));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -65,8 +65,7 @@ public class PonyStandRenderer extends ArmorStandEntityRenderer {
|
|||
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)),
|
||||
context.getModelManager()
|
||||
new ArmorStandArmorEntityModel(context.getPart(EntityModelLayers.ARMOR_STAND_OUTER_ARMOR))
|
||||
);
|
||||
|
||||
pony.applyMetadata(new PonyData(Race.EARTH));
|
||||
|
|
|
@ -7,23 +7,18 @@ import com.minelittlepony.client.model.armour.DefaultArmourTextureResolver;
|
|||
import com.minelittlepony.client.render.IPonyRenderContext;
|
||||
import com.minelittlepony.common.util.Color;
|
||||
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
import net.minecraft.client.render.*;
|
||||
import net.minecraft.client.render.entity.model.*;
|
||||
import net.minecraft.client.render.item.ItemRenderer;
|
||||
import net.minecraft.client.render.model.BakedModelManager;
|
||||
import net.minecraft.client.texture.Sprite;
|
||||
import net.minecraft.client.texture.SpriteAtlasTexture;
|
||||
import net.minecraft.client.util.math.MatrixStack;
|
||||
import net.minecraft.entity.EquipmentSlot;
|
||||
import net.minecraft.entity.LivingEntity;
|
||||
import net.minecraft.item.*;
|
||||
import net.minecraft.item.trim.ArmorTrim;
|
||||
import net.minecraft.util.Identifier;
|
||||
|
||||
public class ArmourFeature<T extends LivingEntity, M extends EntityModel<T> & IPonyModel<T>> extends AbstractPonyFeature<T, M> {
|
||||
|
||||
public ArmourFeature(IPonyRenderContext<T, M> context, BakedModelManager bakery) {
|
||||
public ArmourFeature(IPonyRenderContext<T, M> context) {
|
||||
super(context);
|
||||
}
|
||||
|
||||
|
@ -83,16 +78,6 @@ public class ArmourFeature<T extends LivingEntity, M extends EntityModel<T> & IP
|
|||
m.render(matrices, getArmorConsumer(renderContext, tex, false), light, OverlayTexture.DEFAULT_UV, 1, 1, 1, 1);
|
||||
});
|
||||
}
|
||||
|
||||
if (stack.getItem() instanceof ArmorItem armor) {
|
||||
ArmorTrim.getTrim(entity.getWorld().getRegistryManager(), stack).ifPresent(trim -> {
|
||||
pony.getArmourModel(stack, layer, ArmourVariant.TRIM)
|
||||
.filter(m -> m.poseModel(entity, limbAngle, limbDistance, age, headYaw, headPitch, armorSlot, layer, pony.body()))
|
||||
.ifPresent(m -> {
|
||||
m.render(matrices, getTrimConsumer(renderContext, armor.getMaterial(), trim, layer, glint), light, OverlayTexture.DEFAULT_UV, 1, 1, 1, 1);
|
||||
});
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -100,14 +85,4 @@ public class ArmourFeature<T extends LivingEntity, M extends EntityModel<T> & IP
|
|||
return ItemRenderer.getArmorGlintConsumer(provider, RenderLayer.getArmorCutoutNoCull(texture), false, glint);
|
||||
}
|
||||
|
||||
private static VertexConsumer getTrimConsumer(VertexConsumerProvider provider, ArmorMaterial material, ArmorTrim trim, ArmourLayer layer, boolean glint) {
|
||||
SpriteAtlasTexture armorTrimsAtlas = MinecraftClient.getInstance().getBakedModelManager().getAtlas(TexturedRenderLayers.ARMOR_TRIMS_ATLAS_TEXTURE);
|
||||
Sprite sprite = armorTrimsAtlas.getSprite(
|
||||
layer == ArmourLayer.INNER ? trim.getLeggingsModelId(material) : trim.getGenericModelId(material)
|
||||
);
|
||||
|
||||
return sprite.getTextureSpecificVertexConsumer(
|
||||
ItemRenderer.getDirectItemGlintConsumer(provider, TexturedRenderLayers.getArmorTrims(), true, glint)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -58,11 +58,11 @@ public class CapeFeature<M extends ClientPonyModel<AbstractClientPlayerEntity>>
|
|||
float camera = MathHelper.lerp(tickDelta, player.prevStrideDistance, player.strideDistance);
|
||||
capeMotionY += MathHelper.sin(MathHelper.lerp(tickDelta, player.prevHorizontalSpeed, player.horizontalSpeed) * 6) * 32 * camera;
|
||||
|
||||
stack.multiply(RotationAxis.POSITIVE_X.rotationDegrees(2 + capeMotionX / 12 + capeMotionY));
|
||||
stack.multiply(RotationAxis.POSITIVE_Z.rotationDegrees( diagMotion / 2));
|
||||
stack.multiply(RotationAxis.POSITIVE_Y.rotationDegrees(-diagMotion / 2));
|
||||
stack.multiply(RotationAxis.POSITIVE_Z.rotationDegrees(180));
|
||||
stack.multiply(RotationAxis.POSITIVE_X.rotationDegrees(90));
|
||||
stack.multiply(Vec3f.POSITIVE_X.getDegreesQuaternion(2 + capeMotionX / 12 + capeMotionY));
|
||||
stack.multiply(Vec3f.POSITIVE_Z.getDegreesQuaternion( diagMotion / 2));
|
||||
stack.multiply(Vec3f.POSITIVE_Y.getDegreesQuaternion(-diagMotion / 2));
|
||||
stack.multiply(Vec3f.POSITIVE_Z.getDegreesQuaternion(180));
|
||||
stack.multiply(Vec3f.POSITIVE_X.getDegreesQuaternion(90));
|
||||
|
||||
VertexConsumer vertices = renderContext.getBuffer(RenderLayer.getEntitySolid(player.getCapeTexture()));
|
||||
model.renderCape(stack, vertices, lightUv, OverlayTexture.DEFAULT_UV);
|
||||
|
|
|
@ -9,7 +9,7 @@ import net.minecraft.client.render.entity.feature.HeldItemFeatureRenderer;
|
|||
import net.minecraft.client.render.entity.model.EntityModel;
|
||||
import net.minecraft.client.render.entity.model.ModelWithArms;
|
||||
import net.minecraft.client.render.item.HeldItemRenderer;
|
||||
import net.minecraft.client.render.model.json.ModelTransformationMode;
|
||||
import net.minecraft.client.render.model.json.ModelTransformation;
|
||||
import net.minecraft.client.util.math.MatrixStack;
|
||||
import net.minecraft.entity.LivingEntity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
@ -46,9 +46,9 @@ public class HeldItemFeature<T extends LivingEntity, M extends EntityModel<T> &
|
|||
model.transform(BodyPart.LEGS, stack);
|
||||
|
||||
model.getAttributes().heldStack = right;
|
||||
renderItem(entity, right, ModelTransformationMode.THIRD_PERSON_RIGHT_HAND, Arm.RIGHT, stack, renderContext, lightUv);
|
||||
renderItem(entity, right, ModelTransformation.Mode.THIRD_PERSON_RIGHT_HAND, Arm.RIGHT, stack, renderContext, lightUv);
|
||||
model.getAttributes().heldStack = left;
|
||||
renderItem(entity, left, ModelTransformationMode.THIRD_PERSON_LEFT_HAND, Arm.LEFT, stack, renderContext, lightUv);
|
||||
renderItem(entity, left, ModelTransformation.Mode.THIRD_PERSON_LEFT_HAND, Arm.LEFT, stack, renderContext, lightUv);
|
||||
model.getAttributes().heldStack = ItemStack.EMPTY;
|
||||
stack.pop();
|
||||
}
|
||||
|
|
|
@ -8,9 +8,8 @@ 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.util.math.RotationAxis;
|
||||
import net.minecraft.util.math.Vec3f;
|
||||
import net.minecraft.entity.EntityType;
|
||||
import net.minecraft.entity.passive.ParrotEntity;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.nbt.NbtCompound;
|
||||
import net.minecraft.util.Identifier;
|
||||
|
@ -43,7 +42,7 @@ public class PassengerFeature<T extends PlayerEntity, M extends ClientPonyModel<
|
|||
private Optional<Identifier> getShoulderParrot(NbtCompound tag) {
|
||||
return EntityType.get(tag.getString("id"))
|
||||
.filter(p -> p == EntityType.PARROT)
|
||||
.map(type -> ParrotEntityRenderer.getTexture(ParrotEntity.Variant.byIndex(tag.getInt("Variant"))));
|
||||
.map(type -> ParrotEntityRenderer.TEXTURES[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) {
|
||||
|
@ -55,7 +54,7 @@ public class PassengerFeature<T extends PlayerEntity, M extends ClientPonyModel<
|
|||
sigma * 0.25,
|
||||
entity.isInSneakingPose() ? -0.9 : -1.2,
|
||||
0.45);
|
||||
stack.multiply(RotationAxis.NEGATIVE_Z.rotationDegrees(sigma * -5));
|
||||
stack.multiply(Vec3f.NEGATIVE_Z.getDegreesQuaternion(sigma * -5));
|
||||
|
||||
VertexConsumer buffer = renderContext.getBuffer(model.getLayer(texture));
|
||||
model.poseOnShoulder(stack, buffer, light, OverlayTexture.DEFAULT_UV, limbDistance, limbAngle, headYaw, headPitch, entity.age);
|
||||
|
|
|
@ -17,9 +17,9 @@ 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.ModelTransformationMode;
|
||||
import net.minecraft.client.render.model.json.ModelTransformation;
|
||||
import net.minecraft.client.util.math.MatrixStack;
|
||||
import net.minecraft.util.math.RotationAxis;
|
||||
import net.minecraft.util.math.Vec3f;
|
||||
import net.minecraft.entity.EquipmentSlot;
|
||||
import net.minecraft.entity.LivingEntity;
|
||||
import net.minecraft.item.ArmorItem;
|
||||
|
@ -71,12 +71,12 @@ public class SkullFeature<T extends LivingEntity, M extends EntityModel<T> & IPo
|
|||
}
|
||||
|
||||
private void renderBlock(MatrixStack stack, VertexConsumerProvider renderContext, T entity, ItemStack itemstack, int lightUv) {
|
||||
stack.multiply(RotationAxis.POSITIVE_Y.rotationDegrees(180));
|
||||
stack.multiply(Vec3f.POSITIVE_Y.getDegreesQuaternion(180));
|
||||
stack.scale(0.625F, -0.625F, -0.625F);
|
||||
stack.translate(0, 0.6F, -0.21F);
|
||||
|
||||
MinecraftClient.getInstance().getItemRenderer()
|
||||
.renderItem(entity, itemstack, ModelTransformationMode.HEAD, false, stack, renderContext, entity.getWorld(), lightUv, OverlayTexture.DEFAULT_UV, entity.getId() + ModelTransformationMode.HEAD.ordinal());
|
||||
.renderItem(entity, itemstack, ModelTransformation.Mode.HEAD, false, stack, renderContext, entity.getWorld(), lightUv, OverlayTexture.DEFAULT_UV, entity.getId() + ModelTransformation.Mode.HEAD.ordinal());
|
||||
}
|
||||
|
||||
private void renderSkull(MatrixStack stack, VertexConsumerProvider renderContext, ItemStack itemstack, boolean isVillager, float limbDistance, int lightUv) {
|
||||
|
|
|
@ -49,7 +49,7 @@ public class IllagerPonyRenderer<T extends IllagerEntity> extends PonyRenderer<T
|
|||
@Override
|
||||
public void render(IllusionerEntity entity, float entityYaw, float tickDelta, MatrixStack stack, VertexConsumerProvider renderContext, int lightUv) {
|
||||
if (entity.isInvisible()) {
|
||||
Vec3d[] clones = entity.getMirrorCopyOffsets(tickDelta);
|
||||
Vec3d[] clones = entity.method_7065(tickDelta);
|
||||
float rotation = getAnimationProgress(entity, tickDelta);
|
||||
|
||||
for (int i = 0; i < clones.length; ++i) {
|
||||
|
|
|
@ -8,7 +8,7 @@ import net.minecraft.client.render.entity.model.EntityModel;
|
|||
import net.minecraft.client.render.entity.model.ModelWithHat;
|
||||
import net.minecraft.client.util.math.MatrixStack;
|
||||
import net.minecraft.entity.LivingEntity;
|
||||
import net.minecraft.registry.Registries;
|
||||
import net.minecraft.util.registry.Registry;
|
||||
import net.minecraft.util.Identifier;
|
||||
import net.minecraft.util.Util;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
|
@ -56,9 +56,9 @@ class NpcClothingFeature<
|
|||
M entityModel = getContextModel();
|
||||
|
||||
if (entity.isBaby() || data.getProfession() == VillagerProfession.NONE) {
|
||||
Identifier typeSkin = createTexture("type", Registries.VILLAGER_TYPE.getId(data.getType()));
|
||||
Identifier typeSkin = createTexture("type", Registry.VILLAGER_TYPE.getId(data.getType()));
|
||||
if (!ResourceUtil.textureExists(typeSkin)) {
|
||||
typeSkin = createTexture("type", Registries.VILLAGER_TYPE.getId(VillagerType.PLAINS));
|
||||
typeSkin = createTexture("type", Registry.VILLAGER_TYPE.getId(VillagerType.PLAINS));
|
||||
}
|
||||
renderModel(entityModel, typeSkin, matrixStack, provider, i, entity, 1, 1, 1);
|
||||
} else {
|
||||
|
@ -71,8 +71,8 @@ class NpcClothingFeature<
|
|||
VillagerProfession profession = data.getProfession();
|
||||
int level = MathHelper.clamp(data.getLevel(), 1, LEVEL_TO_ID.size());
|
||||
|
||||
Identifier typeId = Registries.VILLAGER_TYPE.getId(type);
|
||||
Identifier profId = Registries.VILLAGER_PROFESSION.getId(profession);
|
||||
Identifier typeId = Registry.VILLAGER_TYPE.getId(type);
|
||||
Identifier profId = Registry.VILLAGER_PROFESSION.getId(profession);
|
||||
|
||||
Identifier key = new Identifier("minelittlepony", (typeId + "/" + profId + "/" + level).replace(':', '_'));
|
||||
|
||||
|
@ -102,7 +102,7 @@ class NpcClothingFeature<
|
|||
}
|
||||
|
||||
public Identifier createTexture(VillagerDataContainer entity, String category) {
|
||||
return createTexture(category, Registries.VILLAGER_PROFESSION.getId(entity.getVillagerData().getProfession()));
|
||||
return createTexture(category, Registry.VILLAGER_PROFESSION.getId(entity.getVillagerData().getProfession()));
|
||||
}
|
||||
|
||||
private Identifier createTexture(String category, Identifier identifier) {
|
||||
|
|
|
@ -3,11 +3,11 @@ package com.minelittlepony.client.settings;
|
|||
import net.minecraft.client.MinecraftClient;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
|
||||
import com.minelittlepony.api.config.PonyConfig;
|
||||
import com.minelittlepony.client.model.armour.DefaultArmourTextureResolver;
|
||||
import com.minelittlepony.client.render.MobRenderers;
|
||||
import com.minelittlepony.common.client.gui.VisibilityMode;
|
||||
import com.minelittlepony.common.util.settings.Setting;
|
||||
import com.minelittlepony.settings.PonyConfig;
|
||||
|
||||
import java.nio.file.Path;
|
||||
|
||||
|
|
|
@ -54,20 +54,20 @@ public interface PonyPosture {
|
|||
|
||||
if (RenderPass.getCurrent() == RenderPass.GUI) {
|
||||
Vec3d vec3d = player.getRotationVec(tickDelta);
|
||||
Vec3d vec3d2 = ((AbstractClientPlayerEntity)player).lerpVelocity(tickDelta);
|
||||
Vec3d vec3d2 = ((AbstractClientPlayerEntity)player).getVelocity();
|
||||
double d = vec3d2.horizontalLengthSquared();
|
||||
double e = vec3d.horizontalLengthSquared();
|
||||
if (d > 0.0 && e > 0.0) {
|
||||
double l = (vec3d2.x * vec3d.x + vec3d2.z * vec3d.z) / Math.sqrt(d * e);
|
||||
double m = vec3d2.x * vec3d.z - vec3d2.z * vec3d.x;
|
||||
stack.multiply(RotationAxis.NEGATIVE_Y.rotation((float)(Math.signum(m) * Math.acos(l))));
|
||||
stack.multiply(Vec3f.NEGATIVE_Y.getDegreesQuaternion((float)(Math.signum(m) * Math.acos(l))));
|
||||
}
|
||||
}
|
||||
|
||||
float roll = (float)player.getRoll() + tickDelta;
|
||||
float targetRoll = MathHelper.clamp(roll * roll / 100F, 0, 1);
|
||||
if (!player.isUsingRiptide()) {
|
||||
stack.multiply(RotationAxis.NEGATIVE_X.rotationDegrees(targetRoll * (-90 - player.getPitch())));
|
||||
stack.multiply(Vec3f.NEGATIVE_X.getDegreesQuaternion(targetRoll * (-90 - player.getPitch())));
|
||||
}
|
||||
|
||||
} else if (leaningPitch > 0) {
|
||||
|
@ -75,7 +75,7 @@ public interface PonyPosture {
|
|||
stack.translate(0.0f, 1.0f, -0.3f);
|
||||
}
|
||||
float pitch = MathHelper.lerp(leaningPitch, 0, player.isTouchingWater() ? -90 - player.getPitch() : -90);
|
||||
stack.multiply(RotationAxis.NEGATIVE_X.rotationDegrees(pitch));
|
||||
stack.multiply(Vec3f.NEGATIVE_X.getDegreesQuaternion(pitch));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,7 +4,7 @@ import com.minelittlepony.api.model.IModel;
|
|||
import com.minelittlepony.common.util.animation.MotionCompositor;
|
||||
|
||||
import net.minecraft.client.util.math.MatrixStack;
|
||||
import net.minecraft.util.math.RotationAxis;
|
||||
import net.minecraft.util.math.Vec3f;
|
||||
import net.minecraft.entity.LivingEntity;
|
||||
|
||||
public class PostureFlight extends MotionCompositor implements PonyPosture {
|
||||
|
@ -24,8 +24,8 @@ public class PostureFlight extends MotionCompositor implements PonyPosture {
|
|||
|
||||
model.getAttributes().motionRoll = model.getAttributes().getMainInterpolator().interpolate("pegasusRoll", model.getAttributes().motionRoll, 10);
|
||||
|
||||
stack.multiply(RotationAxis.POSITIVE_X.rotationDegrees(model.getAttributes().motionPitch));
|
||||
stack.multiply(RotationAxis.POSITIVE_Z.rotationDegrees(model.getAttributes().motionRoll));
|
||||
stack.multiply(Vec3f.POSITIVE_X.getDegreesQuaternion(model.getAttributes().motionPitch));
|
||||
stack.multiply(Vec3f.POSITIVE_Z.getDegreesQuaternion(model.getAttributes().motionRoll));
|
||||
stack.translate(0, yOffset, 0);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
package com.minelittlepony.api.config;
|
||||
package com.minelittlepony.settings;
|
||||
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package com.minelittlepony.api.config;
|
||||
package com.minelittlepony.settings;
|
||||
|
||||
public enum PonyLevel {
|
||||
PONIES,
|
Loading…
Add table
Reference in a new issue