From 3de903ac2aec5d462fd85439bd2f30c7b9069c52 Mon Sep 17 00:00:00 2001 From: simibubi <31564874+simibubi@users.noreply.github.com> Date: Tue, 7 Dec 2021 19:01:30 +0100 Subject: [PATCH] No Flywheel no Flaps - Fixed Layered ore deposits not able to replace deepslate - Fixed Funnels and Deployers not fully rendering on contraptions when flywheel is disabled --- .../components/deployer/DeployerRenderer.java | 33 ++++++++++++++++++- .../block/funnel/FunnelMovementBehaviour.java | 5 +++ .../foundation/worldgen/LayerPattern.java | 2 +- .../worldgen/LayeredOreFeature.java | 2 +- 4 files changed, 39 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/deployer/DeployerRenderer.java b/src/main/java/com/simibubi/create/content/contraptions/components/deployer/DeployerRenderer.java index 0bb354858..7a346812c 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/deployer/DeployerRenderer.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/deployer/DeployerRenderer.java @@ -5,10 +5,13 @@ import static com.simibubi.create.content.contraptions.base.DirectionalKineticBl import com.jozufozu.flywheel.backend.Backend; import com.jozufozu.flywheel.core.PartialModel; +import com.jozufozu.flywheel.util.transform.MatrixTransformStack; import com.mojang.blaze3d.vertex.PoseStack; import com.mojang.blaze3d.vertex.VertexConsumer; import com.mojang.math.Vector3f; import com.simibubi.create.AllBlockPartials; +import com.simibubi.create.AllBlocks; +import com.simibubi.create.content.contraptions.base.IRotate; import com.simibubi.create.content.contraptions.base.KineticTileEntity; import com.simibubi.create.content.contraptions.base.KineticTileEntityRenderer; import com.simibubi.create.content.contraptions.components.deployer.DeployerTileEntity.Mode; @@ -34,6 +37,7 @@ import net.minecraft.client.renderer.entity.ItemRenderer; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; import net.minecraft.core.Direction.Axis; +import net.minecraft.core.Direction.AxisDirection; import net.minecraft.util.Mth; import net.minecraft.world.item.BlockItem; import net.minecraft.world.level.block.state.BlockState; @@ -158,6 +162,11 @@ public class DeployerRenderer extends SafeTileEntityRenderer Mode mode = NBTHelper.readEnum(context.tileData, "Mode", Mode.class); PartialModel handPose = getHandPose(mode); + float speed = (float) context.getAnimationSpeed(); + if (context.contraption.stalled) + speed = 0; + + SuperByteBuffer shaft = CachedBufferer.block(AllBlocks.SHAFT.getDefaultState()); SuperByteBuffer pole = CachedBufferer.partial(AllBlockPartials.DEPLOYER_POLE, blockState); SuperByteBuffer hand = CachedBufferer.partial(handPose, blockState); @@ -177,13 +186,35 @@ public class DeployerRenderer extends SafeTileEntityRenderer PoseStack m = matrices.getModel(); m.pushPose(); - m.translate(offset.x, offset.y, offset.z); + m.pushPose(); + Axis axis = Axis.Y; + if (context.state.getBlock() instanceof IRotate) { + IRotate def = (IRotate) context.state.getBlock(); + axis = def.getRotationAxis(context.state); + } + + float time = AnimationTickHolder.getRenderTime(context.world) / 20; + float angle = (time * speed) % 360; + + new MatrixTransformStack(m) + .centre() + .rotateY(axis == Axis.Z ? 90 : 0) + .rotateZ(axis.isHorizontal() ? 90 : 0) + .unCentre(); + shaft.transform(m); + shaft.rotateCentered(Direction.get(AxisDirection.POSITIVE, Axis.Y), angle); + m.popPose(); + + m.translate(offset.x, offset.y, offset.z); pole.transform(m); hand.transform(m); + transform(pole, blockState, true); transform(hand, blockState, false); + shaft.light(matrices.getWorld(), ContraptionRenderDispatcher.getContraptionWorldLight(context, renderWorld)) + .renderInto(matrices.getViewProjection(), builder); pole.light(matrices.getWorld(), ContraptionRenderDispatcher.getContraptionWorldLight(context, renderWorld)) .renderInto(matrices.getViewProjection(), builder); hand.light(matrices.getWorld(), ContraptionRenderDispatcher.getContraptionWorldLight(context, renderWorld)) diff --git a/src/main/java/com/simibubi/create/content/logistics/block/funnel/FunnelMovementBehaviour.java b/src/main/java/com/simibubi/create/content/logistics/block/funnel/FunnelMovementBehaviour.java index 00bd9df24..3430fd6f0 100644 --- a/src/main/java/com/simibubi/create/content/logistics/block/funnel/FunnelMovementBehaviour.java +++ b/src/main/java/com/simibubi/create/content/logistics/block/funnel/FunnelMovementBehaviour.java @@ -120,6 +120,11 @@ public class FunnelMovementBehaviour extends MovementBehaviour { item.setItem(remainder); } } + + @Override + public boolean renderAsNormalTileEntity() { + return true; + } private ItemStack getFilter(MovementContext context) { return hasFilter ? ItemStack.of(context.tileData.getCompound("Filter")) : ItemStack.EMPTY; diff --git a/src/main/java/com/simibubi/create/foundation/worldgen/LayerPattern.java b/src/main/java/com/simibubi/create/foundation/worldgen/LayerPattern.java index 19b721601..5fa7ef7f8 100644 --- a/src/main/java/com/simibubi/create/foundation/worldgen/LayerPattern.java +++ b/src/main/java/com/simibubi/create/foundation/worldgen/LayerPattern.java @@ -129,7 +129,7 @@ public class LayerPattern { private LayerBuilder blocks(BlockState stone, BlockState deepslate) { Layer.this.targets.add( ImmutableList.of(OreConfiguration.target(OreConfiguration.Predicates.STONE_ORE_REPLACEABLES, stone), - OreConfiguration.target(OreConfiguration.Predicates.STONE_ORE_REPLACEABLES, deepslate))); + OreConfiguration.target(OreConfiguration.Predicates.DEEPSLATE_ORE_REPLACEABLES, deepslate))); return this; } diff --git a/src/main/java/com/simibubi/create/foundation/worldgen/LayeredOreFeature.java b/src/main/java/com/simibubi/create/foundation/worldgen/LayeredOreFeature.java index 82aa6937b..5fb46b8fd 100644 --- a/src/main/java/com/simibubi/create/foundation/worldgen/LayeredOreFeature.java +++ b/src/main/java/com/simibubi/create/foundation/worldgen/LayeredOreFeature.java @@ -82,7 +82,7 @@ public class LayeredOreFeature extends OreFeatureBase { float dy = y * 2f / height - 1; if (dx * dx + dy * dy > 1) continue; - if (worldgenlevel.isOutsideBuildHeight(y)) + if (worldgenlevel.isOutsideBuildHeight(y0 + y)) continue; for (int z = 0; z < length; z++) {