mirror of
https://github.com/Creators-of-Create/Create.git
synced 2024-12-16 10:33:47 +01:00
Horizontal Crushers Bugfix
-Fix bug where horizontal crushers would input items they just output when the belt was 'facing' the opposite direction.
This commit is contained in:
parent
7b5737cf82
commit
f1c8e92686
2 changed files with 7 additions and 18 deletions
|
@ -137,7 +137,7 @@ public class CrushingWheelControllerTileEntity extends SmartTileEntity {
|
|||
//Output Items
|
||||
if (facing.getAxis().isHorizontal() || facing == Direction.DOWN) {
|
||||
BlockPos nextPos = pos.add(facing.getAxis() == Axis.X ? 1f * offset : 0f
|
||||
, (facing == Direction.DOWN || facing.getAxis().isHorizontal()) ? -1f : 0f
|
||||
, (-1f)
|
||||
, facing.getAxis() == Axis.Z ? 1f * offset : 0f);
|
||||
DirectBeltInputBehaviour behaviour = TileEntityBehaviour.get(world, nextPos, DirectBeltInputBehaviour.TYPE);
|
||||
if (behaviour != null) {
|
||||
|
|
|
@ -32,19 +32,18 @@ public class BeltCrusherInteractionHandler {
|
|||
continue;
|
||||
Direction crusherFacing = crusherState.get(CrushingWheelControllerBlock.FACING);
|
||||
Direction movementFacing = beltInventory.belt.getMovementFacing();
|
||||
boolean blocking = crusherFacing == movementFacing;
|
||||
if (crusherFacing != movementFacing)
|
||||
continue;
|
||||
|
||||
float crusherEntry = segment + .5f;
|
||||
crusherEntry += .399f * (beltMovementPositive ? -1 : 1);
|
||||
float postCrusherEntry = crusherEntry + .199f * (!beltMovementPositive ? -1 : 1);
|
||||
|
||||
boolean hasCrossed = nextOffset > crusherEntry && beltMovementPositive
|
||||
|| nextOffset < crusherEntry && !beltMovementPositive;
|
||||
boolean hasCrossed = nextOffset > crusherEntry && nextOffset < postCrusherEntry && beltMovementPositive
|
||||
|| nextOffset < crusherEntry && nextOffset > postCrusherEntry && !beltMovementPositive;
|
||||
if (!hasCrossed)
|
||||
return false;
|
||||
if (blocking)
|
||||
currentItem.beltPosition = crusherEntry;
|
||||
currentItem.beltPosition = crusherEntry;
|
||||
|
||||
TileEntity te = world.getTileEntity(crusherPos);
|
||||
if (!(te instanceof CrushingWheelControllerTileEntity))
|
||||
|
@ -52,20 +51,11 @@ public class BeltCrusherInteractionHandler {
|
|||
|
||||
CrushingWheelControllerTileEntity crusherTE = (CrushingWheelControllerTileEntity) te;
|
||||
|
||||
int amountToExtract = -1;
|
||||
ItemStack toInsert = currentItem.stack.copy();
|
||||
if (amountToExtract > toInsert.getCount())
|
||||
if (blocking)
|
||||
return true;
|
||||
else
|
||||
continue;
|
||||
|
||||
ItemStack remainder = ItemHandlerHelper.insertItemStacked(crusherTE.inventory, toInsert, false);
|
||||
if (toInsert.equals(remainder, false))
|
||||
if (blocking)
|
||||
return true;
|
||||
else
|
||||
continue;
|
||||
return true;
|
||||
|
||||
int notFilled = currentItem.stack.getCount() - toInsert.getCount();
|
||||
if (!remainder.isEmpty()) {
|
||||
|
@ -75,8 +65,7 @@ public class BeltCrusherInteractionHandler {
|
|||
|
||||
currentItem.stack = remainder;
|
||||
beltInventory.belt.sendData();
|
||||
if (blocking)
|
||||
return true;
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
|
|
Loading…
Reference in a new issue