@Override public Chunk getLoadedChunk(int x, int z) { Chunk tryget = super.getLoadedChunk(x, z); if (tryget == null && m_modPrefix != null && x == m_remoteChunkX && z == m_remoteChunkZ && Util.isPrefixInCallStack(m_modPrefix)) { // some mods use this to check if a chunk is loaded client side... // but they don't actually use the chunk so just give them *something* return new EmptyChunk(m_world, 0, 0); } else { return tryget; } }
static boolean syncRead(ByteBuf buff, EntityPlayer player) { boolean first = true; while (true) { byte state = buff.readByte(); if (state == 0) return true; if (state != 1) { log("Corrupt data sync packet!?"); return true; } Coord at = readCoord(buff, player); if (first && at.getChunk() instanceof EmptyChunk) { return false; } first = false; EnumFacing side = readSide(buff); FlatFace face = readFace(buff); if (face == null) continue; Flat.setWithNotification(at, side, face, FlatChunkLayer.FLAGS_SEAMLESS); } }
public ChunkProviderServer(WorldServer p_i1520_1_, IChunkLoader p_i1520_2_, IChunkProvider p_i1520_3_) { this.dummyChunk = new EmptyChunk(p_i1520_1_, 0, 0); this.worldObj = p_i1520_1_; this.chunkLoader = p_i1520_2_; this.serverChunkGenerator = p_i1520_3_; }
@SubscribeEvent public void onChunkUnLoad(ChunkEvent.Unload event) { if(event.getChunk() instanceof EmptyChunk) return; for(WorldExtension extension : worldMap.get(event.world)) extension.unloadChunk(event.getChunk()); if(event.world.isRemote) removeChunk(event.world, event.getChunk()); }
public FlatFace set(Coord at, EnumFacing dir, FlatFace face, byte flags) { if (chunk instanceof EmptyChunk) { Core.logWarning("FlatLayer.set called on empty chunk", chunk); } if (face == FlatFaceAir.INSTANCE) { face = null; } final int slabY = at.y >> 4; final int localY = at.y & 0xF; final int localX = at.x & 0xF; final int localZ = at.z & 0xF; Slab slab = slabIndex(slabY); short index = index(localX, localY, localZ, dir); if (index == -1) { return FlatFaceAir.INSTANCE; } int oSet = slab.set; Slab newSlab = slab.set(index, face, at, flags); if (slab != newSlab) { slabs[slabY] = newSlab; } set += newSlab.set - oSet; FlatFace ret = slab.get(index); renderInfo.markDirty(at); if ((flags & FLAG_SYNC) > 0) { addChange(at, dir); } if ((flags & FLAG_NOTIFY_NEIGHBORS) > 0) { Flat.onFaceChanged(at, dir); } chunk.setChunkModified(); return ret; }
public ChunkProviderServer(World world, IChunkLoader loader, IChunkProvider provider) { this.defaultEmptyChunk = new EmptyChunk(world, 0, 0); this.worldObj = world; this.currentChunkLoader = loader; this.currentChunkProvider = provider; // TODO: Do a static calc to speed things up if possible. Need // to find out if this assumption is safe. this.worryAboutSpawn = this.worldObj.provider.canRespawnHere() && DimensionManager.shouldLoadSpawn(this.worldObj.provider.dimensionId); }
public ChunkProviderServer(WorldServer par1WorldServer, IChunkLoader par2IChunkLoader, IChunkProvider par3IChunkProvider) { this.defaultEmptyChunk = new EmptyChunk(par1WorldServer, 0, 0); this.worldObj = par1WorldServer; this.currentChunkLoader = par2IChunkLoader; this.currentChunkProvider = par3IChunkProvider; }
public ChunkProviderServer(WorldServer p_i1520_1_, IChunkLoader p_i1520_2_, IChunkProvider p_i1520_3_) { this.initialTick = MinecraftServer.currentTick; // Cauldron keep track of when the loader was created this.defaultEmptyChunk = new EmptyChunk(p_i1520_1_, 0, 0); this.worldObj = p_i1520_1_; this.currentChunkLoader = p_i1520_2_; this.currentChunkProvider = p_i1520_3_; }
public ChunkProviderServer(WorldServer p_i1520_1_, IChunkLoader p_i1520_2_, IChunkProvider p_i1520_3_) { this.defaultEmptyChunk = new EmptyChunk(p_i1520_1_, 0, 0); this.worldObj = p_i1520_1_; this.currentChunkLoader = p_i1520_2_; this.currentChunkProvider = p_i1520_3_; }
@Override public Chunk provideChunk(int i, int j) { //Don't generate any further than 5 chunks if (Math.abs(i) > size || Math.abs(j) > size) return new EmptyChunk(this.worldObj, i, j); Chunk chunk = new Chunk(this.worldObj, i, j); //Generate an layerd chunk for (int k = 0; k < 1; ++k) { int l = k >> 4; ExtendedBlockStorage extendedblockstorage = chunk.getBlockStorageArray()[l]; if (extendedblockstorage == null) { extendedblockstorage = new ExtendedBlockStorage(k, !this.worldObj.provider.hasNoSky); chunk.getBlockStorageArray()[l] = extendedblockstorage; } for (int i1 = 0; i1 < 16; ++i1) { for (int j1 = 0; j1 < 16; ++j1) { extendedblockstorage.setExtBlockID(i1, k & 15, j1, Block.grass.blockID); } } } chunk.generateSkylightMap(); return chunk; }
public ChunkProviderClient(World worldIn) { this.blankChunk = new EmptyChunk(worldIn, 0, 0); this.worldObj = worldIn; }
public ChunkProviderClient(World par1World) { this.blankChunk = new EmptyChunk(par1World, 0, 0); this.worldObj = par1World; }
private void updateWaterOpacity() { if (this.mc.getIntegratedServer() != null) { Config.waterOpacityChanged = true; } byte opacity = 3; if (this.ofClearWater) { opacity = 1; } BlockUtils.setLightOpacity(Blocks.water, opacity); BlockUtils.setLightOpacity(Blocks.flowing_water, opacity); if (this.mc.theWorld != null) { IChunkProvider cp = this.mc.theWorld.getChunkProvider(); if (cp != null) { for (int x = -512; x < 512; ++x) { for (int z = -512; z < 512; ++z) { if (cp.chunkExists(x, z)) { Chunk c = cp.provideChunk(x, z); if (c != null && !(c instanceof EmptyChunk)) { ExtendedBlockStorage[] ebss = c.getBlockStorageArray(); for (int i = 0; i < ebss.length; ++i) { ExtendedBlockStorage ebs = ebss[i]; if (ebs != null) { NibbleArray na = ebs.getSkylightArray(); if (na != null) { byte[] data = na.data; for (int d = 0; d < data.length; ++d) { data[d] = 0; } } } } c.generateSkylightMap(); } } } } this.mc.renderGlobal.loadRenderers(); } } }
public void updateWaterOpacity() { byte opacity = 3; if (Config.isClearWater()) { opacity = 1; } BlockUtils.setLightOpacity(Blocks.water, opacity); BlockUtils.setLightOpacity(Blocks.flowing_water, opacity); IChunkProvider cp = this.chunkProvider; if (cp != null) { for (int x = -512; x < 512; ++x) { for (int z = -512; z < 512; ++z) { if (cp.chunkExists(x, z)) { Chunk c = cp.provideChunk(x, z); if (c != null && !(c instanceof EmptyChunk)) { ExtendedBlockStorage[] ebss = c.getBlockStorageArray(); for (int i = 0; i < ebss.length; ++i) { ExtendedBlockStorage ebs = ebss[i]; if (ebs != null) { NibbleArray na = ebs.getSkylightArray(); if (na != null) { byte[] data = na.data; for (int d = 0; d < data.length; ++d) { data[d] = 0; } } } } c.generateSkylightMap(); } } } } } }
public ChunkProviderClient(World p_i1184_1_) { this.blankChunk = new EmptyChunk(p_i1184_1_, 0, 0); this.worldObj = p_i1184_1_; }
public ChunkProviderServer(WorldServer p_i1520_1_, IChunkLoader p_i1520_2_, IChunkProvider p_i1520_3_) { this.field_73249_c = new EmptyChunk(p_i1520_1_, 0, 0); this.field_73251_h = p_i1520_1_; this.field_73247_e = p_i1520_2_; this.field_73246_d = p_i1520_3_; }
public ChunkProviderClient(World p_i1184_1_) { this.field_73238_a = new EmptyChunk(p_i1184_1_, 0, 0); this.field_73235_d = p_i1184_1_; }