Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Block Code
- public class BlockDimPortal extends BlockPortal
- {
- public void onNeighborBlockChange(World world, BlockPos pos, IBlockState state, Block neighborBlock)
- {
- EnumFacing.Axis axis = (EnumFacing.Axis) state.getValue(AXIS);
- BlockDimPortal.Size size;
- if (axis == EnumFacing.Axis.X)
- {
- size = new BlockDimPortal.Size(world, pos, EnumFacing.Axis.X);
- if (!size.isValidPortal() || size.amountOfPortals < size.sizeXZ * size.sizeY)
- {
- world.setBlockState(pos, Blocks.air.getDefaultState());
- }
- }
- else if (axis == EnumFacing.Axis.Z)
- {
- size = new BlockDimPortal.Size(world, pos, EnumFacing.Axis.Z);
- if (!size.isValidPortal() || size.amountOfPortals < size.sizeXZ * size.sizeY)
- {
- world.setBlockState(pos, Blocks.air.getDefaultState());
- }
- }
- }
- @SideOnly(Side.CLIENT)
- public void randomDisplayTick(World world, BlockPos pos, IBlockState state, Random rand)
- {
- if (rand.nextInt(100) == 0)
- {
- world.playSound((double)pos.getX() + 0.5D, (double)pos.getY() + 0.5D, (double)pos.getZ() + 0.5D,
- "portal.portal", 0.75F, rand.nextFloat() * 0.1F + 1.2F, false);
- }
- for (int i = 0; i < 4; ++i)
- {
- double d0 = (double) ((float) pos.getX() + rand.nextFloat());
- double d1 = (double) ((float) pos.getY() + rand.nextFloat());
- double d2 = (double) ((float) pos.getZ() + rand.nextFloat());
- double d3 = ((double) rand.nextFloat() - 0.5D) * 0.5D;
- double d4 = ((double) rand.nextFloat() - 0.5D) * 0.5D;
- double d5 = ((double) rand.nextFloat() - 0.5D) * 0.5D;
- int j = rand.nextInt(2) * 2 - 1;
- if (world.getBlockState(pos.west()).getBlock() != this && world.getBlockState(pos.east()).getBlock()
- != this)
- {
- d0 = (double) pos.getX() + 0.5D + 0.25D * (double) j;
- d3 = (double) (rand.nextFloat() * 2.0F * (float) j);
- }
- else
- {
- d2 = (double) pos.getZ() + 0.5D + 0.25D * (double) j;
- d5 = (double) (rand.nextFloat() * 2.0F * (float) j);
- }
- EntityDimPortalFX entitydimportalfx = new EntityDimPortalFX(world, x, y, z, vx, vy, vz);
- FMLClientHandler.instance().getClient().effectRenderer.addEffect(entityfx);
- }
- }
- public void onEntityCollidedWithBlock(World world, BlockPos pos, IBlockState state, Entity entity)
- {
- if (entity.ridingEntity == null && entity.riddenByEntity == null && !world.isRemote)
- {
- Dim.teleportEntityToDimension(entity, Dim.getDimensionId(), new
- TeleporterDim(MinecraftServer.getServer().worldServerForDimension(Dim.getDimensionId())));
- }
- }
- public void updateTick(World world, BlockPos pos, IBlockState state, Random rand) {}
- public boolean func_176548_d(World world, BlockPos pos)
- {
- BlockDimPortal.Size size = new BlockDimPortal.Size(world, pos, EnumFacing.Axis.X);
- if (size.isValidPortal() && size.amountOfPortals == 0)
- {
- size.createPortalBlocks();
- return true;
- }
- else
- {
- BlockDimPortal.Size size1 = new BlockDimPortal.Size(world, pos, EnumFacing.Axis.Z);
- if (size1.isValidPortal() && size.amountOfPortals == 0)
- {
- size.createPortalBlocks();
- return true;
- }
- else
- {
- return false;
- }
- }
- }
- public static class Size
- {
- private final World world;
- private final EnumFacing.Axis axis;
- private final EnumFacing south_west;
- private final EnumFacing north_east;
- private int amountOfPortals = 0;
- private BlockPos blockpos;
- private int sizeY;
- private int sizeXZ;
- public Size(World world, BlockPos blockpos, EnumFacing.Axis enumfacingAxis)
- {
- this.world = world;
- this.axis = enumfacingAxis;
- if (enumfacingAxis == EnumFacing.Axis.X)
- {
- this.north_east = EnumFacing.EAST;
- this.south_west = EnumFacing.WEST;
- }
- else
- {
- this.north_east = EnumFacing.NORTH;
- this.south_west = EnumFacing.SOUTH;
- }
- for (BlockPos blockpos1 = blockpos; blockpos.getY() > blockpos1.getY() - 21 && blockpos.getY() > 0 &&
- this.isBlockAllowed(world.getBlockState(blockpos.down()).getBlock()); blockpos = blockpos.down())
- {
- ;
- }
- int i = this.getPortalXZSize(blockpos, this.north_east) - 1;
- if (i >= 0)
- {
- this.blockpos = blockpos.offset(this.north_east, i);
- this.sizeXZ = this.getPortalXZSize(this.blockpos, this.south_west);
- if (this.sizeXZ < 2 || this.sizeXZ > 21)
- {
- this.blockpos = null;
- this.sizeXZ = 0;
- }
- }
- if (this.blockpos != null)
- {
- this.sizeY = this.getPortalHeight();
- }
- }
- protected int getPortalXZSize(BlockPos blockspos, EnumFacing enumfacing)
- {
- int i;
- for (i = 0; i < 22; ++i)
- {
- BlockPos blockpos1 = blockspos.offset(enumfacing, i);
- if (!this.isBlockAllowed(this.world.getBlockState(blockpos1).getBlock()) ||
- this.world.getBlockState(blockpos1.down()).getBlock() != Blocks.quartz_block)
- {
- break;
- }
- }
- Block block = this.world.getBlockState(blockspos.offset(enumfacing, i)).getBlock();
- return block == Blocks.quartz_block ? i : 0;
- }
- protected int getPortalHeight()
- {
- int i;
- label56:
- for (this.sizeY = 0; this.sizeY < 21; ++this.sizeY)
- {
- for (i = 0; i < this.sizeXZ; ++i)
- {
- BlockPos blockpos = this.blockpos.offset(this.south_west, i).up(this.sizeY);
- Block block = this.world.getBlockState(blockpos).getBlock();
- if (!this.isBlockAllowed(block))
- {
- break label56;
- }
- if (block == DimBlocks.dim_portal)
- {
- ++this.amountOfPortals;
- }
- if (i == 0)
- {
- block = this.world.getBlockState(blockpos.offset(this.north_east)).getBlock();
- if (block != Blocks.quartz_block)
- {
- break label56;
- }
- }
- else if (i == this.sizeXZ - 1)
- {
- block = this.world.getBlockState(blockpos.offset(this.south_west)).getBlock();
- if (block != Blocks.quartz_block)
- {
- break label56;
- }
- }
- }
- }
- for (i = 0; i < this.sizeXZ; ++i)
- {
- if (this.world.getBlockState(this.blockpos.offset(this.south_west, i).up(this.sizeY)).getBlock()
- != Blocks.quartz_block)
- {
- this.sizeY = 0;
- break;
- }
- }
- if (this.sizeY <= 21 && this.sizeY >= 3)
- {
- return this.sizeY;
- }
- else
- {
- this.blockpos = null;
- this.sizeXZ = 0;
- this.sizeY = 0;
- return 0;
- }
- }
- protected boolean isBlockAllowed(Block block)
- {
- return block.getMaterial() == Material.air || block == Blocks.water || block == Blocks.flowing_water ||
- block == DimBlocks.dim_portal;
- }
- public boolean isValidPortal()
- {
- return this.blockpos != null && this.sizeXZ >= 2 && this.sizeXZ <= 21 && this.sizeY >= 3 && this.sizeY
- <= 21;
- }
- public void createPortalBlocks()
- {
- for (int i = 0; i < this.sizeXZ; ++i)
- {
- BlockPos blockpos = this.blockpos.offset(this.south_west, i);
- for (int j = 0; j < this.sizeY; ++j)
- {
- this.world.setBlockState(blockpos.up(j),
- DimBlocks.dim_portal.getDefaultState().withProperty(BlockPortal.AXIS, this.axis), 2);
- }
- }
- }
- }
- }
- // Code from Main Class to teleport entity
- public static void teleportEntityToDimension(Entity entity, int dimensionId, Teleporter teleporter)
- {
- 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(dimensionId);
- entity.dimension = dimensionId;
- if (j == dimensionId)
- {
- 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,
- teleporter);
- entity.worldObj.theProfiler.endStartSection("reloading");
- Entity entity1 = EntityList.createEntityByName(EntityList.getEntityString(entity), worldserver1);
- if (entity1 != null)
- {
- entity1.copyDataFromOld(entity);
- if (j == dimensionId)
- {
- BlockPos blockpos = entity.worldObj
- .getTopSolidOrLiquidBlock(worldserver1.getSpawnPoint());
- entity1.moveToBlockPosAndAngles(blockpos, entity1.rotationYaw, entity1.rotationPitch);
- }
- worldserver1.spawnEntityInWorld(entity1);
- }
- entity.isDead = true;
- entity.worldObj.theProfiler.endSection();
- worldserver.resetUpdateEntityTick();
- worldserver1.resetUpdateEntityTick();
- entity.worldObj.theProfiler.endSection();
- }
- }
- // Teleport Code
- public class TeleporterDim extends Teleporter
- {
- private WorldServer worldServerInstance;
- private final Random random;
- private final LongHashMap destinationCoordinateCache = new LongHashMap();
- private final List destinationCoordinateKeys = Lists.newArrayList();
- public TeleporterDim(WorldServer world)
- {
- super(world);
- this.worldServerInstance = world;
- this.worldServerInstance.customTeleporters.add(this);
- this.random = new Random(world.getSeed());
- }
- public void placeInPortal(Entity entity, float rotationYaw)
- {
- if (this.worldServerInstance.provider.getDimensionId() != 1)
- {
- if (!this.placeInExistingPortal(entity, rotationYaw))
- {
- this.makePortal(entity);
- this.placeInExistingPortal(entity, rotationYaw);
- }
- }
- else
- {
- int i = MathHelper.floor_double(entity.posX);
- int j = MathHelper.floor_double(entity.posY) - 1;
- int k = MathHelper.floor_double(entity.posZ);
- byte b0 = 1;
- byte b1 = 0;
- for (int l = -2; l <= 2; ++l)
- {
- for (int i1 = -2; i1 <= 2; ++i1)
- {
- for (int j1 = -1; j1 < 3; ++j1)
- {
- int k1 = i + i1 * b0 + l * b1;
- int l1 = j + j1;
- int i2 = k + i1 * b1 - l * b0;
- boolean flag = j1 < 0;
- this.worldServerInstance.setBlockState(new BlockPos(k1, l1, i2), flag ? Blocks.quartz_block.getDefaultState() : Blocks.air.getDefaultState());
- }
- }
- }
- entity.setLocationAndAngles((double) i, (double) j, (double) k, entity.rotationYaw, 0.0F);
- entity.motionX = entity.motionY = entity.motionZ = 0.0D;
- }
- }
- public boolean placeInExistingPortal(Entity entity, float f)
- {
- boolean flag = true;
- double d0 = -1.0D;
- int i = MathHelper.floor_double(entity.posX);
- int j = MathHelper.floor_double(entity.posZ);
- boolean flag1 = true;
- Object object = BlockPos.ORIGIN;
- long k = ChunkCoordIntPair.chunkXZ2Int(i, j);
- if (this.destinationCoordinateCache.containsItem(k))
- {
- TeleporterDim.PortalPosition portalposition = (TeleporterDim.PortalPosition)
- this.destinationCoordinateCache.getValueByKey(k);
- d0 = 0.0D;
- object = portalposition;
- portalposition.lastUpdateTime = this.worldServerInstance.getTotalWorldTime();
- flag1 = false;
- }
- else
- {
- BlockPos blockpos4 = new BlockPos(entity);
- for (int l = -128; l <= 128; ++l)
- {
- BlockPos blockpos1;
- for (int i1 = -128; i1 <= 128; ++i1)
- {
- for (BlockPos blockpos = blockpos4.add(l, this.worldServerInstance.getActualHeight() - 1
- - blockpos4.getY(), i1); blockpos.getY() >= 0; blockpos = blockpos1)
- {
- blockpos1 = blockpos.down();
- if (this.worldServerInstance.getBlockState(blockpos).getBlock() ==
- DimBlocks.dim_portal)
- {
- while (this.worldServerInstance.getBlockState(blockpos1
- blockpos.down()).getBlock() == DimBlocks.dim_portal)
- {
- blockpos = blockpos1;
- }
- double d1 = blockpos.distanceSq(blockpos4);
- if (d0 < 0.0D || d1 < d0)
- {
- d0 = d1;
- object = blockpos;
- }
- }
- }
- }
- }
- }
- if (d0 >= 0.0D)
- {
- if (flag1)
- {
- this.destinationCoordinateCache.add(k, new TeleporterDim.PortalPosition((BlockPos) object,
- this.worldServerInstance.getTotalWorldTime()));
- this.destinationCoordinateKeys.add(Long.valueOf(k));
- }
- double d4 = (double) ((BlockPos) object).getX() + 0.5D;
- double d5 = (double) ((BlockPos) object).getY() + 0.5D;
- double d6 = (double) ((BlockPos) object).getZ() + 0.5D;
- EnumFacing enumfacing = null;
- if (this.worldServerInstance.getBlockState(((BlockPos) object).west()).getBlock() ==
- DimBlocks.dim_portal)
- {
- enumfacing = EnumFacing.NORTH;
- }
- if (this.worldServerInstance.getBlockState(((BlockPos) object).east()).getBlock() ==
- DimBlocks.dim_portal)
- {
- enumfacing = EnumFacing.SOUTH;
- }
- if (this.worldServerInstance.getBlockState(((BlockPos) object).north()).getBlock() ==
- DimBlocks.dim_portal)
- {
- enumfacing = EnumFacing.EAST;
- }
- if (this.worldServerInstance.getBlockState(((BlockPos) object).south()).getBlock() ==
- DimBlocks.dim_portal)
- {
- enumfacing = EnumFacing.WEST;
- }
- EnumFacing enumfacing1 = EnumFacing.getHorizontal(entity.getTeleportDirection());
- if (enumfacing != null)
- {
- EnumFacing enumfacing2 = enumfacing.rotateYCCW();
- BlockPos blockpos2 = ((BlockPos) object).offset(enumfacing);
- boolean flag2 = this.isAirBlock(blockpos2);
- boolean flag3 = this.isAirBlock(blockpos2.offset(enumfacing));
- if (flag3 && flag2)
- {
- object = ((BlockPos) object).offset(enumfacing2);
- enumfacing = enumfacing.getOpposite();
- enumfacing2 = enumfacing2.getOpposite();
- BlockPos blockpos3 = ((BlockPos) object).offset(enumfacing);
- flag2 = this.isAirBlock(blockpos3);
- flag3 = this.isAirBlock(blockpos3.offset(enumfacing2));
- }
- float f6 = 0.5F;
- float f1 = 0.5F;
- if (!flag3 && flag2)
- {
- f6 = 1.0F;
- }
- else if (flag3 && !flag2)
- {
- f6 = 0.0F;
- }
- else if (flag3)
- {
- f1 = 0.0F;
- }
- d4 = (double)((BlockPos)object).getX() + 0.5D;
- d5 = (double)((BlockPos)object).getY() + 0.5D;
- d6 = (double)((BlockPos)object).getZ() + 0.5D;
- d4 += (double)((float)enumfacing2.getFrontOffsetX() * f6 + (float)enumfacing.getFrontOffsetX() * f1);
- d6 += (double)((float)enumfacing2.getFrontOffsetZ() * f6 + (float)enumfacing.getFrontOffsetZ() * f1);
- float f2 = 0.0F;
- float f3 = 0.0F;
- float f4 = 0.0F;
- float f5 = 0.0F;
- if (enumfacing == enumfacing1)
- {
- f2 = 1.0F;
- f3 = 1.0F;
- }
- else if (enumfacing == enumfacing1.getOpposite())
- {
- f2 = -1.0F;
- f3 = -1.0F;
- }
- else if (enumfacing == enumfacing1.rotateY())
- {
- f4 = 1.0F;
- f5 = -1.0F;
- }
- else
- {
- f4 = -1.0F;
- f5 = 1.0F;
- }
- double d2 = entity.motionX;
- double d3 = entity.motionZ;
- entity.motionX = d2 * (double) f2 + d3 * (double) f5;
- entity.motionZ = d2 * (double) f4 + d3 * (double) f3;
- entity.rotationYaw = f - (float) (enumfacing1.getHorizontalIndex() * 90) + (float)
- (enumfacing.getHorizontalIndex() * 90);
- }
- else
- {
- entity.motionX = entity.motionY = entity.motionZ = 0.0D;
- }
- entity.setLocationAndAngles(d4, d5, d6, entity.rotationYaw, entity.rotationPitch);
- return true;
- }
- else
- {
- return false;
- }
- }
- private boolean isAirBlock(BlockPos pos)
- {
- return !this.worldServerInstance.isAirBlock(pos) || !this.worldServerInstance.isAirBlock(pos.up());
- }
- public boolean makePortal(Entity entity)
- {
- byte b0 = 16;
- double d0 = -1.0D;
- int i = MathHelper.floor_double(entity.posX);
- int j = MathHelper.floor_double(entity.posY);
- int k = MathHelper.floor_double(entity.posZ);
- int l = i;
- int i1 = j;
- int j1 = k;
- int k1 = 0;
- int l1 = this.random.nextInt(4);
- int i2;
- double d1;
- int k2;
- double d2;
- int i3;
- int j3;
- int k3;
- int l3;
- int i4;
- int j4;
- int k4;
- int l4;
- int i5;
- double d3;
- double d4;
- for (i2 = i - b0; i2 <= i + b0; ++i2)
- {
- d1 = (double) i2 + 0.5D - entity.posX;
- for (k2 = k - b0; k2 <= k + b0; ++k2)
- {
- d2 = (double) k2 + 0.5D - entity.posZ;
- label271:
- for (i3 = this.worldServerInstance.getActualHeight() - 1; i3 >= 0; --i3)
- {
- if (this.worldServerInstance.isAirBlock(new BlockPos(i2, i3, k2)))
- {
- while (i3 > 0 && this.worldServerInstance.isAirBlock(new BlockPos(i2, i3 - 1,
- k2)))
- {
- --i3;
- }
- for (j3 = l1; j3 < l1 + 4; ++j3)
- {
- k3 = j3 % 2;
- l3 = 1 - k3;
- if (j3 % 4 >= 2)
- {
- k3 = -k3;
- l3 = -l3;
- }
- for (i4 = 0; i4 < 3; ++i4)
- {
- for (j4 = 0; j4 < 4; ++j4)
- {
- for (k4 = -1; k4 < 4; ++k4)
- {
- l4 = i2 + (j4 - 1) * k3 + i4 * l3;
- i5 = i3 + k4;
- int j5 = k2 + (j4 - 1) * l3 - i4 * k3;
- if (k4 < 0 &&
- !this.worldServerInstance.getBlockState(new BlockPos(l4, i5,
- j5)).getBlock().getMaterial().isSolid() || k4 >= 0 &&
- !this.worldServerInstance.isAirBlock(new BlockPos(l4, i5, j5)))
- {
- continue label271;
- }
- }
- }
- }
- d3 = (double) i3 + 0.5D - entity.posY;
- d4 = d1 * d1 + d3 * d3 + d2 * d2;
- if (d0 < 0.0D || d4 < d0)
- {
- d0 = d4;
- l = i2;
- i1 = i3;
- j1 = k2;
- k1 = j3 % 4;
- }
- }
- }
- }
- }
- }
- if (d0 < 0.0D)
- {
- for (i2 = i - b0; i2 <= i + b0; ++i2)
- {
- d1 = (double) i2 + 0.5D - entity.posX;
- for (k2 = k - b0; k2 <= k + b0; ++k2)
- {
- d2 = (double) k2 + 0.5D - entity.posZ;
- label219:
- for (i3 = this.worldServerInstance.getActualHeight() - 1; i3 >= 0; --i3)
- {
- if (this.worldServerInstance.isAirBlock(new BlockPos(i2, i3, k2)))
- {
- while (i3 > 0 && this.worldServerInstance.isAirBlock(new BlockPos(i2, i3
- - 1, k2)))
- {
- --i3;
- }
- for (j3 = l1; j3 < l1 + 2; ++j3)
- {
- k3 = j3 % 2;
- l3 = 1 - k3;
- for (i4 = 0; i4 < 4; ++i4)
- {
- for (j4 = -1; j4 < 4; ++j4)
- {
- k4 = i2 + (i4 - 1) * k3;
- l4 = i3 + j4;
- i5 = k2 + (i4 - 1) * l3;
- if (j4 < 0 &&
- !this.worldServerInstance.getBlockState(new BlockPos(k4, l4,
- i5)).getBlock().getMaterial().isSolid() || j4 >= 0 &&
- !this.worldServerInstance.isAirBlock(new BlockPos(k4, l4, i5)))
- {
- continue label219;
- }
- }
- }
- d3 = (double) i3 + 0.5D - entity.posY;
- d4 = d1 * d1 + d3 * d3 + d2 * d2;
- if (d0 < 0.0D || d4 < d0)
- {
- d0 = d4;
- l = i2;
- i1 = i3;
- j1 = k2;
- k1 = j3 % 2;
- }
- }
- }
- }
- }
- }
- }
- int k5 = l;
- int j2 = i1;
- k2 = j1;
- int l5 = k1 % 2;
- int l2 = 1 - l5;
- if (k1 % 4 >= 2)
- {
- l5 = -l5;
- l2 = -l2;
- }
- if (d0 < 0.0D)
- {
- i1 = MathHelper.clamp_int(i1, 70, this.worldServerInstance.getActualHeight() - 10);
- j2 = i1;
- for (i3 = -1; i3 <= 1; ++i3)
- {
- for (j3 = 1; j3 < 3; ++j3)
- {
- for (k3 = -1; k3 < 3; ++k3)
- {
- l3 = k5 + (j3 - 1) * l5 + i3 * l2;
- i4 = j2 + k3;
- j4 = k2 + (j3 - 1) * l2 - i3 * l5;
- boolean flag = k3 < 0;
- this.worldServerInstance.setBlockState(new BlockPos(l3, i4, j4), flag ?
- Blocks.quartz_block.getDefaultState() : Blocks.air.getDefaultState());
- }
- }
- }
- }
- IBlockState iblockstate = DimBlocks.dim_portal.getDefaultState().withProperty(BlockPortal.AXIS, l5 != 0 ?
- EnumFacing.Axis.X : EnumFacing.Axis.Z);
- for (j3 = 0; j3 < 4; ++j3)
- {
- for (k3 = 0; k3 < 4; ++k3)
- {
- for (l3 = -1; l3 < 4; ++l3)
- {
- i4 = k5 + (k3 - 1) * l5;
- j4 = j2 + l3;
- k4 = k2 + (k3 - 1) * l2;
- boolean flag1 = k3 == 0 || k3 == 3 || l3 == -1 || l3 == 3;
- this.worldServerInstance.setBlockState(new BlockPos(i4, j4, k4), flag1 ?
- Blocks.quartz_block.getDefaultState() : iblockstate, 2);
- }
- }
- for (k3 = 0; k3 < 4; ++k3)
- {
- for (l3 = -1; l3 < 4; ++l3)
- {
- i4 = k5 + (k3 - 1) * l5;
- j4 = j2 + l3;
- k4 = k2 + (k3 - 1) * l2;
- this.worldServerInstance.notifyNeighborsOfStateChange(new BlockPos(i4, j4, k4),
- this.worldServerInstance.getBlockState(new BlockPos(i4, j4, k4)).getBlock());
- }
- }
- }
- return true;
- }
- /**
- * called periodically to remove out-of-date portal locations from the cache list. Argument par1 is a
- * WorldServer.getTotalWorldTime() value.
- */
- public void removeStalePortalLocations(long totalWorldTime)
- {
- if (totalWorldTime % 100L == 0L)
- {
- Iterator iterator = this.destinationCoordinateKeys.iterator();
- long j = totalWorldTime - 600L;
- while (iterator.hasNext())
- {
- Long olong = (Long) iterator.next();
- TeleporterDim.PortalPosition portalposition = (TeleporterDim.PortalPosition)
- this.destinationCoordinateCache.getValueByKey(olong.longValue());
- if (portalposition == null || portalposition.lastUpdateTime < j)
- {
- iterator.remove();
- this.destinationCoordinateCache.remove(olong.longValue());
- }
- }
- }
- }
- public class PortalPosition extends BlockPos
- {
- public long lastUpdateTime;
- public PortalPosition(BlockPos pos, long worldTime)
- {
- super(pos.getX(), pos.getY(), pos.getZ());
- this.lastUpdateTime = worldTime;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment