From 7faf29775dc7c097d0f585ffc39d5d7bc778cd0a Mon Sep 17 00:00:00 2001 From: grimmauld Date: Thu, 20 Aug 2020 17:02:36 +0200 Subject: [PATCH] fix casing blockstate of clutch and gearshift --- src/generated/resources/.cache/cache | 7 +-- .../create/blockstates/encased_shaft.json | 13 ----- .../assets/create/blockstates/fluid_pipe.json | 22 +++---- .../java/com/simibubi/create/AllBlocks.java | 2 - .../encased/AbstractEncasedShaftBlock.java | 58 +++++++++++++++++++ .../relays/encased/EncasedShaftBlock.java | 39 +------------ .../relays/encased/GearshiftBlock.java | 9 +-- 7 files changed, 75 insertions(+), 75 deletions(-) create mode 100644 src/main/java/com/simibubi/create/content/contraptions/relays/encased/AbstractEncasedShaftBlock.java diff --git a/src/generated/resources/.cache/cache b/src/generated/resources/.cache/cache index 213ad3d3e..ca98c85f9 100644 --- a/src/generated/resources/.cache/cache +++ b/src/generated/resources/.cache/cache @@ -91,7 +91,7 @@ f63a5816d4bfe643aa098d03c3b54462dd06fe19 assets/create/blockstates/dolomite_cobb f179202e59e449157f89efc37229b03bbfd391d7 assets/create/blockstates/dolomite_pillar.json 7b1c40891b07c8f3238537625d9e25c8627e7333 assets/create/blockstates/encased_belt.json 7b2b836649e729feafa60972bf95e3afb2143131 assets/create/blockstates/encased_fan.json -db1777f0eff1eb6987b569aee513656ae889ae75 assets/create/blockstates/encased_shaft.json +e157d7f67b08493b71d7ffea8d622f4a64dbc155 assets/create/blockstates/encased_shaft.json 1442ff1a0e404f99263ba99d734da1dfed03d4e3 assets/create/blockstates/extractor.json a774e815376a67e2a2de44e39af0a1a0b4406932 assets/create/blockstates/fancy_andesite_bricks.json 180be26a75834cf9cdb881f969f77906e91cc36a assets/create/blockstates/fancy_andesite_bricks_slab.json @@ -129,7 +129,7 @@ de8a40b7daf1497d5aecee47a43b3e0b1d030b00 assets/create/blockstates/fancy_scoria_ fc9ac0a7e7191b93516719455a17177fa6524ecc assets/create/blockstates/fancy_weathered_limestone_bricks_slab.json b2a7c321b1795f20e7433f81a55ce4683de081b8 assets/create/blockstates/fancy_weathered_limestone_bricks_stairs.json 6372fe02ba0065acb0758121c45a15a1a8fdc5de assets/create/blockstates/fancy_weathered_limestone_bricks_wall.json -fe9169716dd21a81a3710a89f0a9b7ea4dcd4d51 assets/create/blockstates/fluid_pipe.json +3d97226b5e8d8f70ed08e45e78db1faf78d5e28b assets/create/blockstates/fluid_pipe.json f0eaab18e16c4f3f65ebf3b55b08f0dc445720fe assets/create/blockstates/fluid_tank.json e9da1794b6ece7f9aa8bcb43d42c23a55446133b assets/create/blockstates/flywheel.json ac00d40e1ef50a37041c0481afa1a23a14dea78e assets/create/blockstates/framed_glass.json @@ -1121,7 +1121,6 @@ e974cd23a5456baef8b634f2d21fd8c3822931ab assets/create/models/item/dolomite_pill 3bbf9f6b33ef075fb2e1d20d58a6169e2e942314 assets/create/models/item/empty_schematic.json f2d6b88c3174de01e16da555236727efc33b490c assets/create/models/item/encased_belt.json 250bd0716cc1f04b03892ab74eb0b3a0f32a6158 assets/create/models/item/encased_fan.json -e0f9ad7e7d790e9e21a38fa57395fd3ff892359b assets/create/models/item/encased_shaft.json 68833e2a7836c73776551565783a1d175b715c66 assets/create/models/item/extendo_grip.json 956646df2a75ed651eabb403a3f9e1024538cd56 assets/create/models/item/extractor.json efcbd30ad7a7658c02a3dc3de5fa0f21d7f49b54 assets/create/models/item/fancy_andesite_bricks.json @@ -1921,7 +1920,7 @@ d5fc5b3dc612cd748117e9d8b0ecda76e73f4514 data/create/loot_tables/blocks/dolomite 6121c99e6e037dda9022af3a414aee444467ac1b data/create/loot_tables/blocks/dolomite_pillar.json 503a93787537b46f462d32b0382c3396f42bb1f6 data/create/loot_tables/blocks/encased_belt.json 9055d82b983b673e1638d17b712b9fcd1f5a52e6 data/create/loot_tables/blocks/encased_fan.json -b3849bece65e13128fdeb033b156cf6615bc72f8 data/create/loot_tables/blocks/encased_shaft.json +b127cb6920e6d7d9c8b2402cb186402a9a8dd3fc data/create/loot_tables/blocks/encased_shaft.json 5a47c1535c866184b4ffca65763f5676f319e0aa data/create/loot_tables/blocks/extractor.json ddfc4764a6039d771e03af815ac4493da80d2e6b data/create/loot_tables/blocks/fancy_andesite_bricks.json 31f2e6932505c68b28e92221a37144f69161c376 data/create/loot_tables/blocks/fancy_andesite_bricks_slab.json diff --git a/src/generated/resources/assets/create/blockstates/encased_shaft.json b/src/generated/resources/assets/create/blockstates/encased_shaft.json index d904e950d..b630e5edf 100644 --- a/src/generated/resources/assets/create/blockstates/encased_shaft.json +++ b/src/generated/resources/assets/create/blockstates/encased_shaft.json @@ -13,19 +13,6 @@ "x": 90, "y": 180 }, - "axis=x,casing=copper": { - "model": "create:block/encased_shaft/copper", - "x": 90, - "y": 90 - }, - "axis=y,casing=copper": { - "model": "create:block/encased_shaft/copper" - }, - "axis=z,casing=copper": { - "model": "create:block/encased_shaft/copper", - "x": 90, - "y": 180 - }, "axis=x,casing=brass": { "model": "create:block/encased_shaft/brass", "x": 90, diff --git a/src/generated/resources/assets/create/blockstates/fluid_pipe.json b/src/generated/resources/assets/create/blockstates/fluid_pipe.json index 3b646b920..a4cffcde7 100644 --- a/src/generated/resources/assets/create/blockstates/fluid_pipe.json +++ b/src/generated/resources/assets/create/blockstates/fluid_pipe.json @@ -303,8 +303,8 @@ { "when": { "west": "false", - "east": "true", "down": "false", + "east": "true", "up": "true" }, "apply": { @@ -314,8 +314,8 @@ { "when": { "west": "true", - "east": "false", "down": "false", + "east": "false", "up": "true" }, "apply": { @@ -325,8 +325,8 @@ { "when": { "west": "false", - "east": "true", "down": "true", + "east": "true", "up": "false" }, "apply": { @@ -336,8 +336,8 @@ { "when": { "west": "true", - "east": "false", "down": "true", + "east": "false", "up": "false" }, "apply": { @@ -347,8 +347,8 @@ { "when": { "west": "false", - "east": "false", "down": "true", + "east": "false", "up": "true" }, "apply": { @@ -358,8 +358,8 @@ { "when": { "west": "false", - "east": "false", "down": "false", + "east": "false", "up": "true" }, "apply": { @@ -369,8 +369,8 @@ { "when": { "west": "false", - "east": "false", "down": "true", + "east": "false", "up": "false" }, "apply": { @@ -380,8 +380,8 @@ { "when": { "west": "true", - "east": "true", "down": "false", + "east": "true", "up": "false" }, "apply": { @@ -391,8 +391,8 @@ { "when": { "west": "false", - "east": "true", "down": "false", + "east": "true", "up": "false" }, "apply": { @@ -402,8 +402,8 @@ { "when": { "west": "true", - "east": "false", "down": "false", + "east": "false", "up": "false" }, "apply": { @@ -413,8 +413,8 @@ { "when": { "west": "false", - "east": "false", "down": "false", + "east": "false", "up": "false" }, "apply": { diff --git a/src/main/java/com/simibubi/create/AllBlocks.java b/src/main/java/com/simibubi/create/AllBlocks.java index 29d52c071..c4d77e2b9 100644 --- a/src/main/java/com/simibubi/create/AllBlocks.java +++ b/src/main/java/com/simibubi/create/AllBlocks.java @@ -226,8 +226,6 @@ public class AllBlocks { //.blockstate(BlockStateGen.axisBlockProvider(true)) .blockstate((c, p) -> axisBlock(c, p, blockState -> p.models().getExistingFile(p.modLoc("block/encased_shaft/" + blockState.get(EncasedShaftBlock.CASING).getName())))) .loot((p, b) -> p.registerDropping(b, SHAFT.get())) - //.item() - //.transform(customItemModel()) .register(); public static final BlockEntry GEARBOX = REGISTRATE.block("gearbox", GearboxBlock::new) diff --git a/src/main/java/com/simibubi/create/content/contraptions/relays/encased/AbstractEncasedShaftBlock.java b/src/main/java/com/simibubi/create/content/contraptions/relays/encased/AbstractEncasedShaftBlock.java new file mode 100644 index 000000000..cc8273503 --- /dev/null +++ b/src/main/java/com/simibubi/create/content/contraptions/relays/encased/AbstractEncasedShaftBlock.java @@ -0,0 +1,58 @@ +package com.simibubi.create.content.contraptions.relays.encased; + +import com.simibubi.create.content.contraptions.base.RotatedPillarKineticBlock; +import mcp.MethodsReturnNonnullByDefault; +import net.minecraft.block.Block; +import net.minecraft.block.BlockState; +import net.minecraft.block.material.PushReaction; +import net.minecraft.item.BlockItemUseContext; +import net.minecraft.state.StateContainer; +import net.minecraft.util.Direction; +import net.minecraft.util.math.BlockPos; +import net.minecraft.world.IWorldReader; + +import javax.annotation.Nullable; + +@MethodsReturnNonnullByDefault +public abstract class AbstractEncasedShaftBlock extends RotatedPillarKineticBlock { + public AbstractEncasedShaftBlock(Properties properties) { + super(properties); + } + + @Override + protected void fillStateContainer(StateContainer.Builder builder) { + super.fillStateContainer(builder); + } + + @Override + public boolean shouldCheckWeakPower(BlockState state, IWorldReader world, BlockPos pos, Direction side) { + return false; + } + + @Override + @SuppressWarnings("deprecation") + public PushReaction getPushReaction(@Nullable BlockState state) { + return PushReaction.PUSH_ONLY; + } + + @Override + public BlockState getStateForPlacement(BlockItemUseContext context) { + if (context.getPlayer() != null && context.getPlayer() + .isSneaking()) + return super.getStateForPlacement(context); + Direction.Axis preferredAxis = getPreferredAxis(context); + return this.getDefaultState() + .with(AXIS, preferredAxis == null ? context.getNearestLookingDirection() + .getAxis() : preferredAxis); + } + + @Override + public boolean hasShaftTowards(IWorldReader world, BlockPos pos, BlockState state, Direction face) { + return face.getAxis() == state.get(AXIS); + } + + @Override + public Direction.Axis getRotationAxis(BlockState state) { + return state.get(AXIS); + } +} diff --git a/src/main/java/com/simibubi/create/content/contraptions/relays/encased/EncasedShaftBlock.java b/src/main/java/com/simibubi/create/content/contraptions/relays/encased/EncasedShaftBlock.java index 2230b833a..a62db1860 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/relays/encased/EncasedShaftBlock.java +++ b/src/main/java/com/simibubi/create/content/contraptions/relays/encased/EncasedShaftBlock.java @@ -4,15 +4,12 @@ import com.simibubi.create.AllBlocks; import com.simibubi.create.AllTileEntities; import com.simibubi.create.content.contraptions.base.CasingBlock; import com.simibubi.create.content.contraptions.base.KineticTileEntity; -import com.simibubi.create.content.contraptions.base.RotatedPillarKineticBlock; import com.simibubi.create.foundation.utility.Lang; import com.tterrag.registrate.util.entry.BlockEntry; import net.minecraft.block.Block; import net.minecraft.block.BlockState; -import net.minecraft.block.material.PushReaction; import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.item.BlockItemUseContext; import net.minecraft.item.ItemStack; import net.minecraft.item.ItemUseContext; import net.minecraft.state.EnumProperty; @@ -20,15 +17,12 @@ import net.minecraft.state.IProperty; import net.minecraft.state.StateContainer; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.ActionResultType; -import net.minecraft.util.Direction; -import net.minecraft.util.Direction.Axis; import net.minecraft.util.IStringSerializable; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.RayTraceResult; import net.minecraft.world.IBlockReader; -import net.minecraft.world.IWorldReader; -public class EncasedShaftBlock extends RotatedPillarKineticBlock { +public class EncasedShaftBlock extends AbstractEncasedShaftBlock { public static final IProperty CASING = EnumProperty.create("casing", Casing.class); @@ -48,42 +42,11 @@ public class EncasedShaftBlock extends RotatedPillarKineticBlock { return new ItemStack(state.get(CASING).getCasingEntry().get().asItem()); } - @Override - public boolean shouldCheckWeakPower(BlockState state, IWorldReader world, BlockPos pos, Direction side) { - return false; - } - @Override public TileEntity createTileEntity(BlockState state, IBlockReader world) { return AllTileEntities.ENCASED_SHAFT.create(); } - @Override - public PushReaction getPushReaction(BlockState state) { - return PushReaction.PUSH_ONLY; - } - - @Override - public BlockState getStateForPlacement(BlockItemUseContext context) { - if (context.getPlayer() != null && context.getPlayer() - .isSneaking()) - return super.getStateForPlacement(context); - Axis preferredAxis = getPreferredAxis(context); - return this.getDefaultState() - .with(AXIS, preferredAxis == null ? context.getNearestLookingDirection() - .getAxis() : preferredAxis); - } - - @Override - public boolean hasShaftTowards(IWorldReader world, BlockPos pos, BlockState state, Direction face) { - return face.getAxis() == state.get(AXIS); - } - - @Override - public Axis getRotationAxis(BlockState state) { - return state.get(AXIS); - } - @Override public ActionResultType onSneakWrenched(BlockState state, ItemUseContext context) { if (context.getWorld().isRemote) diff --git a/src/main/java/com/simibubi/create/content/contraptions/relays/encased/GearshiftBlock.java b/src/main/java/com/simibubi/create/content/contraptions/relays/encased/GearshiftBlock.java index 5a235677b..54e7717b7 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/relays/encased/GearshiftBlock.java +++ b/src/main/java/com/simibubi/create/content/contraptions/relays/encased/GearshiftBlock.java @@ -23,7 +23,7 @@ import net.minecraft.world.TickPriority; import net.minecraft.world.World; import net.minecraft.world.server.ServerWorld; -public class GearshiftBlock extends EncasedShaftBlock implements ITE { +public class GearshiftBlock extends AbstractEncasedShaftBlock implements ITE { public static final BooleanProperty POWERED = BlockStateProperties.POWERED; @@ -46,7 +46,7 @@ public class GearshiftBlock extends EncasedShaftBlock implements ITE getTileEntityClass() { return GearshiftTileEntity.class; @@ -90,5 +86,4 @@ public class GearshiftBlock extends EncasedShaftBlock implements ITE