Posted June 8, 201510 yr Hey, is it in anyway possible to make a custom portal that transports both entities and players? I started but it causes the non-player entity to be teleported to and from the dimensions rapidly, causing lots of lag and it ends up spawning multiple 'clones' of the same entity. My code is up to date and posted on Github: https://github.com/NovaViper/ZeroQuest/tree/master/src/main/java/common/zeroquest/block/portal Main Developer and Owner of Zero Quest Visit the Wiki for more information If I helped anyone, please give me a applaud and a thank you!
June 9, 201510 yr Author Anyone know why I get that cloning whenever I put a non-player entity in my custom portal? Main Developer and Owner of Zero Quest Visit the Wiki for more information If I helped anyone, please give me a applaud and a thank you!
June 9, 201510 yr Take a look at the vanilla nether portal code if you haven't already. it teleports both entities and players.
June 9, 201510 yr Author I have, but it takes the entity to the nether portal, not to my custom dimension Main Developer and Owner of Zero Quest Visit the Wiki for more information If I helped anyone, please give me a applaud and a thank you!
June 9, 201510 yr if (player.timeUntilPortal > 0) { player.timeUntilPortal = 10; } This code looks suspicous. If I'm understanding it correctly you're resetting the timeUntilPortal field when it's more than zero. Also, I don't know for sure, but onEntityCollidedWithBlock might be called every tick the player is touching the block.
June 9, 201510 yr Author The code for teleporting the player works, but not for entities. And it ususally does call players, but I modified it to also call entites Main Developer and Owner of Zero Quest Visit the Wiki for more information If I helped anyone, please give me a applaud and a thank you!
June 9, 201510 yr Minecarts are the only vanilla entities that can travel through portal. Look them up. 1.7.10 is no longer supported by forge, you are on your own.
June 9, 201510 yr Author I know that but the problem is that non player entites of ANY kind are experiencing that cloning Main Developer and Owner of Zero Quest Visit the Wiki for more information If I helped anyone, please give me a applaud and a thank you!
June 10, 201510 yr Author I add a cooldown time to the entities also, but that makes the cloning even worse and causes even more lag Main Developer and Owner of Zero Quest Visit the Wiki for more information If I helped anyone, please give me a applaud and a thank you!
June 10, 201510 yr Author I tried doing what vanilla does, it only takes me to the nether dimension, not my dimension Main Developer and Owner of Zero Quest Visit the Wiki for more information If I helped anyone, please give me a applaud and a thank you!
June 10, 201510 yr Author I did that already private void travelToDimension(Entity entity, int id) { if (!entity.worldObj.isRemote && !entity.isDead) { entity.worldObj.theProfiler.startSection("changeDimension"); MinecraftServer minecraftserver = MinecraftServer.getServer(); int j = entity.dimension; WorldServer worldserver = minecraftserver.worldServerForDimension(j); WorldServer worldserver1 = minecraftserver.worldServerForDimension(id); entity.dimension = id; if (j == 1 && id == 1) { worldserver1 = minecraftserver.worldServerForDimension(0); entity.dimension = 0; } entity.worldObj.removeEntity(entity); entity.isDead = false; entity.worldObj.theProfiler.startSection("reposition"); entity.timeUntilPortal = 10; minecraftserver.getConfigurationManager().transferEntityToWorld(entity, j, worldserver, worldserver1, new TeleporterNillax(worldserver1)); entity.worldObj.theProfiler.endStartSection("reloading"); Entity entity1 = EntityList.createEntityByName(EntityList.getEntityString(entity), worldserver1); if (entity1 != null) { entity1.copyDataFromOld(entity); if (j == 1 && id == 1) { BlockPos spawnPoint = worldserver1.getSpawnPoint(); spawnPoint = entity.worldObj.getTopSolidOrLiquidBlock(spawnPoint); entity1.setLocationAndAngles(spawnPoint.getX(), spawnPoint.getY(), spawnPoint.getZ(), entity1.rotationYaw, entity1.rotationPitch); } worldserver1.spawnEntityInWorld(entity1); } entity.isDead = true; entity.worldObj.theProfiler.endSection(); worldserver.resetUpdateEntityTick(); worldserver1.resetUpdateEntityTick(); entity.worldObj.theProfiler.endSection(); } } The entity teleports but it rapidly teleports, which causes the cloning and lag Main Developer and Owner of Zero Quest Visit the Wiki for more information If I helped anyone, please give me a applaud and a thank you!
June 10, 201510 yr Author I took it out because it caused even more lag than before I added it in private void travelToDimension(Entity entity, int id) { if (!entity.worldObj.isRemote && !entity.isDead) { entity.worldObj.theProfiler.startSection("changeDimension"); MinecraftServer minecraftserver = MinecraftServer.getServer(); int j = entity.dimension; WorldServer worldserver = minecraftserver.worldServerForDimension(j); WorldServer worldserver1 = minecraftserver.worldServerForDimension(id); entity.dimension = id; if (j == 1 && id == 1) { worldserver1 = minecraftserver.worldServerForDimension(0); entity.dimension = 0; } entity.timeUntilPortal = 10; entity.worldObj.removeEntity(entity); entity.isDead = false; entity.worldObj.theProfiler.startSection("reposition"); entity.timeUntilPortal = 10; minecraftserver.getConfigurationManager().transferEntityToWorld(entity, j, worldserver, worldserver1, new TeleporterNillax(worldserver1)); entity.worldObj.theProfiler.endStartSection("reloading"); Entity entity1 = EntityList.createEntityByName(EntityList.getEntityString(entity), worldserver1); if (entity1 != null) { entity1.copyDataFromOld(entity); if (j == 1 && id == 1) { BlockPos spawnPoint = worldserver1.getSpawnPoint(); spawnPoint = entity.worldObj.getTopSolidOrLiquidBlock(spawnPoint); entity1.setLocationAndAngles(spawnPoint.getX(), spawnPoint.getY(), spawnPoint.getZ(), entity1.rotationYaw, entity1.rotationPitch); } worldserver1.spawnEntityInWorld(entity1); entity.timeUntilPortal = 10; } entity.isDead = true; entity.worldObj.theProfiler.endSection(); worldserver.resetUpdateEntityTick(); worldserver1.resetUpdateEntityTick(); entity.worldObj.theProfiler.endSection(); } } Main Developer and Owner of Zero Quest Visit the Wiki for more information If I helped anyone, please give me a applaud and a thank you!
June 10, 201510 yr Author So.. I should put the cooldown where it acutally transfers the entity to the dimension, like this? private void travelToDimension(Entity entity, int id) { if (!entity.worldObj.isRemote && !entity.isDead) { entity.worldObj.theProfiler.startSection("changeDimension"); MinecraftServer minecraftserver = MinecraftServer.getServer(); int j = entity.dimension; WorldServer worldserver = minecraftserver.worldServerForDimension(j); WorldServer worldserver1 = minecraftserver.worldServerForDimension(id); entity.dimension = id; if (j == 1 && id == 1) { worldserver1 = minecraftserver.worldServerForDimension(0); entity.dimension = 0; } entity.worldObj.removeEntity(entity); entity.isDead = false; entity.worldObj.theProfiler.startSection("reposition"); minecraftserver.getConfigurationManager().transferEntityToWorld(entity, j, worldserver, worldserver1, new TeleporterNillax(worldserver1)); entity.timeUntilPortal = 10; entity.worldObj.theProfiler.endStartSection("reloading"); Entity entity1 = EntityList.createEntityByName(EntityList.getEntityString(entity), worldserver1); if (entity1 != null) { entity1.copyDataFromOld(entity); if (j == 1 && id == 1) { BlockPos spawnPoint = worldserver1.getSpawnPoint(); spawnPoint = entity.worldObj.getTopSolidOrLiquidBlock(spawnPoint); entity1.setLocationAndAngles(spawnPoint.getX(), spawnPoint.getY(), spawnPoint.getZ(), entity1.rotationYaw, entity1.rotationPitch); } worldserver1.spawnEntityInWorld(entity1); } entity.isDead = true; entity.worldObj.theProfiler.endSection(); worldserver.resetUpdateEntityTick(); worldserver1.resetUpdateEntityTick(); entity.worldObj.theProfiler.endSection(); } } Main Developer and Owner of Zero Quest Visit the Wiki for more information If I helped anyone, please give me a applaud and a thank you!
June 10, 201510 yr Author *Facepalm* Oh.. I feel stupid for not knowing Main Developer and Owner of Zero Quest Visit the Wiki for more information If I helped anyone, please give me a applaud and a thank you!
June 10, 201510 yr Author It works for a little bit but then it begins to lag out, which leaves the entity stuck in the portal and cloning only in the Nillax Dimension private void travelToDimension(Entity entity, int id) { if (!entity.worldObj.isRemote && !entity.isDead) { entity.timeUntilPortal = 10; entity.worldObj.theProfiler.startSection("changeDimension"); MinecraftServer minecraftserver = MinecraftServer.getServer(); int j = entity.dimension; WorldServer worldserver = minecraftserver.worldServerForDimension(j); WorldServer worldserver1 = minecraftserver.worldServerForDimension(id); entity.dimension = id; if (j == 1 && id == 1) { worldserver1 = minecraftserver.worldServerForDimension(0); entity.dimension = 0; } entity.worldObj.removeEntity(entity); entity.isDead = false; entity.worldObj.theProfiler.startSection("reposition"); minecraftserver.getConfigurationManager().transferEntityToWorld(entity, j, worldserver, worldserver1, new TeleporterNillax(worldserver1)); entity.worldObj.theProfiler.endStartSection("reloading"); Entity entity1 = EntityList.createEntityByName(EntityList.getEntityString(entity), worldserver1); if (entity1 != null) { entity1.copyDataFromOld(entity); if (j == 1 && id == 1) { BlockPos spawnPoint = worldserver1.getSpawnPoint(); spawnPoint = entity.worldObj.getTopSolidOrLiquidBlock(spawnPoint); entity1.setLocationAndAngles(spawnPoint.getX(), spawnPoint.getY(), spawnPoint.getZ(), entity1.rotationYaw, entity1.rotationPitch); } worldserver1.spawnEntityInWorld(entity1); } entity.isDead = true; entity.worldObj.theProfiler.endSection(); worldserver.resetUpdateEntityTick(); worldserver1.resetUpdateEntityTick(); entity.worldObj.theProfiler.endSection(); } } Main Developer and Owner of Zero Quest Visit the Wiki for more information If I helped anyone, please give me a applaud and a thank you!
June 10, 201510 yr Author I thought that is the cooldown. Well, where am I suppose to get the cooldown from? Main Developer and Owner of Zero Quest Visit the Wiki for more information If I helped anyone, please give me a applaud and a thank you!
June 10, 201510 yr Author So, use getPortalCooldown() at the end of the method? private void travelToDimension(Entity entity, int id) { if (!entity.worldObj.isRemote && !entity.isDead) { entity.timeUntilPortal = 10; entity.worldObj.theProfiler.startSection("changeDimension"); MinecraftServer minecraftserver = MinecraftServer.getServer(); int j = entity.dimension; WorldServer worldserver = minecraftserver.worldServerForDimension(j); WorldServer worldserver1 = minecraftserver.worldServerForDimension(id); entity.dimension = id; if (j == 1 && id == 1) { worldserver1 = minecraftserver.worldServerForDimension(0); entity.dimension = 0; } entity.worldObj.removeEntity(entity); entity.isDead = false; entity.worldObj.theProfiler.startSection("reposition"); minecraftserver.getConfigurationManager().transferEntityToWorld(entity, j, worldserver, worldserver1, new TeleporterNillax(worldserver1)); entity.worldObj.theProfiler.endStartSection("reloading"); Entity entity1 = EntityList.createEntityByName(EntityList.getEntityString(entity), worldserver1); if (entity1 != null) { entity1.copyDataFromOld(entity); if (j == 1 && id == 1) { BlockPos spawnPoint = worldserver1.getSpawnPoint(); spawnPoint = entity.worldObj.getTopSolidOrLiquidBlock(spawnPoint); entity1.setLocationAndAngles(spawnPoint.getX(), spawnPoint.getY(), spawnPoint.getZ(), entity1.rotationYaw, entity1.rotationPitch); } worldserver1.spawnEntityInWorld(entity1); } entity.isDead = true; entity.worldObj.theProfiler.endSection(); worldserver.resetUpdateEntityTick(); worldserver1.resetUpdateEntityTick(); entity.worldObj.theProfiler.endSection(); entity.getPortalCooldown(); } } Main Developer and Owner of Zero Quest Visit the Wiki for more information If I helped anyone, please give me a applaud and a thank you!
June 10, 201510 yr Author I'm now confused now Main Developer and Owner of Zero Quest Visit the Wiki for more information If I helped anyone, please give me a applaud and a thank you!
June 11, 201510 yr I'm now confused now ...... You should set Entity#timeUntilPortal to Entity#getPortalCooldown() when an entity is teleported, and only teleport the entity when the counter is smaller than 0. Then make the counter of the colliding entity decrease. Please learn how to construct logic.. I. Stellarium for Minecraft: Configurable Universe for Minecraft! (WIP) II. Stellar Sky, Better Star Rendering&Sky Utility mod, had separated from Stellarium.
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.