Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Vacuum hoppers cause entity overflow #1012

Open
LarsonMichael opened this issue May 13, 2020 · 0 comments
Open

Vacuum hoppers cause entity overflow #1012

LarsonMichael opened this issue May 13, 2020 · 0 comments

Comments

@LarsonMichael
Copy link

Vacuum hoppers can cause major performance issues when connected inventories are full.
In packs with automation(farms) continuing to produce entities, the vacuum hopper pulls the entities towards it even though it cannot pick them up. The entities count as having been interacted with and therefore will not despawn.
A vacuum hopper running over a field with an automatic harvester will eventually cause thousands of entities to be stuck beneath the hopper.

The vacuum hopper should suspend interactions with entities if its inventory could not possibly pick them up.

Placing a "hopper full" check around this block of code from https://github.com/OpenMods/OpenBlocks/blob/master/src/main/java/openblocks/common/tileentity/TileEntityVacuumHopper.java should allow the entities to despawn naturally on overflowing farms.

List<Entity> interestingItems = world.getEntitiesWithinAABB(Entity.class, getBB().grow(3), entitySelector);

		boolean needsSync = false;

		for (Entity entity : interestingItems) {
			double dx = (pos.getX() + 0.5D - entity.posX);
			double dy = (pos.getY() + 0.5D - entity.posY);
			double dz = (pos.getZ() + 0.5D - entity.posZ);

			double distance = Math.sqrt(dx * dx + dy * dy + dz * dz);
			if (distance < 1.1) {
				needsSync |= onEntityCollidedWithBlock(entity);
			} else {
				double var11 = 1.0 - distance / 15.0;

				if (var11 > 0.0D) {
					var11 *= var11;
					entity.motionX += dx / distance * var11 * 0.05;
					entity.motionY += dy / distance * var11 * 0.2;
					entity.motionZ += dz / distance * var11 * 0.05;
				}
			}

		}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant