Jump to content

MCrafterzz

Members
  • Posts

    285
  • Joined

  • Last visited

Everything posted by MCrafterzz

  1. Yes it works (even for items!) but it takes a couple of ticks before they teleport so you still see the water particles.
  2. Please do a door tutorial
  3. But it doesn't work for entities either!
  4. TP Command: p_189862_0_.setLocationAndAngles(p_189862_1_.getResult(), p_189862_2_.getResult(), p_189862_3_.getResult(), f2, f3); public void setLocationAndAngles(double x, double y, double z, float yaw, float pitch) { this.posX = x; this.posY = y; this.posZ = z; this.prevPosX = this.posX; this.prevPosY = this.posY; this.prevPosZ = this.posZ; this.lastTickPosX = this.posX; this.lastTickPosY = this.posY; this.lastTickPosZ = this.posZ; this.rotationYaw = yaw; this.rotationPitch = pitch; this.setPosition(this.posX, this.posY, this.posZ); } My code: entityIn.posX = worldIn.getSpawnPoint().getX(); entityIn.posY = worldIn.getSpawnPoint().getY(); entityIn.posZ = worldIn.getSpawnPoint().getZ(); So what is the big difference!!! Can't you just send a example how it should be instead of saying to look on the /tp command all the time
  5. Changed to: @Override public void onEntityCollidedWithBlock(World worldIn, BlockPos pos, IBlockState state, Entity entityIn) { if (!worldIn.isRemote) { entityIn.posX = worldIn.getSpawnPoint().getX(); entityIn.posY = worldIn.getSpawnPoint().getY(); entityIn.posZ = worldIn.getSpawnPoint().getZ(); entityIn.playSound(SoundEvents.ENTITY_ENDERPEARL_THROW, 0.5f, 0.5f); worldIn.spawnParticle(EnumParticleTypes.PORTAL, entityIn.getPosition().getX(), entityIn.getPosition().getY(), entityIn.getPosition().getZ(), 0, 0, 10, 0); } } But it doesn't work :c It does the same as setLocationAndAngles that /tp uses but only setting the location
  6. I know, but I don't know what I should replace it with because that's how the TP command works (and it works with entities too).
  7. Ok, but I still don't know how to teleport players and other entities. My current code crashes
  8. WHAT??? The hopper has nothing with teleporting items
  9. Because that's how the teleport command works. I still don't know how I should teleport things. I want players to teleport to there spawn point(in the same dimension) and item and other entities to teleport to the worlds spawn (in the same dimension)
  10. New error: http://pastebin.com/TTrPzcdC Line 39(errored line): ((EntityPlayerMP) entityIn).connection.setPlayerLocation(worldIn.getSpawnPoint().getX(), worldIn.getSpawnPoint().getY(), worldIn.getSpawnPoint().getZ(), entityIn.getRotationYawHead(), entityIn.getRotationYawHead());
  11. Changed it to this: @Override public void onEntityCollidedWithBlock(World worldIn, BlockPos pos, IBlockState state, Entity entityIn) { if (!worldIn.isRemote) { if (entityIn instanceof EntityPlayer) { EntityPlayer player = (EntityPlayer) entityIn; BlockPos spawnPosition = player.getBedLocation(); ((EntityPlayerMP) entityIn).connection.setPlayerLocation(spawnPosition.getX(), spawnPosition.getY(), spawnPosition.getZ(), player.getRotationYawHead(), player.getRotationYawHead()); entityIn.playSound(SoundEvents.ENTITY_ENDERPEARL_THROW, 0.5f, 0.5f); worldIn.spawnParticle(EnumParticleTypes.PORTAL, entityIn.getPosition().getX(), entityIn.getPosition().getY(), entityIn.getPosition().getZ(), 0, 0, 10, 0); } else { ((EntityPlayerMP) entityIn).connection.setPlayerLocation(worldIn.getSpawnPoint().getX(), worldIn.getSpawnPoint().getY(), worldIn.getSpawnPoint().getZ(), entityIn.getRotationYawHead(), entityIn.getRotationYawHead()); entityIn.playSound(SoundEvents.ENTITY_ENDERPEARL_THROW, 0.5f, 0.5f); worldIn.spawnParticle(EnumParticleTypes.PORTAL, entityIn.getPosition().getX(), entityIn.getPosition().getY(), entityIn.getPosition().getZ(), 0, 0, 10, 0); } } } Testing now
  12. It crashes because of a null point exception. Crash: http://pastebin.com/H05XxPqj
  13. I have removed one of the instanceof checks: @Override public void onEntityCollidedWithBlock(World worldIn, BlockPos pos, IBlockState state, Entity entityIn) { if (!worldIn.isRemote) { if (entityIn instanceof EntityPlayer) { EntityPlayer player = (EntityPlayer) entityIn; BlockPos spawnPosition = player.getBedLocation(); entityIn.setPosition(spawnPosition.getX(), spawnPosition.getY(), spawnPosition.getZ()); entityIn.playSound(SoundEvents.ENTITY_ENDERPEARL_THROW, 0.5f, 0.5f); worldIn.spawnParticle(EnumParticleTypes.PORTAL, entityIn.getPosition().getX(), entityIn.getPosition().getY(), entityIn.getPosition().getZ(), 0, 0, 10, 0); } else { entityIn.setPosition(worldIn.getSpawnPoint().getX(), worldIn.getSpawnPoint().getY(), worldIn.getSpawnPoint().getZ()); entityIn.playSound(SoundEvents.ENTITY_ENDERPEARL_THROW, 0.5f, 0.5f); worldIn.spawnParticle(EnumParticleTypes.PORTAL, entityIn.getPosition().getX(), entityIn.getPosition().getY(), entityIn.getPosition().getZ(), 0, 0, 10, 0); } } } But I still don't know how to use the commandteleport code
  14. Still looks the same with the latest forge version, http://www.minecraftforge.net/forum/Smileys/default/sad.gif
  15. This is how the codes looks like now: @Override public void onEntityCollidedWithBlock(World worldIn, BlockPos pos, IBlockState state, Entity entityIn) { if (!worldIn.isRemote) { if (entityIn instanceof EntityLivingBase) { if (entityIn instanceof EntityPlayer) { EntityPlayer player = (EntityPlayer) entityIn; BlockPos spawnPosition = player.getBedLocation(); entityIn.setPosition(spawnPosition.getX(), spawnPosition.getY(), spawnPosition.getZ()); entityIn.playSound(SoundEvents.ENTITY_ENDERPEARL_THROW, 0.5f, 0.5f); worldIn.spawnParticle(EnumParticleTypes.PORTAL, entityIn.getPosition().getX(), entityIn.getPosition().getY(), entityIn.getPosition().getZ(), 0, 0, 10, 0); } else { entityIn.setPosition(worldIn.getSpawnPoint().getX(), worldIn.getSpawnPoint().getY(), worldIn.getSpawnPoint().getZ()); entityIn.playSound(SoundEvents.ENTITY_ENDERPEARL_THROW, 0.5f, 0.5f); worldIn.spawnParticle(EnumParticleTypes.PORTAL, entityIn.getPosition().getX(), entityIn.getPosition().getY(), entityIn.getPosition().getZ(), 0, 0, 10, 0); } } } }
  16. So how should I do it then?
  17. Why can't I use: entityIn.setPosition Why does it even excist if it doesn't work?
  18. I guess this is the code that I need to look at: http://pastebin.com/ySKJqdyV But nearly nothing have real names so it's hard to understand what it's accually doing
  19. Done, I will now take a look at the teleport command
  20. Changed to: @Override @SideOnly(Side.SERVER) public void onEntityCollidedWithBlock(World worldIn, BlockPos pos, IBlockState state, Entity entityIn) { if (entityIn instanceof EntityLivingBase) { if (entityIn instanceof EntityPlayer) { EntityPlayer player = (EntityPlayer) entityIn; BlockPos spawnPosition = player.getBedLocation(); entityIn.setPosition(spawnPosition.getX(), spawnPosition.getY(), spawnPosition.getZ()); entityIn.playSound(SoundEvents.ENTITY_ENDERPEARL_THROW, 0.5f, 0.5f); worldIn.spawnParticle(EnumParticleTypes.PORTAL, entityIn.getPosition().getX(), entityIn.getPosition().getY(), entityIn.getPosition().getZ(), 0, 0, 10, 0); } else { entityIn.setPosition(worldIn.getSpawnPoint().getX(), worldIn.getSpawnPoint().getY(), worldIn.getSpawnPoint().getZ()); } } }
  21. With the updated code that I just posted it no longer crashes. It teleports to a location that I think is right(?) for a fraction of a seconds but then it teleports back
  22. Updated code: @Override public void onEntityCollidedWithBlock(World worldIn, BlockPos pos, IBlockState state, Entity entityIn) { if (entityIn instanceof EntityLivingBase) { if (entityIn instanceof EntityPlayer) { EntityPlayer player = (EntityPlayer) entityIn; BlockPos spawnPosition = player.getBedLocation(); entityIn.setPosition(spawnPosition.getX(), spawnPosition.getY(), spawnPosition.getZ()); entityIn.playSound(SoundEvents.ENTITY_ENDERPEARL_THROW, 0.5f, 0.5f); worldIn.spawnParticle(EnumParticleTypes.PORTAL, entityIn.getPosition().getX(), entityIn.getPosition().getY(), entityIn.getPosition().getZ(), 0, 0, 10, 0); } else { entityIn.setPosition(worldIn.getSpawnPoint().getX(), worldIn.getSpawnPoint().getY(), worldIn.getSpawnPoint().getZ()); } } }
  23. I want players to teleport to there spawn point this is the code I've use (it crashes with a null Point exception): @Override public void onEntityCollidedWithBlock(World worldIn, BlockPos pos, IBlockState state, Entity entityIn) { if (entityIn instanceof EntityLivingBase) { EntityPlayer player = (EntityPlayer) entityIn; entityIn.setPosition(player.getBedSpawnLocation(worldIn, player.getBedLocation(), false).getX(), player.getBedSpawnLocation(worldIn, player.getBedLocation(), false).getY(), player.getBedSpawnLocation(worldIn, player.getBedLocation(), false).getZ()); entityIn.playSound(SoundEvents.ENTITY_ENDERPEARL_THROW, 0.5f, 0.5f); worldIn.spawnParticle(EnumParticleTypes.PORTAL, entityIn.getPosition().getX(), entityIn.getPosition().getY(), entityIn.getPosition().getZ(), 0, 0, 10, 0); } }
×
×
  • Create New...

Important Information

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