public void loadChunks() { if(!worldObj.isRemote) { while(chunkTicket == null) { chunkTicket = ForgeChunkManager.requestTicket(AdvancedUtilities.instance, worldObj, Type.NORMAL); } if(chunkTicket==null) { System.out.println("FuckingHell"); } chunkTicket.getModData().setInteger("type", AdvancedUtilitiesChunkLoadCallback.ChunkLoaderBlockID); chunkTicket.getModData().setInteger("blockX", xCoord); chunkTicket.getModData().setInteger("blockY", yCoord); chunkTicket.getModData().setInteger("blockZ", zCoord); ForgeChunkManager.forceChunk(chunkTicket, new ChunkCoordIntPair(xCoord>>4, zCoord >>4)); } }
public static void forceChunkLoad(World w, ChunkPos pos) { if (!ticketList.containsKey(pos)) { if (chunkLoaderTicket == null) { chunkLoaderTicket = ForgeChunkManager.requestTicket(Currency.INSTANCE, w, Type.NORMAL); } ticketList.put(pos, 1); ForgeChunkManager.forceChunk(chunkLoaderTicket, pos); } else { ticketList.put(pos, ticketList.get(pos) + 1); } }
public final void setupInitialTicket() { if(chunkTicket!=null){ForgeChunkManager.releaseTicket(chunkTicket);} if(getUpgrades().contains(WorksiteUpgrade.BASIC_CHUNK_LOADER) || getUpgrades().contains(WorksiteUpgrade.QUARRY_CHUNK_LOADER)) { setTicket(ForgeChunkManager.requestTicket(CrystalMod.instance, getWorld(), Type.NORMAL)); } }
@Override protected void onCreated() { if(ticket == null) { ticket = ForgeChunkManager.requestTicket(AdvancedRocketry.instance, this.worldObj, Type.NORMAL); if(ticket != null) ForgeChunkManager.forceChunk(ticket, new ChunkCoordIntPair(this.xCoord / 16 - (this.xCoord < 0 ? 1 : 0), this.zCoord / 16 - (this.zCoord < 0 ? 1 : 0))); } }
/** * 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(!isAllowedToRun() || !worldObj.isBlockIndirectlyGettingPowered(xCoord, yCoord, zCoord)) { if(laserSat.isAlive()) { laserSat.deactivateLaser(); } setRunning(false); } else if(!laserSat.isAlive() && !finished && !laserSat.getJammed() && worldObj.isBlockIndirectlyGettingPowered(xCoord, yCoord, zCoord) && canMachineSeeEarth()) { //Laser will be on at this point int orbitDimId = ((WorldProviderSpace)this.worldObj.provider).getDimensionProperties(xCoord, zCoord).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.worldObj, Type.NORMAL); if(ticket != null) ForgeChunkManager.forceChunk(ticket, new ChunkCoordIntPair(this.xCoord / 16 - (this.xCoord < 0 ? 1 : 0), this.zCoord / 16 - (this.zCoord < 0 ? 1 : 0))); } setRunning(laserSat.activateLaser(orbitWorld, laserX, laserZ)); } if(!this.worldObj.isRemote) PacketHandler.sendToNearby(new PacketMachine(this, (byte)12), this.xCoord, this.yCoord, this.zCoord, 128, this.worldObj.provider.dimensionId); }
/** * 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 ChunkCoordIntPair(x >> 4, z >> 4)); int y = 64; if(world.getChunkFromBlockCoords(x, z).isChunkLoaded) { int current = 0; for(int i = 0; i < 9; i++) { current = world.getTopSolidOrLiquidBlock(x + (i % 3) - 1, z + (i / 3) - 1); if(current > y) y = current; } if(y < 1) y = 255; } else y = 255; laser = new EntityLaserNode(world, x, y, z); laser.forceSpawn = true; world.spawnEntityInWorld(laser); return true; } return false; }
@Override public void update() { if (!MiscPeripherals.proxy.isServer()) return; Vec3 pos = turtle.getPosition(); if (pos == null) { MiscPeripherals.log.warning("Turtle position is null! "+turtle); return; } if (ticketCreated && (pos.xCoord != oldXCoord || pos.yCoord != oldYCoord || pos.zCoord != oldZCoord)) { if (ticket == null) { MiscPeripherals.log.warning("Null ticket when moving chunkloaded turtle "+(computer == null ? "[unknown]" : computer.getID())+" at ("+(int)pos.xCoord+","+(int)pos.yCoord+","+(int)pos.zCoord+")!"); } else { ForgeChunkManager.releaseTicket(ticket); ticketCreated = false; oldXCoord = pos.xCoord; oldYCoord = pos.yCoord; oldZCoord = pos.zCoord; } } if (!ticketCreated) { ticketCreated = true; ticket = ForgeChunkManager.requestTicket(MiscPeripherals.instance, turtle.getWorld(), Type.NORMAL); if (ticket == null) { MiscPeripherals.log.warning("Chunk loading limit exceeded, not chunkloading turtle "+(computer == null ? "[unknown]" : computer.getID())+" at ("+(int)pos.xCoord+","+(int)pos.yCoord+","+(int)pos.zCoord+")!"); return; } int width = (MiscPeripherals.instance.chunkLoaderRadius * 2) + 1; ticket.setChunkListDepth(width * width); } }
public EntitySpeedyChunkChestCart(World par1World) { super(par1World); if(ticket == null) ticket = ForgeChunkManager.requestTicket(AdvancedUtilities.instance, par1World, Type.ENTITY); ticket.getModData().setInteger("type", AdvancedUtilitiesChunkLoadCallback.ChunkLoaderCartID); ticket.bindEntity(this); ForgeChunkManager.forceChunk(ticket, new ChunkCoordIntPair(((int)this.posX) >> 4, ((int)this.posZ) >> 4)); }
public EntitySpeedyChunkChestCart(World par1World, double par2, double par4, double par6) { super(par1World, par2, par4, par6); if(ticket == null) ticket = ForgeChunkManager.requestTicket(AdvancedUtilities.instance, par1World, Type.ENTITY); ticket.getModData().setInteger("type", AdvancedUtilitiesChunkLoadCallback.ChunkLoaderCartID); ticket.bindEntity(this); ForgeChunkManager.forceChunk(ticket, new ChunkCoordIntPair(((int)this.posX) >> 4, ((int)this.posZ) >> 4)); }
public EntityChunkLoadingCart(World par1World) { super(par1World); if(ticket == null) ticket = ForgeChunkManager.requestTicket(AdvancedUtilities.instance, par1World, Type.ENTITY); ticket.getModData().setInteger("type", AdvancedUtilitiesChunkLoadCallback.ChunkLoaderCartID); ticket.bindEntity(this); ForgeChunkManager.forceChunk(ticket, new ChunkCoordIntPair(((int)this.posX) >> 4, ((int)this.posZ) >> 4)); }
public EntityChunkLoadingCart(World par1World, double par2, double par4, double par6) { super(par1World, par2, par4, par6); if(ticket == null) ticket = ForgeChunkManager.requestTicket(AdvancedUtilities.instance, par1World, Type.ENTITY); ticket.getModData().setInteger("type", AdvancedUtilitiesChunkLoadCallback.ChunkLoaderCartID); ticket.bindEntity(this); ForgeChunkManager.forceChunk(ticket, new ChunkCoordIntPair(((int)this.posX) >> 4, ((int)this.posZ) >> 4)); }
public EntityChunkChestCart(World par1World) { super(par1World); if(ticket == null) ticket = ForgeChunkManager.requestTicket(AdvancedUtilities.instance, par1World, Type.ENTITY); ticket.getModData().setInteger("type", AdvancedUtilitiesChunkLoadCallback.ChunkLoaderCartID); ticket.bindEntity(this); ForgeChunkManager.forceChunk(ticket, new ChunkCoordIntPair(((int)this.posX) >> 4, ((int)this.posZ) >> 4)); }
public EntityChunkChestCart(World par1World, double par2, double par4, double par6) { super(par1World, par2, par4, par6); if(ticket == null) ticket = ForgeChunkManager.requestTicket(AdvancedUtilities.instance, par1World, Type.ENTITY); ticket.getModData().setInteger("type", AdvancedUtilitiesChunkLoadCallback.ChunkLoaderCartID); ticket.bindEntity(this); ForgeChunkManager.forceChunk(ticket, new ChunkCoordIntPair(((int)this.posX) >> 4, ((int)this.posZ) >> 4)); }
public void loadMining() { if(miningTicket == null) { miningTicket = ForgeChunkManager.requestTicket(AdvancedUtilities.instance, worldObj, Type.NORMAL); } miningTicket.getModData().setInteger("type", AdvancedUtilitiesChunkLoadCallback.ChunkLoaderQuarryDigID); miningTicket.getModData().setInteger("blockX", xCoord); miningTicket.getModData().setInteger("blocky", yCoord); miningTicket.getModData().setInteger("blockz", zCoord); isLoadingMining = true; ForgeChunkManager.forceChunk(miningTicket, new ChunkCoordIntPair(digChunk[0], digChunk[1])); }
public void loadChunks() { if(chunkTicket == null) { chunkTicket = ForgeChunkManager.requestTicket(AdvancedUtilities.instance, worldObj, Type.NORMAL); } chunkTicket.getModData().setInteger("blockX", xCoord); chunkTicket.getModData().setInteger("blocky", yCoord); chunkTicket.getModData().setInteger("blockz", zCoord); chunkTicket.getModData().setInteger("type", AdvancedUtilitiesChunkLoadCallback.ChunkLoaderQuarryID); ForgeChunkManager.forceChunk(chunkTicket, new ChunkCoordIntPair(xCoord>>4, zCoord >>4)); }
@Override public Ticket createTicket(int dimension) { return ForgeChunkManager.requestPlayerTicket(instance, username, DimensionManager.getWorld(dimension), Type.NORMAL); }
@Override protected Ticket createTicket(int dimension) { return ForgeChunkManager.requestTicket(mod, DimensionManager.getWorld(dimension), Type.NORMAL); }
@Override public void onUpdate() { super.onUpdate(); if(teleportBounds == null) { resetBounds(); } if(!worldObj.isRemote) { if(chunkTicket == null) { Ticket ticket = ForgeChunkManager.requestTicket(Mekanism.instance, worldObj, Type.NORMAL); if(ticket != null) { ticket.getModData().setInteger("xCoord", xCoord); ticket.getModData().setInteger("yCoord", yCoord); ticket.getModData().setInteger("zCoord", zCoord); forceChunks(ticket); } } FrequencyManager manager = getManager(frequency); if(manager != null) { if(frequency != null && !frequency.valid) { frequency = manager.validateFrequency(owner, Coord4D.get(this), frequency); } if(frequency != null) { frequency = manager.update(owner, Coord4D.get(this), frequency); } } else { frequency = null; } status = canTeleport(); if(status == 1 && teleDelay == 0) { teleport(); } if(teleDelay == 0 && didTeleport.size() > 0) { cleanTeleportCache(); } shouldRender = status == 1 || status > 4; if(shouldRender != prevShouldRender) { Mekanism.packetHandler.sendToAllAround(new TileEntityMessage(Coord4D.get(this), getNetworkedData(new ArrayList())), Coord4D.get(this).getTargetPoint(40D)); } prevShouldRender = shouldRender; teleDelay = Math.max(0, teleDelay-1); } ChargeUtils.discharge(0, this); }