From dc66e5ac048494fecef1a4d0d309764a42c9af51 Mon Sep 17 00:00:00 2001 From: abel1502 Date: Thu, 22 May 2025 18:26:41 +0300 Subject: [PATCH 1/4] Conveyor ejector & splitter compat Previously, an ejector ejecting directly into a splitter bypassed the splitting --- .../hbm/tileentity/network/TileEntityCraneExtractor.java | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/main/java/com/hbm/tileentity/network/TileEntityCraneExtractor.java b/src/main/java/com/hbm/tileentity/network/TileEntityCraneExtractor.java index aab0e354d..f539271cb 100644 --- a/src/main/java/com/hbm/tileentity/network/TileEntityCraneExtractor.java +++ b/src/main/java/com/hbm/tileentity/network/TileEntityCraneExtractor.java @@ -1,6 +1,8 @@ package com.hbm.tileentity.network; import api.hbm.conveyor.IConveyorBelt; +import api.hbm.conveyor.IEnterableBlock; + import com.hbm.entity.item.EntityMovingItem; import com.hbm.inventory.container.ContainerCraneExtractor; import com.hbm.inventory.gui.GUICraneExtractor; @@ -123,6 +125,11 @@ public class TileEntityCraneExtractor extends TileEntityCraneBase implements IGU moving.setPosition(snap.xCoord, snap.yCoord, snap.zCoord); moving.setItemStack(stack); worldObj.spawnEntityInWorld(moving); + + if (b instanceof IEnterableBlock) { + ((IEnterableBlock)b).onItemEnter(worldObj, xCoord + outputSide.offsetX, yCoord + outputSide.offsetY, zCoord + outputSide.offsetZ, outputSide, moving); + } + hasSent = true; break; } From 3a6f890774da08843e912760773a12812d78aac8 Mon Sep 17 00:00:00 2001 From: abel1502 Date: Thu, 22 May 2025 18:43:13 +0300 Subject: [PATCH 2/4] Fix dupe --- .../hbm/tileentity/network/TileEntityCraneExtractor.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/hbm/tileentity/network/TileEntityCraneExtractor.java b/src/main/java/com/hbm/tileentity/network/TileEntityCraneExtractor.java index f539271cb..2ce576e1f 100644 --- a/src/main/java/com/hbm/tileentity/network/TileEntityCraneExtractor.java +++ b/src/main/java/com/hbm/tileentity/network/TileEntityCraneExtractor.java @@ -127,7 +127,12 @@ public class TileEntityCraneExtractor extends TileEntityCraneBase implements IGU worldObj.spawnEntityInWorld(moving); if (b instanceof IEnterableBlock) { - ((IEnterableBlock)b).onItemEnter(worldObj, xCoord + outputSide.offsetX, yCoord + outputSide.offsetY, zCoord + outputSide.offsetZ, outputSide, moving); + IEnterableBlock enterable = (IEnterableBlock) b; + + if(enterable.canItemEnter(worldObj, xCoord + outputSide.offsetX, yCoord + outputSide.offsetY, zCoord + outputSide.offsetZ, outputSide, moving)) { + enterable.onItemEnter(worldObj, xCoord + outputSide.offsetX, yCoord + outputSide.offsetY, zCoord + outputSide.offsetZ, outputSide, moving); + moving.setDead(); + } } hasSent = true; From 953d120fc668c3905e2532d554f3e52d4ce61723 Mon Sep 17 00:00:00 2001 From: abel1502 Date: Thu, 22 May 2025 19:05:55 +0300 Subject: [PATCH 3/4] Fix direction --- .../com/hbm/tileentity/network/TileEntityCraneExtractor.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/hbm/tileentity/network/TileEntityCraneExtractor.java b/src/main/java/com/hbm/tileentity/network/TileEntityCraneExtractor.java index 2ce576e1f..12d5b8208 100644 --- a/src/main/java/com/hbm/tileentity/network/TileEntityCraneExtractor.java +++ b/src/main/java/com/hbm/tileentity/network/TileEntityCraneExtractor.java @@ -129,8 +129,8 @@ public class TileEntityCraneExtractor extends TileEntityCraneBase implements IGU if (b instanceof IEnterableBlock) { IEnterableBlock enterable = (IEnterableBlock) b; - if(enterable.canItemEnter(worldObj, xCoord + outputSide.offsetX, yCoord + outputSide.offsetY, zCoord + outputSide.offsetZ, outputSide, moving)) { - enterable.onItemEnter(worldObj, xCoord + outputSide.offsetX, yCoord + outputSide.offsetY, zCoord + outputSide.offsetZ, outputSide, moving); + if(enterable.canItemEnter(worldObj, xCoord + outputSide.offsetX, yCoord + outputSide.offsetY, zCoord + outputSide.offsetZ, outputSide.getOpposite(), moving)) { + enterable.onItemEnter(worldObj, xCoord + outputSide.offsetX, yCoord + outputSide.offsetY, zCoord + outputSide.offsetZ, outputSide.getOpposite(), moving); moving.setDead(); } } From f3a88b6afb42a61a47773c1e86898245115c9c95 Mon Sep 17 00:00:00 2001 From: abel1502 Date: Thu, 22 May 2025 19:15:39 +0300 Subject: [PATCH 4/4] Apply fix to buffered items --- .../network/TileEntityCraneExtractor.java | 42 +++++++++---------- 1 file changed, 20 insertions(+), 22 deletions(-) diff --git a/src/main/java/com/hbm/tileentity/network/TileEntityCraneExtractor.java b/src/main/java/com/hbm/tileentity/network/TileEntityCraneExtractor.java index 12d5b8208..105ceb3fd 100644 --- a/src/main/java/com/hbm/tileentity/network/TileEntityCraneExtractor.java +++ b/src/main/java/com/hbm/tileentity/network/TileEntityCraneExtractor.java @@ -119,22 +119,7 @@ public class TileEntityCraneExtractor extends TileEntityCraneBase implements IGU inv.decrStackSize(index, toSend); stack.stackSize = toSend; - EntityMovingItem moving = new EntityMovingItem(worldObj); - Vec3 pos = Vec3.createVectorHelper(xCoord + 0.5 + outputSide.offsetX * 0.55, yCoord + 0.5 + outputSide.offsetY * 0.55, zCoord + 0.5 + outputSide.offsetZ * 0.55); - Vec3 snap = belt.getClosestSnappingPosition(worldObj, xCoord + outputSide.offsetX, yCoord + outputSide.offsetY, zCoord + outputSide.offsetZ, pos); - moving.setPosition(snap.xCoord, snap.yCoord, snap.zCoord); - moving.setItemStack(stack); - worldObj.spawnEntityInWorld(moving); - - if (b instanceof IEnterableBlock) { - IEnterableBlock enterable = (IEnterableBlock) b; - - if(enterable.canItemEnter(worldObj, xCoord + outputSide.offsetX, yCoord + outputSide.offsetY, zCoord + outputSide.offsetZ, outputSide.getOpposite(), moving)) { - enterable.onItemEnter(worldObj, xCoord + outputSide.offsetX, yCoord + outputSide.offsetY, zCoord + outputSide.offsetZ, outputSide.getOpposite(), moving); - moving.setDead(); - } - } - + sendItem(stack, belt, outputSide); hasSent = true; break; } @@ -154,12 +139,7 @@ public class TileEntityCraneExtractor extends TileEntityCraneBase implements IGU decrStackSize(i, toSend); stack.stackSize = toSend; - EntityMovingItem moving = new EntityMovingItem(worldObj); - Vec3 pos = Vec3.createVectorHelper(xCoord + 0.5 + outputSide.offsetX * 0.55, yCoord + 0.5 + outputSide.offsetY * 0.55, zCoord + 0.5 + outputSide.offsetZ * 0.55); - Vec3 snap = belt.getClosestSnappingPosition(worldObj, xCoord + outputSide.offsetX, yCoord + outputSide.offsetY, zCoord + outputSide.offsetZ, pos); - moving.setPosition(snap.xCoord, snap.yCoord, snap.zCoord); - moving.setItemStack(stack); - worldObj.spawnEntityInWorld(moving); + sendItem(stack, belt, outputSide); break; } } @@ -171,6 +151,24 @@ public class TileEntityCraneExtractor extends TileEntityCraneBase implements IGU } } + private void sendItem(ItemStack stack, IConveyorBelt belt, ForgeDirection outputSide) { + EntityMovingItem moving = new EntityMovingItem(worldObj); + Vec3 pos = Vec3.createVectorHelper(xCoord + 0.5 + outputSide.offsetX * 0.55, yCoord + 0.5 + outputSide.offsetY * 0.55, zCoord + 0.5 + outputSide.offsetZ * 0.55); + Vec3 snap = belt.getClosestSnappingPosition(worldObj, xCoord + outputSide.offsetX, yCoord + outputSide.offsetY, zCoord + outputSide.offsetZ, pos); + moving.setPosition(snap.xCoord, snap.yCoord, snap.zCoord); + moving.setItemStack(stack); + worldObj.spawnEntityInWorld(moving); + + if (belt instanceof IEnterableBlock) { + IEnterableBlock enterable = (IEnterableBlock) belt; + + if(enterable.canItemEnter(worldObj, xCoord + outputSide.offsetX, yCoord + outputSide.offsetY, zCoord + outputSide.offsetZ, outputSide.getOpposite(), moving)) { + enterable.onItemEnter(worldObj, xCoord + outputSide.offsetX, yCoord + outputSide.offsetY, zCoord + outputSide.offsetZ, outputSide.getOpposite(), moving); + moving.setDead(); + } + } + } + @Override public void serialize(ByteBuf buf) { super.serialize(buf);