diff --git a/src/main/java/org/dimdev/dimdoors/block/DimensionalPortalBlock.java b/src/main/java/org/dimdev/dimdoors/block/DimensionalPortalBlock.java index 330737d3..1f5491c4 100644 --- a/src/main/java/org/dimdev/dimdoors/block/DimensionalPortalBlock.java +++ b/src/main/java/org/dimdev/dimdoors/block/DimensionalPortalBlock.java @@ -21,7 +21,7 @@ public class DimensionalPortalBlock extends Block implements RiftProvider state.contains(HorizontalFacingBlock.FACING)) + .map(state -> state.get(HorizontalFacingBlock.FACING)) + .orElse(Direction.NORTH); +// BlockState state = this.world.getBlockState(this.pos); +// if (state.contains(HorizontalFacingBlock.FACING)) { +// return state.get(HorizontalFacingBlock.FACING); +// } +// return Direction.NORTH; + } + + /** + * Specifies if the portal should be rendered two blocks tall + */ + public boolean isTall() { + //noinspection ConstantConditions + return this.world.getBlockState(this.pos).getBlock() instanceof DoorBlock; } @Override diff --git a/src/main/java/org/dimdev/dimdoors/client/EntranceRiftBlockEntityRenderer.java b/src/main/java/org/dimdev/dimdoors/client/EntranceRiftBlockEntityRenderer.java index a25f7525..b5526f6d 100644 --- a/src/main/java/org/dimdev/dimdoors/client/EntranceRiftBlockEntityRenderer.java +++ b/src/main/java/org/dimdev/dimdoors/client/EntranceRiftBlockEntityRenderer.java @@ -12,6 +12,7 @@ import net.minecraft.block.BlockState; import net.minecraft.block.DoorBlock; import net.minecraft.block.HorizontalFacingBlock; import net.minecraft.client.MinecraftClient; +import net.minecraft.client.model.ModelPart; import net.minecraft.client.render.RenderLayer; import net.minecraft.client.render.VertexConsumer; import net.minecraft.client.render.VertexConsumerProvider; @@ -29,9 +30,12 @@ import net.fabricmc.api.Environment; @Environment(EnvType.CLIENT) public class EntranceRiftBlockEntityRenderer extends BlockEntityRenderer { private static final Random RANDOM = new Random(31100L); + private final ModelPart warpModel; public EntranceRiftBlockEntityRenderer(BlockEntityRenderDispatcher blockEntityRenderDispatcher) { super(blockEntityRenderDispatcher); + this.warpModel = new ModelPart(1024, 1024, 0, 0); + this.warpModel.addCuboid(0, 0, 0, 16, 16, 0); } @Override @@ -43,7 +47,7 @@ public class EntranceRiftBlockEntityRenderer extends BlockEntityRenderer layers) { + private void renderVertices(EntranceRiftBlockEntity entrance, MatrixStack matrices, VertexConsumerProvider vertexConsumers, Direction orientation, Vector3f vec, List layers, int light, int overlay) { vec.scale((float) (orientation == Direction.NORTH || orientation == Direction.WEST || orientation == Direction.UP ? 0.01 : 0.01 - 1)); double squaredDistance = entrance.getPos().getSquaredDistance(this.dispatcher.camera.getPos(), true); int offset = this.getOffset(squaredDistance); float u = 0.75F; - Matrix4f matrix4f = matrices.peek().getModel(); - this.drawAllVertices(entrance, u, 0.15F, matrix4f, vertexConsumers.getBuffer(layers.get(0))); + this.drawAllVertices(entrance, u, 0.15F, matrices, vertexConsumers.getBuffer(layers.get(0)), light, overlay); for (int i = 1; i < offset; ++i) { - this.drawAllVertices(entrance, u, 2.0F / (float) (18 - i), matrix4f, vertexConsumers.getBuffer(layers.get(i))); + this.drawAllVertices(entrance, u, 2.0F / (float) (18 - i), matrices, vertexConsumers.getBuffer(layers.get(i)), light, overlay); } } @@ -94,49 +97,57 @@ public class EntranceRiftBlockEntityRenderer extends BlockEntityRenderer