Fix chute item dupe (#939)

This commit is contained in:
Snownee 2021-02-01 16:46:36 +08:00
parent d1e9b76a24
commit fc459732fc
3 changed files with 6 additions and 2 deletions

View File

@ -82,7 +82,7 @@ public class AirCurrent {
protected void tickAffectedEntities(World world, Direction facing) { protected void tickAffectedEntities(World world, Direction facing) {
for (Iterator<Entity> iterator = caughtEntities.iterator(); iterator.hasNext();) { for (Iterator<Entity> iterator = caughtEntities.iterator(); iterator.hasNext();) {
Entity entity = iterator.next(); Entity entity = iterator.next();
if (!entity.getBoundingBox() if (!entity.isAlive() || !entity.getBoundingBox()
.intersects(bounds)) { .intersects(bounds)) {
iterator.remove(); iterator.remove();
continue; continue;

View File

@ -153,6 +153,8 @@ public class MechanicalPressTileEntity extends BasinOperatingTileEntity {
for (ItemEntity itemEntity : world.getEntitiesWithinAABB(ItemEntity.class, for (ItemEntity itemEntity : world.getEntitiesWithinAABB(ItemEntity.class,
new AxisAlignedBB(pos.down()).shrink(.125f))) { new AxisAlignedBB(pos.down()).shrink(.125f))) {
if (!itemEntity.isAlive() || !itemEntity.onGround)
continue;
ItemStack stack = itemEntity.getItem(); ItemStack stack = itemEntity.getItem();
Optional<PressingRecipe> recipe = getRecipe(stack); Optional<PressingRecipe> recipe = getRecipe(stack);
if (!recipe.isPresent()) if (!recipe.isPresent())
@ -233,7 +235,7 @@ public class MechanicalPressTileEntity extends BasinOperatingTileEntity {
for (Entity entity : world.getEntitiesWithinAABBExcludingEntity(null, bb)) { for (Entity entity : world.getEntitiesWithinAABBExcludingEntity(null, bb)) {
if (!(entity instanceof ItemEntity)) if (!(entity instanceof ItemEntity))
continue; continue;
if (!entity.isAlive()) if (!entity.isAlive() || !entity.onGround)
continue; continue;
ItemEntity itemEntity = (ItemEntity) entity; ItemEntity itemEntity = (ItemEntity) entity;
pressedItems.add(itemEntity.getItem()); pressedItems.add(itemEntity.getItem());

View File

@ -223,6 +223,8 @@ public class ChuteTileEntity extends SmartTileEntity implements IHaveGoggleInfor
AxisAlignedBB searchArea = AxisAlignedBB searchArea =
new AxisAlignedBB(center.add(0, -bottomPullDistance - 0.5, 0), center.add(0, -0.5, 0)).grow(.45f); 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)) { for (ItemEntity itemEntity : world.getEntitiesWithinAABB(ItemEntity.class, searchArea)) {
if (!itemEntity.isAlive())
continue;
ItemStack entityItem = itemEntity.getItem(); ItemStack entityItem = itemEntity.getItem();
if (!canAcceptItem(entityItem)) if (!canAcceptItem(entityItem))
continue; continue;