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
This commit is contained in:
simibubi 2021-12-07 19:01:30 +01:00
parent 9362374b1e
commit 3de903ac2a
4 changed files with 39 additions and 3 deletions

View file

@ -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<DeployerTileEntity>
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<DeployerTileEntity>
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))

View file

@ -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;

View file

@ -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;
}

View file

@ -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++) {