diff --git a/src/main/java/net/minecraftforge/client/model/pipeline/VertexLighterFlat.java b/src/main/java/net/minecraftforge/client/model/pipeline/VertexLighterFlat.java index a30166609f..7480c90e4a 100644 --- a/src/main/java/net/minecraftforge/client/model/pipeline/VertexLighterFlat.java +++ b/src/main/java/net/minecraftforge/client/model/pipeline/VertexLighterFlat.java @@ -31,7 +31,7 @@ import net.minecraft.util.EnumFacing; import net.minecraft.util.math.BlockPos; import net.minecraft.world.IBlockAccess; -import com.google.common.base.Objects; +import java.util.Objects; public class VertexLighterFlat extends QuadGatheringTransformer { @@ -46,6 +46,8 @@ public class VertexLighterFlat extends QuadGatheringTransformer protected int colorIndex = -1; protected int lightmapIndex = -1; + protected VertexFormat baseFormat; + public VertexLighterFlat(BlockColors colors) { this.blockInfo = new BlockInfo(colors); @@ -55,9 +57,11 @@ public class VertexLighterFlat extends QuadGatheringTransformer public void setParent(IVertexConsumer parent) { super.setParent(parent); - VertexFormat format = getVertexFormat(parent); - if(Objects.equal(format, getVertexFormat())) return; - setVertexFormat(format); + setVertexFormat(parent.getVertexFormat()); + } + + private void updateIndices() + { for(int i = 0; i < getVertexFormat().getElementCount(); i++) { switch(getVertexFormat().getElement(i).getUsage()) @@ -94,13 +98,19 @@ public class VertexLighterFlat extends QuadGatheringTransformer } } - private static VertexFormat getVertexFormat(IVertexConsumer parent) + @Override + public void setVertexFormat(VertexFormat format) { - VertexFormat format = parent.getVertexFormat(); - if(format == null || format.hasNormal()) return format; - format = new VertexFormat(format); - format.addElement(NORMAL_4F); - return format; + if (Objects.equals(format, baseFormat)) return; + baseFormat = format; + super.setVertexFormat(withNormal(format)); + updateIndices(); + } + + private static VertexFormat withNormal(VertexFormat format) + { + if (format == null || format.hasNormal()) return format; + return new VertexFormat(format).addElement(NORMAL_4F); } @Override