From 00e733e60855ed9a425b827fb13a6f2588d1f00a Mon Sep 17 00:00:00 2001 From: simibubi <31564874+simibubi@users.noreply.github.com> Date: Thu, 2 Mar 2023 12:43:08 +0100 Subject: [PATCH] Meeting notes - Can now use trapdoors with copycat panels - Copycat bars are less likely to cause zfighting - Fixed waterwheels not updating flow score in some edge cases - Metal Scaffolding no longer zfights with adjacent non-solid blocks - Boiler status now highlights information about water flow when insufficient --- src/generated/resources/.cache/cache | 2 +- .../resources/assets/create/lang/en_us.json | 2 ++ .../waterwheel/WaterWheelBlockEntity.java | 16 +++++++++--- .../contraptions/fluids/tank/BoilerData.java | 21 +++++++++++++-- .../curiosities/frames/CopycatBlock.java | 12 +++++++-- .../frames/CopycatBlockEntity.java | 15 ++++++++--- .../curiosities/frames/CopycatPanelBlock.java | 26 +++++++++++++++++-- .../curiosities/frames/CopycatPanelModel.java | 9 +++++-- .../frames/CopycatSpecialCases.java | 6 +++++ .../assets/create/lang/default/interface.json | 2 ++ .../models/block/copycat_panel/bars.json | 4 +-- .../block/copycat_panel/bars_vertical.json | 8 +++--- .../create/models/block/scaffold/block.json | 16 +++++++++--- .../block/scaffold/block_horizontal.json | 21 ++++++++++----- 14 files changed, 127 insertions(+), 33 deletions(-) diff --git a/src/generated/resources/.cache/cache b/src/generated/resources/.cache/cache index 9b638b536..ae30ebffa 100644 --- a/src/generated/resources/.cache/cache +++ b/src/generated/resources/.cache/cache @@ -578,7 +578,7 @@ bf2b0310500213ff853c748c236eb5d01f61658e assets/create/blockstates/yellow_toolbo 7f39521b211441f5c3e06d60c5978cebe16cacfb assets/create/blockstates/zinc_block.json b7181bcd8182b2f17088e5aa881f374c9c65470c assets/create/blockstates/zinc_ore.json ea8adceca24670f1b5850ccd5c2ac766de590f05 assets/create/lang/en_ud.json -a65e9c868a5da341170e4ddf38405a4d3e8403e8 assets/create/lang/en_us.json +231bf5987635c816220c32ae69f269f9de43fecd assets/create/lang/en_us.json 487a511a01b2a4531fb672f917922312db78f958 assets/create/models/block/acacia_window.json b48060cba1a382f373a05bf0039054053eccf076 assets/create/models/block/acacia_window_pane_noside.json 3066db1bf03cffa1a9c7fbacf47ae586632f4eb3 assets/create/models/block/acacia_window_pane_noside_alt.json diff --git a/src/generated/resources/assets/create/lang/en_us.json b/src/generated/resources/assets/create/lang/en_us.json index 98c9533ca..d42b193f0 100644 --- a/src/generated/resources/assets/create/lang/en_us.json +++ b/src/generated/resources/assets/create/lang/en_us.json @@ -1482,6 +1482,8 @@ "create.boiler.heat_dots": "...... ", "create.boiler.via_one_engine": "via 1 engine", "create.boiler.via_engines": "via %1$s engines", + "create.boiler.water_input_rate": "Water input rate", + "create.boiler.per_tick": "%1$s per Tick", "create.elevator_contact.title": "Elevator Contact", "create.elevator_contact.floor_identifier": "Floor Identifier", diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/waterwheel/WaterWheelBlockEntity.java b/src/main/java/com/simibubi/create/content/contraptions/components/waterwheel/WaterWheelBlockEntity.java index ac2820f1a..c0076de3b 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/waterwheel/WaterWheelBlockEntity.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/waterwheel/WaterWheelBlockEntity.java @@ -72,6 +72,7 @@ public class WaterWheelBlockEntity extends GeneratingKineticBlockEntity { public WaterWheelBlockEntity(BlockEntityType type, BlockPos pos, BlockState state) { super(type, pos, state); material = Blocks.SPRUCE_PLANKS.defaultBlockState(); + setLazyTickRate(60); } protected int getSize() { @@ -81,11 +82,12 @@ public class WaterWheelBlockEntity extends GeneratingKineticBlockEntity { protected Set getOffsetsToCheck() { return (getSize() == 1 ? SMALL_OFFSETS : LARGE_OFFSETS).get(getAxis()); } - + public InteractionResult applyMaterialIfValid(ItemStack stack) { - if (!(stack.getItem() instanceof BlockItem blockItem)) + if (!(stack.getItem()instanceof BlockItem blockItem)) return InteractionResult.PASS; - BlockState material = blockItem.getBlock().defaultBlockState(); + BlockState material = blockItem.getBlock() + .defaultBlockState(); if (material == this.material) return InteractionResult.PASS; if (!material.is(BlockTags.PLANKS)) @@ -106,6 +108,14 @@ public class WaterWheelBlockEntity extends GeneratingKineticBlockEntity { return axis; } + @Override + public void lazyTick() { + super.lazyTick(); + + // Water can change flow direction without notifying neighbours + determineAndApplyFlowScore(); + } + public void determineAndApplyFlowScore() { Vec3 wheelPlane = Vec3.atLowerCornerOf(new Vec3i(1, 1, 1).subtract(Direction.get(AxisDirection.POSITIVE, getAxis()) diff --git a/src/main/java/com/simibubi/create/content/contraptions/fluids/tank/BoilerData.java b/src/main/java/com/simibubi/create/content/contraptions/fluids/tank/BoilerData.java index 9aa89c17a..26cfc74dd 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/fluids/tank/BoilerData.java +++ b/src/main/java/com/simibubi/create/content/contraptions/fluids/tank/BoilerData.java @@ -96,7 +96,7 @@ public class BoilerData { for (float i : supplyOverTime) waterSupply = Math.max(i, waterSupply); } - + if (controller instanceof CreativeFluidTankBlockEntity) waterSupply = waterSupplyPerLevel * 20; @@ -171,6 +171,22 @@ public class BoilerData { tooltip.add(Components.immutableEmpty()); + if (attachedEngines > 0 && maxHeatForSize > 0 && maxHeatForWater == 0 && (passiveHeat ? 1 : activeHeat) > 0) { + Lang.translate("boiler.water_input_rate") + .style(ChatFormatting.GRAY) + .forGoggles(tooltip); + Lang.number(waterSupply) + .style(ChatFormatting.BLUE) + .add(Lang.translate("generic.unit.millibuckets")) + .add(Lang.text(" / ") + .style(ChatFormatting.GRAY)) + .add(Lang.translate("boiler.per_tick", Lang.number(waterSupplyPerLevel) + .add(Lang.translate("generic.unit.millibuckets"))) + .style(ChatFormatting.DARK_GRAY)) + .forGoggles(tooltip, 1); + return true; + } + Lang.translate("tooltip.capacityProvided") .style(ChatFormatting.GRAY) .forGoggles(tooltip); @@ -250,7 +266,8 @@ public class BoilerData { } private MutableComponent bars(int level, ChatFormatting format) { - return Components.literal(Strings.repeat('|', level)).withStyle(format); + return Components.literal(Strings.repeat('|', level)) + .withStyle(format); } public boolean evaluate(FluidTankBlockEntity controller) { diff --git a/src/main/java/com/simibubi/create/content/curiosities/frames/CopycatBlock.java b/src/main/java/com/simibubi/create/content/curiosities/frames/CopycatBlock.java index 713cba43a..fcc5e90e4 100644 --- a/src/main/java/com/simibubi/create/content/curiosities/frames/CopycatBlock.java +++ b/src/main/java/com/simibubi/create/content/curiosities/frames/CopycatBlock.java @@ -95,11 +95,14 @@ public abstract class CopycatBlock extends Block implements IBE { if (ufte.getMaterial() .is(material.getBlock())) { @@ -208,6 +211,11 @@ public abstract class CopycatBlock extends Block implements IBE pPos.getY(); + return material.setValue(TrapDoorBlock.OPEN, true) + .setValue(TrapDoorBlock.HALF, clickedNearTop ? Half.TOP : Half.BOTTOM) + .setValue(TrapDoorBlock.FACING, panelFacing); + } + @Override public InteractionResult use(BlockState state, Level world, BlockPos pos, Player player, InteractionHand hand, BlockHitResult ray) { diff --git a/src/main/java/com/simibubi/create/content/curiosities/frames/CopycatPanelModel.java b/src/main/java/com/simibubi/create/content/curiosities/frames/CopycatPanelModel.java index e77d49477..16e3cd559 100644 --- a/src/main/java/com/simibubi/create/content/curiosities/frames/CopycatPanelModel.java +++ b/src/main/java/com/simibubi/create/content/curiosities/frames/CopycatPanelModel.java @@ -10,6 +10,7 @@ import com.simibubi.create.foundation.model.BakedQuadHelper; import com.simibubi.create.foundation.utility.Iterate; import net.minecraft.client.Minecraft; +import net.minecraft.client.renderer.block.BlockRenderDispatcher; import net.minecraft.client.renderer.block.model.BakedQuad; import net.minecraft.client.resources.model.BakedModel; import net.minecraft.core.BlockPos; @@ -33,14 +34,18 @@ public class CopycatPanelModel extends CopycatModel { IModelData wrappedData) { Direction facing = state.getOptionalValue(CopycatPanelBlock.FACING) .orElse(Direction.UP); + BlockRenderDispatcher blockRenderer = Minecraft.getInstance() + .getBlockRenderer(); BlockState specialCopycatModelState = null; if (CopycatSpecialCases.isBarsMaterial(material)) specialCopycatModelState = AllBlocks.COPYCAT_BARS.getDefaultState(); + if (CopycatSpecialCases.isTrapdoorMaterial(material)) + return blockRenderer.getBlockModel(material) + .getQuads(state, side, rand, wrappedData); if (specialCopycatModelState != null) { - BakedModel blockModel = Minecraft.getInstance() - .getBlockRenderer() + BakedModel blockModel = blockRenderer .getBlockModel(specialCopycatModelState.setValue(DirectionalBlock.FACING, facing)); if (blockModel instanceof CopycatModel cm) return cm.getCroppedQuads(state, side, rand, material, wrappedData); diff --git a/src/main/java/com/simibubi/create/content/curiosities/frames/CopycatSpecialCases.java b/src/main/java/com/simibubi/create/content/curiosities/frames/CopycatSpecialCases.java index 270ed9d9e..097fb1fe6 100644 --- a/src/main/java/com/simibubi/create/content/curiosities/frames/CopycatSpecialCases.java +++ b/src/main/java/com/simibubi/create/content/curiosities/frames/CopycatSpecialCases.java @@ -4,6 +4,7 @@ import com.simibubi.create.content.palettes.GlassPaneBlock; import net.minecraft.world.level.block.IronBarsBlock; import net.minecraft.world.level.block.StainedGlassPaneBlock; +import net.minecraft.world.level.block.TrapDoorBlock; import net.minecraft.world.level.block.state.BlockState; public class CopycatSpecialCases { @@ -13,4 +14,9 @@ public class CopycatSpecialCases { && !(material.getBlock() instanceof StainedGlassPaneBlock); } + public static boolean isTrapdoorMaterial(BlockState material) { + return material.getBlock() instanceof TrapDoorBlock && material.hasProperty(TrapDoorBlock.HALF) + && material.hasProperty(TrapDoorBlock.OPEN) && material.hasProperty(TrapDoorBlock.FACING); + } + } diff --git a/src/main/resources/assets/create/lang/default/interface.json b/src/main/resources/assets/create/lang/default/interface.json index 2271939cf..34a02972a 100644 --- a/src/main/resources/assets/create/lang/default/interface.json +++ b/src/main/resources/assets/create/lang/default/interface.json @@ -629,6 +629,8 @@ "create.boiler.heat_dots": "...... ", "create.boiler.via_one_engine": "via 1 engine", "create.boiler.via_engines": "via %1$s engines", + "create.boiler.water_input_rate": "Water input rate", + "create.boiler.per_tick": "%1$s per Tick", "create.elevator_contact.title": "Elevator Contact", "create.elevator_contact.floor_identifier": "Floor Identifier", diff --git a/src/main/resources/assets/create/models/block/copycat_panel/bars.json b/src/main/resources/assets/create/models/block/copycat_panel/bars.json index 6c3313328..f6b98d177 100644 --- a/src/main/resources/assets/create/models/block/copycat_panel/bars.json +++ b/src/main/resources/assets/create/models/block/copycat_panel/bars.json @@ -7,8 +7,8 @@ }, "elements": [ { - "from": [0, 0, 1], - "to": [16, 16, 1], + "from": [0, 0, 0.95], + "to": [16, 16, 1.05], "rotation": {"angle": 0, "axis": "y", "origin": [8, 8, 8]}, "faces": { "north": {"uv": [0, 0, 16, 16], "texture": "#edge"}, diff --git a/src/main/resources/assets/create/models/block/copycat_panel/bars_vertical.json b/src/main/resources/assets/create/models/block/copycat_panel/bars_vertical.json index f49777f33..4988cb51f 100644 --- a/src/main/resources/assets/create/models/block/copycat_panel/bars_vertical.json +++ b/src/main/resources/assets/create/models/block/copycat_panel/bars_vertical.json @@ -7,8 +7,8 @@ }, "elements": [ { - "from": [0, 1, 0], - "to": [16, 1, 16], + "from": [0, 0.95, 0], + "to": [16, 1.05, 16], "rotation": {"angle": 0, "axis": "y", "origin": [8, 8, 8]}, "faces": { "up": {"uv": [0, 0, 16, 16], "texture": "#edge"}, @@ -16,9 +16,9 @@ } }, { - "shade": false, "from": [0, 0, 0], "to": [16, 2, 16], + "shade": false, "faces": { "north": {"uv": [7, 0, 9, 16], "rotation": 90, "texture": "#edge", "cullface": "north"}, "east": {"uv": [7, 0, 9, 16], "rotation": 90, "texture": "#edge", "cullface": "east"}, @@ -27,9 +27,9 @@ } }, { - "shade": false, "from": [0.05, 1.95, 0.05], "to": [15.95, 0.05, 15.95], + "shade": false, "faces": { "north": {"uv": [9, 0, 7, 16], "rotation": 90, "texture": "#edge", "cullface": "north"}, "east": {"uv": [9, 0, 7, 16], "rotation": 90, "texture": "#edge", "cullface": "east"}, diff --git a/src/main/resources/assets/create/models/block/scaffold/block.json b/src/main/resources/assets/create/models/block/scaffold/block.json index e72b19b92..0e7707b06 100644 --- a/src/main/resources/assets/create/models/block/scaffold/block.json +++ b/src/main/resources/assets/create/models/block/scaffold/block.json @@ -34,13 +34,21 @@ }, { "name": "inside", - "from": [0, 0, 16], - "to": [16, 16, 0], + "from": [0.05, 0, 16], + "to": [15.95, 16, 0], + "faces": { + "east": {"uv": [0, 0, 16, 16], "texture": "#inside", "cullface": "east"}, + "west": {"uv": [0, 0, 16, 16], "texture": "#inside", "cullface": "west"}, + "up": {"uv": [0, 0, 16, 16], "texture": "#top"} + } + }, + { + "name": "inside", + "from": [0, 0, 15.95], + "to": [16, 16, 0.05], "faces": { "north": {"uv": [0, 0, 16, 16], "texture": "#inside", "cullface": "south"}, - "east": {"uv": [0, 0, 16, 16], "texture": "#inside", "cullface": "east"}, "south": {"uv": [0, 0, 16, 16], "texture": "#inside", "cullface": "north"}, - "west": {"uv": [0, 0, 16, 16], "texture": "#inside", "cullface": "west"}, "up": {"uv": [0, 0, 16, 16], "texture": "#top"} } } diff --git a/src/main/resources/assets/create/models/block/scaffold/block_horizontal.json b/src/main/resources/assets/create/models/block/scaffold/block_horizontal.json index 7b3528ef9..76f237f1b 100644 --- a/src/main/resources/assets/create/models/block/scaffold/block_horizontal.json +++ b/src/main/resources/assets/create/models/block/scaffold/block_horizontal.json @@ -2,9 +2,9 @@ "credit": "Made with Blockbench", "textures": { "inside": "create:block/scaffold/brass_scaffold_inside", + "particle": "create:block/scaffold/brass_scaffold", "side": "create:block/scaffold/brass_scaffold", - "casing": "create:block/brass_casing", - "particle": "create:block/scaffold/brass_scaffold" + "casing": "create:block/brass_casing" }, "elements": [ { @@ -33,13 +33,20 @@ }, { "name": "inside", - "from": [16, 8, 0], - "to": [0, 13.05, 16], + "from": [15.95, 8, 0], + "to": [0.05, 13.05, 16], + "faces": { + "east": {"uv": [16, 3, 0, 8], "texture": "#inside", "cullface": "west"}, + "west": {"uv": [16, 3, 0, 8], "texture": "#inside", "cullface": "east"} + } + }, + { + "name": "inside", + "from": [16, 8, 0.05], + "to": [0, 13.05, 15.95], "faces": { "north": {"uv": [16, 3, 0, 8], "texture": "#inside", "cullface": "north"}, - "east": {"uv": [16, 3, 0, 8], "texture": "#inside", "cullface": "west"}, - "south": {"uv": [16, 2.95, 0, 7.95], "texture": "#inside", "cullface": "south"}, - "west": {"uv": [16, 3, 0, 8], "texture": "#inside", "cullface": "east"} + "south": {"uv": [16, 2.95, 0, 7.95], "texture": "#inside", "cullface": "south"} } } ]