mirror of
https://github.com/Creators-of-Create/Create.git
synced 2024-11-10 03:53:12 +01:00
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:
parent
9362374b1e
commit
3de903ac2a
4 changed files with 39 additions and 3 deletions
|
@ -5,10 +5,13 @@ import static com.simibubi.create.content.contraptions.base.DirectionalKineticBl
|
||||||
|
|
||||||
import com.jozufozu.flywheel.backend.Backend;
|
import com.jozufozu.flywheel.backend.Backend;
|
||||||
import com.jozufozu.flywheel.core.PartialModel;
|
import com.jozufozu.flywheel.core.PartialModel;
|
||||||
|
import com.jozufozu.flywheel.util.transform.MatrixTransformStack;
|
||||||
import com.mojang.blaze3d.vertex.PoseStack;
|
import com.mojang.blaze3d.vertex.PoseStack;
|
||||||
import com.mojang.blaze3d.vertex.VertexConsumer;
|
import com.mojang.blaze3d.vertex.VertexConsumer;
|
||||||
import com.mojang.math.Vector3f;
|
import com.mojang.math.Vector3f;
|
||||||
import com.simibubi.create.AllBlockPartials;
|
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.KineticTileEntity;
|
||||||
import com.simibubi.create.content.contraptions.base.KineticTileEntityRenderer;
|
import com.simibubi.create.content.contraptions.base.KineticTileEntityRenderer;
|
||||||
import com.simibubi.create.content.contraptions.components.deployer.DeployerTileEntity.Mode;
|
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.BlockPos;
|
||||||
import net.minecraft.core.Direction;
|
import net.minecraft.core.Direction;
|
||||||
import net.minecraft.core.Direction.Axis;
|
import net.minecraft.core.Direction.Axis;
|
||||||
|
import net.minecraft.core.Direction.AxisDirection;
|
||||||
import net.minecraft.util.Mth;
|
import net.minecraft.util.Mth;
|
||||||
import net.minecraft.world.item.BlockItem;
|
import net.minecraft.world.item.BlockItem;
|
||||||
import net.minecraft.world.level.block.state.BlockState;
|
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);
|
Mode mode = NBTHelper.readEnum(context.tileData, "Mode", Mode.class);
|
||||||
PartialModel handPose = getHandPose(mode);
|
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 pole = CachedBufferer.partial(AllBlockPartials.DEPLOYER_POLE, blockState);
|
||||||
SuperByteBuffer hand = CachedBufferer.partial(handPose, blockState);
|
SuperByteBuffer hand = CachedBufferer.partial(handPose, blockState);
|
||||||
|
|
||||||
|
@ -177,13 +186,35 @@ public class DeployerRenderer extends SafeTileEntityRenderer<DeployerTileEntity>
|
||||||
|
|
||||||
PoseStack m = matrices.getModel();
|
PoseStack m = matrices.getModel();
|
||||||
m.pushPose();
|
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);
|
pole.transform(m);
|
||||||
hand.transform(m);
|
hand.transform(m);
|
||||||
|
|
||||||
transform(pole, blockState, true);
|
transform(pole, blockState, true);
|
||||||
transform(hand, blockState, false);
|
transform(hand, blockState, false);
|
||||||
|
|
||||||
|
shaft.light(matrices.getWorld(), ContraptionRenderDispatcher.getContraptionWorldLight(context, renderWorld))
|
||||||
|
.renderInto(matrices.getViewProjection(), builder);
|
||||||
pole.light(matrices.getWorld(), ContraptionRenderDispatcher.getContraptionWorldLight(context, renderWorld))
|
pole.light(matrices.getWorld(), ContraptionRenderDispatcher.getContraptionWorldLight(context, renderWorld))
|
||||||
.renderInto(matrices.getViewProjection(), builder);
|
.renderInto(matrices.getViewProjection(), builder);
|
||||||
hand.light(matrices.getWorld(), ContraptionRenderDispatcher.getContraptionWorldLight(context, renderWorld))
|
hand.light(matrices.getWorld(), ContraptionRenderDispatcher.getContraptionWorldLight(context, renderWorld))
|
||||||
|
|
|
@ -121,6 +121,11 @@ public class FunnelMovementBehaviour extends MovementBehaviour {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean renderAsNormalTileEntity() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
private ItemStack getFilter(MovementContext context) {
|
private ItemStack getFilter(MovementContext context) {
|
||||||
return hasFilter ? ItemStack.of(context.tileData.getCompound("Filter")) : ItemStack.EMPTY;
|
return hasFilter ? ItemStack.of(context.tileData.getCompound("Filter")) : ItemStack.EMPTY;
|
||||||
}
|
}
|
||||||
|
|
|
@ -129,7 +129,7 @@ public class LayerPattern {
|
||||||
private LayerBuilder blocks(BlockState stone, BlockState deepslate) {
|
private LayerBuilder blocks(BlockState stone, BlockState deepslate) {
|
||||||
Layer.this.targets.add(
|
Layer.this.targets.add(
|
||||||
ImmutableList.of(OreConfiguration.target(OreConfiguration.Predicates.STONE_ORE_REPLACEABLES, stone),
|
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;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -82,7 +82,7 @@ public class LayeredOreFeature extends OreFeatureBase {
|
||||||
float dy = y * 2f / height - 1;
|
float dy = y * 2f / height - 1;
|
||||||
if (dx * dx + dy * dy > 1)
|
if (dx * dx + dy * dy > 1)
|
||||||
continue;
|
continue;
|
||||||
if (worldgenlevel.isOutsideBuildHeight(y))
|
if (worldgenlevel.isOutsideBuildHeight(y0 + y))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
for (int z = 0; z < length; z++) {
|
for (int z = 0; z < length; z++) {
|
||||||
|
|
Loading…
Reference in a new issue