From fc459732fc274e69a643dcad245c82fef638c2f8 Mon Sep 17 00:00:00 2001 From: Snownee Date: Mon, 1 Feb 2021 16:46:36 +0800 Subject: [PATCH] Fix chute item dupe (#939) --- .../content/contraptions/components/fan/AirCurrent.java | 2 +- .../components/press/MechanicalPressTileEntity.java | 4 +++- .../create/content/logistics/block/chute/ChuteTileEntity.java | 2 ++ 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/fan/AirCurrent.java b/src/main/java/com/simibubi/create/content/contraptions/components/fan/AirCurrent.java index ca4693b1a..8f499bce8 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/fan/AirCurrent.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/fan/AirCurrent.java @@ -82,7 +82,7 @@ public class AirCurrent { protected void tickAffectedEntities(World world, Direction facing) { for (Iterator iterator = caughtEntities.iterator(); iterator.hasNext();) { Entity entity = iterator.next(); - if (!entity.getBoundingBox() + if (!entity.isAlive() || !entity.getBoundingBox() .intersects(bounds)) { iterator.remove(); continue; diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/press/MechanicalPressTileEntity.java b/src/main/java/com/simibubi/create/content/contraptions/components/press/MechanicalPressTileEntity.java index 3d320743a..ca52ae3a6 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/press/MechanicalPressTileEntity.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/press/MechanicalPressTileEntity.java @@ -153,6 +153,8 @@ public class MechanicalPressTileEntity extends BasinOperatingTileEntity { for (ItemEntity itemEntity : world.getEntitiesWithinAABB(ItemEntity.class, new AxisAlignedBB(pos.down()).shrink(.125f))) { + if (!itemEntity.isAlive() || !itemEntity.onGround) + continue; ItemStack stack = itemEntity.getItem(); Optional recipe = getRecipe(stack); if (!recipe.isPresent()) @@ -233,7 +235,7 @@ public class MechanicalPressTileEntity extends BasinOperatingTileEntity { for (Entity entity : world.getEntitiesWithinAABBExcludingEntity(null, bb)) { if (!(entity instanceof ItemEntity)) continue; - if (!entity.isAlive()) + if (!entity.isAlive() || !entity.onGround) continue; ItemEntity itemEntity = (ItemEntity) entity; pressedItems.add(itemEntity.getItem()); diff --git a/src/main/java/com/simibubi/create/content/logistics/block/chute/ChuteTileEntity.java b/src/main/java/com/simibubi/create/content/logistics/block/chute/ChuteTileEntity.java index 006097715..943f8345e 100644 --- a/src/main/java/com/simibubi/create/content/logistics/block/chute/ChuteTileEntity.java +++ b/src/main/java/com/simibubi/create/content/logistics/block/chute/ChuteTileEntity.java @@ -223,6 +223,8 @@ public class ChuteTileEntity extends SmartTileEntity implements IHaveGoggleInfor AxisAlignedBB searchArea = new AxisAlignedBB(center.add(0, -bottomPullDistance - 0.5, 0), center.add(0, -0.5, 0)).grow(.45f); for (ItemEntity itemEntity : world.getEntitiesWithinAABB(ItemEntity.class, searchArea)) { + if (!itemEntity.isAlive()) + continue; ItemStack entityItem = itemEntity.getItem(); if (!canAcceptItem(entityItem)) continue;