Cleanup
This commit is contained in:
parent
fe38d2d468
commit
e0ed3855e9
2 changed files with 9 additions and 18 deletions
|
@ -85,14 +85,11 @@ public class EChestBlockEntityRenderer extends BlockEntityRenderer<EChestBlockEn
|
||||||
this.partLeftB.pivotY = 8.0F;
|
this.partLeftB.pivotY = 8.0F;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void render(EChestBlockEntity entity, float tickDelta, MatrixStack matrices,
|
public void render(EChestBlockEntity entity, float tickDelta, MatrixStack matrices, VertexConsumerProvider vertexConsumers, int light, int overlay) {
|
||||||
VertexConsumerProvider vertexConsumers, int light, int overlay) {
|
|
||||||
World world = entity.getWorld();
|
World world = entity.getWorld();
|
||||||
boolean worldExists = world != null;
|
boolean worldExists = world != null;
|
||||||
BlockState blockState = worldExists ? entity.getCachedState()
|
BlockState blockState = worldExists ? entity.getCachedState() : (BlockState) Blocks.CHEST.getDefaultState().with(ChestBlock.FACING, Direction.SOUTH);
|
||||||
: (BlockState) Blocks.CHEST.getDefaultState().with(ChestBlock.FACING, Direction.SOUTH);
|
ChestType chestType = blockState.contains(ChestBlock.CHEST_TYPE) ? (ChestType) blockState.get(ChestBlock.CHEST_TYPE) : ChestType.SINGLE;
|
||||||
ChestType chestType = blockState.contains(ChestBlock.CHEST_TYPE)
|
|
||||||
? (ChestType) blockState.get(ChestBlock.CHEST_TYPE) : ChestType.SINGLE;
|
|
||||||
Block block = blockState.getBlock();
|
Block block = blockState.getBlock();
|
||||||
if (block instanceof AbstractChestBlock) {
|
if (block instanceof AbstractChestBlock) {
|
||||||
AbstractChestBlock<?> abstractChestBlock = (AbstractChestBlock<?>) block;
|
AbstractChestBlock<?> abstractChestBlock = (AbstractChestBlock<?>) block;
|
||||||
|
@ -111,23 +108,19 @@ public class EChestBlockEntityRenderer extends BlockEntityRenderer<EChestBlockEn
|
||||||
propertySource = DoubleBlockProperties.PropertyRetriever::getFallback;
|
propertySource = DoubleBlockProperties.PropertyRetriever::getFallback;
|
||||||
}
|
}
|
||||||
|
|
||||||
float pitch = ((Float2FloatFunction) propertySource
|
float pitch = ((Float2FloatFunction) propertySource.apply(ChestBlock.getAnimationProgressRetriever((ChestAnimationProgress) entity))).get(tickDelta);
|
||||||
.apply(ChestBlock.getAnimationProgressRetriever((ChestAnimationProgress) entity))).get(tickDelta);
|
|
||||||
pitch = 1.0F - pitch;
|
pitch = 1.0F - pitch;
|
||||||
pitch = 1.0F - pitch * pitch * pitch;
|
pitch = 1.0F - pitch * pitch * pitch;
|
||||||
@SuppressWarnings({ "unchecked", "rawtypes" })
|
@SuppressWarnings({ "unchecked", "rawtypes" })
|
||||||
int blockLight = ((Int2IntFunction) propertySource.apply(new LightmapCoordinatesRetriever()))
|
int blockLight = ((Int2IntFunction) propertySource.apply(new LightmapCoordinatesRetriever())).applyAsInt(light);
|
||||||
.applyAsInt(light);
|
|
||||||
|
|
||||||
VertexConsumer vertexConsumer = getConsumer(vertexConsumers, block, chestType);
|
VertexConsumer vertexConsumer = getConsumer(vertexConsumers, block, chestType);
|
||||||
|
|
||||||
if (isDouble) {
|
if (isDouble) {
|
||||||
if (chestType == ChestType.LEFT) {
|
if (chestType == ChestType.LEFT) {
|
||||||
renderParts(matrices, vertexConsumer, this.partLeftA, this.partLeftB, this.partLeftC, pitch,
|
renderParts(matrices, vertexConsumer, this.partLeftA, this.partLeftB, this.partLeftC, pitch, blockLight, overlay);
|
||||||
blockLight, overlay);
|
|
||||||
} else {
|
} else {
|
||||||
renderParts(matrices, vertexConsumer, this.partRightA, this.partRightB, this.partRightC, pitch,
|
renderParts(matrices, vertexConsumer, this.partRightA, this.partRightB, this.partRightC, pitch, blockLight, overlay);
|
||||||
blockLight, overlay);
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
renderParts(matrices, vertexConsumer, this.partA, this.partB, this.partC, pitch, blockLight, overlay);
|
renderParts(matrices, vertexConsumer, this.partA, this.partB, this.partC, pitch, blockLight, overlay);
|
||||||
|
@ -137,8 +130,7 @@ public class EChestBlockEntityRenderer extends BlockEntityRenderer<EChestBlockEn
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void renderParts(MatrixStack matrices, VertexConsumer vertices, ModelPart modelPart, ModelPart modelPart2,
|
private void renderParts(MatrixStack matrices, VertexConsumer vertices, ModelPart modelPart, ModelPart modelPart2, ModelPart modelPart3, float pitch, int light, int overlay) {
|
||||||
ModelPart modelPart3, float pitch, int light, int overlay) {
|
|
||||||
modelPart.pitch = -(pitch * 1.5707964F);
|
modelPart.pitch = -(pitch * 1.5707964F);
|
||||||
modelPart2.pitch = modelPart.pitch;
|
modelPart2.pitch = modelPart.pitch;
|
||||||
modelPart.render(matrices, vertices, light, overlay);
|
modelPart.render(matrices, vertices, light, overlay);
|
||||||
|
|
|
@ -81,8 +81,7 @@ public class ESignBlockEntityRenderer extends BlockEntityRenderer<ESignBlockEnti
|
||||||
});
|
});
|
||||||
if (orderedText != null) {
|
if (orderedText != null) {
|
||||||
float t = (float) (-textRenderer.getWidth(orderedText) / 2);
|
float t = (float) (-textRenderer.getWidth(orderedText) / 2);
|
||||||
textRenderer.draw((OrderedText) orderedText, t, (float) (s * 10 - 20), q, false,
|
textRenderer.draw((OrderedText) orderedText, t, (float) (s * 10 - 20), q, false, matrixStack.peek().getModel(), provider, false, 0, light);
|
||||||
matrixStack.peek().getModel(), provider, false, 0, light);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue