Posted November 5, 20159 yr 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); } } }
November 5, 20159 yr 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? Projects: Discontinued: - N2ConfigAPI - Meachanical Crafting Table Latest: - CollectionUtils Coöperations: - InGameConfigManager
November 5, 20159 yr 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.
November 5, 20159 yr 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?
November 5, 20159 yr 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.