diff --git a/src/main/java/io/github/cottonmc/templates/model/RetexturingBakedModel.java b/src/main/java/io/github/cottonmc/templates/model/RetexturingBakedModel.java index 93a71f1..79e5131 100644 --- a/src/main/java/io/github/cottonmc/templates/model/RetexturingBakedModel.java +++ b/src/main/java/io/github/cottonmc/templates/model/RetexturingBakedModel.java @@ -62,7 +62,7 @@ public abstract class RetexturingBakedModel extends ForwardingBakedModel { @Override public Sprite getParticleSprite() { - return tam.getDefaultAppearance().getParticleSprite(); + return tam.getDefaultAppearance().getSprite(Direction.UP); } @Override diff --git a/src/main/java/io/github/cottonmc/templates/model/TemplateAppearance.java b/src/main/java/io/github/cottonmc/templates/model/TemplateAppearance.java index 9a55ed3..18e2525 100644 --- a/src/main/java/io/github/cottonmc/templates/model/TemplateAppearance.java +++ b/src/main/java/io/github/cottonmc/templates/model/TemplateAppearance.java @@ -7,16 +7,20 @@ import org.jetbrains.annotations.NotNull; //TODO: move to the api package public interface TemplateAppearance { - @NotNull Sprite getParticleSprite(); //TODO: plug this in (particle mixins don't use it atm) - @NotNull RenderMaterial getRenderMaterial(boolean ao); @NotNull Sprite getSprite(Direction dir); int getBakeFlags(Direction dir); boolean hasColor(Direction dir); - //binary-compat + //binary-compat - from before conditional model AO was added @Deprecated(forRemoval = true) default @NotNull RenderMaterial getRenderMaterial() { return getRenderMaterial(false); } + + //binary-compat - I never ended up implementing this, it's much easier to modify particles via the BlockState + @Deprecated(forRemoval = true) + default @NotNull Sprite getParticleSprite() { + return getSprite(Direction.NORTH); + } } diff --git a/src/main/java/io/github/cottonmc/templates/model/TemplateAppearanceManager.java b/src/main/java/io/github/cottonmc/templates/model/TemplateAppearanceManager.java index 4dc1e22..3ab382a 100644 --- a/src/main/java/io/github/cottonmc/templates/model/TemplateAppearanceManager.java +++ b/src/main/java/io/github/cottonmc/templates/model/TemplateAppearanceManager.java @@ -51,7 +51,8 @@ public class TemplateAppearanceManager { this.barrierItemAppearance = new SingleSpriteAppearance(barrier, materialsWithoutAo.get(BlendMode.CUTOUT), serialNumber.getAndIncrement()); } - @ApiStatus.Internal //shouldn't have made this public, just maintaining abi compat + //TODO ABI: Shouldn't have been made public. Clean up at a later point. + @ApiStatus.Internal public static final SpriteIdentifier DEFAULT_SPRITE_ID = new SpriteIdentifier(PlayerScreenHandler.BLOCK_ATLAS_TEXTURE, new Identifier("minecraft:block/scaffolding_top")); private static final SpriteIdentifier BARRIER_SPRITE_ID = new SpriteIdentifier(PlayerScreenHandler.BLOCK_ATLAS_TEXTURE, new Identifier("minecraft:item/barrier")); @@ -92,7 +93,7 @@ public class TemplateAppearanceManager { QuadEmitter emitter = r.meshBuilder().getEmitter(); RenderMaterial defaultMat = r.materialFinder().clear().find(); - Sprite[] sprites = new Sprite[7]; + Sprite[] sprites = new Sprite[6]; int[] bakeFlags = new int[6]; byte hasColorMask = 0b000000; @@ -140,17 +141,15 @@ public class TemplateAppearanceManager { } else if(lowHighSignature == 0b01111000) { bakeFlags[dir.ordinal()] = MutableQuadView.BAKE_ROTATE_270; } else { + //TODO handle more cases. //Its not critical error or anything, the texture will show rotated or flipped //System.out.println("unknown sig " + Integer.toString(lowHighSignature, 2) + ", state: " + state + ", sprite: " + sprite.getContents().getId() + ", side: " + dir); } } - //Just for space-usage purposes, we store the particle in sprites[6] instead of using another field. - sprites[6] = model.getParticleSprite(); - //Fill out any missing values in the sprites array, since failure to pick textures shouldn't lead to NPEs later on for(int i = 0; i < sprites.length; i++) { - if(sprites[i] == null) sprites[i] = defaultAppearance.getParticleSprite(); + if(sprites[i] == null) sprites[i] = defaultAppearance.getSprite(Direction.byId(i)); } return new ComputedApperance( @@ -181,11 +180,6 @@ public class TemplateAppearanceManager { this.matWithoutAo = withoutAo; } - @Override - public @NotNull Sprite getParticleSprite() { - return sprites[6]; - } - @Override public @NotNull RenderMaterial getRenderMaterial(boolean ao) { return ao ? matWithAo : matWithoutAo; @@ -237,11 +231,6 @@ public class TemplateAppearanceManager { this.id = id; } - @Override - public @NotNull Sprite getParticleSprite() { - return defaultSprite; - } - @Override public @NotNull RenderMaterial getRenderMaterial(boolean ao) { return mat;