diff --git a/src/generated/resources/.cache/cache b/src/generated/resources/.cache/cache index e07ce1129..57f7d584f 100644 --- a/src/generated/resources/.cache/cache +++ b/src/generated/resources/.cache/cache @@ -17,7 +17,7 @@ a579c40c43dc2174afb66f42d00d0c4a0efaaeee assets\create\blockstates\andesite_bric 398922758a6219544e5b85c91c9cf8a543b437e5 assets\create\blockstates\andesite_pillar.json f9fa6aa530eb0891a74eadfbebc663172a57147a assets\create\blockstates\basin.json 96a4fae5883eda130f8ec1a57d34534f6d0793c4 assets\create\blockstates\belt.json -86487988273d365436dbadad597c112aacf5aa92 assets\create\blockstates\belt_funnel.json +fe0278550e4795cc9757e726b88db12b599ec9ef assets\create\blockstates\belt_funnel.json 40d10934934ea142d71fc6ce598b1455c3ad47b4 assets\create\blockstates\belt_observer.json 4325605fbdea60d5f54286c309c825bebcd74b95 assets\create\blockstates\belt_tunnel.json cf9045eb16e5299a1d917c4cb536289f49411276 assets\create\blockstates\birch_window.json @@ -283,7 +283,7 @@ e8b0a401c10d1ba67ed71ba31bd5f9bc28571b65 assets\create\blockstates\powered_toggl 3a739f9d4276828d83f2d2750bf3227c87bcd438 assets\create\blockstates\pulley_magnet.json 469e430d96cb0a5e1aaf6b7cc5d401d488c9e600 assets\create\blockstates\pulse_repeater.json 6fa36883e76e9e403bb429c8f86b8c0d3bba0cff assets\create\blockstates\radial_chassis.json -35cc2bb35c9e2809f69d1fb70e854f69e0f9bbe6 assets\create\blockstates\reality_funnel.json +5e03eb759050c365f9f452ef0659f19a80e1e2f8 assets\create\blockstates\reality_funnel.json 8929677f2cc5354aa19ef182af69f9f0b41eb242 assets\create\blockstates\redstone_contact.json c29213b77ac0c78d8979c5f6188d2b265696f9b9 assets\create\blockstates\redstone_link.json 1eac804cba08aebb5f4646758ae1ef9b32e01365 assets\create\blockstates\reinforced_rail.json diff --git a/src/generated/resources/assets/create/blockstates/belt_funnel.json b/src/generated/resources/assets/create/blockstates/belt_funnel.json index 5ff1ee0c3..a692d1738 100644 --- a/src/generated/resources/assets/create/blockstates/belt_funnel.json +++ b/src/generated/resources/assets/create/blockstates/belt_funnel.json @@ -1,49 +1,64 @@ { "variants": { - "facing=north,shape=retracted": { + "facing=north,powered=false,shape=retracted": { "model": "create:block/belt_funnel/block_retracted" }, - "facing=south,shape=retracted": { + "facing=south,powered=false,shape=retracted": { "model": "create:block/belt_funnel/block_retracted", "y": 180 }, - "facing=west,shape=retracted": { + "facing=west,powered=false,shape=retracted": { "model": "create:block/belt_funnel/block_retracted", "y": 270 }, - "facing=east,shape=retracted": { + "facing=east,powered=false,shape=retracted": { "model": "create:block/belt_funnel/block_retracted", "y": 90 }, - "facing=north,shape=default": { - "model": "create:block/belt_funnel/block_default" + "facing=north,powered=true,shape=retracted": { + "model": "create:block/belt_funnel/block_retracted_powered" }, - "facing=south,shape=default": { - "model": "create:block/belt_funnel/block_default", + "facing=south,powered=true,shape=retracted": { + "model": "create:block/belt_funnel/block_retracted_powered", "y": 180 }, - "facing=west,shape=default": { - "model": "create:block/belt_funnel/block_default", + "facing=west,powered=true,shape=retracted": { + "model": "create:block/belt_funnel/block_retracted_powered", "y": 270 }, - "facing=east,shape=default": { - "model": "create:block/belt_funnel/block_default", + "facing=east,powered=true,shape=retracted": { + "model": "create:block/belt_funnel/block_retracted_powered", "y": 90 }, - "facing=north,shape=extended": { + "facing=north,powered=false,shape=extended": { "model": "create:block/belt_funnel/block_extended" }, - "facing=south,shape=extended": { + "facing=south,powered=false,shape=extended": { "model": "create:block/belt_funnel/block_extended", "y": 180 }, - "facing=west,shape=extended": { + "facing=west,powered=false,shape=extended": { "model": "create:block/belt_funnel/block_extended", "y": 270 }, - "facing=east,shape=extended": { + "facing=east,powered=false,shape=extended": { "model": "create:block/belt_funnel/block_extended", "y": 90 + }, + "facing=north,powered=true,shape=extended": { + "model": "create:block/belt_funnel/block_extended_powered" + }, + "facing=south,powered=true,shape=extended": { + "model": "create:block/belt_funnel/block_extended_powered", + "y": 180 + }, + "facing=west,powered=true,shape=extended": { + "model": "create:block/belt_funnel/block_extended_powered", + "y": 270 + }, + "facing=east,powered=true,shape=extended": { + "model": "create:block/belt_funnel/block_extended_powered", + "y": 90 } } } \ No newline at end of file diff --git a/src/generated/resources/assets/create/blockstates/reality_funnel.json b/src/generated/resources/assets/create/blockstates/reality_funnel.json index 63d9403e1..7b9e14ef9 100644 --- a/src/generated/resources/assets/create/blockstates/reality_funnel.json +++ b/src/generated/resources/assets/create/blockstates/reality_funnel.json @@ -1,30 +1,56 @@ { "variants": { - "facing=down": { + "facing=down,powered=false": { "model": "create:block/reality_funnel/block", "x": 180 }, - "facing=up": { + "facing=up,powered=false": { "model": "create:block/reality_funnel/block" }, - "facing=north": { + "facing=north,powered=false": { "model": "create:block/reality_funnel/block", "x": 90 }, - "facing=south": { + "facing=south,powered=false": { "model": "create:block/reality_funnel/block", "x": 90, "y": 180 }, - "facing=west": { + "facing=west,powered=false": { "model": "create:block/reality_funnel/block", "x": 90, "y": 270 }, - "facing=east": { + "facing=east,powered=false": { "model": "create:block/reality_funnel/block", "x": 90, "y": 90 + }, + "facing=down,powered=true": { + "model": "create:block/reality_funnel/block_powered", + "x": 180 + }, + "facing=up,powered=true": { + "model": "create:block/reality_funnel/block_powered" + }, + "facing=north,powered=true": { + "model": "create:block/reality_funnel/block_powered", + "x": 90 + }, + "facing=south,powered=true": { + "model": "create:block/reality_funnel/block_powered", + "x": 90, + "y": 180 + }, + "facing=west,powered=true": { + "model": "create:block/reality_funnel/block_powered", + "x": 90, + "y": 270 + }, + "facing=east,powered=true": { + "model": "create:block/reality_funnel/block_powered", + "x": 90, + "y": 90 } } } \ No newline at end of file diff --git a/src/main/java/com/simibubi/create/AllBlocks.java b/src/main/java/com/simibubi/create/AllBlocks.java index 784f1cf69..ed2b72bbb 100644 --- a/src/main/java/com/simibubi/create/AllBlocks.java +++ b/src/main/java/com/simibubi/create/AllBlocks.java @@ -742,16 +742,19 @@ public class AllBlocks { public static final BlockEntry REALITY_FUNNEL = REGISTRATE.block("reality_funnel", RealityFunnelBlock::new) .initialProperties(SharedProperties::softMetal) - .blockstate((c, p) -> p.directionalBlock(c.get(), s -> AssetLookup.partialBaseModel(c, p))) + .blockstate((c, p) -> p.directionalBlock(c.get(), AssetLookup.forPowered(c, p))) .item(FunnelItem::new) .transform(customItemModel()) .register(); public static final BlockEntry BELT_FUNNEL = REGISTRATE.block("belt_funnel", BeltFunnelBlock::new) .initialProperties(SharedProperties::softMetal) - .blockstate((c, p) -> p.horizontalBlock(c.get(), - s -> AssetLookup.partialBaseModel(c, p, s.get(BeltFunnelBlock.SHAPE) - .getName()))) + .blockstate((c, p) -> p.horizontalBlock(c.get(), s -> { + String shape = s.get(BeltFunnelBlock.SHAPE) + .getName(); + return s.get(BeltFunnelBlock.POWERED) ? AssetLookup.partialBaseModel(c, p, shape, "powered") + : AssetLookup.partialBaseModel(c, p, shape); + })) .loot((p, b) -> p.registerDropping(b, REALITY_FUNNEL.get())) .register(); diff --git a/src/main/java/com/simibubi/create/AllShapes.java b/src/main/java/com/simibubi/create/AllShapes.java index e690a9169..9404ed41c 100644 --- a/src/main/java/com/simibubi/create/AllShapes.java +++ b/src/main/java/com/simibubi/create/AllShapes.java @@ -65,7 +65,10 @@ public class AllShapes { NIXIE_TUBE_CEILING = shape(0, 12, 0, 16, 16, 16).add(9, 1, 5, 15, 16, 11) .add(1, 1, 5, 7, 16, 11) .forHorizontalAxis(), - REALITY_FUNNEL = shape(2, -2, 2, 14, 2, 14).forDirectional(UP), + REALITY_FUNNEL = shape(3, -2, 3, 13, 2, 13).add(2, 2, 2, 14, 6, 14) + .add(1, 6, 1, 15, 10, 15) + .add(0, 10, 0, 16, 16, 16) + .forDirectional(UP), BELT_FUNNEL_RETRACTED = shape(3, -5, 14, 13, 13, 19).add(0, -5, 8, 16, 16, 14) .forHorizontal(NORTH), BELT_FUNNEL_DEFAULT = shape(3, -5, 12, 13, 13, 17).add(0, -5, 6, 16, 16, 12) diff --git a/src/main/java/com/simibubi/create/content/logistics/block/realityFunnel/BeltFunnelBlock.java b/src/main/java/com/simibubi/create/content/logistics/block/realityFunnel/BeltFunnelBlock.java index 48fa9c93f..fb7217329 100644 --- a/src/main/java/com/simibubi/create/content/logistics/block/realityFunnel/BeltFunnelBlock.java +++ b/src/main/java/com/simibubi/create/content/logistics/block/realityFunnel/BeltFunnelBlock.java @@ -17,9 +17,11 @@ 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.BooleanProperty; import net.minecraft.state.EnumProperty; import net.minecraft.state.IProperty; import net.minecraft.state.StateContainer.Builder; +import net.minecraft.state.properties.BlockStateProperties; import net.minecraft.util.ActionResultType; import net.minecraft.util.Direction; import net.minecraft.util.IStringSerializable; @@ -36,11 +38,10 @@ import net.minecraft.world.World; public class BeltFunnelBlock extends HorizontalBlock implements IWrenchable { public static final IProperty SHAPE = EnumProperty.create("shape", Shape.class); + public static final BooleanProperty POWERED = BlockStateProperties.POWERED; public enum Shape implements IStringSerializable { - RETRACTED(AllShapes.BELT_FUNNEL_RETRACTED), - DEFAULT(AllShapes.BELT_FUNNEL_DEFAULT), - EXTENDED(AllShapes.BELT_FUNNEL_EXTENDED); + RETRACTED(AllShapes.BELT_FUNNEL_RETRACTED), EXTENDED(AllShapes.BELT_FUNNEL_EXTENDED); VoxelShaper shaper; @@ -56,14 +57,15 @@ public class BeltFunnelBlock extends HorizontalBlock implements IWrenchable { public BeltFunnelBlock(Properties p_i48377_1_) { super(p_i48377_1_); - setDefaultState(getDefaultState().with(SHAPE, Shape.DEFAULT)); + setDefaultState(getDefaultState().with(SHAPE, Shape.RETRACTED) + .with(POWERED, false)); } @Override protected void fillStateContainer(Builder p_206840_1_) { - super.fillStateContainer(p_206840_1_.add(HORIZONTAL_FACING, SHAPE)); + super.fillStateContainer(p_206840_1_.add(HORIZONTAL_FACING, SHAPE, POWERED)); } - + @Override public VoxelShape getShape(BlockState state, IBlockReader p_220053_2_, BlockPos p_220053_3_, ISelectionContext p_220053_4_) { @@ -71,8 +73,9 @@ public class BeltFunnelBlock extends HorizontalBlock implements IWrenchable { } @Override - public BlockState getStateForPlacement(BlockItemUseContext p_196258_1_) { - return updateShape(super.getStateForPlacement(p_196258_1_), p_196258_1_.getWorld(), p_196258_1_.getPos()); + public BlockState getStateForPlacement(BlockItemUseContext ctx) { + return updateShape(super.getStateForPlacement(ctx), ctx.getWorld(), ctx.getPos()).with(POWERED, ctx.getWorld() + .isBlockPowered(ctx.getPos())); } @Override @@ -80,7 +83,7 @@ public class BeltFunnelBlock extends HorizontalBlock implements IWrenchable { PlayerEntity player) { return AllBlocks.REALITY_FUNNEL.asStack(); } - + @Override public BlockState updatePostPlacement(BlockState state, Direction direction, BlockState neighbour, IWorld world, BlockPos pos, BlockPos p_196271_6_) { @@ -126,10 +129,14 @@ public class BeltFunnelBlock extends HorizontalBlock implements IWrenchable { if (fromPos.equals(pos.offset(blockFacing))) if (!isValidPosition(state, worldIn, pos)) worldIn.destroyBlock(pos, true); + + boolean previouslyPowered = state.get(POWERED); + if (previouslyPowered != worldIn.isBlockPowered(pos)) + worldIn.setBlockState(pos, state.cycle(POWERED), 2); } private BlockState updateShape(BlockState state, ILightReader world, BlockPos pos) { - state = state.with(SHAPE, Shape.DEFAULT); + state = state.with(SHAPE, Shape.RETRACTED); BlockState neighbour = world.getBlockState(pos.offset(state.get(HORIZONTAL_FACING))); if (canConnectTo(state, neighbour)) return state.with(SHAPE, Shape.EXTENDED); diff --git a/src/main/java/com/simibubi/create/content/logistics/block/realityFunnel/RealityFunnelBlock.java b/src/main/java/com/simibubi/create/content/logistics/block/realityFunnel/RealityFunnelBlock.java index 6d367e59f..e3873d576 100644 --- a/src/main/java/com/simibubi/create/content/logistics/block/realityFunnel/RealityFunnelBlock.java +++ b/src/main/java/com/simibubi/create/content/logistics/block/realityFunnel/RealityFunnelBlock.java @@ -7,6 +7,9 @@ import com.simibubi.create.foundation.block.ProperDirectionalBlock; import net.minecraft.block.Block; import net.minecraft.block.BlockState; import net.minecraft.item.BlockItemUseContext; +import net.minecraft.state.BooleanProperty; +import net.minecraft.state.StateContainer.Builder; +import net.minecraft.state.properties.BlockStateProperties; import net.minecraft.util.Direction; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.shapes.ISelectionContext; @@ -18,15 +21,25 @@ import net.minecraft.world.World; public class RealityFunnelBlock extends ProperDirectionalBlock { + public static final BooleanProperty POWERED = BlockStateProperties.POWERED; + public RealityFunnelBlock(Properties p_i48415_1_) { super(p_i48415_1_); + setDefaultState(getDefaultState().with(POWERED, false)); } @Override public BlockState getStateForPlacement(BlockItemUseContext context) { - return getDefaultState().with(FACING, context.getFace()); + return getDefaultState().with(FACING, context.getFace()) + .with(POWERED, context.getWorld() + .isBlockPowered(context.getPos())); } - + + @Override + protected void fillStateContainer(Builder builder) { + super.fillStateContainer(builder.add(POWERED)); + } + @Override public VoxelShape getShape(BlockState state, IBlockReader p_220053_2_, BlockPos p_220053_3_, ISelectionContext p_220053_4_) { @@ -58,6 +71,10 @@ public class RealityFunnelBlock extends ProperDirectionalBlock { if (fromPos.equals(pos.offset(blockFacing))) if (!isValidPosition(state, worldIn, pos)) worldIn.destroyBlock(pos, true); + + boolean previouslyPowered = state.get(POWERED); + if (previouslyPowered != worldIn.isBlockPowered(pos)) + worldIn.setBlockState(pos, state.cycle(POWERED), 2); } @Override diff --git a/src/main/java/com/simibubi/create/content/logistics/block/redstone/RedstoneLinkBlock.java b/src/main/java/com/simibubi/create/content/logistics/block/redstone/RedstoneLinkBlock.java index 80ded0153..1933627ff 100644 --- a/src/main/java/com/simibubi/create/content/logistics/block/redstone/RedstoneLinkBlock.java +++ b/src/main/java/com/simibubi/create/content/logistics/block/redstone/RedstoneLinkBlock.java @@ -1,5 +1,6 @@ package com.simibubi.create.content.logistics.block.redstone; +import com.simibubi.create.AllBlocks; import com.simibubi.create.AllShapes; import com.simibubi.create.AllTileEntities; import com.simibubi.create.content.contraptions.wrench.IWrenchable; @@ -164,6 +165,8 @@ public class RedstoneLinkBlock extends ProperDirectionalBlock implements ITE