Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @Override
- public ItemStack onItemUseFinish(ItemStack stack, World world, EntityLivingBase entity) {
- BlockPos pos = getLocation(stack);
- if (pos != null) {
- BlockPos bedLoc = EntityPlayer.getBedSpawnLocation(world,
- pos, false);
- if (bedLoc != null) {
- if (entity instanceof EntityPlayerMP) {
- EntityPlayerMP player = (EntityPlayerMP) entity;
- player.dismountRidingEntity();
- player.attemptTeleport(
- bedLoc.getX() + .5,
- bedLoc.getY() + .1,
- bedLoc.getZ() + .5
- );
- /*player.connection.setPlayerLocation(
- bedLoc.getX() + .5,
- bedLoc.getY() + .1,
- bedLoc.getZ() + .5,
- entity.rotationYaw,
- entity.rotationPitch
- );*/
- } else if (!(entity instanceof EntityPlayer)) {
- entity.setLocationAndAngles(
- bedLoc.getX() + .5,
- bedLoc.getY() + .1,
- bedLoc.getZ() + .5,
- entity.rotationYaw,
- entity.rotationPitch
- );
- }
- }
- }
- return stack;
- }
Advertisement
Add Comment
Please, Sign In to add comment