Jump to content

[1.7.10] EntityItem motion problems


nexusrightsi

Recommended Posts

Hey there, so i've been trying to create a block that acts as a conveyer belt though this should have been an easy task but for some reason when the Item's collide with the block they either do nothing when I mess about with their motion x/y/z it is when I call the moveEntity code that it actually starts moving around but in a teleporting way rather then a slow paced movement.

 

here is my onEntityCollide from my block class:

@Override
public void onEntityCollidedWithBlock(World world, int x, int y, int z, Entity entity)
{
	if(!world.isRemote)
	{
		if(entity instanceof EntityItem)
		{
			int meta = world.getBlockMetadata(x, y, z);
			EntityItem eItem = (EntityItem) entity;
			double moveX = 0D;
			double moveY = 0D;
			double moveZ = 0D;

			switch(meta)
			{
			case 0:
				//SOUTH
				moveZ = 0.25D;
				break;

			case 1:
				//WEST
				break;

			case 2: 
				//NORTH
				break;

			case 3:
				//EAST
				break;
			}

			eItem.moveEntity(moveX, moveY, moveZ);
		}
	}
}

Link to comment
Share on other sites

I would take a close look at the switch block.

1. Only the south direction will do anything

2. Are you sure those are the right metadata?

 

Also have you tried Entity#setMotion instead of Entity#moveEntity?

 

The reason that the south block only had "functionallity" is because it's the first side to experiment with, yes I know for a fact that all meta data's are correct as i've got a onactivation method printing out the blocks metadata.

 

No, I didn't even see the setMotion method, I'll give it a try and see if it works. Thank you.

Link to comment
Share on other sites

so I managed to fix the issue, its now gliding along instead of teleporting. One of the major issues was the !world.isRemote check, but now that i have removed it its instead of resting on top of the block its floating in mid air. but transport for all directions seems to work appart from the height issue. So next up is figuring out a way to disable the despawn and pickup for the EntityItems whiles they are on the transport.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.