From 282d9d680113dd41181ac3d9fd49389ea9ed4941 Mon Sep 17 00:00:00 2001 From: LordGrimmauld Date: Thu, 11 Jun 2020 12:57:02 +0200 Subject: [PATCH] Cart Assembler - States and Drops --- src/generated/resources/.cache/cache | 6 +- .../create/blockstates/cart_assembler.json | 72 ++- .../create/blockstates/radial_chassis.json | 72 +-- .../resources/assets/create/lang/en_us.json | 1 + .../java/com/simibubi/create/AllBlocks.java | 3 +- .../mounted/CartAssemblerBlock.java | 439 +++++++++++------- .../mounted/CartAssemblerBlockItem.java | 59 +++ .../contraptions/wrench/IWrenchable.java | 23 +- .../contraptions/wrench/WrenchItem.java | 23 +- .../create/foundation/data/BlockStateGen.java | 10 +- .../assets/create/lang/default/messages.json | 1 + .../block/cart_assembler/block_none.json | 93 ++++ .../cart_assembler/block_powered_none.json | 6 + .../block_powered_rail_activator.json | 7 + .../block_powered_rail_detector.json | 7 + .../block_powered_rail_normal.json | 7 + ...d.json => block_powered_rail_powered.json} | 0 .../cart_assembler/block_rail_activator.json | 6 + .../cart_assembler/block_rail_detector.json | 6 + .../cart_assembler/block_rail_normal.json | 6 + .../cart_assembler/block_rail_powered.json | 6 + .../contraptions/cart_assembler.json | 5 +- 22 files changed, 610 insertions(+), 248 deletions(-) create mode 100644 src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/mounted/CartAssemblerBlockItem.java create mode 100644 src/main/resources/assets/create/models/block/cart_assembler/block_none.json create mode 100644 src/main/resources/assets/create/models/block/cart_assembler/block_powered_none.json create mode 100644 src/main/resources/assets/create/models/block/cart_assembler/block_powered_rail_activator.json create mode 100644 src/main/resources/assets/create/models/block/cart_assembler/block_powered_rail_detector.json create mode 100644 src/main/resources/assets/create/models/block/cart_assembler/block_powered_rail_normal.json rename src/main/resources/assets/create/models/block/cart_assembler/{block_powered.json => block_powered_rail_powered.json} (100%) create mode 100644 src/main/resources/assets/create/models/block/cart_assembler/block_rail_activator.json create mode 100644 src/main/resources/assets/create/models/block/cart_assembler/block_rail_detector.json create mode 100644 src/main/resources/assets/create/models/block/cart_assembler/block_rail_normal.json create mode 100644 src/main/resources/assets/create/models/block/cart_assembler/block_rail_powered.json diff --git a/src/generated/resources/.cache/cache b/src/generated/resources/.cache/cache index 6839ce96b..5164ad56f 100644 --- a/src/generated/resources/.cache/cache +++ b/src/generated/resources/.cache/cache @@ -23,7 +23,7 @@ cf9045eb16e5299a1d917c4cb536289f49411276 assets\create\blockstates\birch_window. 94a1a91403eb4b035fec48071e7fcae57a8a6abd assets\create\blockstates\birch_window_pane.json 8b1dd00adcc7e74c5a9feed069e2610b15a338cb assets\create\blockstates\brass_block.json b8dd6e505943e06706d0718ece620ab3cf943650 assets\create\blockstates\brass_casing.json -4a5e49de9e0d6b278f737af936a743e03a6c361a assets\create\blockstates\cart_assembler.json +dd1e9a928702415722f99d165571c2d63d847987 assets\create\blockstates\cart_assembler.json 7299cea212d879d6d5611bd139b24768b9af236f assets\create\blockstates\chiseled_dark_scoria.json 0f01f813388d3e6907c1cfd992e4b21c914e267e assets\create\blockstates\chiseled_dolomite.json 324488e0c228f38f2597b2f76849e962bc1a7d90 assets\create\blockstates\chiseled_gabbro.json @@ -273,7 +273,7 @@ b7829c2ef2c47188713f8cab21b2c9bc7f9c5b79 assets\create\blockstates\portable_stor e8b0a401c10d1ba67ed71ba31bd5f9bc28571b65 assets\create\blockstates\powered_toggle_latch.json 3a739f9d4276828d83f2d2750bf3227c87bcd438 assets\create\blockstates\pulley_magnet.json 469e430d96cb0a5e1aaf6b7cc5d401d488c9e600 assets\create\blockstates\pulse_repeater.json -8d7e653bfd9846e684a0d3725595714a19201017 assets\create\blockstates\radial_chassis.json +5d1b30c2bab556f57c78e7780fd445b08f541a50 assets\create\blockstates\radial_chassis.json 8929677f2cc5354aa19ef182af69f9f0b41eb242 assets\create\blockstates\redstone_contact.json c29213b77ac0c78d8979c5f6188d2b265696f9b9 assets\create\blockstates\redstone_link.json 1eac804cba08aebb5f4646758ae1ef9b32e01365 assets\create\blockstates\reinforced_rail.json @@ -326,7 +326,7 @@ c77b46d8b459e5c7cc495393546f3fcca8a1fa1d assets\create\blockstates\weathered_lim 7f39521b211441f5c3e06d60c5978cebe16cacfb assets\create\blockstates\zinc_block.json b7181bcd8182b2f17088e5aa881f374c9c65470c assets\create\blockstates\zinc_ore.json 6bf74a9e1f74b41f53399c1f817942b01a010bf0 assets\create\lang\en_ud.json -7bb6dd61820e1b7a42310632c09c22daff870ac8 assets\create\lang\en_us.json +587b2f5b13ba67674d5eec135e5f767e9255d20d assets\create\lang\en_us.json 846200eb548d3bfa2e77b41039de159b4b6cfb45 assets\create\models\block\acacia_window.json 1930fa3a3c98d53dd19e4ee7f55bc27fd47aa281 assets\create\models\block\acacia_window_pane_noside.json 1763ea2c9b981d187f5031ba608f3d5d3be3986a assets\create\models\block\acacia_window_pane_noside_alt.json diff --git a/src/generated/resources/assets/create/blockstates/cart_assembler.json b/src/generated/resources/assets/create/blockstates/cart_assembler.json index 2972bbf8f..de1c46433 100644 --- a/src/generated/resources/assets/create/blockstates/cart_assembler.json +++ b/src/generated/resources/assets/create/blockstates/cart_assembler.json @@ -1,17 +1,73 @@ { "variants": { - "powered=false,shape=north_south": { - "model": "create:block/cart_assembler/block" + "powered=false,rail_type=0,shape=north_south": { + "model": "create:block/cart_assembler/block_none" }, - "powered=true,shape=north_south": { - "model": "create:block/cart_assembler/block_powered" + "powered=true,rail_type=0,shape=north_south": { + "model": "create:block/cart_assembler/block_powered_none" }, - "powered=false,shape=east_west": { - "model": "create:block/cart_assembler/block", + "powered=false,rail_type=1,shape=north_south": { + "model": "create:block/cart_assembler/block_rail_normal" + }, + "powered=true,rail_type=1,shape=north_south": { + "model": "create:block/cart_assembler/block_powered_rail_normal" + }, + "powered=false,rail_type=2,shape=north_south": { + "model": "create:block/cart_assembler/block_rail_powered" + }, + "powered=true,rail_type=2,shape=north_south": { + "model": "create:block/cart_assembler/block_powered_rail_powered" + }, + "powered=false,rail_type=3,shape=north_south": { + "model": "create:block/cart_assembler/block_rail_detector" + }, + "powered=true,rail_type=3,shape=north_south": { + "model": "create:block/cart_assembler/block_powered_rail_detector" + }, + "powered=false,rail_type=4,shape=north_south": { + "model": "create:block/cart_assembler/block_rail_activator" + }, + "powered=true,rail_type=4,shape=north_south": { + "model": "create:block/cart_assembler/block_powered_rail_activator" + }, + "powered=false,rail_type=0,shape=east_west": { + "model": "create:block/cart_assembler/block_none", "y": 90 }, - "powered=true,shape=east_west": { - "model": "create:block/cart_assembler/block_powered", + "powered=true,rail_type=0,shape=east_west": { + "model": "create:block/cart_assembler/block_powered_none", + "y": 90 + }, + "powered=false,rail_type=1,shape=east_west": { + "model": "create:block/cart_assembler/block_rail_normal", + "y": 90 + }, + "powered=true,rail_type=1,shape=east_west": { + "model": "create:block/cart_assembler/block_powered_rail_normal", + "y": 90 + }, + "powered=false,rail_type=2,shape=east_west": { + "model": "create:block/cart_assembler/block_rail_powered", + "y": 90 + }, + "powered=true,rail_type=2,shape=east_west": { + "model": "create:block/cart_assembler/block_powered_rail_powered", + "y": 90 + }, + "powered=false,rail_type=3,shape=east_west": { + "model": "create:block/cart_assembler/block_rail_detector", + "y": 90 + }, + "powered=true,rail_type=3,shape=east_west": { + "model": "create:block/cart_assembler/block_powered_rail_detector", + "y": 90 + }, + "powered=false,rail_type=4,shape=east_west": { + "model": "create:block/cart_assembler/block_rail_activator", + "y": 90 + }, + "powered=true,rail_type=4,shape=east_west": { + "model": "create:block/cart_assembler/block_powered_rail_activator", "y": 90 } } diff --git a/src/generated/resources/assets/create/blockstates/radial_chassis.json b/src/generated/resources/assets/create/blockstates/radial_chassis.json index 9d00ea8b1..04e5c08ae 100644 --- a/src/generated/resources/assets/create/blockstates/radial_chassis.json +++ b/src/generated/resources/assets/create/blockstates/radial_chassis.json @@ -29,8 +29,8 @@ }, { "when": { - "sticky_south": "true", - "axis": "x" + "axis": "x", + "sticky_south": "true" }, "apply": { "model": "create:block/radial_chassis_side_x_sticky", @@ -39,8 +39,8 @@ }, { "when": { - "sticky_south": "true", - "axis": "y" + "axis": "y", + "sticky_south": "true" }, "apply": { "model": "create:block/radial_chassis_side_y_sticky" @@ -48,8 +48,8 @@ }, { "when": { - "sticky_south": "true", - "axis": "z" + "axis": "z", + "sticky_south": "true" }, "apply": { "model": "create:block/radial_chassis_side_x_sticky", @@ -59,8 +59,8 @@ }, { "when": { - "sticky_south": "false", - "axis": "x" + "axis": "x", + "sticky_south": "false" }, "apply": { "model": "create:block/radial_chassis_side_x", @@ -69,8 +69,8 @@ }, { "when": { - "sticky_south": "false", - "axis": "y" + "axis": "y", + "sticky_south": "false" }, "apply": { "model": "create:block/radial_chassis_side_y" @@ -78,8 +78,8 @@ }, { "when": { - "sticky_south": "false", - "axis": "z" + "axis": "z", + "sticky_south": "false" }, "apply": { "model": "create:block/radial_chassis_side_x", @@ -89,8 +89,8 @@ }, { "when": { - "sticky_west": "true", - "axis": "x" + "axis": "x", + "sticky_west": "true" }, "apply": { "model": "create:block/radial_chassis_side_x_sticky", @@ -99,8 +99,8 @@ }, { "when": { - "sticky_west": "true", - "axis": "y" + "axis": "y", + "sticky_west": "true" }, "apply": { "model": "create:block/radial_chassis_side_y_sticky", @@ -109,8 +109,8 @@ }, { "when": { - "sticky_west": "true", - "axis": "z" + "axis": "z", + "sticky_west": "true" }, "apply": { "model": "create:block/radial_chassis_side_z_sticky", @@ -119,8 +119,8 @@ }, { "when": { - "sticky_west": "false", - "axis": "x" + "axis": "x", + "sticky_west": "false" }, "apply": { "model": "create:block/radial_chassis_side_x", @@ -129,8 +129,8 @@ }, { "when": { - "sticky_west": "false", - "axis": "y" + "axis": "y", + "sticky_west": "false" }, "apply": { "model": "create:block/radial_chassis_side_y", @@ -139,8 +139,8 @@ }, { "when": { - "sticky_west": "false", - "axis": "z" + "axis": "z", + "sticky_west": "false" }, "apply": { "model": "create:block/radial_chassis_side_z", @@ -149,8 +149,8 @@ }, { "when": { - "sticky_north": "true", - "axis": "x" + "axis": "x", + "sticky_north": "true" }, "apply": { "model": "create:block/radial_chassis_side_x_sticky" @@ -158,8 +158,8 @@ }, { "when": { - "sticky_north": "true", - "axis": "y" + "axis": "y", + "sticky_north": "true" }, "apply": { "model": "create:block/radial_chassis_side_y_sticky", @@ -168,8 +168,8 @@ }, { "when": { - "sticky_north": "true", - "axis": "z" + "axis": "z", + "sticky_north": "true" }, "apply": { "model": "create:block/radial_chassis_side_x_sticky", @@ -178,8 +178,8 @@ }, { "when": { - "sticky_north": "false", - "axis": "x" + "axis": "x", + "sticky_north": "false" }, "apply": { "model": "create:block/radial_chassis_side_x" @@ -187,8 +187,8 @@ }, { "when": { - "sticky_north": "false", - "axis": "y" + "axis": "y", + "sticky_north": "false" }, "apply": { "model": "create:block/radial_chassis_side_y", @@ -197,8 +197,8 @@ }, { "when": { - "sticky_north": "false", - "axis": "z" + "axis": "z", + "sticky_north": "false" }, "apply": { "model": "create:block/radial_chassis_side_x", diff --git a/src/generated/resources/assets/create/lang/en_us.json b/src/generated/resources/assets/create/lang/en_us.json index c4a31c888..03f795120 100644 --- a/src/generated/resources/assets/create/lang/en_us.json +++ b/src/generated/resources/assets/create/lang/en_us.json @@ -484,6 +484,7 @@ "death.attack.create.cuckoo_clock_explosion": "%1$s was blown up by tampered cuckoo clock", "create.block.deployer.damage_source_name": "a rogue Deployer", + "create.block.cart_assembler.invalid": "Can not place a Cart Assembler on this rail type", "create.recipe.crushing": "Crushing", "create.recipe.milling": "Milling", diff --git a/src/main/java/com/simibubi/create/AllBlocks.java b/src/main/java/com/simibubi/create/AllBlocks.java index 3e2d216de..fc104a223 100644 --- a/src/main/java/com/simibubi/create/AllBlocks.java +++ b/src/main/java/com/simibubi/create/AllBlocks.java @@ -40,6 +40,7 @@ import com.simibubi.create.content.contraptions.components.structureMovement.cha import com.simibubi.create.content.contraptions.components.structureMovement.chassis.LinearChassisBlock.ChassisCTBehaviour; import com.simibubi.create.content.contraptions.components.structureMovement.chassis.RadialChassisBlock; import com.simibubi.create.content.contraptions.components.structureMovement.mounted.CartAssemblerBlock; +import com.simibubi.create.content.contraptions.components.structureMovement.mounted.CartAssemblerBlockItem; import com.simibubi.create.content.contraptions.components.structureMovement.mounted.CartAssemblerBlock.MinecartAnchorBlock; import com.simibubi.create.content.contraptions.components.structureMovement.piston.MechanicalPistonBlock; import com.simibubi.create.content.contraptions.components.structureMovement.piston.MechanicalPistonHeadBlock; @@ -451,7 +452,7 @@ public class AllBlocks { .blockstate(BlockStateGen.cartAssembler()) .addLayer(() -> RenderType::getCutoutMipped) .tag(BlockTags.RAILS) - .item() + .item(CartAssemblerBlockItem::new) .model((c, p) -> p.blockItem(() -> c.getEntry() .getBlock(), "/block")) .build() diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/mounted/CartAssemblerBlock.java b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/mounted/CartAssemblerBlock.java index 038c3c274..81d76e888 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/mounted/CartAssemblerBlock.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/mounted/CartAssemblerBlock.java @@ -1,29 +1,47 @@ package com.simibubi.create.content.contraptions.components.structureMovement.mounted; +import java.util.List; + +import javax.annotation.Nullable; + import com.simibubi.create.AllBlocks; import com.simibubi.create.AllShapes; import com.simibubi.create.AllTileEntities; import com.simibubi.create.content.contraptions.components.structureMovement.ContraptionEntity; import com.simibubi.create.content.contraptions.components.structureMovement.mounted.CartAssemblerTileEntity.CartMovementMode; import com.simibubi.create.content.contraptions.wrench.IWrenchable; +import com.simibubi.create.content.schematics.ISpecialBlockItemRequirement; +import com.simibubi.create.content.schematics.ItemRequirement; +import com.simibubi.create.content.schematics.ItemRequirement.ItemUseType; import com.simibubi.create.foundation.block.ITE; import com.simibubi.create.foundation.utility.VecHelper; import net.minecraft.block.AbstractRailBlock; import net.minecraft.block.Block; import net.minecraft.block.BlockState; +import net.minecraft.block.Blocks; +import net.minecraft.block.DetectorRailBlock; +import net.minecraft.block.PoweredRailBlock; +import net.minecraft.block.RailBlock; import net.minecraft.block.material.PushReaction; +import net.minecraft.entity.Entity; import net.minecraft.entity.item.minecart.AbstractMinecartEntity; import net.minecraft.entity.item.minecart.FurnaceMinecartEntity; -import net.minecraft.item.BlockItemUseContext; +import net.minecraft.entity.player.PlayerEntity; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.item.ItemUseContext; +import net.minecraft.item.Items; import net.minecraft.nbt.CompoundNBT; import net.minecraft.state.BooleanProperty; import net.minecraft.state.EnumProperty; import net.minecraft.state.IProperty; +import net.minecraft.state.IntegerProperty; import net.minecraft.state.StateContainer.Builder; import net.minecraft.state.properties.BlockStateProperties; import net.minecraft.state.properties.RailShape; 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.math.BlockPos; @@ -32,188 +50,261 @@ import net.minecraft.util.math.shapes.ISelectionContext; import net.minecraft.util.math.shapes.VoxelShape; import net.minecraft.util.math.shapes.VoxelShapes; import net.minecraft.world.IBlockReader; +import net.minecraft.world.IWorldReader; import net.minecraft.world.World; +import net.minecraft.world.server.ServerWorld; +import net.minecraft.world.storage.loot.LootContext; +import net.minecraft.world.storage.loot.LootParameters; -public class CartAssemblerBlock extends AbstractRailBlock implements ITE, IWrenchable { +public class CartAssemblerBlock extends AbstractRailBlock implements ITE, IWrenchable, ISpecialBlockItemRequirement { - public static IProperty RAIL_SHAPE = - EnumProperty.create("shape", RailShape.class, RailShape.EAST_WEST, RailShape.NORTH_SOUTH); - public static BooleanProperty POWERED = BlockStateProperties.POWERED; + public static final int RAIL_NONE = 0; + public static final int RAIL_NORMAL = 1; + public static final int RAIL_POWERED = 2; + public static final int RAIL_DETECTOR = 3; + public static final int RAIL_ACTIVATOR = 4; + public static IProperty RAIL_SHAPE = + EnumProperty.create("shape", RailShape.class, RailShape.EAST_WEST, RailShape.NORTH_SOUTH); + public static IProperty RAIL_TYPE = IntegerProperty.create("rail_type", 0, 4); - public CartAssemblerBlock(Properties properties) { - super(true, properties); - setDefaultState(getDefaultState().with(POWERED, false)); + public static BooleanProperty POWERED = BlockStateProperties.POWERED; + + public CartAssemblerBlock(Properties properties) { + super(true, properties); + setDefaultState(getDefaultState().with(POWERED, false).with(RAIL_TYPE, RAIL_POWERED)); + } + + public static BlockState createAnchor(BlockState state) { + Axis axis = state.get(RAIL_SHAPE) == RailShape.NORTH_SOUTH ? Axis.Z : Axis.X; + return AllBlocks.MINECART_ANCHOR.getDefaultState() + .with(BlockStateProperties.HORIZONTAL_AXIS, axis); + } + + @Override + protected void fillStateContainer(Builder builder) { + builder.add(RAIL_SHAPE, POWERED, RAIL_TYPE); + super.fillStateContainer(builder); + } + + @Override + public boolean hasTileEntity(BlockState state) { + return true; + } + + @Override + public TileEntity createTileEntity(BlockState state, IBlockReader world) { + return AllTileEntities.CART_ASSEMBLER.create(); + } + + @Override + public boolean canMakeSlopes(BlockState state, IBlockReader world, BlockPos pos) { + return false; + } + + @Override + public void onMinecartPass(BlockState state, World world, BlockPos pos, AbstractMinecartEntity cart) { + if (!cart.canBeRidden() && !(cart instanceof FurnaceMinecartEntity)) + return; + + withTileEntityDo(world, pos, te -> { + if (te.isMinecartUpdateValid()) { + if (state.get(POWERED)) { + assemble(world, pos, cart); + Direction facing = cart.getAdjustedHorizontalFacing(); + cart.setMotion(facing.getXOffset(), facing.getYOffset(), facing.getZOffset()); + } else { + disassemble(world, pos, cart); + Vec3d diff = VecHelper.getCenterOf(pos) + .subtract(cart.getPositionVec()); + cart.setMotion(diff.x / 16f, 0, diff.z / 16f); + } + te.resetTicksSinceMinecartUpdate(); + } + }); + } + + protected void assemble(World world, BlockPos pos, AbstractMinecartEntity cart) { + if (!cart.getPassengers() + .isEmpty()) + return; + + MountedContraption contraption = MountedContraption.assembleMinecart(world, pos); + if (contraption == null) + return; + if (contraption.blocks.size() == 1) + return; + + Direction facing = cart.getAdjustedHorizontalFacing(); + float initialAngle = facing.getHorizontalAngle(); + + withTileEntityDo(world, pos, te -> contraption.rotationMode = CartMovementMode.values()[te.movementMode.value]); + ContraptionEntity entity = ContraptionEntity.createMounted(world, contraption, initialAngle, facing); + entity.setPosition(pos.getX(), pos.getY(), pos.getZ()); + world.addEntity(entity); + entity.startRiding(cart); + + if (cart instanceof FurnaceMinecartEntity) { + CompoundNBT nbt = cart.serializeNBT(); + nbt.putDouble("PushZ", 0); + nbt.putDouble("PushX", 0); + cart.deserializeNBT(nbt); + } + } + + protected void disassemble(World world, BlockPos pos, AbstractMinecartEntity cart) { + if (cart.getPassengers() + .isEmpty()) + return; + if (!(cart.getPassengers() + .get(0) instanceof ContraptionEntity)) + return; + cart.removePassengers(); + + if (cart instanceof FurnaceMinecartEntity) { + CompoundNBT nbt = cart.serializeNBT(); + nbt.putDouble("PushZ", cart.getMotion().x); + nbt.putDouble("PushX", cart.getMotion().z); + cart.deserializeNBT(nbt); + } + } + + @Override + public void neighborChanged(BlockState state, World worldIn, BlockPos pos, Block blockIn, BlockPos fromPos, + boolean isMoving) { + super.neighborChanged(state, worldIn, pos, blockIn, fromPos, isMoving); + + if (worldIn.isRemote) + return; + + boolean previouslyPowered = state.get(POWERED); + if (previouslyPowered != worldIn.isBlockPowered(pos)) { + worldIn.setBlockState(pos, state.cycle(POWERED), 2); + } + } + + @Override + public IProperty getShapeProperty() { + return RAIL_SHAPE; + } + + @Override + public VoxelShape getShape(BlockState state, IBlockReader worldIn, BlockPos pos, ISelectionContext context) { + return AllShapes.CART_ASSEMBLER + .get(state.get(RAIL_SHAPE) == RailShape.NORTH_SOUTH ? Direction.Axis.Z : Direction.Axis.X); + } + + @Override + public VoxelShape getCollisionShape(BlockState state, IBlockReader worldIn, BlockPos pos, + ISelectionContext context) { + if (context.getEntity() instanceof AbstractMinecartEntity) + return VoxelShapes.empty(); + return VoxelShapes.fullCube(); + } + + @Override + public PushReaction getPushReaction(BlockState state) { + return PushReaction.BLOCK; + } + + @Override + public boolean isNormalCube(BlockState state, IBlockReader worldIn, BlockPos pos) { + return false; + } + + @Override + public Class getTileEntityClass() { + return CartAssemblerTileEntity.class; + } + + @Override + public boolean isValidPosition(BlockState state, IWorldReader world, BlockPos pos) { + return false; + } + + @Override + @SuppressWarnings("deprecation") + public List getDrops(BlockState state, net.minecraft.world.storage.loot.LootContext.Builder builder) { + List drops = super.getDrops(state, builder); + drops.addAll(getRailBlock(state).getDrops(builder)); + return drops; } - - @Override - protected void fillStateContainer(Builder builder) { - builder.add(RAIL_SHAPE, POWERED); - super.fillStateContainer(builder); - } - - @Override - public boolean hasTileEntity(BlockState state) { - return true; - } - - @Override - public TileEntity createTileEntity(BlockState state, IBlockReader world) { - return AllTileEntities.CART_ASSEMBLER.create(); - } - - @Override - public BlockState getStateForPlacement(BlockItemUseContext context) { - boolean alongX = context.getPlacementHorizontalFacing() - .getAxis() == Axis.X; - boolean powered = context.getWorld() - .isBlockPowered(context.getPos()); - return super.getStateForPlacement(context).with(POWERED, Boolean.valueOf(powered)) - .with(RAIL_SHAPE, alongX ? RailShape.EAST_WEST : RailShape.NORTH_SOUTH); - } - - @Override - public boolean canMakeSlopes(BlockState state, IBlockReader world, BlockPos pos) { - return false; - } - - @Override - public void onMinecartPass(BlockState state, World world, BlockPos pos, AbstractMinecartEntity cart) { - if (!cart.canBeRidden() && !(cart instanceof FurnaceMinecartEntity)) - return; - - withTileEntityDo(world, pos, te -> { - if (te.isMinecartUpdateValid()) { - if (state.get(POWERED)) { - assemble(world, pos, cart); - Direction facing = cart.getAdjustedHorizontalFacing(); - cart.setMotion(facing.getXOffset(), facing.getYOffset(), facing.getZOffset()); - } else { - disassemble(world, pos, cart); - Vec3d diff = VecHelper.getCenterOf(pos) - .subtract(cart.getPositionVec()); - cart.setMotion(diff.x / 16f, 0, diff.z / 16f); - } - te.resetTicksSinceMinecartUpdate(); - } - }); - } - - protected void assemble(World world, BlockPos pos, AbstractMinecartEntity cart) { - if (!cart.getPassengers() - .isEmpty()) - return; - - MountedContraption contraption = MountedContraption.assembleMinecart(world, pos); - if (contraption == null) - return; - if (contraption.blocks.size() == 1) - return; - - Direction facing = cart.getAdjustedHorizontalFacing(); - float initialAngle = facing.getHorizontalAngle(); - - withTileEntityDo(world, pos, te -> contraption.rotationMode = CartMovementMode.values()[te.movementMode.value]); - ContraptionEntity entity = ContraptionEntity.createMounted(world, contraption, initialAngle, facing); - entity.setPosition(pos.getX(), pos.getY(), pos.getZ()); - world.addEntity(entity); - entity.startRiding(cart); - - if (cart instanceof FurnaceMinecartEntity) { - CompoundNBT nbt = cart.serializeNBT(); - nbt.putDouble("PushZ", 0); - nbt.putDouble("PushX", 0); - cart.deserializeNBT(nbt); + + + private static Item getRailItem(BlockState state) { + switch (state.get(RAIL_TYPE)) { + case RAIL_NORMAL: + return Items.RAIL; + case RAIL_DETECTOR: + return Items.DETECTOR_RAIL; + case RAIL_POWERED: + return Items.POWERED_RAIL; + case RAIL_ACTIVATOR: + return Items.ACTIVATOR_RAIL; + default: + return Items.AIR; } - } - - protected void disassemble(World world, BlockPos pos, AbstractMinecartEntity cart) { - if (cart.getPassengers() - .isEmpty()) - return; - if (!(cart.getPassengers() - .get(0) instanceof ContraptionEntity)) - return; - cart.removePassengers(); - - if (cart instanceof FurnaceMinecartEntity) { - CompoundNBT nbt = cart.serializeNBT(); - nbt.putDouble("PushZ", cart.getMotion().x); - nbt.putDouble("PushX", cart.getMotion().z); - cart.deserializeNBT(nbt); + } + + public static BlockState getRailBlock(BlockState assembler) { + switch (assembler.get(RAIL_TYPE)) { + case RAIL_NORMAL: + return Blocks.RAIL.getDefaultState().with(RailBlock.SHAPE, assembler.get(RAIL_SHAPE)); + case RAIL_DETECTOR: + return Blocks.DETECTOR_RAIL.getDefaultState().with(DetectorRailBlock.SHAPE, assembler.get(RAIL_SHAPE)); + case RAIL_POWERED: + return Blocks.POWERED_RAIL.getDefaultState().with(PoweredRailBlock.SHAPE, assembler.get(RAIL_SHAPE)); + case RAIL_ACTIVATOR: + return Blocks.ACTIVATOR_RAIL.getDefaultState().with(PoweredRailBlock.SHAPE, assembler.get(RAIL_SHAPE)); + default: + return null; } - } + } + - @Override - public void neighborChanged(BlockState state, World worldIn, BlockPos pos, Block blockIn, BlockPos fromPos, - boolean isMoving) { - super.neighborChanged(state, worldIn, pos, blockIn, fromPos, isMoving); + public static class MinecartAnchorBlock extends Block { - if (worldIn.isRemote) - return; + public MinecartAnchorBlock(Properties p_i48440_1_) { + super(p_i48440_1_); + } - boolean previouslyPowered = state.get(POWERED); - if (previouslyPowered != worldIn.isBlockPowered(pos)) { - worldIn.setBlockState(pos, state.cycle(POWERED), 2); + @Override + protected void fillStateContainer(Builder builder) { + builder.add(BlockStateProperties.HORIZONTAL_AXIS); + super.fillStateContainer(builder); + } + + @Override + public VoxelShape getShape(BlockState p_220053_1_, IBlockReader p_220053_2_, BlockPos p_220053_3_, + ISelectionContext p_220053_4_) { + return VoxelShapes.empty(); + } + } + + @Override + public ItemRequirement getRequiredItems(BlockState state) { + return new ItemRequirement(ItemUseType.CONSUME, getRailItem(state)); + } + + + @SuppressWarnings("deprecation") + public List getDropedAssembler(BlockState p_220077_0_, ServerWorld p_220077_1_, BlockPos p_220077_2_, @Nullable TileEntity p_220077_3_, @Nullable Entity p_220077_4_, ItemStack p_220077_5_) { + return super.getDrops(p_220077_0_, (new LootContext.Builder(p_220077_1_)).withRandom(p_220077_1_.rand).withParameter(LootParameters.POSITION, p_220077_2_).withParameter(LootParameters.TOOL, p_220077_5_).withNullableParameter(LootParameters.THIS_ENTITY, p_220077_4_).withNullableParameter(LootParameters.BLOCK_ENTITY, p_220077_3_)); + } + + @Override + public ActionResultType onSneakWrenched(BlockState state, ItemUseContext context) { + World world = context.getWorld(); + BlockPos pos = context.getPos(); + PlayerEntity player = context.getPlayer(); + if (world instanceof ServerWorld) { + if (!player.isCreative()) + getDropedAssembler(state, (ServerWorld) world, pos, world.getTileEntity(pos), player, context.getItem()) + .forEach(itemStack -> { + player.inventory.placeItemBackInInventory(world, itemStack); + }); + state.spawnAdditionalDrops(world, pos, ItemStack.EMPTY); + world.setBlockState(pos, getRailBlock(state)); } - } - - @Override - public IProperty getShapeProperty() { - return RAIL_SHAPE; - } - - @Override - public VoxelShape getShape(BlockState state, IBlockReader worldIn, BlockPos pos, ISelectionContext context) { - return AllShapes.CART_ASSEMBLER - .get(state.get(RAIL_SHAPE) == RailShape.NORTH_SOUTH ? Direction.Axis.Z : Direction.Axis.X); - } - - @Override - public VoxelShape getCollisionShape(BlockState state, IBlockReader worldIn, BlockPos pos, - ISelectionContext context) { - if (context.getEntity() instanceof AbstractMinecartEntity) - return VoxelShapes.empty(); - return VoxelShapes.fullCube(); - } - - @Override - public PushReaction getPushReaction(BlockState state) { - return PushReaction.BLOCK; - } - - @Override - public boolean isNormalCube(BlockState state, IBlockReader worldIn, BlockPos pos) { - return false; - } - - public static class MinecartAnchorBlock extends Block { - - public MinecartAnchorBlock(Properties p_i48440_1_) { - super(p_i48440_1_); - } - - @Override - protected void fillStateContainer(Builder builder) { - builder.add(BlockStateProperties.HORIZONTAL_AXIS); - super.fillStateContainer(builder); - } - - @Override - public VoxelShape getShape(BlockState p_220053_1_, IBlockReader p_220053_2_, BlockPos p_220053_3_, - ISelectionContext p_220053_4_) { - return VoxelShapes.empty(); - } - - } - - public static BlockState createAnchor(BlockState state) { - Axis axis = state.get(RAIL_SHAPE) == RailShape.NORTH_SOUTH ? Axis.Z : Axis.X; - return AllBlocks.MINECART_ANCHOR.getDefaultState() - .with(BlockStateProperties.HORIZONTAL_AXIS, axis); - } - - @Override - public Class getTileEntityClass() { - return CartAssemblerTileEntity.class; - } + return ActionResultType.SUCCESS; + } } diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/mounted/CartAssemblerBlockItem.java b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/mounted/CartAssemblerBlockItem.java new file mode 100644 index 000000000..1cca7fdd8 --- /dev/null +++ b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/mounted/CartAssemblerBlockItem.java @@ -0,0 +1,59 @@ +package com.simibubi.create.content.contraptions.components.structureMovement.mounted; + +import com.simibubi.create.AllBlocks; +import com.simibubi.create.foundation.utility.Lang; +import net.minecraft.block.*; +import net.minecraft.item.BlockItem; +import net.minecraft.item.ItemUseContext; +import net.minecraft.state.properties.RailShape; +import net.minecraft.util.ActionResultType; +import net.minecraft.util.math.BlockPos; +import net.minecraft.util.text.StringTextComponent; +import net.minecraft.world.World; + +public class CartAssemblerBlockItem extends BlockItem { + + public CartAssemblerBlockItem(Block block, Properties properties) { + super(block, properties); + } + + @Override + public ActionResultType onItemUse(ItemUseContext context) { + BlockPos pos = context.getPos(); + World world = context.getWorld(); + BlockState state = world.getBlockState(pos); + Block block = state.getBlock(); + if (block instanceof AbstractRailBlock) { + RailShape shape = state.get(((AbstractRailBlock) block).getShapeProperty()); + if (shape == RailShape.EAST_WEST || shape == RailShape.NORTH_SOUTH) { + BlockState defaultState = AllBlocks.CART_ASSEMBLER.getDefaultState().with(CartAssemblerBlock.RAIL_SHAPE, shape); + if (block.getClass() == RailBlock.class) { + world.setBlockState(pos, defaultState.with(CartAssemblerBlock.RAIL_TYPE, CartAssemblerBlock.RAIL_NORMAL)); + } else if (block.getClass() == PoweredRailBlock.class) { + if(((PoweredRailBlock) block).isActivatorRail()) { + world.setBlockState(pos, defaultState.with(CartAssemblerBlock.RAIL_TYPE, CartAssemblerBlock.RAIL_ACTIVATOR)); + } else { + world.setBlockState(pos, defaultState.with(CartAssemblerBlock.RAIL_TYPE, CartAssemblerBlock.RAIL_POWERED)); + } + + } else if (block.getClass() == DetectorRailBlock.class) { + world.setBlockState(pos, defaultState.with(CartAssemblerBlock.RAIL_TYPE, CartAssemblerBlock.RAIL_DETECTOR)); + } else { + showWarning(context); + return super.onItemUse(context); + } + if (!context.getPlayer().isCreative()) + context.getItem().setCount(context.getItem().getCount() - 1); + return ActionResultType.SUCCESS; + } + showWarning(context); + } + + + return super.onItemUse(context); + } + + private void showWarning(ItemUseContext context) { + context.getPlayer().sendStatusMessage(new StringTextComponent(Lang.translate("block.cart_assembler.invalid")), true); + } +} \ No newline at end of file diff --git a/src/main/java/com/simibubi/create/content/contraptions/wrench/IWrenchable.java b/src/main/java/com/simibubi/create/content/contraptions/wrench/IWrenchable.java index 0f5cc64cf..e27bd3789 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/wrench/IWrenchable.java +++ b/src/main/java/com/simibubi/create/content/contraptions/wrench/IWrenchable.java @@ -10,12 +10,17 @@ import com.simibubi.create.content.contraptions.base.RotatedPillarKineticBlock; import com.simibubi.create.foundation.utility.DirectionHelper; import com.simibubi.create.foundation.utility.VoxelShaper; +import net.minecraft.block.Block; import net.minecraft.block.BlockState; +import net.minecraft.entity.player.PlayerEntity; +import net.minecraft.item.ItemStack; import net.minecraft.item.ItemUseContext; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.ActionResultType; import net.minecraft.util.Direction; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; +import net.minecraft.world.server.ServerWorld; public interface IWrenchable { @@ -40,6 +45,23 @@ public interface IWrenchable { default BlockState updateAfterWrenched(BlockState newState, ItemUseContext context) { return newState; } + + default ActionResultType onSneakWrenched(BlockState state, ItemUseContext context) { + World world = context.getWorld(); + BlockPos pos = context.getPos(); + PlayerEntity player = context.getPlayer(); + if (world instanceof ServerWorld) { + if (!player.isCreative()) + Block.getDrops(state, (ServerWorld) world, pos, world.getTileEntity(pos), player, context.getItem()) + .forEach(itemStack -> { + player.inventory.placeItemBackInInventory(world, itemStack); + }); + state.spawnAdditionalDrops(world, pos, ItemStack.EMPTY); + world.destroyBlock(pos, false); + } + return ActionResultType.SUCCESS; + } + static BlockState getRotatedBlockState(BlockState originalState, Direction targetedFace){ BlockState newState = originalState; @@ -69,5 +91,4 @@ public interface IWrenchable { } return newState; } - } diff --git a/src/main/java/com/simibubi/create/content/contraptions/wrench/WrenchItem.java b/src/main/java/com/simibubi/create/content/contraptions/wrench/WrenchItem.java index 11ce1e717..3f24de4a0 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/wrench/WrenchItem.java +++ b/src/main/java/com/simibubi/create/content/contraptions/wrench/WrenchItem.java @@ -1,15 +1,10 @@ package com.simibubi.create.content.contraptions.wrench; -import net.minecraft.block.Block; import net.minecraft.block.BlockState; import net.minecraft.entity.player.PlayerEntity; import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; import net.minecraft.item.ItemUseContext; import net.minecraft.util.ActionResultType; -import net.minecraft.util.math.BlockPos; -import net.minecraft.world.World; -import net.minecraft.world.server.ServerWorld; public class WrenchItem extends Item { @@ -23,27 +18,15 @@ public class WrenchItem extends Item { if (!player.isAllowEdit()) return super.onItemUse(context); - World world = context.getWorld(); - BlockPos pos = context.getPos(); - BlockState state = world.getBlockState(pos); + + BlockState state = context.getWorld().getBlockState(context.getPos()); if (!(state.getBlock() instanceof IWrenchable)) return super.onItemUse(context); IWrenchable actor = (IWrenchable) state.getBlock(); if (player.isSneaking()) { - if (world instanceof ServerWorld) { - if (!player.isCreative()) - Block.getDrops(state, (ServerWorld) world, pos, world.getTileEntity(pos), player, context.getItem()) - .forEach(itemStack -> { - player.inventory.placeItemBackInInventory(world, itemStack); - }); - state.spawnAdditionalDrops(world, pos, ItemStack.EMPTY); - world.destroyBlock(pos, false); - } - return ActionResultType.SUCCESS; + actor.onSneakWrenched(state, context); } - return actor.onWrenched(state, context); } - } diff --git a/src/main/java/com/simibubi/create/foundation/data/BlockStateGen.java b/src/main/java/com/simibubi/create/foundation/data/BlockStateGen.java index e77c2d171..d26f9f88d 100644 --- a/src/main/java/com/simibubi/create/foundation/data/BlockStateGen.java +++ b/src/main/java/com/simibubi/create/foundation/data/BlockStateGen.java @@ -166,12 +166,20 @@ public class BlockStateGen { } public static NonNullBiConsumer, RegistrateBlockstateProvider> cartAssembler() { + HashMap railTypes = new HashMap(); + railTypes.put(CartAssemblerBlock.RAIL_NONE, "_none"); + railTypes.put(CartAssemblerBlock.RAIL_NORMAL, "_rail_normal"); + railTypes.put(CartAssemblerBlock.RAIL_POWERED, "_rail_powered"); + railTypes.put(CartAssemblerBlock.RAIL_DETECTOR, "_rail_detector"); + railTypes.put(CartAssemblerBlock.RAIL_ACTIVATOR, "_rail_activator"); + return (c, p) -> p.getVariantBuilder(c.get()) .forAllStates(state -> { return ConfiguredModel.builder() .modelFile(p.models() .getExistingFile(p.modLoc("block/" + c.getName() + "/block" - + (state.get(CartAssemblerBlock.POWERED) ? "_powered" : "")))) + + (state.get(CartAssemblerBlock.POWERED) ? "_powered" : "") + + railTypes.get(state.get(CartAssemblerBlock.RAIL_TYPE))))) .rotationY(state.get(CartAssemblerBlock.RAIL_SHAPE) == RailShape.EAST_WEST ? 90 : 0) .build(); }); diff --git a/src/main/resources/assets/create/lang/default/messages.json b/src/main/resources/assets/create/lang/default/messages.json index 3d64ffaeb..eefcc69c6 100644 --- a/src/main/resources/assets/create/lang/default/messages.json +++ b/src/main/resources/assets/create/lang/default/messages.json @@ -10,6 +10,7 @@ "death.attack.create.mechanical_saw": "%1$s got cut in half by Mechanical mechanical_saw", "death.attack.create.cuckoo_clock_explosion": "%1$s was blown up by tampered cuckoo clock", "create.block.deployer.damage_source_name": "a rogue Deployer", + "create.block.cart_assembler.invalid": "Can not place a Cart Assembler on this rail type", "create.recipe.crushing": "Crushing", "create.recipe.milling": "Milling", diff --git a/src/main/resources/assets/create/models/block/cart_assembler/block_none.json b/src/main/resources/assets/create/models/block/cart_assembler/block_none.json new file mode 100644 index 000000000..cb19247f7 --- /dev/null +++ b/src/main/resources/assets/create/models/block/cart_assembler/block_none.json @@ -0,0 +1,93 @@ +{ + "credit": "Made with Blockbench", + "parent": "block/block", + "textures": { + "4": "create:block/bearing_top", + "5": "create:block/mechanical_bearing_side", + "clutch_off": "create:block/clutch_off", + "translation_chassis_side": "create:block/cart_assembler_side", + "particle": "create:block/cart_assembler_side" + }, + "elements": [ + { + "name": "Side", + "from": [13.875, 0.062, 1.125], + "to": [17.875, 13.937, 14.875], + "faces": { + "north": {"uv": [1, 4, 15, 0], "rotation": 90, "texture": "#translation_chassis_side"}, + "east": {"uv": [1, 1, 15, 15], "rotation": 90, "texture": "#translation_chassis_side"}, + "south": {"uv": [1, 0, 15, 4], "rotation": 90, "texture": "#translation_chassis_side"}, + "west": {"uv": [1, 1, 15, 15], "rotation": 90, "texture": "#translation_chassis_side"}, + "up": {"uv": [5, 1, 9, 15], "texture": "#translation_chassis_side"}, + "down": {"uv": [2, 1, 6, 15], "texture": "#translation_chassis_side"} + } + }, + { + "name": "Side", + "from": [-1.875, 0.062, 1.125], + "to": [2.125, 13.937, 14.875], + "faces": { + "north": {"uv": [1, 0, 15, 4], "rotation": 90, "texture": "#translation_chassis_side"}, + "east": {"uv": [1, 15, 15, 1], "rotation": 90, "texture": "#translation_chassis_side"}, + "south": {"uv": [1, 4, 15, 0], "rotation": 90, "texture": "#translation_chassis_side"}, + "west": {"uv": [1, 15, 15, 1], "rotation": 90, "texture": "#translation_chassis_side"}, + "up": {"uv": [9, 1, 5, 15], "texture": "#translation_chassis_side"}, + "down": {"uv": [6, 1, 2, 15], "texture": "#translation_chassis_side"} + } + }, + { + "from": [0, 12, 0], + "to": [16, 16, 16], + "rotation": {"angle": 0, "axis": "y", "origin": [8, 23, 8]}, + "faces": { + "north": {"uv": [0, 0, 16, 4], "texture": "#5"}, + "east": {"uv": [0, 0, 16, 4], "texture": "#5"}, + "south": {"uv": [0, 0, 16, 4], "texture": "#5"}, + "west": {"uv": [0, 0, 16, 4], "texture": "#5"}, + "up": {"uv": [0, 0, 16, 16], "texture": "#4"}, + "down": {"uv": [0, 0, 16, 16], "texture": "#translation_chassis_side"} + } + }, + { + "from": [2, 10, 1], + "to": [14, 12, 15], + "rotation": {"angle": 0, "axis": "y", "origin": [18, 22, 10]}, + "faces": { + "north": {"uv": [2, 7, 14, 9], "texture": "#clutch_off"}, + "south": {"uv": [2, 7, 14, 9], "texture": "#clutch_off"}, + "down": {"uv": [2, 1, 14, 15], "texture": "#translation_chassis_side"} + } + } + ], + "display": { + "thirdperson_righthand": { + "rotation": [75, 45, 0], + "translation": [0, 2.5, 0], + "scale": [0.375, 0.375, 0.375] + }, + "thirdperson_lefthand": { + "rotation": [75, 45, 0], + "translation": [0, 2.5, 0], + "scale": [0.375, 0.375, 0.375] + }, + "firstperson_righthand": { + "rotation": [0, 45, 0], + "scale": [0.4, 0.4, 0.4] + }, + "firstperson_lefthand": { + "rotation": [0, 225, 0], + "scale": [0.4, 0.4, 0.4] + }, + "ground": { + "translation": [0, 3, 0], + "scale": [0.25, 0.25, 0.25] + }, + "gui": { + "rotation": [30, 225, 0], + "scale": [0.625, 0.625, 0.625] + }, + "fixed": { + "scale": [0.5, 0.5, 0.5] + } + } +} \ No newline at end of file diff --git a/src/main/resources/assets/create/models/block/cart_assembler/block_powered_none.json b/src/main/resources/assets/create/models/block/cart_assembler/block_powered_none.json new file mode 100644 index 000000000..4ab6647f2 --- /dev/null +++ b/src/main/resources/assets/create/models/block/cart_assembler/block_powered_none.json @@ -0,0 +1,6 @@ +{ + "parent": "create:block/cart_assembler/block_none", + "textures": { + "clutch_off": "create:block/clutch_on" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/create/models/block/cart_assembler/block_powered_rail_activator.json b/src/main/resources/assets/create/models/block/cart_assembler/block_powered_rail_activator.json new file mode 100644 index 000000000..d911d3124 --- /dev/null +++ b/src/main/resources/assets/create/models/block/cart_assembler/block_powered_rail_activator.json @@ -0,0 +1,7 @@ +{ + "parent": "create:block/cart_assembler/block", + "textures": { + "clutch_off": "create:block/clutch_on", + "rail": "block/activator_rail" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/create/models/block/cart_assembler/block_powered_rail_detector.json b/src/main/resources/assets/create/models/block/cart_assembler/block_powered_rail_detector.json new file mode 100644 index 000000000..3f10f7cd8 --- /dev/null +++ b/src/main/resources/assets/create/models/block/cart_assembler/block_powered_rail_detector.json @@ -0,0 +1,7 @@ +{ + "parent": "create:block/cart_assembler/block", + "textures": { + "clutch_off": "create:block/clutch_on", + "rail": "block/detector_rail" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/create/models/block/cart_assembler/block_powered_rail_normal.json b/src/main/resources/assets/create/models/block/cart_assembler/block_powered_rail_normal.json new file mode 100644 index 000000000..132b8ead6 --- /dev/null +++ b/src/main/resources/assets/create/models/block/cart_assembler/block_powered_rail_normal.json @@ -0,0 +1,7 @@ +{ + "parent": "create:block/cart_assembler/block", + "textures": { + "clutch_off": "create:block/clutch_on", + "rail": "block/rail" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/create/models/block/cart_assembler/block_powered.json b/src/main/resources/assets/create/models/block/cart_assembler/block_powered_rail_powered.json similarity index 100% rename from src/main/resources/assets/create/models/block/cart_assembler/block_powered.json rename to src/main/resources/assets/create/models/block/cart_assembler/block_powered_rail_powered.json diff --git a/src/main/resources/assets/create/models/block/cart_assembler/block_rail_activator.json b/src/main/resources/assets/create/models/block/cart_assembler/block_rail_activator.json new file mode 100644 index 000000000..27a107f80 --- /dev/null +++ b/src/main/resources/assets/create/models/block/cart_assembler/block_rail_activator.json @@ -0,0 +1,6 @@ +{ + "parent": "create:block/cart_assembler/block", + "textures": { + "rail": "block/activator_rail" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/create/models/block/cart_assembler/block_rail_detector.json b/src/main/resources/assets/create/models/block/cart_assembler/block_rail_detector.json new file mode 100644 index 000000000..501988d3e --- /dev/null +++ b/src/main/resources/assets/create/models/block/cart_assembler/block_rail_detector.json @@ -0,0 +1,6 @@ +{ + "parent": "create:block/cart_assembler/block", + "textures": { + "rail": "block/detector_rail" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/create/models/block/cart_assembler/block_rail_normal.json b/src/main/resources/assets/create/models/block/cart_assembler/block_rail_normal.json new file mode 100644 index 000000000..d5c44417c --- /dev/null +++ b/src/main/resources/assets/create/models/block/cart_assembler/block_rail_normal.json @@ -0,0 +1,6 @@ +{ + "parent": "create:block/cart_assembler/block", + "textures": { + "rail": "block/rail" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/create/models/block/cart_assembler/block_rail_powered.json b/src/main/resources/assets/create/models/block/cart_assembler/block_rail_powered.json new file mode 100644 index 000000000..92572dcdd --- /dev/null +++ b/src/main/resources/assets/create/models/block/cart_assembler/block_rail_powered.json @@ -0,0 +1,6 @@ +{ + "parent": "create:block/cart_assembler/block", + "textures": { + "rail": "block/powered_rail" + } +} \ No newline at end of file diff --git a/src/main/resources/data/create/recipes/crafting_shaped/contraptions/cart_assembler.json b/src/main/resources/data/create/recipes/crafting_shaped/contraptions/cart_assembler.json index 350bbf5e5..d421a33d0 100644 --- a/src/main/resources/data/create/recipes/crafting_shaped/contraptions/cart_assembler.json +++ b/src/main/resources/data/create/recipes/crafting_shaped/contraptions/cart_assembler.json @@ -3,7 +3,7 @@ "pattern": [ " L ", "CRC", - "LTL" + "L L" ], "key": { "L": { @@ -11,9 +11,6 @@ }, "R": { "tag": "forge:dusts/redstone" - }, - "T": { - "item": "minecraft:rail" }, "C": { "item": "create:andesite_alloy"