Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

Posted

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);
		}
	}
}

  • Author

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.

  • Author

setMotion doesn't seem to be a known method in the Entity class. Are you sure that the method exists in 1.7.10?

so I'll just assume you meant setPosition instead?

  • Author

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.

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...

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.