Java Code Examples for net.minecraftforge.common.ForgeChunkManager#requestTicket()
The following examples show how to use
net.minecraftforge.common.ForgeChunkManager#requestTicket() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TicketMap.java From MyTown2 with The Unlicense | 6 votes |
@Override public ForgeChunkManager.Ticket get(Object key) { if (key instanceof Integer) { if (super.get(key) == null) { World world = DimensionManager.getWorld((Integer) key); if (world == null) { return null; } ForgeChunkManager.Ticket ticket = ForgeChunkManager.requestTicket(MyTown.instance, world, ForgeChunkManager.Type.NORMAL); ticket.getModData().setString("townName", town.getName()); ticket.getModData().setTag("chunkCoords", new NBTTagList()); put((Integer) key, ticket); return ticket; } else { return super.get(key); } } return null; }
Example 2
Source File: BaseVehicleEntity.java From CommunityMod with GNU Lesser General Public License v2.1 | 5 votes |
public BaseVehicleEntity(World worldIn) { super(worldIn); storage = new ShipStorage(getOffset(), worldIn); Ticket tic = ForgeChunkManager.requestTicket(CommunityMod.INSTANCE, DimensionManager.getWorld(StorageDimReg.storageDimensionType.getId()), Type.NORMAL); loadTicket = tic; }
Example 3
Source File: TileRailgun.java From AdvancedRocketry with MIT License | 5 votes |
@Override public void onLoad() { if(ticket == null) { ticket = ForgeChunkManager.requestTicket(AdvancedRocketry.instance, this.world, Type.NORMAL); if(ticket != null) ForgeChunkManager.forceChunk(ticket, new ChunkPos(getPos().getX() / 16 - (getPos().getX() < 0 ? 1 : 0), getPos().getZ() / 16 - (getPos().getZ() < 0 ? 1 : 0))); } }
Example 4
Source File: TileSpaceLaser.java From AdvancedRocketry with MIT License | 5 votes |
/** * Checks to see if the situation for firing the laser exists... and changes the state accordingly */ public void checkCanRun() { //Laser requires lense, redstone power, not be jammed, and be in orbit and energy to function if(world.isBlockIndirectlyGettingPowered(getPos()) == 0 || !isAllowedToRun()) { if(laserSat.isAlive()) { laserSat.deactivateLaser(); } setRunning(false); } else if(!laserSat.isAlive() && !finished && !laserSat.getJammed() && world.isBlockIndirectlyGettingPowered(getPos()) > 0 && canMachineSeeEarth()) { //Laser will be on at this point int orbitDimId = ((WorldProviderSpace)this.world.provider).getDimensionProperties(getPos()).getParentPlanet(); if(orbitDimId == SpaceObjectManager.WARPDIMID) return; WorldServer orbitWorld = DimensionManager.getWorld(orbitDimId); if(orbitWorld == null) { DimensionManager.initDimension(orbitDimId); orbitWorld = DimensionManager.getWorld(orbitDimId); if(orbitWorld == null) return; } if(ticket == null) { ticket = ForgeChunkManager.requestTicket(AdvancedRocketry.instance, this.world, Type.NORMAL); if(ticket != null) ForgeChunkManager.forceChunk(ticket, new ChunkPos(getPos().getX() / 16 - (getPos().getX() < 0 ? 1 : 0), getPos().getZ() / 16 - (getPos().getZ() < 0 ? 1 : 0))); } setRunning(laserSat.activateLaser(orbitWorld, laserX, laserZ)); } if(!this.world.isRemote) PacketHandler.sendToNearby(new PacketMachine(this, (byte)12), 128, pos, this.world.provider.getDimension()); }
Example 5
Source File: SatelliteLaser.java From AdvancedRocketry with MIT License | 5 votes |
/** * creates the laser and begins mining. This can * fail if the chunk cannot be force loaded * @param world world to spawn the laser into * @param x x coord * @param z z coord * @return whether creating the laser is successful */ public boolean activateLaser(World world, int x, int z) { ticketLaser = ForgeChunkManager.requestTicket(AdvancedRocketry.instance, world, Type.NORMAL); if(ticketLaser != null) { ForgeChunkManager.forceChunk(ticketLaser, new ChunkPos(x >> 4, z >> 4)); int y = 64; if(world.getChunkFromChunkCoords(x >> 4, z >> 4).isLoaded()) { int current = 0; for(int i = 0; i < 9; i++) { current = world.getTopSolidOrLiquidBlock(new BlockPos(x + (i % 3) - 1, 0xFF, z + (i / 3) - 1)).getY(); if(current > y) y = current; } if(y < 1) y = 255; } else y = 255; laser = new EntityLaserNode(world, x, y, z); laser.forceSpawn = true; world.spawnEntity(laser); return true; } return false; }
Example 6
Source File: ChunkLoaderManager.java From ChickenChunks with MIT License | 4 votes |
@Override protected Ticket createTicket(int dimension) { return ForgeChunkManager.requestTicket(mod, DimensionManager.getWorld(dimension), Type.NORMAL); }