mirror of
https://github.com/Sollace/Unicopia.git
synced 2024-11-24 05:47:59 +01:00
Fixed crash when attempting to render blocks with tile non-rendered entities
This commit is contained in:
parent
1df7f4fa40
commit
83d81b0a25
1 changed files with 15 additions and 11 deletions
|
@ -13,6 +13,7 @@ import net.minecraft.client.model.Model;
|
||||||
import net.minecraft.client.render.OverlayTexture;
|
import net.minecraft.client.render.OverlayTexture;
|
||||||
import net.minecraft.client.render.VertexConsumerProvider;
|
import net.minecraft.client.render.VertexConsumerProvider;
|
||||||
import net.minecraft.client.render.block.entity.BlockEntityRenderDispatcher;
|
import net.minecraft.client.render.block.entity.BlockEntityRenderDispatcher;
|
||||||
|
import net.minecraft.client.render.block.entity.BlockEntityRenderer;
|
||||||
import net.minecraft.client.render.entity.EntityRenderDispatcher;
|
import net.minecraft.client.render.entity.EntityRenderDispatcher;
|
||||||
import net.minecraft.client.render.entity.EntityRenderer;
|
import net.minecraft.client.render.entity.EntityRenderer;
|
||||||
import net.minecraft.client.render.entity.LivingEntityRenderer;
|
import net.minecraft.client.render.entity.LivingEntityRenderer;
|
||||||
|
@ -100,23 +101,26 @@ public class WorldRenderDelegate {
|
||||||
BlockEntity blockEntity = ve.getBlockEntity();
|
BlockEntity blockEntity = ve.getBlockEntity();
|
||||||
|
|
||||||
if (blockEntity != null) {
|
if (blockEntity != null) {
|
||||||
blockEntity.setPos(e.getBlockPos());
|
BlockEntityRenderer<BlockEntity> r = BlockEntityRenderDispatcher.INSTANCE.get(blockEntity);
|
||||||
matrices.push();
|
if (r != null) {
|
||||||
|
blockEntity.setPos(e.getBlockPos());
|
||||||
|
matrices.push();
|
||||||
|
|
||||||
BlockState state = blockEntity.getCachedState();
|
BlockState state = blockEntity.getCachedState();
|
||||||
Direction direction = state.contains(Properties.HORIZONTAL_FACING) ? state.get(Properties.HORIZONTAL_FACING) : Direction.UP;
|
Direction direction = state.contains(Properties.HORIZONTAL_FACING) ? state.get(Properties.HORIZONTAL_FACING) : Direction.UP;
|
||||||
|
|
||||||
matrices.translate(x, y, z);
|
matrices.translate(x, y, z);
|
||||||
|
|
||||||
matrices.multiply(direction.getRotationQuaternion());
|
matrices.multiply(direction.getRotationQuaternion());
|
||||||
matrices.multiply(Vector3f.NEGATIVE_X.getDegreesQuaternion(90));
|
matrices.multiply(Vector3f.NEGATIVE_X.getDegreesQuaternion(90));
|
||||||
|
|
||||||
matrices.translate(-0.5, 0, -0.5);
|
matrices.translate(-0.5, 0, -0.5);
|
||||||
|
|
||||||
BlockEntityRenderDispatcher.INSTANCE.get(blockEntity).render(blockEntity, 1, matrices, vertexConsumers, light, OverlayTexture.DEFAULT_UV);
|
r.render(blockEntity, 1, matrices, vertexConsumers, light, OverlayTexture.DEFAULT_UV);
|
||||||
|
|
||||||
matrices.pop();
|
matrices.pop();
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
BipedEntityModel<?> model = getBipedModel(dispatcher, e);
|
BipedEntityModel<?> model = getBipedModel(dispatcher, e);
|
||||||
|
|
Loading…
Reference in a new issue