private void suckEntityInNetwork(Entity closest) { if (!pipeNetwork.contains(closest)) { if (type == START) { pipeNetwork.addEntity(closest); } } }
public void update() { EntitiesLayer layer = ((EntitiesLayer) getLevel().getLayer(getLayer())); if (pipeNetwork != null && pipeNetwork.invalid) { layer.removeEntity(this); } else if (pipeNetwork == null && type == START) { pipeNetwork = PipeNetwork.create(this); if (pipeNetwork == null) layer.removeEntity(this); } else if (pipeNetwork != null && type == START) { ArrayList<Entity> closestEnts = layer.getClosestEntities(this, 24); for (Entity closest : closestEnts) if (closest != null) { suckEntityInNetwork(closest); } } motionX = 0; motionY = 0; }