1.20.5 -> 1.21-pre2

This commit is contained in:
Sollace 2024-06-04 23:43:55 +01:00
parent 8afa58f014
commit 91976a1020
No known key found for this signature in database
GPG key ID: E52FACE7B5C773DB
62 changed files with 188 additions and 376 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.20.5 minecraft_version=1.21-pre2
yarn_mappings=1.20.5+build.1 yarn_mappings=1.21-pre2+build.2
loader_version=0.15.7 loader_version=0.15.11
fabric_version=0.97.5+1.20.5 fabric_version=0.99.4+1.21
# Mod Properties # Mod Properties
group=com.minelittlepony group=com.minelittlepony
@ -19,7 +19,7 @@ org.gradle.daemon=false
modrinth_project_id=JBjInUXM modrinth_project_id=JBjInUXM
# Dependencies # Dependencies
modmenu_version=10.0.0-beta.1 modmenu_version=11.0.0-beta.1
kirin_version=1.18.0-beta.1+1.20.5 kirin_version=1.19.0-beta.1+1.21
hd_skins_version=6.12.3-beta.6+1.20.5 hd_skins_version=6.12.3-beta.6+1.20.5
mson_version=1.9.3+1.20.5 mson_version=1.10.0-beta.2+1.21

View file

@ -94,7 +94,7 @@ public class PonyConfig extends Config {
public PonyConfig(Path path) { public PonyConfig(Path path) {
super(new HeirarchicalJsonConfigAdapter(new GsonBuilder() super(new HeirarchicalJsonConfigAdapter(new GsonBuilder()
.registerTypeAdapter(Identifier.class, new ToStringAdapter<>(Identifier::toString, Identifier::new))), path); .registerTypeAdapter(Identifier.class, new ToStringAdapter<>(Identifier::toString, Identifier::of))), path);
instance = this; instance = this;
} }

View file

@ -65,7 +65,7 @@ public class Channel {
} }
record PonyDataPayload(PonyData data) implements CustomPayload { record PonyDataPayload(PonyData data) implements CustomPayload {
public static final Id<PonyDataPayload> ID = new Id<>(new Identifier("minelittlepony", "pony_data")); public static final Id<PonyDataPayload> ID = new Id<>(Identifier.of("minelittlepony", "pony_data"));
public static final PacketCodec<PacketByteBuf, PonyDataPayload> CODEC = CustomPayload.codecOf( public static final PacketCodec<PacketByteBuf, PonyDataPayload> CODEC = CustomPayload.codecOf(
(p, buffer) -> MsgPonyData.write(p.data(), buffer), (p, buffer) -> MsgPonyData.write(p.data(), buffer),
buffer -> new PonyDataPayload(MsgPonyData.read(buffer)) buffer -> new PonyDataPayload(MsgPonyData.read(buffer))
@ -79,7 +79,7 @@ public class Channel {
record PonyDataRequest() implements CustomPayload { record PonyDataRequest() implements CustomPayload {
public static final PonyDataRequest INSTANCE = new PonyDataRequest(); public static final PonyDataRequest INSTANCE = new PonyDataRequest();
private static final Id<PonyDataRequest> ID = new Id<>(new Identifier("minelittlepony", "request_pony_data")); private static final Id<PonyDataRequest> ID = new Id<>(Identifier.of("minelittlepony", "request_pony_data"));
public static final PacketCodec<PacketByteBuf, PonyDataRequest> CODEC = PacketCodec.unit(INSTANCE); public static final PacketCodec<PacketByteBuf, PonyDataRequest> CODEC = PacketCodec.unit(INSTANCE);
@Override @Override

View file

@ -14,7 +14,7 @@ public interface SubModel {
/** /**
* Renders this model component. * Renders this model component.
*/ */
void renderPart(MatrixStack stack, VertexConsumer vertices, int overlay, int light, float red, float green, float blue, float alpha, ModelAttributes attributes); void renderPart(MatrixStack stack, VertexConsumer vertices, int overlay, int light, int color, ModelAttributes attributes);
/** /**
* Sets whether this part should be rendered. * Sets whether this part should be rendered.

View file

@ -27,14 +27,14 @@ public abstract class AbstractGearModel extends Model implements Gear {
} }
@Override @Override
public void render(MatrixStack stack, VertexConsumer vertices, int overlayUv, int lightUv, float red, float green, float blue, float alpha, UUID interpolatorId) { public void render(MatrixStack stack, VertexConsumer vertices, int overlay, int light, int color, UUID interpolatorId) {
render(stack, vertices, overlayUv, lightUv, red, green, blue, alpha); render(stack, vertices, overlay, light, color);
} }
@Override @Override
public void render(MatrixStack stack, VertexConsumer renderContext, int overlayUv, int lightUv, float red, float green, float blue, float alpha) { public void render(MatrixStack stack, VertexConsumer renderContext, int overlay, int light, int color) {
parts.forEach(part -> { parts.forEach(part -> {
part.render(stack, renderContext, overlayUv, lightUv, red, green, blue, alpha); part.render(stack, renderContext, overlay, light, color);
}); });
} }

View file

@ -92,7 +92,7 @@ public interface Gear {
/** /**
* Renders this model component. * Renders this model component.
*/ */
void render(MatrixStack stack, VertexConsumer vertices, int overlayUv, int lightUv, float red, float green, float blue, float alpha, UUID interpolatorId); void render(MatrixStack stack, VertexConsumer vertices, int overlay, int light, int color, UUID interpolatorId);
/** /**
* A render context for instance of IGear. * A render context for instance of IGear.

View file

@ -17,7 +17,7 @@ public final class DefaultPonySkinHelper {
public static final Identifier NIRIK_SKIN_TYPE_ID = id("nirik"); public static final Identifier NIRIK_SKIN_TYPE_ID = id("nirik");
private static final Function<SkinTextures, SkinTextures> SKINS = Util.memoize(original -> new SkinTextures( private static final Function<SkinTextures, SkinTextures> SKINS = Util.memoize(original -> new SkinTextures(
new Identifier("minelittlepony", original.texture().getPath().replace(".png", "_pony.png")), id(original.texture().getPath().replace(".png", "_pony.png")),
null, null,
null, null,
null, null,
@ -26,7 +26,7 @@ public final class DefaultPonySkinHelper {
)); ));
public static Identifier id(String name) { public static Identifier id(String name) {
return new Identifier("minelittlepony", name); return Identifier.of("minelittlepony", name);
} }
public static SkinTextures getTextures(SkinTextures original) { public static SkinTextures getTextures(SkinTextures original) {

View file

@ -3,20 +3,22 @@ package com.minelittlepony.api.pony.meta;
import net.minecraft.util.Identifier; import net.minecraft.util.Identifier;
import net.minecraft.util.math.ColorHelper; import net.minecraft.util.math.ColorHelper;
import com.minelittlepony.api.pony.DefaultPonySkinHelper;
import java.util.*; import java.util.*;
import java.util.function.Function; import java.util.function.Function;
import java.util.stream.Collectors; import java.util.stream.Collectors;
public enum Wearable implements TValue<Wearable> { public enum Wearable implements TValue<Wearable> {
NONE (0x00, null), NONE (0x00, null),
CROWN (0x16, new Identifier("minelittlepony", "textures/models/crown.png")), CROWN (0x16, DefaultPonySkinHelper.id("textures/models/crown.png")),
MUFFIN (0x32, new Identifier("minelittlepony", "textures/models/muffin.png")), MUFFIN (0x32, DefaultPonySkinHelper.id("textures/models/muffin.png")),
HAT (0x64, new Identifier("textures/entity/witch.png")), HAT (0x64, Identifier.ofVanilla("textures/entity/witch.png")),
ANTLERS (0x96, new Identifier("minelittlepony", "textures/models/antlers.png")), ANTLERS (0x96, DefaultPonySkinHelper.id("textures/models/antlers.png")),
SADDLE_BAGS_LEFT (0xC6, new Identifier("minelittlepony", "textures/models/saddlebags.png")), SADDLE_BAGS_LEFT (0xC6, DefaultPonySkinHelper.id("textures/models/saddlebags.png")),
SADDLE_BAGS_RIGHT (0xC7, new Identifier("minelittlepony", "textures/models/saddlebags.png")), SADDLE_BAGS_RIGHT (0xC7, DefaultPonySkinHelper.id("textures/models/saddlebags.png")),
SADDLE_BAGS_BOTH (0xC8, new Identifier("minelittlepony", "textures/models/saddlebags.png")), SADDLE_BAGS_BOTH (0xC8, DefaultPonySkinHelper.id("textures/models/saddlebags.png")),
STETSON (0xFA, new Identifier("minelittlepony", "textures/models/stetson.png")); STETSON (0xFA, DefaultPonySkinHelper.id("textures/models/stetson.png"));
private int triggerValue; private int triggerValue;
@ -29,7 +31,7 @@ public enum Wearable implements TValue<Wearable> {
Wearable(int pixel, Identifier texture) { Wearable(int pixel, Identifier texture) {
triggerValue = pixel; triggerValue = pixel;
id = new Identifier("minelittlepony", name().toLowerCase(Locale.ROOT)); id = DefaultPonySkinHelper.id(name().toLowerCase(Locale.ROOT));
this.texture = texture; this.texture = texture;
} }

View file

@ -87,7 +87,7 @@ public class HorseCam {
public static float rescaleCameraPitch(double toHeight, float originalPitch) { public static float rescaleCameraPitch(double toHeight, float originalPitch) {
MinecraftClient client = MinecraftClient.getInstance(); MinecraftClient client = MinecraftClient.getInstance();
PlayerEntity player = client.player; PlayerEntity player = client.player;
client.gameRenderer.updateCrosshairTarget(client.getTickDelta()); client.gameRenderer.updateCrosshairTarget(client.getRenderTickCounter().getTickDelta(false));
HitResult hit = client.crosshairTarget; HitResult hit = client.crosshairTarget;
if (client.targetedEntity != null) { if (client.targetedEntity != null) {

View file

@ -64,7 +64,7 @@ public class MineLittlePony implements ClientModInitializer {
} }
public static Identifier id(String name) { public static Identifier id(String name) {
return new Identifier("minelittlepony", name); return Identifier.of("minelittlepony", name);
} }
@Override @Override
@ -129,7 +129,7 @@ public class MineLittlePony implements ClientModInitializer {
button.getStyle() button.getStyle()
.setIcon(new TextureSprite() .setIcon(new TextureSprite()
.setPosition(2, 2) .setPosition(2, 2)
.setTexture(new Identifier("minelittlepony", "textures/gui/pony.png")) .setTexture(id("textures/gui/pony.png"))
.setTextureSize(16, 16) .setTextureSize(16, 16)
.setSize(16, 16)) .setSize(16, 16))
.setTooltip("minelp.options.title", 0, 10); .setTooltip("minelp.options.title", 0, 10);

View file

@ -10,7 +10,7 @@ import net.minecraft.util.math.Vec3d;
public class PonyBounds { public class PonyBounds {
private static Vec3d getBaseRidingOffset(LivingEntity entity) { private static Vec3d getBaseRidingOffset(LivingEntity entity) {
float delta = MinecraftClient.getInstance().getTickDelta(); float delta = MinecraftClient.getInstance().getRenderTickCounter().getTickDelta(false);
return new Vec3d( return new Vec3d(
MathHelper.lerp(delta, entity.prevX, entity.getX()), MathHelper.lerp(delta, entity.prevX, entity.getX()),
MathHelper.lerp(delta, entity.prevY, entity.getY()), MathHelper.lerp(delta, entity.prevY, entity.getY()),

View file

@ -25,7 +25,7 @@ import java.util.concurrent.ExecutionException;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
public class PonyManagerImpl implements PonyManager, SimpleSynchronousResourceReloadListener { public class PonyManagerImpl implements PonyManager, SimpleSynchronousResourceReloadListener {
private static final Identifier ID = new Identifier("minelittlepony", "background_ponies"); private static final Identifier ID = MineLittlePony.id("background_ponies");
private final PonyConfig config; private final PonyConfig config;

View file

@ -11,9 +11,9 @@ import com.minelittlepony.util.MathUtil;
import java.util.*; import java.util.*;
public class VariatedTextureSupplier implements SimpleSynchronousResourceReloadListener { public class VariatedTextureSupplier implements SimpleSynchronousResourceReloadListener {
private static final Identifier ID = new Identifier("minelittlepony", "variated_textures"); private static final Identifier ID = MineLittlePony.id("variated_textures");
public static final Identifier BACKGROUND_PONIES_POOL = new Identifier("minelittlepony", "textures/entity/pony"); public static final Identifier BACKGROUND_PONIES_POOL = MineLittlePony.id("textures/entity/pony");
public static final Identifier BACKGROUND_ZOMPONIES_POOL = new Identifier("minelittlepony", "textures/entity/zompony"); public static final Identifier BACKGROUND_ZOMPONIES_POOL = MineLittlePony.id("textures/entity/zompony");
private final Map<Identifier, SkinList> entries = new HashMap<>(); private final Map<Identifier, SkinList> entries = new HashMap<>();

View file

@ -17,10 +17,10 @@ import net.minecraft.util.Identifier;
* Skin uploading GUI. Usually displayed over the main menu. * Skin uploading GUI. Usually displayed over the main menu.
*/ */
class GuiSkinsMineLP extends GuiSkins { class GuiSkinsMineLP extends GuiSkins {
private static final String[] PANORAMAS = new String[] { private static final Identifier[] PANORAMAS = new Identifier[] {
"minelittlepony:textures/cubemap/sugarcubecorner", MineLittlePony.id("textures/cubemap/sugarcubecorner"),
"minelittlepony:textures/cubemap/quillsandsofas", MineLittlePony.id("textures/cubemap/quillsandsofas"),
"minelittlepony:textures/cubemap/sweetappleacres" MineLittlePony.id("textures/cubemap/sweetappleacres")
}; };
public GuiSkinsMineLP(Screen parent, SkinServerList servers) { public GuiSkinsMineLP(Screen parent, SkinServerList servers) {
@ -47,7 +47,7 @@ class GuiSkinsMineLP extends GuiSkins {
.getStyle() .getStyle()
.setIcon(new TextureSprite() .setIcon(new TextureSprite()
.setPosition(2, 2) .setPosition(2, 2)
.setTexture(new Identifier("minelittlepony", "textures/gui/pony.png")) .setTexture(MineLittlePony.id("textures/gui/pony.png"))
.setTextureSize(16, 16) .setTextureSize(16, 16)
.setSize(16, 16)) .setSize(16, 16))
.setTooltip("minelp.options.title", 0, 10); .setTooltip("minelp.options.title", 0, 10);
@ -64,8 +64,6 @@ class GuiSkinsMineLP extends GuiSkins {
@Override @Override
protected Identifier getBackground() { protected Identifier getBackground() {
int i = (int)Math.floor(Math.random() * PANORAMAS.length); return PANORAMAS[(int)Math.floor(Math.random() * PANORAMAS.length)];
return new Identifier(PANORAMAS[i]);
} }
} }

View file

@ -1,12 +1,12 @@
package com.minelittlepony.client.mixin; package com.minelittlepony.client.mixin;
import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.*;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
import java.util.Arrays; import java.util.Set;
import it.unimi.dsi.fastutil.objects.ObjectArraySet;
import net.minecraft.client.render.VertexConsumer; import net.minecraft.client.render.VertexConsumer;
import net.minecraft.client.render.VertexConsumers; import net.minecraft.client.render.VertexConsumers;
@ -25,15 +25,12 @@ abstract class MixinVertextConsumers {
} }
} }
@Inject(method = "union([" + T + ")" + T, at = @At("HEAD"), cancellable = true) @ModifyVariable(method = "union([" + T + ")" + T, at = @At("HEAD"), argsOnly = true)
private static void onUnion(VertexConsumer[] delegates, CallbackInfoReturnable<VertexConsumer> info) { private static VertexConsumer[] onUnion(VertexConsumer[] delegates) {
int oldLength = delegates.length; Set<VertexConsumer> set = new ObjectArraySet<>(delegates.length);
delegates = Arrays.stream(delegates).distinct().toArray(VertexConsumer[]::new); for (VertexConsumer delegate : delegates) {
set.add(delegate);
if (delegates.length == 1) {
info.setReturnValue(delegates[0]);
} else if (delegates.length != oldLength) {
info.setReturnValue(new VertexConsumers.Union(delegates));
} }
return set.toArray(VertexConsumer[]::new);
} }
} }

View file

@ -4,7 +4,7 @@ import com.minelittlepony.api.model.*;
import com.minelittlepony.api.events.PonyModelPrepareCallback; import com.minelittlepony.api.events.PonyModelPrepareCallback;
import com.minelittlepony.api.pony.meta.SizePreset; import com.minelittlepony.api.pony.meta.SizePreset;
import com.minelittlepony.client.transform.PonyTransformation; import com.minelittlepony.client.transform.PonyTransformation;
import com.minelittlepony.client.util.render.RenderList; import com.minelittlepony.mson.util.RenderList;
import com.minelittlepony.util.MathUtil; import com.minelittlepony.util.MathUtil;
import com.minelittlepony.util.MathUtil.Angles; import com.minelittlepony.util.MathUtil.Angles;
@ -71,27 +71,27 @@ public abstract class AbstractPonyModel<T extends LivingEntity> extends ClientPo
} }
protected RenderList forPart(Supplier<SubModel> part) { protected RenderList forPart(Supplier<SubModel> part) {
return (stack, vertices, overlayUv, lightUv, red, green, blue, alpha) -> { return (stack, vertices, overlay, light, color) -> {
part.get().renderPart(stack, vertices, overlayUv, lightUv, red, green, blue, alpha, attributes); part.get().renderPart(stack, vertices, overlay, light, color, attributes);
}; };
} }
protected RenderList forPart(SubModel part) { protected RenderList forPart(SubModel part) {
return (stack, vertices, overlayUv, lightUv, red, green, blue, alpha) -> { return (stack, vertices, overlay, light, color) -> {
part.renderPart(stack, vertices, overlayUv, lightUv, red, green, blue, alpha, attributes); part.renderPart(stack, vertices, overlay, light, color, attributes);
}; };
} }
@Override @Override
public void render(MatrixStack stack, VertexConsumer vertices, int overlayUv, int lightUv, float red, float green, float blue, float alpha) { public void render(MatrixStack stack, VertexConsumer vertices, int overlay, int light, int color) {
mainRenderList.accept(stack, vertices, overlayUv, lightUv, red, green, blue, alpha); mainRenderList.accept(stack, vertices, overlay, light, color);
} }
protected RenderList withStage(BodyPart part, RenderList action) { protected RenderList withStage(BodyPart part, RenderList action) {
return (stack, vertices, overlayUv, lightUv, red, green, blue, alpha) -> { return (stack, vertices, overlay, light, color) -> {
stack.push(); stack.push();
transform(part, stack); transform(part, stack);
action.accept(stack, vertices, overlayUv, lightUv, red, green, blue, alpha); action.accept(stack, vertices, overlay, light, color);
stack.pop(); stack.pop();
}; };
} }

View file

@ -6,13 +6,13 @@ import net.minecraft.client.render.entity.model.ArmorStandEntityModel;
import net.minecraft.entity.LivingEntity; import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.mob.VexEntity; import net.minecraft.entity.mob.VexEntity;
import net.minecraft.entity.passive.*; import net.minecraft.entity.passive.*;
import net.minecraft.util.Identifier;
import com.minelittlepony.api.model.BodyPart; import com.minelittlepony.api.model.BodyPart;
import com.minelittlepony.api.model.PonyModel; import com.minelittlepony.api.model.PonyModel;
import com.minelittlepony.api.model.gear.*; import com.minelittlepony.api.model.gear.*;
import com.minelittlepony.api.pony.meta.Race; import com.minelittlepony.api.pony.meta.Race;
import com.minelittlepony.api.pony.meta.Wearable; import com.minelittlepony.api.pony.meta.Wearable;
import com.minelittlepony.client.MineLittlePony;
import com.minelittlepony.client.model.armour.PonyArmourModel; import com.minelittlepony.client.model.armour.PonyArmourModel;
import com.minelittlepony.client.model.entity.*; import com.minelittlepony.client.model.entity.*;
import com.minelittlepony.client.model.entity.race.*; import com.minelittlepony.client.model.entity.race.*;
@ -93,7 +93,7 @@ public final class ModelType {
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
static <T extends AbstractGearModel> GearModelKey<T> registerGear(String name, Wearable wearable, MsonModel.Factory<T> constructor) { static <T extends AbstractGearModel> GearModelKey<T> registerGear(String name, Wearable wearable, MsonModel.Factory<T> constructor) {
return (GearModelKey<T>)GEAR_MODELS.computeIfAbsent(wearable, w -> { return (GearModelKey<T>)GEAR_MODELS.computeIfAbsent(wearable, w -> {
return new GearModelKey<T>(Mson.getInstance().registerModel(new Identifier("minelittlepony", "gear/" + name), constructor), constructor); return new GearModelKey<T>(Mson.getInstance().registerModel(MineLittlePony.id("gear/" + name), constructor), constructor);
}); });
} }
@ -103,7 +103,7 @@ public final class ModelType {
} }
static <T extends Model> ModelKey<T> register(String name, MsonModel.Factory<T> constructor) { static <T extends Model> ModelKey<T> register(String name, MsonModel.Factory<T> constructor) {
return new ModelKeyImpl<T>(new Identifier("minelittlepony", name), constructor); return new ModelKeyImpl<T>(MineLittlePony.id(name), constructor);
} }
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")

View file

@ -3,12 +3,12 @@ package com.minelittlepony.client.model;
import net.minecraft.client.model.Model; import net.minecraft.client.model.Model;
import net.minecraft.client.model.ModelPart; import net.minecraft.client.model.ModelPart;
import net.minecraft.entity.LivingEntity; import net.minecraft.entity.LivingEntity;
import net.minecraft.util.Identifier;
import org.jetbrains.annotations.Nullable; import org.jetbrains.annotations.Nullable;
import com.minelittlepony.api.model.Models; import com.minelittlepony.api.model.Models;
import com.minelittlepony.api.model.PonyModel; import com.minelittlepony.api.model.PonyModel;
import com.minelittlepony.client.MineLittlePony;
import com.minelittlepony.client.model.armour.PonyArmourModel; import com.minelittlepony.client.model.armour.PonyArmourModel;
import com.minelittlepony.mson.api.*; import com.minelittlepony.mson.api.*;
@ -21,8 +21,8 @@ public record PlayerModelKey<T extends LivingEntity, M extends Model & PonyModel
) { ) {
PlayerModelKey(String name, BiFunction<ModelPart, Boolean, M> modelFactory, MsonModel.Factory<PonyArmourModel<T>> armorFactory) { PlayerModelKey(String name, BiFunction<ModelPart, Boolean, M> modelFactory, MsonModel.Factory<PonyArmourModel<T>> armorFactory) {
this( this(
new ModelKeyImpl<>(new Identifier("minelittlepony", "races/steve/" + name), tree -> modelFactory.apply(tree, false)), new ModelKeyImpl<>(MineLittlePony.id("races/steve/" + name), tree -> modelFactory.apply(tree, false)),
new ModelKeyImpl<>(new Identifier("minelittlepony", "races/alex/" + name), tree -> modelFactory.apply(tree, true)), new ModelKeyImpl<>(MineLittlePony.id("races/alex/" + name), tree -> modelFactory.apply(tree, true)),
armorFactory armorFactory
); );
} }

View file

@ -48,10 +48,10 @@ public class EnderStallionModel extends SkeleponyModel<EndermanEntity> {
} }
@Override @Override
public void render(MatrixStack stack, VertexConsumer vertices, int overlayUv, int lightUv, float red, float green, float blue, float alpha) { public void render(MatrixStack stack, VertexConsumer vertices, int overlay, int light, int color) {
stack.push(); stack.push();
stack.translate(0, -1.15F, 0); stack.translate(0, -1.15F, 0);
super.render(stack, vertices, overlayUv, lightUv, red, green, blue, alpha); super.render(stack, vertices, overlay, light, color);
stack.pop(); stack.pop();
} }

View file

@ -24,8 +24,8 @@ public class GuardianPonyModel extends GuardianEntityModel implements PonyModelM
} }
@Override @Override
public void render(MatrixStack matrices, VertexConsumer vertices, int light, int overlay, float red, float green, float blue, float alpha) { public void render(MatrixStack matrices, VertexConsumer vertices, int light, int overlay, int color) {
mixin().render(matrices, vertices, light, overlay, red, green, blue, alpha); mixin().render(matrices, vertices, light, overlay, color);
} }
@Override @Override

View file

@ -38,8 +38,8 @@ public class ParaspriteModel<T extends LivingEntity> extends EntityModel<T> {
} }
@Override @Override
public void render(MatrixStack matrices, VertexConsumer vertices, int light, int overlay, float red, float green, float blue, float alpha) { public void render(MatrixStack matrices, VertexConsumer vertices, int light, int overlay, int color) {
root.render(matrices, vertices, light, overlay, red, green, blue, alpha); root.render(matrices, vertices, light, overlay, color);
} }
@Override @Override

View file

@ -21,7 +21,7 @@ public class SaddleModel<T extends LivingEntity> extends EntityModel<T> {
} }
@Override @Override
public void render(MatrixStack matrices, VertexConsumer vertices, int light, int overlay, float red, float green, float blue, float alpha) { public void render(MatrixStack matrices, VertexConsumer vertices, int light, int overlay, int color) {
root.render(matrices, vertices, light, overlay, red, green, blue, alpha); root.render(matrices, vertices, light, overlay, color);
} }
} }

View file

@ -5,8 +5,8 @@ import com.minelittlepony.api.model.*;
import com.minelittlepony.api.pony.meta.Size; import com.minelittlepony.api.pony.meta.Size;
import com.minelittlepony.api.pony.meta.SizePreset; import com.minelittlepony.api.pony.meta.SizePreset;
import com.minelittlepony.client.model.part.UnicornHorn; import com.minelittlepony.client.model.part.UnicornHorn;
import com.minelittlepony.client.util.render.RenderList;
import com.minelittlepony.mson.api.ModelView; import com.minelittlepony.mson.api.ModelView;
import com.minelittlepony.mson.util.RenderList;
import net.minecraft.client.model.ModelPart; import net.minecraft.client.model.ModelPart;
import net.minecraft.client.util.math.MatrixStack; import net.minecraft.client.util.math.MatrixStack;
@ -35,7 +35,7 @@ public class UnicornModel<T extends LivingEntity> extends EarthPonyModel<T> impl
super.init(context); super.init(context);
horn = addPart(context.findByName("horn")); horn = addPart(context.findByName("horn"));
headRenderList.add(RenderList.of().add(head::rotate).add(forPart(horn)).checked(() -> getRace().hasHorn())); headRenderList.add(RenderList.of().add(head::rotate).add(forPart(horn)).checked(() -> getRace().hasHorn()));
this.mainRenderList.add(withStage(BodyPart.HEAD, RenderList.of().add(head::rotate).add((stack, vertices, overlayUv, lightUv, red, green, blue, alpha) -> { this.mainRenderList.add(withStage(BodyPart.HEAD, RenderList.of().add(head::rotate).add((stack, vertices, overlay, light, color) -> {
horn.renderMagic(stack, vertices, getAttributes().metadata.glowColor()); horn.renderMagic(stack, vertices, getAttributes().metadata.glowColor());
})).checked(() -> hasMagic() && isCasting())); })).checked(() -> hasMagic() && isCasting()));
} }

View file

@ -10,7 +10,6 @@ import com.minelittlepony.api.model.BodyPart;
import com.minelittlepony.api.model.PonyModel; import com.minelittlepony.api.model.PonyModel;
import com.minelittlepony.api.model.gear.WearableGear; import com.minelittlepony.api.model.gear.WearableGear;
import com.minelittlepony.api.pony.meta.Wearable; import com.minelittlepony.api.pony.meta.Wearable;
import com.minelittlepony.common.util.Color;
import java.util.Calendar; import java.util.Calendar;
import java.util.UUID; import java.util.UUID;
@ -63,14 +62,12 @@ public class DeerAntlers extends WearableGear {
} }
@Override @Override
public void render(MatrixStack stack, VertexConsumer vertices, int overlayUv, int lightUv, float red, float green, float blue, float alpha, UUID interpolatorId) { public void render(MatrixStack stack, VertexConsumer vertices, int overlay, int light, int color, UUID interpolatorId) {
if (tint != 0) { if (tint != 0) {
red = Color.r(tint); color = tint;
green = Color.g(tint);
blue = Color.b(tint);
} }
left.render(stack, vertices, overlayUv, lightUv, red, green, blue, alpha); left.render(stack, vertices, overlay, light, color);
right.render(stack, vertices, overlayUv, lightUv, red, green, blue, alpha); right.render(stack, vertices, overlay, light, color);
} }
} }

View file

@ -63,7 +63,7 @@ public class SaddleBags extends WearableGear {
} }
@Override @Override
public void render(MatrixStack stack, VertexConsumer renderContext, int overlayUv, int lightUv, float red, float green, float blue, float alpha, UUID interpolatorId) { public void render(MatrixStack stack, VertexConsumer renderContext, int overlay, int light, int color, UUID interpolatorId) {
stack.push(); stack.push();
if (wearable == Wearable.SADDLE_BAGS_BOTH) { if (wearable == Wearable.SADDLE_BAGS_BOTH) {
@ -77,11 +77,11 @@ public class SaddleBags extends WearableGear {
stack.translate(0, 0.3F, -0.3F); stack.translate(0, 0.3F, -0.3F);
} }
leftBag.render(stack, renderContext, overlayUv, lightUv, red, green, blue, alpha); leftBag.render(stack, renderContext, overlay, light, color);
rightBag.render(stack, renderContext, overlayUv, lightUv, red, green, blue, alpha); rightBag.render(stack, renderContext, overlay, light, color);
stack.pop(); stack.pop();
strap.render(stack, renderContext, overlayUv, lightUv, red, green, blue, alpha); strap.render(stack, renderContext, overlay, light, color);
stack.pop(); stack.pop();
} }

View file

@ -96,7 +96,7 @@ public class LionTail implements SubModel {
} }
@Override @Override
public void renderPart(MatrixStack stack, VertexConsumer vertices, int overlayUv, int lightUv, float red, float green, float blue, float alpha, ModelAttributes attributes) { public void renderPart(MatrixStack stack, VertexConsumer vertices, int overlay, int light, int color, ModelAttributes attributes) {
tail.render(stack, vertices, overlayUv, lightUv, red, green, blue, alpha); tail.render(stack, vertices, overlay, light, color);
} }
} }

View file

@ -58,7 +58,7 @@ public class PonyEars implements SubModel, MsonModel {
} }
@Override @Override
public void renderPart(MatrixStack stack, VertexConsumer vertices, int overlayUv, int lightUv, float red, float green, float blue, float alpha, ModelAttributes attributes) { public void renderPart(MatrixStack stack, VertexConsumer vertices, int overlay, int light, int color, ModelAttributes attributes) {
} }
@Override @Override

View file

@ -34,7 +34,7 @@ public class PonySnout implements SubModel, MsonModel {
} }
@Override @Override
public void renderPart(MatrixStack stack, VertexConsumer vertices, int overlayUv, int lightUv, float red, float green, float blue, float alpha, ModelAttributes attributes) { public void renderPart(MatrixStack stack, VertexConsumer vertices, int overlay, int light, int color, ModelAttributes attributes) {
} }
@Override @Override

View file

@ -86,12 +86,12 @@ public class PonyTail implements SubModel, MsonModel {
} }
@Override @Override
public void renderPart(MatrixStack stack, VertexConsumer vertices, int overlayUv, int lightUv, float red, float green, float blue, float alpha, ModelAttributes attributes) { public void renderPart(MatrixStack stack, VertexConsumer vertices, int overlay, int light, int color, ModelAttributes attributes) {
stack.push(); stack.push();
tail.rotate(stack); tail.rotate(stack);
for (int i = 0; i < segments.size(); i++) { for (int i = 0; i < segments.size(); i++) {
segments.get(i).render(this, stack, vertices, i, overlayUv, lightUv, red, green, blue, alpha, attributes); segments.get(i).render(this, stack, vertices, i, overlay, light, color, attributes);
} }
stack.pop(); stack.pop();
@ -104,7 +104,7 @@ public class PonyTail implements SubModel, MsonModel {
this.tree = tree; this.tree = tree;
} }
public void render(PonyTail tail, MatrixStack stack, VertexConsumer renderContext, int index, int overlayUv, int lightUv, float red, float green, float blue, float alpha, ModelAttributes attributes) { public void render(PonyTail tail, MatrixStack stack, VertexConsumer renderContext, int index, int overlay, int light, int color, ModelAttributes attributes) {
if (index >= tail.tailStop) { if (index >= tail.tailStop) {
return; return;
} }
@ -118,7 +118,7 @@ public class PonyTail implements SubModel, MsonModel {
if (attributes.isHorsey || tail.shape == TailShape.STRAIGHT) { if (attributes.isHorsey || tail.shape == TailShape.STRAIGHT) {
tree.yaw = 0; tree.yaw = 0;
tree.render(stack, renderContext, overlayUv, lightUv, red, green, blue, alpha); tree.render(stack, renderContext, overlay, light, color);
return; return;
} }
@ -145,7 +145,7 @@ public class PonyTail implements SubModel, MsonModel {
tree.yaw = 0.2F * (index % 2 - 1); tree.yaw = 0.2F * (index % 2 - 1);
tree.pivotZ = 9; tree.pivotZ = 9;
} }
tree.render(stack, renderContext, overlayUv, lightUv, red, green, blue, alpha); tree.render(stack, renderContext, overlay, light, color);
stack.pop(); stack.pop();
} }
} }

View file

@ -96,9 +96,9 @@ public class PonyWings<T extends Model & WingedPonyModel<?>> implements SubModel
} }
@Override @Override
public void renderPart(MatrixStack stack, VertexConsumer vertices, int overlayUv, int lightUv, float red, float green, float blue, float alpha, ModelAttributes attributes) { public void renderPart(MatrixStack stack, VertexConsumer vertices, int overlay, int light, int color, ModelAttributes attributes) {
getLeft().render(stack, vertices, overlayUv, lightUv, red, green, blue, alpha); getLeft().render(stack, vertices, overlay, light, color);
getRight().render(stack, vertices, overlayUv, lightUv, red, green, blue, alpha); getRight().render(stack, vertices, overlay, light, color);
} }
public static class Wing implements MsonModel { public static class Wing implements MsonModel {
@ -135,19 +135,19 @@ public class PonyWings<T extends Model & WingedPonyModel<?>> implements SubModel
} }
} }
public void render(MatrixStack stack, VertexConsumer vertices, int overlayUv, int lightUv, float red, float green, float blue, float alpha) { public void render(MatrixStack stack, VertexConsumer vertices, int overlay, int light, int color) {
stack.push(); stack.push();
stack.scale(wingScale, wingScale, wingScale); stack.scale(wingScale, wingScale, wingScale);
if (pegasus.wingsAreOpen()) { if (pegasus.wingsAreOpen()) {
extended.render(stack, vertices, overlayUv, lightUv, red, green, blue, alpha); extended.render(stack, vertices, overlay, light, color);
} else { } else {
boolean bags = pegasus.isWearing(Wearable.SADDLE_BAGS_BOTH); boolean bags = pegasus.isWearing(Wearable.SADDLE_BAGS_BOTH);
if (bags) { if (bags) {
stack.push(); stack.push();
stack.translate(0, 0, 0.198F); stack.translate(0, 0, 0.198F);
} }
folded.render(stack, vertices, overlayUv, lightUv, red, green, blue, alpha); folded.render(stack, vertices, overlay, light, color);
if (bags) { if (bags) {
stack.pop(); stack.pop();
} }

View file

@ -39,8 +39,8 @@ public class SeaponyTail implements SubModel, MsonModel {
} }
@Override @Override
public void renderPart(MatrixStack stack, VertexConsumer vertices, int overlayUv, int lightUv, float red, float green, float blue, float alpha, ModelAttributes attributes) { public void renderPart(MatrixStack stack, VertexConsumer vertices, int overlay, int light, int color, ModelAttributes attributes) {
tailBase.render(stack, vertices, overlayUv, lightUv, red, green, blue, alpha); tailBase.render(stack, vertices, overlay, light, color);
} }
} }

View file

@ -10,7 +10,6 @@ import net.minecraft.client.util.math.MatrixStack;
import com.minelittlepony.api.model.SubModel; import com.minelittlepony.api.model.SubModel;
import com.minelittlepony.api.model.ModelAttributes; import com.minelittlepony.api.model.ModelAttributes;
import com.minelittlepony.client.render.MagicGlow; import com.minelittlepony.client.render.MagicGlow;
import com.minelittlepony.common.util.Color;
public class UnicornHorn implements SubModel { public class UnicornHorn implements SubModel {
@ -25,8 +24,8 @@ public class UnicornHorn implements SubModel {
} }
@Override @Override
public void renderPart(MatrixStack stack, VertexConsumer vertices, int overlayUv, int lightUv, float red, float green, float blue, float alpha, ModelAttributes attributes) { public void renderPart(MatrixStack stack, VertexConsumer vertices, int overlay, int light, int color, ModelAttributes attributes) {
horn.render(stack, vertices, overlayUv, lightUv, red, green, blue, alpha); horn.render(stack, vertices, overlay, light, color);
} }
public void renderMagic(MatrixStack stack, VertexConsumer verts, int tint) { public void renderMagic(MatrixStack stack, VertexConsumer verts, int tint) {
@ -34,8 +33,7 @@ public class UnicornHorn implements SubModel {
Immediate immediate = MinecraftClient.getInstance().getBufferBuilders().getEntityVertexConsumers(); Immediate immediate = MinecraftClient.getInstance().getBufferBuilders().getEntityVertexConsumers();
VertexConsumer vertices = immediate.getBuffer(MagicGlow.getRenderLayer()); VertexConsumer vertices = immediate.getBuffer(MagicGlow.getRenderLayer());
glow.render(stack, vertices, OverlayTexture.DEFAULT_UV, 0x0F00F0, (tint & 0xFFFFFF) | (102 << 24));
glow.render(stack, vertices, OverlayTexture.DEFAULT_UV, 0x0F00F0, Color.r(tint), Color.g(tint), Color.b(tint), 0.4F);
} }
} }

View file

@ -4,7 +4,7 @@ import com.minelittlepony.api.config.PonyConfig;
import com.minelittlepony.api.model.HornedPonyModel; import com.minelittlepony.api.model.HornedPonyModel;
import com.minelittlepony.api.pony.Pony; import com.minelittlepony.api.pony.Pony;
import com.minelittlepony.client.MineLittlePony; import com.minelittlepony.client.MineLittlePony;
import com.minelittlepony.client.util.render.RenderLayerUtil; import com.minelittlepony.common.util.render.RenderLayerUtil;
import org.jetbrains.annotations.Nullable; import org.jetbrains.annotations.Nullable;
@ -64,7 +64,7 @@ public class LevitatingItemRenderer {
stack.set(DataComponentTypes.ENCHANTMENT_GLINT_OVERRIDE, false); stack.set(DataComponentTypes.ENCHANTMENT_GLINT_OVERRIDE, false);
} }
float tickDelta = MinecraftClient.getInstance().getTickDelta() + entity.age; float tickDelta = MinecraftClient.getInstance().getRenderTickCounter().getTickDelta(false) + entity.age;
float driftStrength = 0.002F; float driftStrength = 0.002F;

View file

@ -1,98 +0,0 @@
package com.minelittlepony.client.render;
import net.minecraft.client.render.VertexConsumer;
import org.joml.Vector3f;
// TODO: This works but it only outsets the faces making them look disjointed. We need to scale the vertices relative to the quad center as well.
public class OffsetVertexConsumer implements VertexConsumer {
private final VertexConsumer delegate;
private double x, y, z;
private int r, g, b, a;
private float textureU, textureV;
private int overlayU, overlayV;
private int lightU, lightV;
private float normalX, normalY, normalZ;
private final Vector3f normalVector = new Vector3f();
private final float offsetDistance;
public OffsetVertexConsumer(VertexConsumer delegate, float offsetDistance) {
this.delegate = delegate;
this.offsetDistance = offsetDistance;
}
@Override
public VertexConsumer vertex(double x, double y, double z) {
this.x = x;
this.y = y;
this.z = z;
return this;
}
@Override
public VertexConsumer color(int red, int green, int blue, int alpha) {
r = red;
g = green;
b = blue;
a = alpha;
return this;
}
@Override
public VertexConsumer texture(float u, float v) {
textureU = u;
textureV = v;
return this;
}
@Override
public VertexConsumer overlay(int u, int v) {
overlayU = u;
overlayV = v;
return this;
}
@Override
public VertexConsumer light(int u, int v) {
lightU = u;
lightV = v;
return this;
}
@Override
public VertexConsumer normal(float x, float y, float z) {
normalX = x;
normalY = y;
normalZ = z;
return this;
}
@Override
public void next() {
normalVector.set(normalX, normalY, normalZ).normalize(offsetDistance);
delegate.vertex(
(normalVector.x + (float)x),
(normalVector.y + (float)y),
(normalVector.z + (float)z),
r / 255F, g / 255F, b / 255F, a / 255F,
textureU, textureV,
overlayU | overlayV << 16,
lightU | lightV << 16,
normalX, normalY, normalZ
);
}
@Override
public void fixedColor(int red, int green, int blue, int alpha) {
delegate.fixedColor(red, green, blue, alpha);
}
@Override
public void unfixColor() {
delegate.unfixColor();
}
}

View file

@ -61,7 +61,7 @@ public class MobSkull implements ISkull {
} }
@Override @Override
public void render(MatrixStack stack, VertexConsumer vertices, int lightUv, int overlayUv, float red, float green, float blue, float alpha) { public void render(MatrixStack stack, VertexConsumer vertices, int light, int overlay, int color) {
ponyHead.get().headRenderList.accept(stack, vertices, lightUv, overlayUv, red, green, blue, alpha); ponyHead.get().headRenderList.accept(stack, vertices, light, overlay, color);
} }
} }

View file

@ -80,18 +80,18 @@ public class PlayerPonySkull implements ISkull {
} }
@Override @Override
public void render(MatrixStack stack, VertexConsumer vertices, int lightUv, int overlayUv, float red, float green, float blue, float alpha) { public void render(MatrixStack stack, VertexConsumer vertices, int light, int overlay, int color) {
stack.push(); stack.push();
ponyHead.headRenderList.accept(stack, vertices, lightUv, overlayUv, red, green, blue, alpha); ponyHead.headRenderList.accept(stack, vertices, light, overlay, color);
stack.pop(); stack.pop();
stack.push(); stack.push();
ponyHead.helmetRenderList.accept(stack, vertices, lightUv, overlayUv, red, green, blue, alpha); ponyHead.helmetRenderList.accept(stack, vertices, light, overlay, color);
stack.pop(); stack.pop();
if (renderingEars) { if (renderingEars) {
stack.push(); stack.push();
stack.scale(1.3333334f, 1.3333334f, 1.3333334f); stack.scale(1.3333334f, 1.3333334f, 1.3333334f);
stack.translate(0, 0.05F, 0); stack.translate(0, 0.05F, 0);
deadMau5.render(stack, vertices, lightUv, overlayUv, red, green, blue, alpha); deadMau5.render(stack, vertices, light, overlay, color);
stack.pop(); stack.pop();
} }
} }

View file

@ -7,6 +7,7 @@ import com.minelittlepony.client.model.armour.ArmourLayer;
import com.minelittlepony.client.model.armour.ArmourRendererPlugin; import com.minelittlepony.client.model.armour.ArmourRendererPlugin;
import com.minelittlepony.client.render.MobRenderers; import com.minelittlepony.client.render.MobRenderers;
import com.minelittlepony.client.render.entity.*; import com.minelittlepony.client.render.entity.*;
import com.minelittlepony.common.util.Color;
import net.minecraft.block.AbstractSkullBlock; import net.minecraft.block.AbstractSkullBlock;
import net.minecraft.block.SkullBlock; import net.minecraft.block.SkullBlock;
@ -88,7 +89,7 @@ public class PonySkullRenderer {
public boolean renderSkull(@Nullable Direction direction, public boolean renderSkull(@Nullable Direction direction,
float yaw, float animationProgress, float yaw, float animationProgress,
MatrixStack stack, VertexConsumerProvider renderContext, RenderLayer layer, MatrixStack stack, VertexConsumerProvider renderContext, RenderLayer layer,
int lightUv) { int light) {
if (selectedSkull == null || !selectedSkull.canRender(PonyConfig.getInstance()) || !selectedSkull.bindPony(Pony.getManager().getPony(selectedSkin))) { if (selectedSkull == null || !selectedSkull.canRender(PonyConfig.getInstance()) || !selectedSkull.bindPony(Pony.getManager().getPony(selectedSkin))) {
return false; return false;
@ -111,7 +112,7 @@ public class PonySkullRenderer {
VertexConsumer vertices = renderContext.getBuffer(layer); VertexConsumer vertices = renderContext.getBuffer(layer);
selectedSkull.setAngles(yaw, animationProgress); selectedSkull.setAngles(yaw, animationProgress);
selectedSkull.render(stack, vertices, lightUv, OverlayTexture.DEFAULT_UV, 1, 1, 1, ArmourRendererPlugin.INSTANCE.get().getArmourAlpha(EquipmentSlot.HEAD, ArmourLayer.OUTER)); selectedSkull.render(stack, vertices, light, OverlayTexture.DEFAULT_UV, Color.argbToHex(ArmourRendererPlugin.INSTANCE.get().getArmourAlpha(EquipmentSlot.HEAD, ArmourLayer.OUTER), 1, 1, 1));
stack.pop(); stack.pop();
@ -126,7 +127,7 @@ public class PonySkullRenderer {
public interface ISkull { public interface ISkull {
void setAngles(float angle, float poweredTicks); void setAngles(float angle, float poweredTicks);
void render(MatrixStack stack, VertexConsumer vertices, int lightUv, int overlayUv, float red, float green, float blue, float alpha); void render(MatrixStack stack, VertexConsumer vertices, int light, int overlay, int color);
boolean canRender(PonyConfig config); boolean canRender(PonyConfig config);

View file

@ -16,7 +16,7 @@ import com.minelittlepony.client.model.entity.BreezieModel;
* AKA a breezie :D * AKA a breezie :D
*/ */
public class AllayRenderer extends MobEntityRenderer<AllayEntity, BreezieModel<AllayEntity>> { public class AllayRenderer extends MobEntityRenderer<AllayEntity, BreezieModel<AllayEntity>> {
public static final Identifier BREEZIE_PONIES = new Identifier("minelittlepony", "textures/entity/allay/pony"); public static final Identifier BREEZIE_PONIES = MineLittlePony.id("textures/entity/allay/pony");
public AllayRenderer(EntityRendererFactory.Context context) { public AllayRenderer(EntityRendererFactory.Context context) {
super(context, ModelType.ALLAY.createModel(), 0.4f); super(context, ModelType.ALLAY.createModel(), 0.4f);

View file

@ -1,5 +1,6 @@
package com.minelittlepony.client.render.entity; package com.minelittlepony.client.render.entity;
import com.minelittlepony.client.MineLittlePony;
import com.minelittlepony.client.model.ModelType; import com.minelittlepony.client.model.ModelType;
import com.minelittlepony.client.model.entity.EnderStallionModel; import com.minelittlepony.client.model.entity.EnderStallionModel;
import com.minelittlepony.client.render.entity.feature.GlowingEyesFeature; import com.minelittlepony.client.render.entity.feature.GlowingEyesFeature;
@ -19,9 +20,8 @@ import net.minecraft.util.Identifier;
import java.util.Random; import java.util.Random;
public class EnderStallionRenderer extends PonyRenderer<EndermanEntity, EnderStallionModel> implements IGlowingRenderer { public class EnderStallionRenderer extends PonyRenderer<EndermanEntity, EnderStallionModel> implements IGlowingRenderer {
public static final Identifier ENDERMAN = MineLittlePony.id("textures/entity/enderman/enderman_pony.png");
public static final Identifier ENDERMAN = new Identifier("minelittlepony", "textures/entity/enderman/enderman_pony.png"); private static final Identifier EYES = MineLittlePony.id("textures/entity/enderman/enderman_pony_eyes.png");
private static final Identifier EYES = new Identifier("minelittlepony", "textures/entity/enderman/enderman_pony_eyes.png");
private final Random rnd = new Random(); private final Random rnd = new Random();

View file

@ -10,7 +10,7 @@ import com.minelittlepony.client.model.*;
import com.minelittlepony.client.render.DebugBoundingBoxRenderer; import com.minelittlepony.client.render.DebugBoundingBoxRenderer;
import com.minelittlepony.client.render.PonyRenderContext; import com.minelittlepony.client.render.PonyRenderContext;
import com.minelittlepony.client.render.entity.feature.*; import com.minelittlepony.client.render.entity.feature.*;
import com.minelittlepony.client.util.render.RenderLayerUtil; import com.minelittlepony.common.util.render.RenderLayerUtil;
import java.util.*; import java.util.*;
import java.util.function.Function; import java.util.function.Function;

View file

@ -36,7 +36,7 @@ public class PonyPigRenderer extends PigEntityRenderer {
model.animateModel(entity, limbAngle, limbDistance, tickDelta); model.animateModel(entity, limbAngle, limbDistance, tickDelta);
model.setAngles(entity, limbAngle, limbDistance, animationProgress, headYaw, headPitch); model.setAngles(entity, limbAngle, limbDistance, animationProgress, headYaw, headPitch);
VertexConsumer vertexConsumer = vertexConsumers.getBuffer(RenderLayer.getEntityCutoutNoCull(Wearable.CROWN.getDefaultTexture())); VertexConsumer vertexConsumer = vertexConsumers.getBuffer(RenderLayer.getEntityCutoutNoCull(Wearable.CROWN.getDefaultTexture()));
model.render(matrices, vertexConsumer, light, OverlayTexture.DEFAULT_UV, 1, 1, 1, 1); model.render(matrices, vertexConsumer, light, OverlayTexture.DEFAULT_UV, 0xFFFFFFFF);
} }
} }
} }

View file

@ -5,14 +5,15 @@ import net.minecraft.entity.mob.AbstractPiglinEntity;
import net.minecraft.entity.mob.HostileEntity; import net.minecraft.entity.mob.HostileEntity;
import net.minecraft.util.Identifier; import net.minecraft.util.Identifier;
import com.minelittlepony.client.MineLittlePony;
import com.minelittlepony.client.model.ModelType; import com.minelittlepony.client.model.ModelType;
import com.minelittlepony.client.model.entity.PiglinPonyModel; import com.minelittlepony.client.model.entity.PiglinPonyModel;
import com.minelittlepony.client.render.entity.npc.textures.TextureSupplier; import com.minelittlepony.client.render.entity.npc.textures.TextureSupplier;
public class PonyPiglinRenderer extends PonyRenderer<HostileEntity, PiglinPonyModel> { public class PonyPiglinRenderer extends PonyRenderer<HostileEntity, PiglinPonyModel> {
public static final Identifier PIGLIN = new Identifier("minelittlepony", "textures/entity/piglin/piglin_pony.png"); public static final Identifier PIGLIN = MineLittlePony.id("textures/entity/piglin/piglin_pony.png");
public static final Identifier PIGLIN_BRUTE = new Identifier("minelittlepony", "textures/entity/piglin/piglin_brute_pony.png"); public static final Identifier PIGLIN_BRUTE = MineLittlePony.id("textures/entity/piglin/piglin_brute_pony.png");
public static final Identifier ZOMBIFIED_PIGLIN = new Identifier("minelittlepony", "textures/entity/piglin/zombified_piglin_pony.png"); public static final Identifier ZOMBIFIED_PIGLIN = MineLittlePony.id("textures/entity/piglin/zombified_piglin_pony.png");
public PonyPiglinRenderer(EntityRendererFactory.Context context, Identifier texture, float scale) { public PonyPiglinRenderer(EntityRendererFactory.Context context, Identifier texture, float scale) {
super(context, ModelType.PIGLIN, TextureSupplier.of(texture), scale); super(context, ModelType.PIGLIN, TextureSupplier.of(texture), scale);

View file

@ -3,6 +3,7 @@ package com.minelittlepony.client.render.entity;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import com.minelittlepony.api.model.ModelAttributes; import com.minelittlepony.api.model.ModelAttributes;
import com.minelittlepony.client.MineLittlePony;
import com.minelittlepony.client.mixin.IResizeable; import com.minelittlepony.client.mixin.IResizeable;
import com.minelittlepony.client.model.ModelType; import com.minelittlepony.client.model.ModelType;
import com.minelittlepony.client.model.entity.GuardianPonyModel; import com.minelittlepony.client.model.entity.GuardianPonyModel;
@ -17,10 +18,10 @@ import net.minecraft.entity.mob.GuardianEntity;
import net.minecraft.util.Identifier; import net.minecraft.util.Identifier;
public class SeaponyRenderer extends GuardianEntityRenderer { public class SeaponyRenderer extends GuardianEntityRenderer {
public static final Identifier SEAPONY = new Identifier("minelittlepony", "textures/entity/guardian/blueball.png"); public static final Identifier SEAPONY = MineLittlePony.id("textures/entity/guardian/blueball.png");
private static final Identifier SEAPONY_TEXTURES = new Identifier("minelittlepony", "textures/entity/guardian"); private static final Identifier SEAPONY_TEXTURES = MineLittlePony.id("textures/entity/guardian");
public static final Identifier ELDER_SEAPONY = new Identifier("minelittlepony", "textures/entity/elder_guardian/blueball.png"); public static final Identifier ELDER_SEAPONY = MineLittlePony.id("textures/entity/elder_guardian/blueball.png");
private static final Identifier ELDER_SEAPONY_TEXTURES = new Identifier("minelittlepony", "textures/entity/elder_guardian"); private static final Identifier ELDER_SEAPONY_TEXTURES = MineLittlePony.id("textures/entity/elder_guardian");
private final AbstractPonyRenderer<GuardianEntity, GuardianPonyModel> ponyRenderer; private final AbstractPonyRenderer<GuardianEntity, GuardianPonyModel> ponyRenderer;

View file

@ -1,5 +1,6 @@
package com.minelittlepony.client.render.entity; package com.minelittlepony.client.render.entity;
import com.minelittlepony.client.MineLittlePony;
import com.minelittlepony.client.model.ModelType; import com.minelittlepony.client.model.ModelType;
import com.minelittlepony.client.model.entity.SkeleponyModel; import com.minelittlepony.client.model.entity.SkeleponyModel;
import com.minelittlepony.client.render.entity.feature.StrayClothingFeature; import com.minelittlepony.client.render.entity.feature.StrayClothingFeature;
@ -10,10 +11,9 @@ import net.minecraft.entity.mob.*;
import net.minecraft.util.Identifier; import net.minecraft.util.Identifier;
public class SkeleponyRenderer<Skeleton extends AbstractSkeletonEntity> extends PonyRenderer<Skeleton, SkeleponyModel<Skeleton>> { public class SkeleponyRenderer<Skeleton extends AbstractSkeletonEntity> extends PonyRenderer<Skeleton, SkeleponyModel<Skeleton>> {
public static final Identifier SKELETON = MineLittlePony.id("textures/entity/skeleton/skeleton_pony.png");
public static final Identifier SKELETON = new Identifier("minelittlepony", "textures/entity/skeleton/skeleton_pony.png"); public static final Identifier WITHER = MineLittlePony.id("textures/entity/skeleton/skeleton_wither_pony.png");
public static final Identifier WITHER = new Identifier("minelittlepony", "textures/entity/skeleton/skeleton_wither_pony.png"); public static final Identifier STRAY = MineLittlePony.id("textures/entity/skeleton/stray_pony.png");
public static final Identifier STRAY = new Identifier("minelittlepony", "textures/entity/skeleton/stray_pony.png");
public SkeleponyRenderer(EntityRendererFactory.Context context, Identifier texture, float scale) { public SkeleponyRenderer(EntityRendererFactory.Context context, Identifier texture, float scale) {
super(context, ModelType.SKELETON, TextureSupplier.of(texture), scale); super(context, ModelType.SKELETON, TextureSupplier.of(texture), scale);

View file

@ -13,10 +13,10 @@ import com.minelittlepony.client.MineLittlePony;
import com.minelittlepony.client.model.ModelType; import com.minelittlepony.client.model.ModelType;
public class StriderRenderer extends MobEntityRenderer<StriderEntity, EntityModel<StriderEntity>> { public class StriderRenderer extends MobEntityRenderer<StriderEntity, EntityModel<StriderEntity>> {
public static final Identifier DRAGON_PONIES = new Identifier("minelittlepony", "textures/entity/strider/pony"); public static final Identifier DRAGON_PONIES = MineLittlePony.id("textures/entity/strider/pony");
public static final Identifier COLD_DRAGON_PONIES = new Identifier("minelittlepony", "textures/entity/strider/cold_pony"); public static final Identifier COLD_DRAGON_PONIES = MineLittlePony.id("textures/entity/strider/cold_pony");
private static final Identifier SADDLE = new Identifier("minelittlepony", "textures/entity/strider/strider_saddle_pony.png"); private static final Identifier SADDLE = MineLittlePony.id("textures/entity/strider/strider_saddle_pony.png");
public StriderRenderer(EntityRendererFactory.Context context) { public StriderRenderer(EntityRendererFactory.Context context) {
super(context, ModelType.STRIDER.createModel(), 0.5F); super(context, ModelType.STRIDER.createModel(), 0.5F);

View file

@ -11,7 +11,7 @@ import com.minelittlepony.client.model.ModelType;
import com.minelittlepony.client.model.entity.ParaspriteModel; import com.minelittlepony.client.model.entity.ParaspriteModel;
public class VexRenderer extends MobEntityRenderer<VexEntity, ParaspriteModel<VexEntity>> { public class VexRenderer extends MobEntityRenderer<VexEntity, ParaspriteModel<VexEntity>> {
public static final Identifier PARASPRITE_PONIES = new Identifier("minelittlepony", "textures/entity/illager/vex_pony"); public static final Identifier PARASPRITE_PONIES = MineLittlePony.id("textures/entity/illager/vex_pony");
public VexRenderer(EntityRendererFactory.Context context) { public VexRenderer(EntityRendererFactory.Context context) {
super(context, ModelType.VEX.createModel(), 0.3F); super(context, ModelType.VEX.createModel(), 0.3F);

View file

@ -1,5 +1,6 @@
package com.minelittlepony.client.render.entity; package com.minelittlepony.client.render.entity;
import com.minelittlepony.client.MineLittlePony;
import com.minelittlepony.client.model.ModelType; import com.minelittlepony.client.model.ModelType;
import com.minelittlepony.client.model.entity.WitchPonyModel; import com.minelittlepony.client.model.entity.WitchPonyModel;
import com.minelittlepony.client.render.entity.npc.textures.TextureSupplier; import com.minelittlepony.client.render.entity.npc.textures.TextureSupplier;
@ -9,8 +10,7 @@ import net.minecraft.entity.mob.WitchEntity;
import net.minecraft.util.Identifier; import net.minecraft.util.Identifier;
public class WitchRenderer extends PonyRenderer<WitchEntity, WitchPonyModel> { public class WitchRenderer extends PonyRenderer<WitchEntity, WitchPonyModel> {
private static final Identifier WITCH_TEXTURES = MineLittlePony.id("textures/entity/witch_pony.png");
private static final Identifier WITCH_TEXTURES = new Identifier("minelittlepony", "textures/entity/witch_pony.png");
public WitchRenderer(EntityRendererFactory.Context context) { public WitchRenderer(EntityRendererFactory.Context context) {
super(context, ModelType.WITCH, TextureSupplier.of(WITCH_TEXTURES), BASE_MODEL_SCALE); super(context, ModelType.WITCH, TextureSupplier.of(WITCH_TEXTURES), BASE_MODEL_SCALE);

View file

@ -4,17 +4,17 @@ import net.minecraft.client.render.entity.EntityRendererFactory;
import net.minecraft.entity.mob.*; import net.minecraft.entity.mob.*;
import net.minecraft.util.Identifier; import net.minecraft.util.Identifier;
import com.minelittlepony.client.MineLittlePony;
import com.minelittlepony.client.model.ModelType; import com.minelittlepony.client.model.ModelType;
import com.minelittlepony.client.model.entity.ZomponyModel; import com.minelittlepony.client.model.entity.ZomponyModel;
import com.minelittlepony.client.render.entity.npc.textures.TextureSupplier; import com.minelittlepony.client.render.entity.npc.textures.TextureSupplier;
public class ZomponyRenderer<Zombie extends HostileEntity> extends PonyRenderer<Zombie, ZomponyModel<Zombie>> { public class ZomponyRenderer<Zombie extends HostileEntity> extends PonyRenderer<Zombie, ZomponyModel<Zombie>> {
public static final Identifier ZOMBIE = MineLittlePony.id("textures/entity/zombie/zombie_pony.png");
public static final Identifier HUSK = MineLittlePony.id("textures/entity/zombie/husk_pony.png");
public static final Identifier DROWNED = MineLittlePony.id("textures/entity/zombie/drowned_pony.png");
public static final Identifier ZOMBIE = new Identifier("minelittlepony", "textures/entity/zombie/zombie_pony.png"); public static final Identifier DEMON_CHILD = MineLittlePony.id("textures/entity/zombie/demon_child.png");
public static final Identifier HUSK = new Identifier("minelittlepony", "textures/entity/zombie/husk_pony.png");
public static final Identifier DROWNED = new Identifier("minelittlepony", "textures/entity/zombie/drowned_pony.png");
public static final Identifier DEMON_CHILD = new Identifier("minelittlepony", "textures/entity/zombie/demon_child.png");
public ZomponyRenderer(EntityRendererFactory.Context context, TextureSupplier<Zombie> texture, float scale) { public ZomponyRenderer(EntityRendererFactory.Context context, TextureSupplier<Zombie> texture, float scale) {
super(context, ModelType.ZOMBIE, texture, scale); super(context, ModelType.ZOMBIE, texture, scale);

View file

@ -8,6 +8,7 @@ import net.minecraft.client.render.entity.feature.FeatureRendererContext;
import net.minecraft.client.render.entity.model.BipedEntityModel; import net.minecraft.client.render.entity.model.BipedEntityModel;
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.util.Colors;
import net.minecraft.util.Identifier; import net.minecraft.util.Identifier;
import com.minelittlepony.api.model.PonyModel; import com.minelittlepony.api.model.PonyModel;
@ -31,7 +32,7 @@ public abstract class AbstractClothingFeature<T extends LivingEntity, M extends
overlayModel.setAngles(entity, limbDistance, limbAngle, age, headYaw, headPitch); overlayModel.setAngles(entity, limbDistance, limbAngle, age, headYaw, headPitch);
VertexConsumer vertexConsumer = renderContext.getBuffer(overlayModel.getLayer(getOverlayTexture())); VertexConsumer vertexConsumer = renderContext.getBuffer(overlayModel.getLayer(getOverlayTexture()));
overlayModel.render(stack, vertexConsumer, lightUv, OverlayTexture.DEFAULT_UV, 1, 1, 1, 1); overlayModel.render(stack, vertexConsumer, lightUv, OverlayTexture.DEFAULT_UV, Colors.WHITE);
} }
protected abstract M getOverlayModel(); protected abstract M getOverlayModel();

View file

@ -37,7 +37,7 @@ public class ArmourFeature<T extends LivingEntity, M extends EntityModel<T> & Po
ArmourRendererPlugin plugin = ArmourRendererPlugin.INSTANCE.get(); ArmourRendererPlugin plugin = ArmourRendererPlugin.INSTANCE.get();
for (EquipmentSlot i : EquipmentSlot.values()) { for (EquipmentSlot i : EquipmentSlot.values()) {
if (i.getType() == EquipmentSlot.Type.ARMOR) { if (i.getType() == EquipmentSlot.Type.HUMANOID_ARMOR) {
renderArmor(pony, matrices, provider, light, entity, limbDistance, limbAngle, age, headYaw, headPitch, i, ArmourLayer.INNER, plugin); renderArmor(pony, matrices, provider, light, entity, limbDistance, limbAngle, age, headYaw, headPitch, i, ArmourLayer.INNER, plugin);
renderArmor(pony, matrices, provider, light, entity, limbDistance, limbAngle, age, headYaw, headPitch, i, ArmourLayer.OUTER, plugin); renderArmor(pony, matrices, provider, light, entity, limbDistance, limbAngle, age, headYaw, headPitch, i, ArmourLayer.OUTER, plugin);
} }
@ -78,15 +78,11 @@ public class ArmourFeature<T extends LivingEntity, M extends EntityModel<T> & Po
if (m != null && m.poseModel(entity, limbAngle, limbDistance, age, headYaw, headPitch, armorSlot, layer, pony.body())) { if (m != null && m.poseModel(entity, limbAngle, limbDistance, age, headYaw, headPitch, armorSlot, layer, pony.body())) {
VertexConsumer armorConsumer = plugin.getArmourConsumer(armorSlot, provider, layerTexture.texture(), layer); VertexConsumer armorConsumer = plugin.getArmourConsumer(armorSlot, provider, layerTexture.texture(), layer);
if (armorConsumer != null) { if (armorConsumer != null) {
float red = 1; int armorTint = Colors.WHITE;
float green = 1;
float blue = 1;
if (armorLayer.isDyeable() && color != Colors.WHITE) { if (armorLayer.isDyeable() && color != Colors.WHITE) {
red = Color.r(color); armorTint = color;
green = Color.g(color);
blue = Color.b(color);
} }
m.render(matrices, armorConsumer, light, OverlayTexture.DEFAULT_UV, red, green, blue, alpha); m.render(matrices, armorConsumer, light, OverlayTexture.DEFAULT_UV, (armorTint & 0xFFFFFF) | ((int)(alpha * 255) << 24));
} }
if (glint) { if (glint) {
models.add(m); models.add(m);
@ -104,7 +100,7 @@ public class ArmourFeature<T extends LivingEntity, M extends EntityModel<T> & Po
if (m != null && m.poseModel(entity, limbAngle, limbDistance, age, headYaw, headPitch, armorSlot, layer, pony.body())) { if (m != null && m.poseModel(entity, limbAngle, limbDistance, age, headYaw, headPitch, armorSlot, layer, pony.body())) {
VertexConsumer trimConsumer = plugin.getTrimConsumer(armorSlot, provider, armor.getMaterial(), trim, layer); VertexConsumer trimConsumer = plugin.getTrimConsumer(armorSlot, provider, armor.getMaterial(), trim, layer);
if (trimConsumer != null) { if (trimConsumer != null) {
m.render(matrices, trimConsumer, light, OverlayTexture.DEFAULT_UV, 1, 1, 1, 1); m.render(matrices, trimConsumer, light, OverlayTexture.DEFAULT_UV, 0xFFFFFFFF);
} }
} }
} }
@ -114,7 +110,7 @@ public class ArmourFeature<T extends LivingEntity, M extends EntityModel<T> & Po
VertexConsumer glintConsumer = plugin.getGlintConsumer(armorSlot, provider, layer); VertexConsumer glintConsumer = plugin.getGlintConsumer(armorSlot, provider, layer);
if (glintConsumer != null) { if (glintConsumer != null) {
for (var m : models) { for (var m : models) {
m.render(matrices, glintConsumer, light, OverlayTexture.DEFAULT_UV, 1, 1, 1, glintAlpha); m.render(matrices, glintConsumer, light, OverlayTexture.DEFAULT_UV, Color.argbToHex(glintAlpha, 1, 1, 1));
} }
} }
} }

View file

@ -10,9 +10,9 @@ import net.minecraft.client.network.AbstractClientPlayerEntity;
import net.minecraft.client.render.OverlayTexture; import net.minecraft.client.render.OverlayTexture;
import net.minecraft.client.render.VertexConsumer; 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.util.math.MatrixStack; import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.entity.EquipmentSlot; import net.minecraft.entity.EquipmentSlot;
import net.minecraft.entity.player.PlayerModelPart;
import net.minecraft.util.math.*; import net.minecraft.util.math.*;
public class CapeFeature<M extends ClientPonyModel<AbstractClientPlayerEntity>> extends AbstractPonyFeature<AbstractClientPlayerEntity, M> { public class CapeFeature<M extends ClientPonyModel<AbstractClientPlayerEntity>> extends AbstractPonyFeature<AbstractClientPlayerEntity, M> {

View file

@ -6,6 +6,7 @@ import net.minecraft.client.render.VertexConsumer;
import net.minecraft.client.render.VertexConsumerProvider; import net.minecraft.client.render.VertexConsumerProvider;
import net.minecraft.client.render.entity.model.EntityModel; import net.minecraft.client.render.entity.model.EntityModel;
import net.minecraft.client.util.math.MatrixStack; import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.util.Colors;
import com.minelittlepony.client.model.ModelType; import com.minelittlepony.client.model.ModelType;
import com.minelittlepony.api.model.BodyPart; import com.minelittlepony.api.model.BodyPart;
@ -22,7 +23,7 @@ public class DJPon3Feature<T extends AbstractClientPlayerEntity, M extends Entit
} }
@Override @Override
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 light, T entity, float limbDistance, float limbAngle, float tickDelta, float age, float headYaw, float headPitch) {
if ("deadmau5".equals(entity.getName().getString())) { if ("deadmau5".equals(entity.getName().getString())) {
stack.push(); stack.push();
@ -38,7 +39,7 @@ public class DJPon3Feature<T extends AbstractClientPlayerEntity, M extends Entit
VertexConsumer vertices = renderContext.getBuffer(deadMau5.getLayer(entity.getSkinTextures().texture())); VertexConsumer vertices = renderContext.getBuffer(deadMau5.getLayer(entity.getSkinTextures().texture()));
deadMau5.render(stack, vertices, OverlayTexture.DEFAULT_UV, lightUv, limbDistance, limbAngle, tickDelta, 1); deadMau5.render(stack, vertices, OverlayTexture.DEFAULT_UV, light, Colors.WHITE);
stack.pop(); stack.pop();
} }

View file

@ -13,17 +13,18 @@ import net.minecraft.client.network.AbstractClientPlayerEntity;
import net.minecraft.client.render.OverlayTexture; import net.minecraft.client.render.OverlayTexture;
import net.minecraft.client.render.VertexConsumer; 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.model.EntityModel; import net.minecraft.client.render.entity.model.EntityModel;
import net.minecraft.client.util.SkinTextures; import net.minecraft.client.util.SkinTextures;
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.entity.player.PlayerModelPart;
import net.minecraft.entity.EquipmentSlot; import net.minecraft.entity.EquipmentSlot;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.util.Colors;
import net.minecraft.util.Identifier; import net.minecraft.util.Identifier;
public class ElytraFeature<T extends LivingEntity, M extends EntityModel<T> & PonyModel<T>> extends AbstractPonyFeature<T, M> { public class ElytraFeature<T extends LivingEntity, M extends EntityModel<T> & PonyModel<T>> extends AbstractPonyFeature<T, M> {
private static final Identifier TEXTURE = new Identifier("textures/entity/elytra.png"); private static final Identifier TEXTURE = Identifier.ofVanilla("textures/entity/elytra.png");
private final PonyElytra<T> model = ModelType.ELYTRA.createModel(); private final PonyElytra<T> model = ModelType.ELYTRA.createModel();
@ -52,7 +53,7 @@ public class ElytraFeature<T extends LivingEntity, M extends EntityModel<T> & Po
getContextModel().copyStateTo(model); getContextModel().copyStateTo(model);
model.isSneaking = PonyPosture.isCrouching(getContext().getEntityPony(entity), entity); model.isSneaking = PonyPosture.isCrouching(getContext().getEntityPony(entity), entity);
model.setAngles(entity, limbDistance, limbAngle, age, headYaw, headPitch); model.setAngles(entity, limbDistance, limbAngle, age, headYaw, headPitch);
model.render(matrices, vertexConsumer, light, OverlayTexture.DEFAULT_UV, 1, 1, 1, alpha); model.render(matrices, vertexConsumer, light, OverlayTexture.DEFAULT_UV, (Colors.WHITE & 0xFFFFFF) | (int)(alpha * 255) << 24);
matrices.pop(); matrices.pop();
} }

View file

@ -9,6 +9,7 @@ import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.entity.EquipmentSlot; import net.minecraft.entity.EquipmentSlot;
import net.minecraft.entity.LivingEntity; import net.minecraft.entity.LivingEntity;
import net.minecraft.item.*; import net.minecraft.item.*;
import net.minecraft.util.Colors;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.random.Random; import net.minecraft.util.math.random.Random;
import net.minecraft.world.EmptyBlockView; import net.minecraft.world.EmptyBlockView;
@ -96,7 +97,7 @@ public class GearFeature<T extends LivingEntity, M extends EntityModel<T> & Pony
private void renderGear(M model, T entity, Gear gear, MatrixStack stack, VertexConsumerProvider renderContext, int lightUv, float limbDistance, float limbAngle, float tickDelta) { private void renderGear(M model, T entity, Gear gear, MatrixStack stack, VertexConsumerProvider renderContext, int lightUv, float limbDistance, float limbAngle, float tickDelta) {
gear.pose(model, entity, model.getAttributes().isGoingFast, entity.getUuid(), limbDistance, limbAngle, model.getWobbleAmount(), tickDelta); gear.pose(model, entity, model.getAttributes().isGoingFast, entity.getUuid(), limbDistance, limbAngle, model.getWobbleAmount(), tickDelta);
gear.render(stack, renderContext.getBuffer(gear.getLayer(entity, getContext())), lightUv, OverlayTexture.DEFAULT_UV, 1, 1, 1, 1, entity.getUuid()); gear.render(stack, renderContext.getBuffer(gear.getLayer(entity, getContext())), lightUv, OverlayTexture.DEFAULT_UV, Colors.WHITE, entity.getUuid());
} }
static record Entry(Gear gear, Wearable wearable) { } static record Entry(Gear gear, Wearable wearable) { }

View file

@ -4,12 +4,12 @@ import net.minecraft.client.render.entity.LivingEntityRenderer;
import net.minecraft.entity.mob.AbstractSkeletonEntity; import net.minecraft.entity.mob.AbstractSkeletonEntity;
import net.minecraft.util.Identifier; import net.minecraft.util.Identifier;
import com.minelittlepony.client.MineLittlePony;
import com.minelittlepony.client.model.ModelType; import com.minelittlepony.client.model.ModelType;
import com.minelittlepony.client.model.entity.SkeleponyModel; import com.minelittlepony.client.model.entity.SkeleponyModel;
public class StrayClothingFeature<Skeleton extends AbstractSkeletonEntity> extends AbstractClothingFeature<Skeleton, SkeleponyModel<Skeleton>> { public class StrayClothingFeature<Skeleton extends AbstractSkeletonEntity> extends AbstractClothingFeature<Skeleton, SkeleponyModel<Skeleton>> {
public static final Identifier STRAY_SKELETON_OVERLAY = MineLittlePony.id("textures/entity/skeleton/stray_pony_overlay.png");
public static final Identifier STRAY_SKELETON_OVERLAY = new Identifier("minelittlepony", "textures/entity/skeleton/stray_pony_overlay.png");
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
private final SkeleponyModel<Skeleton> overlayModel = (SkeleponyModel<Skeleton>)ModelType.SKELETON_CLOTHES.createModel(); private final SkeleponyModel<Skeleton> overlayModel = (SkeleponyModel<Skeleton>)ModelType.SKELETON_CLOTHES.createModel();

View file

@ -1,5 +1,6 @@
package com.minelittlepony.client.render.entity.npc; package com.minelittlepony.client.render.entity.npc;
import com.minelittlepony.client.MineLittlePony;
import com.minelittlepony.client.model.ModelType; import com.minelittlepony.client.model.ModelType;
import com.minelittlepony.client.model.entity.IllagerPonyModel; import com.minelittlepony.client.model.entity.IllagerPonyModel;
import com.minelittlepony.client.render.entity.feature.IllagerHeldItemFeature; import com.minelittlepony.client.render.entity.feature.IllagerHeldItemFeature;
@ -19,9 +20,9 @@ import net.minecraft.util.math.MathHelper;
import net.minecraft.util.math.Vec3d; import net.minecraft.util.math.Vec3d;
public class IllagerPonyRenderer<T extends IllagerEntity> extends PonyRenderer<T, IllagerPonyModel<T>> { public class IllagerPonyRenderer<T extends IllagerEntity> extends PonyRenderer<T, IllagerPonyModel<T>> {
public static final Identifier ILLUSIONIST = new Identifier("minelittlepony", "textures/entity/illager/illusionist_pony.png"); public static final Identifier ILLUSIONIST = MineLittlePony.id("textures/entity/illager/illusionist_pony.png");
public static final Identifier EVOKER = new Identifier("minelittlepony", "textures/entity/illager/evoker_pony.png"); public static final Identifier EVOKER = MineLittlePony.id("textures/entity/illager/evoker_pony.png");
public static final Identifier VINDICATOR = new Identifier("minelittlepony", "textures/entity/illager/vindicator_pony.png"); public static final Identifier VINDICATOR = MineLittlePony.id("textures/entity/illager/vindicator_pony.png");
public IllagerPonyRenderer(EntityRendererFactory.Context context, Identifier texture) { public IllagerPonyRenderer(EntityRendererFactory.Context context, Identifier texture) {
super(context, ModelType.ILLAGER, TextureSupplier.of(texture), BASE_MODEL_SCALE); super(context, ModelType.ILLAGER, TextureSupplier.of(texture), BASE_MODEL_SCALE);

View file

@ -8,8 +8,7 @@ import net.minecraft.client.render.entity.model.EntityModel;
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.registry.Registries;
import net.minecraft.util.Identifier; import net.minecraft.util.*;
import net.minecraft.util.Util;
import net.minecraft.util.math.MathHelper; import net.minecraft.util.math.MathHelper;
import net.minecraft.village.VillagerData; import net.minecraft.village.VillagerData;
import net.minecraft.village.VillagerDataContainer; import net.minecraft.village.VillagerDataContainer;
@ -17,6 +16,7 @@ import net.minecraft.village.VillagerProfession;
import net.minecraft.village.VillagerType; import net.minecraft.village.VillagerType;
import com.minelittlepony.api.model.PonyModel; import com.minelittlepony.api.model.PonyModel;
import com.minelittlepony.client.MineLittlePony;
import com.minelittlepony.client.render.PonyRenderContext; import com.minelittlepony.client.render.PonyRenderContext;
import com.minelittlepony.client.render.entity.feature.AbstractPonyFeature; import com.minelittlepony.client.render.entity.feature.AbstractPonyFeature;
import com.minelittlepony.client.util.render.TextureFlattener; import com.minelittlepony.client.util.render.TextureFlattener;
@ -30,11 +30,11 @@ class NpcClothingFeature<
C extends FeatureRendererContext<T, M> & PonyRenderContext<T, M>> extends AbstractPonyFeature<T, M> { C extends FeatureRendererContext<T, M> & PonyRenderContext<T, M>> extends AbstractPonyFeature<T, M> {
private static final Int2ObjectMap<Identifier> LEVEL_TO_ID = Util.make(new Int2ObjectOpenHashMap<>(), a -> { private static final Int2ObjectMap<Identifier> LEVEL_TO_ID = Util.make(new Int2ObjectOpenHashMap<>(), a -> {
a.put(1, new Identifier("stone")); a.put(1, Identifier.ofVanilla("stone"));
a.put(2, new Identifier("iron")); a.put(2, Identifier.ofVanilla("iron"));
a.put(3, new Identifier("gold")); a.put(3, Identifier.ofVanilla("gold"));
a.put(4, new Identifier("emerald")); a.put(4, Identifier.ofVanilla("emerald"));
a.put(5, new Identifier("diamond")); a.put(5, Identifier.ofVanilla("diamond"));
}); });
private final Set<Identifier> loadedTextures = new HashSet<>(); private final Set<Identifier> loadedTextures = new HashSet<>();
@ -59,9 +59,9 @@ class NpcClothingFeature<
if (!ResourceUtil.textureExists(typeSkin)) { if (!ResourceUtil.textureExists(typeSkin)) {
typeSkin = createTexture("type", Registries.VILLAGER_TYPE.getId(VillagerType.PLAINS)); typeSkin = createTexture("type", Registries.VILLAGER_TYPE.getId(VillagerType.PLAINS));
} }
renderModel(entityModel, typeSkin, matrixStack, provider, i, entity, 1, 1, 1); renderModel(entityModel, typeSkin, matrixStack, provider, i, entity, Colors.WHITE);
} else { } else {
renderModel(entityModel, getMergedTexture(data), matrixStack, provider, i, entity, 1, 1, 1); renderModel(entityModel, getMergedTexture(data), matrixStack, provider, i, entity, Colors.WHITE);
} }
} }
@ -73,7 +73,7 @@ class NpcClothingFeature<
Identifier typeId = Registries.VILLAGER_TYPE.getId(type); Identifier typeId = Registries.VILLAGER_TYPE.getId(type);
Identifier profId = Registries.VILLAGER_PROFESSION.getId(profession); Identifier profId = Registries.VILLAGER_PROFESSION.getId(profession);
Identifier key = new Identifier("minelittlepony", (typeId + "/" + profId + "/" + level).replace(':', '_')); Identifier key = MineLittlePony.id((typeId + "/" + profId + "/" + level).replace(':', '_'));
if (loadedTextures.add(key) && !ResourceUtil.textureExists(key)) { if (loadedTextures.add(key) && !ResourceUtil.textureExists(key)) {
TextureFlattener.flatten(computeTextures(typeId, profId, profession == VillagerProfession.NITWIT ? -1 : level), key); TextureFlattener.flatten(computeTextures(typeId, profId, profession == VillagerProfession.NITWIT ? -1 : level), key);
@ -91,7 +91,7 @@ class NpcClothingFeature<
} }
Identifier profTexture = createTexture("profession", profId); Identifier profTexture = createTexture("profession", profId);
skins.add(ResourceUtil.textureExists(profTexture) ? profTexture : createTexture("profession", new Identifier(VillagerProfession.NITWIT.id()))); skins.add(ResourceUtil.textureExists(profTexture) ? profTexture : createTexture("profession", Identifier.of(VillagerProfession.NITWIT.id())));
if (level != -1) { if (level != -1) {
skins.add(createTexture("profession_level", LEVEL_TO_ID.get(level))); skins.add(createTexture("profession_level", LEVEL_TO_ID.get(level)));
@ -105,6 +105,6 @@ class NpcClothingFeature<
} }
private Identifier createTexture(String category, Identifier identifier) { private Identifier createTexture(String category, Identifier identifier) {
return new Identifier("minelittlepony", String.format("textures/entity/%s/%s/%s.png", entityType, category, identifier.getPath())); return MineLittlePony.id(String.format("textures/entity/%s/%s/%s.png", entityType, category, identifier.getPath()));
} }
} }

View file

@ -4,6 +4,7 @@ import net.minecraft.client.render.entity.EntityRendererFactory;
import net.minecraft.entity.mob.PillagerEntity; import net.minecraft.entity.mob.PillagerEntity;
import net.minecraft.util.Identifier; import net.minecraft.util.Identifier;
import com.minelittlepony.client.MineLittlePony;
import com.minelittlepony.client.model.ModelType; import com.minelittlepony.client.model.ModelType;
import com.minelittlepony.client.model.entity.PillagerPonyModel; import com.minelittlepony.client.model.entity.PillagerPonyModel;
import com.minelittlepony.client.render.entity.feature.IllagerHeldItemFeature; import com.minelittlepony.client.render.entity.feature.IllagerHeldItemFeature;
@ -12,8 +13,7 @@ import com.minelittlepony.client.render.entity.PonyRenderer;
import com.minelittlepony.client.render.entity.feature.HeldItemFeature; import com.minelittlepony.client.render.entity.feature.HeldItemFeature;
public class PillagerRenderer extends PonyRenderer<PillagerEntity, PillagerPonyModel<PillagerEntity>> { public class PillagerRenderer extends PonyRenderer<PillagerEntity, PillagerPonyModel<PillagerEntity>> {
private static final Identifier TEXTURE = MineLittlePony.id("textures/entity/illager/pillager_pony.png");
private static final Identifier TEXTURE = new Identifier("minelittlepony", "textures/entity/illager/pillager_pony.png");
public PillagerRenderer(EntityRendererFactory.Context context) { public PillagerRenderer(EntityRendererFactory.Context context) {
super(context, ModelType.PILLAGER, TextureSupplier.of(TEXTURE)); super(context, ModelType.PILLAGER, TextureSupplier.of(TEXTURE));

View file

@ -4,14 +4,14 @@ import net.minecraft.client.render.entity.EntityRendererFactory;
import net.minecraft.entity.passive.WanderingTraderEntity; import net.minecraft.entity.passive.WanderingTraderEntity;
import net.minecraft.util.Identifier; import net.minecraft.util.Identifier;
import com.minelittlepony.client.MineLittlePony;
import com.minelittlepony.client.model.ModelType; import com.minelittlepony.client.model.ModelType;
import com.minelittlepony.client.model.entity.race.AlicornModel; import com.minelittlepony.client.model.entity.race.AlicornModel;
import com.minelittlepony.client.render.entity.PonyRenderer; import com.minelittlepony.client.render.entity.PonyRenderer;
import com.minelittlepony.client.render.entity.npc.textures.TextureSupplier; import com.minelittlepony.client.render.entity.npc.textures.TextureSupplier;
public class TraderRenderer extends PonyRenderer<WanderingTraderEntity, AlicornModel<WanderingTraderEntity>> { public class TraderRenderer extends PonyRenderer<WanderingTraderEntity, AlicornModel<WanderingTraderEntity>> {
public static final Identifier TEXTURE = MineLittlePony.id("textures/entity/wandering_trader_pony.png");
public static final Identifier TEXTURE = new Identifier("minelittlepony", "textures/entity/wandering_trader_pony.png");
public TraderRenderer(EntityRendererFactory.Context context) { public TraderRenderer(EntityRendererFactory.Context context) {
super(context, ModelType.ALICORN.getKey(false), TextureSupplier.of(TEXTURE), BASE_MODEL_SCALE); super(context, ModelType.ALICORN.getKey(false), TextureSupplier.of(TEXTURE), BASE_MODEL_SCALE);

View file

@ -24,7 +24,7 @@ public interface TextureSupplier<T> extends Function<T, Identifier> {
Identifier apply(T key); Identifier apply(T key);
static TextureSupplier<String> formatted(String domain, String path) { static TextureSupplier<String> formatted(String domain, String path) {
return key -> new Identifier(domain, String.format(path, key)); return key -> Identifier.of(domain, String.format(path, key));
} }
static <T extends LivingEntity> TextureSupplier<T> ofVariations(Identifier poolId, TextureSupplier<T> fallback) { static <T extends LivingEntity> TextureSupplier<T> ofVariations(Identifier poolId, TextureSupplier<T> fallback) {

View file

@ -1,15 +0,0 @@
package com.minelittlepony.client.util.render;
import java.util.Optional;
import net.minecraft.client.render.*;
import net.minecraft.util.Identifier;
@Deprecated
public interface RenderLayerUtil {
static Optional<Identifier> getTexture(RenderLayer layer) {
if (layer instanceof RenderLayer.MultiPhase multiphase) {
return multiphase.getPhases().texture.getId();
}
return Optional.empty();
}
}

View file

@ -1,71 +0,0 @@
package com.minelittlepony.client.util.render;
import net.minecraft.client.model.ModelPart;
import net.minecraft.client.render.VertexConsumer;
import net.minecraft.client.util.math.MatrixStack;
import java.util.*;
import java.util.function.BooleanSupplier;
import java.util.function.Consumer;
@Deprecated
public interface RenderList {
void accept(MatrixStack stack, VertexConsumer vertices, int overlayUv, int lightUv, float red, float green, float blue, float alpha);
default RenderList add(RenderList part) {
return this;
}
default RenderList add(Consumer<MatrixStack> action) {
return add((stack, vertices, overlayUv, lightUv, red, green, blue, alpha) -> action.accept(stack));
}
default RenderList add(ModelPart...parts) {
return add(of(parts));
}
default RenderList checked(BooleanSupplier check) {
RenderList self = this;
return (stack, vertices, overlayUv, lightUv, red, green, blue, alpha) -> {
if (check.getAsBoolean()) {
self.accept(stack, vertices, overlayUv, lightUv, red, green, blue, alpha);
}
};
}
default void clear() {}
static RenderList of() {
return new Impl(List.of());
}
static RenderList of(ModelPart...parts) {
return new Impl(Arrays.stream(parts).map(part -> (RenderList)part::render).toList());
}
public class Impl implements RenderList {
private final List<RenderList> parts;
Impl(List<RenderList> parts) {
this.parts = new ArrayList<>(parts);
}
@Override
public RenderList add(RenderList part) {
parts.add(part);
return this;
}
@Override
public void clear() {
parts.clear();
}
@Override
public void accept(MatrixStack stack, VertexConsumer vertices, int overlayUv, int lightUv, float red, float green, float blue, float alpha) {
parts.forEach(part -> part.accept(stack, vertices, overlayUv, lightUv, red, green, blue, alpha));
}
}
}