net.minecraftforge.common.ForgeChunkManager.Type Java Examples

The following examples show how to use net.minecraftforge.common.ForgeChunkManager.Type. 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: BaseVehicleEntity.java    From CommunityMod with GNU Lesser General Public License v2.1 5 votes vote down vote up
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 #2
Source File: ChunkLoadManager.java    From Signals with GNU General Public License v3.0 5 votes vote down vote up
public boolean markAsChunkLoader(String chunkloadingPlayer, EntityMinecart cart){
    Ticket ticket = ForgeChunkManager.requestPlayerTicket(Signals.instance, chunkloadingPlayer, cart.world, Type.ENTITY);
    if(ticket != null) {
        ticket.bindEntity(cart);
        add(ticket);
        return true;
    } else {
        return false;
    }
}
 
Example #3
Source File: TileRailgun.java    From AdvancedRocketry with MIT License 5 votes vote down vote up
@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 vote down vote up
/**
 * 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 vote down vote up
/**
 * 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 vote down vote up
@Override
public Ticket createTicket(int dimension) {
    return ForgeChunkManager.requestPlayerTicket(ChickenChunks.instance, username, DimensionManager.getWorld(dimension), Type.NORMAL);
}
 
Example #7
Source File: ChunkLoaderManager.java    From ChickenChunks with MIT License 4 votes vote down vote up
@Override
protected Ticket createTicket(int dimension) {
    return ForgeChunkManager.requestTicket(mod, DimensionManager.getWorld(dimension), Type.NORMAL);
}