Java Code Examples for net.minecraft.world.ChunkCoordIntPair#chunkXZ2Int()

The following examples show how to use net.minecraft.world.ChunkCoordIntPair#chunkXZ2Int() . 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: VanillaChunkHashMap.java    From Thermos with GNU General Public License v3.0 5 votes vote down vote up
private long V2B(long key) {
	if(notRealFace)
	{
        return key;
	}
	else
	{
		return ChunkCoordIntPair.chunkXZ2Int(LongHash.msw(key) , LongHash.lsw(key));
	}
	//return LongHash.toLong((int) (key & 0xFFFFFFFFL), (int) (key >>> 32));
}
 
Example 2
Source File: ForgeQueue_All.java    From FastAsyncWorldedit with GNU General Public License v3.0 5 votes vote down vote up
@Override
public boolean regenerateChunk(World world, int x, int z, BaseBiome biome, Long seed) {
    IChunkProvider provider = world.getChunkProvider();
    if (!(provider instanceof ChunkProviderServer)) {
        return false;
    }
    ChunkProviderServer chunkServer = (ChunkProviderServer) provider;
    IChunkProvider chunkProvider = chunkServer.serverChunkGenerator;

    long pos = ChunkCoordIntPair.chunkXZ2Int(x, z);
    Chunk mcChunk;
    if (chunkServer.chunkExists(x, z)) {
        mcChunk = chunkServer.loadChunk(x, z);
        mcChunk.onChunkUnload();
    }
    try {
        Field droppedChunksSetField = chunkServer.getClass().getDeclaredField("field_73248_b");
        droppedChunksSetField.setAccessible(true);
        Set droppedChunksSet = (Set) droppedChunksSetField.get(chunkServer);
        droppedChunksSet.remove(pos);
    } catch (Throwable e) {
        MainUtil.handleError(e);
    }
    chunkServer.id2ChunkMap.remove(pos);
    mcChunk = chunkProvider.provideChunk(x, z);
    chunkServer.id2ChunkMap.add(pos, mcChunk);
    chunkServer.loadedChunks.add(mcChunk);
    if (mcChunk != null) {
        mcChunk.onChunkLoad();
        mcChunk.populateChunk(chunkProvider, chunkProvider, x, z);
    }
    return true;
}
 
Example 3
Source File: MultiblockWorldRegistry.java    From BeefCore with MIT License 5 votes vote down vote up
/**
 * Called when a chunk has finished loading. Adds all of the parts which are awaiting
 * load to the list of parts which are orphans and therefore will be added to machines
 * after the next world tick.
 * 
 * @param chunkX Chunk X coordinate (world coordate >> 4) of the chunk that was loaded
 * @param chunkZ Chunk Z coordinate (world coordate >> 4) of the chunk that was loaded
 */
public void onChunkLoaded(int chunkX, int chunkZ) {
	long chunkHash = ChunkCoordIntPair.chunkXZ2Int(chunkX, chunkZ);
	if(partsAwaitingChunkLoad.containsKey(chunkHash)) {
		synchronized(partsAwaitingChunkLoadMutex) {
			if(partsAwaitingChunkLoad.containsKey(chunkHash)) {
				addAllOrphanedPartsThreadsafe(partsAwaitingChunkLoad.get(chunkHash));
				partsAwaitingChunkLoad.remove(chunkHash);
			}
		}
	}
}
 
Example 4
Source File: CoordTriplet.java    From BeefCore with MIT License votes vote down vote up
public long getChunkXZHash() { return ChunkCoordIntPair.chunkXZ2Int(x >> 4, z >> 4); }