0
\$\begingroup\$

Sorry if my code looks amateur I just started modding, although I have experience in Java.

I have a tile entity checking every frame if there are entities above it. It works, but then stops after 1 tick. Here is the code I am using.

import java.util.List;

import net.minecraft.entity.Entity;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ITickable;
import net.minecraft.util.math.AxisAlignedBB;

public class TileEntityConveyor extends TileEntity implements ITickable {

    public static float speed = 1f;

    @Override
    public void update() {
        if (this.worldObj.isRemote)
            return;
        double x = this.pos.getX();
        double y = this.pos.getY();
        double z = this.pos.getZ();

        AxisAlignedBB collsion = new AxisAlignedBB(x, y, z, x + 1, y + 2, z + 1);

        List<Entity> list = this.worldObj.getEntitiesWithinAABB(Entity.class, collsion);

        for (Entity entity : list) {
            entity.motionX += speed;
            //          this.
        }
    }

}
\$\endgroup\$
1
  • 1
    \$\begingroup\$ You should analyze what part of the method fails, e.g., is this.worldObj.isRemote true after one tick, is the returned list empty, is speed == 0 after the first tick, etc. \$\endgroup\$
    – Thomas
    Mar 4, 2017 at 9:50

1 Answer 1

0
\$\begingroup\$

There is actually FOUR sides in minecraft, but they are usually just shortened to two. There's a physical server, which is the server in the real world, the physical client, which is the client in the real world, the logical server, the server that you know as the server in game, and the logical client, the client you play.

World#isRemote simply checks if the method you are running is in the logical server (false) or the logical client (true).

\$\endgroup\$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .