MCPcopy Create free account
hub / github.com/DGVPSH/SlackOpen / travelToDimension

Method travelToDimension

src/main/java/net/minecraft/entity/Entity.java:2512–2555  ·  view source on GitHub ↗

Teleports the entity to another dimension. Params: Dimension number to teleport to

(int dimensionId)

Source from the content-addressed store, hash-verified

2510 * Teleports the entity to another dimension. Params: Dimension number to teleport to
2511 */
2512 public void travelToDimension(int dimensionId)
2513 {
2514 if (!this.worldObj.isRemote && !this.isDead)
2515 {
2516 this.worldObj.theProfiler.startSection("changeDimension");
2517 MinecraftServer minecraftserver = MinecraftServer.getServer();
2518 int i = this.dimension;
2519 WorldServer worldserver = minecraftserver.worldServerForDimension(i);
2520 WorldServer worldserver1 = minecraftserver.worldServerForDimension(dimensionId);
2521 this.dimension = dimensionId;
2522
2523 if (i == 1 && dimensionId == 1)
2524 {
2525 worldserver1 = minecraftserver.worldServerForDimension(0);
2526 this.dimension = 0;
2527 }
2528
2529 this.worldObj.removeEntity(this);
2530 this.isDead = false;
2531 this.worldObj.theProfiler.startSection("reposition");
2532 minecraftserver.getConfigurationManager().transferEntityToWorld(this, i, worldserver, worldserver1);
2533 this.worldObj.theProfiler.endStartSection("reloading");
2534 Entity entity = EntityList.createEntityByName(EntityList.getEntityString(this), worldserver1);
2535
2536 if (entity != null)
2537 {
2538 entity.copyDataFromOld(this);
2539
2540 if (i == 1 && dimensionId == 1)
2541 {
2542 BlockPos blockpos = this.worldObj.getTopSolidOrLiquidBlock(worldserver1.getSpawnPoint());
2543 entity.moveToBlockPosAndAngles(blockpos, entity.rotationYaw, entity.rotationPitch);
2544 }
2545
2546 worldserver1.spawnEntityInWorld(entity);
2547 }
2548
2549 this.isDead = true;
2550 this.worldObj.theProfiler.endSection();
2551 worldserver.resetUpdateEntityTick();
2552 worldserver1.resetUpdateEntityTick();
2553 this.worldObj.theProfiler.endSection();
2554 }
2555 }
2556
2557 /**
2558 * Explosion resistance of a block relative to this entity

Callers 2

onEntityUpdateMethod · 0.95

Calls 15

getServerMethod · 0.95
createEntityByNameMethod · 0.95
getEntityStringMethod · 0.95
copyDataFromOldMethod · 0.95
resetUpdateEntityTickMethod · 0.95
startSectionMethod · 0.80
transferEntityToWorldMethod · 0.80
endStartSectionMethod · 0.80

Tested by

no test coverage detected