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 3a44dd4d1..f02d4b0cc 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 @@ -76,10 +76,20 @@ public class CartAssemblerBlock extends AbstractRailBlock implements ITE { + if(te.isMinecartUpdateValid()) { + if (state.get(POWERED)) { + assemble(world, pos, cart); + cart.setVelocity(cart.getAdjustedHorizontalFacing().getXOffset(), cart.getAdjustedHorizontalFacing().getYOffset(), cart.getAdjustedHorizontalFacing().getZOffset()); + } + else { + disassemble(world, pos, cart); + cart.setVelocity(0, 0, 0); + } + te.resetTicksSinceMinecartUpdate(); + } + }); } protected void assemble(World world, BlockPos pos, AbstractMinecartEntity cart) { diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/mounted/CartAssemblerTileEntity.java b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/mounted/CartAssemblerTileEntity.java index 3c355601a..2638f75bf 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/mounted/CartAssemblerTileEntity.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/mounted/CartAssemblerTileEntity.java @@ -15,11 +15,22 @@ import net.minecraft.tileentity.TileEntityType; import net.minecraft.util.Direction; public class CartAssemblerTileEntity extends SmartTileEntity { + private static final int assemblyCooldown = 8; protected ScrollOptionBehaviour movementMode; + private int ticksSinceMinecartUpdate; public CartAssemblerTileEntity(TileEntityType type) { super(type); + ticksSinceMinecartUpdate = assemblyCooldown; + } + + @Override + public void tick() { + super.tick(); + if(ticksSinceMinecartUpdate < assemblyCooldown) { + ticksSinceMinecartUpdate++; + } } @Override @@ -59,7 +70,14 @@ public class CartAssemblerTileEntity extends SmartTileEntity { public String getTranslationKey() { return translationKey; } - + } + + public void resetTicksSinceMinecartUpdate() { + ticksSinceMinecartUpdate = 0; + } + + public boolean isMinecartUpdateValid() { + return ticksSinceMinecartUpdate >= assemblyCooldown; } } diff --git a/src/main/resources/assets/create/models/block/cart_assembler/block.json b/src/main/resources/assets/create/models/block/cart_assembler/block.json index f86811033..e0ea99754 100644 --- a/src/main/resources/assets/create/models/block/cart_assembler/block.json +++ b/src/main/resources/assets/create/models/block/cart_assembler/block.json @@ -5,7 +5,7 @@ "4": "create:block/bearing_top", "5": "create:block/mechanical_bearing_side", "clutch_off": "create:block/clutch_off", - "rail": "block/rail", + "rail": "block/powered_rail", "translation_chassis_side": "create:block/cart_assembler_side", "particle": "create:block/cart_assembler_side" }, 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.json index bbb648335..04f11d8c9 100644 --- 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.json @@ -1,6 +1,7 @@ { "parent": "create:block/cart_assembler/block", "textures": { - "clutch_off": "create:block/clutch_on" + "clutch_off": "create:block/clutch_on", + "rail": "block/powered_rail_on" } } \ No newline at end of file