
MCrafterzz
Members-
Posts
285 -
Joined
-
Last visited
Everything posted by MCrafterzz
-
[1.10.2][SOLVED] Teleport to the players spawn point
MCrafterzz replied to MCrafterzz's topic in Modder Support
Yes it works (even for items!) but it takes a couple of ticks before they teleport so you still see the water particles. -
Please do a door tutorial
-
[1.10.2][SOLVED] Teleport to the players spawn point
MCrafterzz replied to MCrafterzz's topic in Modder Support
But it doesn't work for entities either! -
[1.10.2][SOLVED] Teleport to the players spawn point
MCrafterzz replied to MCrafterzz's topic in Modder Support
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 -
[1.10.2][SOLVED] Teleport to the players spawn point
MCrafterzz replied to MCrafterzz's topic in Modder Support
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 -
[1.10.2][SOLVED] Teleport to the players spawn point
MCrafterzz replied to MCrafterzz's topic in Modder Support
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). -
[1.10.2][SOLVED] Teleport to the players spawn point
MCrafterzz replied to MCrafterzz's topic in Modder Support
Ok, but I still don't know how to teleport players and other entities. My current code crashes -
[1.10.2][SOLVED] Teleport to the players spawn point
MCrafterzz replied to MCrafterzz's topic in Modder Support
Why would I need that? -
[1.10.2][SOLVED] Teleport to the players spawn point
MCrafterzz replied to MCrafterzz's topic in Modder Support
WHAT??? The hopper has nothing with teleporting items -
[1.10.2][SOLVED] Teleport to the players spawn point
MCrafterzz replied to MCrafterzz's topic in Modder Support
And how should I fix that? -
[1.10.2][SOLVED] Teleport to the players spawn point
MCrafterzz replied to MCrafterzz's topic in Modder Support
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) -
[1.10.2][SOLVED] Teleport to the players spawn point
MCrafterzz replied to MCrafterzz's topic in Modder Support
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()); -
[1.10.2][SOLVED] Teleport to the players spawn point
MCrafterzz replied to MCrafterzz's topic in Modder Support
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 -
[1.10.2][SOLVED] Teleport to the players spawn point
MCrafterzz replied to MCrafterzz's topic in Modder Support
It crashes because of a null point exception. Crash: http://pastebin.com/H05XxPqj -
[1.10.2][SOLVED] Teleport to the players spawn point
MCrafterzz replied to MCrafterzz's topic in Modder Support
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 -
[1.10.2][SOLVED] Teleport to the players spawn point
MCrafterzz replied to MCrafterzz's topic in Modder Support
Still looks the same with the latest forge version, http://www.minecraftforge.net/forum/Smileys/default/sad.gif -
[1.10.2][SOLVED] Teleport to the players spawn point
MCrafterzz replied to MCrafterzz's topic in Modder Support
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); } } } } -
[1.10.2][SOLVED] Teleport to the players spawn point
MCrafterzz replied to MCrafterzz's topic in Modder Support
So how should I do it then? -
[1.10.2][SOLVED] Teleport to the players spawn point
MCrafterzz replied to MCrafterzz's topic in Modder Support
Why can't I use: entityIn.setPosition Why does it even excist if it doesn't work? -
[1.10.2][SOLVED] Teleport to the players spawn point
MCrafterzz replied to MCrafterzz's topic in Modder Support
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 -
[1.10.2][SOLVED] Teleport to the players spawn point
MCrafterzz replied to MCrafterzz's topic in Modder Support
Done, I will now take a look at the teleport command -
[1.10.2][SOLVED] Teleport to the players spawn point
MCrafterzz replied to MCrafterzz's topic in Modder Support
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()); } } } -
[1.10.2][SOLVED] Teleport to the players spawn point
MCrafterzz replied to MCrafterzz's topic in Modder Support
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 -
[1.10.2][SOLVED] Teleport to the players spawn point
MCrafterzz replied to MCrafterzz's topic in Modder Support
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()); } } } -
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); } }