本文整理了Java中net.minecraft.world.World.getChunkFromChunkCoords()
方法的一些代码示例,展示了World.getChunkFromChunkCoords()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。World.getChunkFromChunkCoords()
方法的具体详情如下:
包路径:net.minecraft.world.World
类名称:World
方法名:getChunkFromChunkCoords
暂无
代码示例来源:origin: EngineHub/WorldEdit
@Override
public void fixLighting(Iterable<BlockVector2> chunks) {
World world = getWorld();
for (BlockVector2 chunk : chunks) {
world.getChunkFromChunkCoords(chunk.getBlockX(), chunk.getBlockZ()).resetRelightChecks();
}
}
代码示例来源:origin: AppliedEnergistics/Applied-Energistics-2
public ChunkOnly( final World w, final int cx, final int cz )
{
super( w );
this.target = w.getChunkFromChunkCoords( cx, cz );
this.cx = cx;
this.cz = cz;
}
代码示例来源:origin: EngineHub/WorldEdit
freshWorld.getChunkFromChunkCoords(chunk.getBlockX(), chunk.getBlockZ());
代码示例来源:origin: EngineHub/WorldEdit
Chunk chunk = world.getChunkFromChunkCoords(x >> 4, z >> 4);
BlockPos pos = new BlockPos(x, y, z);
IBlockState old = chunk.getBlockState(pos);
代码示例来源:origin: AppliedEnergistics/Applied-Energistics-2
final Chunk c = w.getChunkFromChunkCoords( cx, cz );
代码示例来源:origin: SleepyTrousers/EnderIO
@Override
public @Nonnull Chunk getChunkFromChunkCoords(int chunkX, int chunkZ) {
return wrapped.getChunkFromChunkCoords(chunkX, chunkZ);
}
代码示例来源:origin: AppliedEnergistics/Applied-Energistics-2
this.myColumns[x][z] = new Column( w.getChunkFromChunkCoords( ( minX + x ) >> 4,
( minZ + z ) >> 4 ), ( minX + x ) & 0xF, ( minZ + z ) & 0xF, minCY, cy_size );
final List<BlockPos> deadTiles = new ArrayList<>();
final Chunk c = w.getChunkFromChunkCoords( minCX + cx, minCZ + cz );
this.myChunks[cx][cz] = c;
代码示例来源:origin: amadornes/MCMultiPart
@Override
public Chunk getChunkFromChunkCoords(int chunkX, int chunkZ) {
return getActualWorld().getChunkFromChunkCoords(chunkX, chunkZ);
}
代码示例来源:origin: P3pp3rF1y/AncientWarfare2
private static boolean isAverageHeightWithin(World world, int cx, int cz, int min, int max) {
Chunk chunk = world.getChunkFromChunkCoords(cx, cz);
int val;
int total = 0;
for (int x = (cx << 4); x < ((cx << 4) + 16); x++) {
for (int z = (cz << 4); z < ((cz << 4) + 16); z++) {
val = getTopFilledHeight(chunk, x, z);
if (val < 0) {
return false;
}//exit out if a non-proper block-type is detected
total += val;
}
}
total /= 256; //make it the average top-height of all blocks in chunk
return total >= min && total <= max;
}
代码示例来源:origin: ValkyrienWarfare/Valkyrien-Warfare-Revamped
public VWChunkCache(World world, int mnX, int mnZ, int mxX, int mxZ) {
worldFor = world;
minChunkX = mnX >> 4;
minChunkZ = mnZ >> 4;
maxChunkX = mxX >> 4;
maxChunkZ = mxZ >> 4;
cachedChunks = new Chunk[maxChunkX - minChunkX + 1][maxChunkZ - minChunkZ + 1];
isChunkLoaded = new boolean[maxChunkX - minChunkX + 1][maxChunkZ - minChunkZ + 1];
for (int x = minChunkX; x <= maxChunkX; x++) {
for (int z = minChunkZ; z <= maxChunkZ; z++) {
cachedChunks[x - minChunkX][z - minChunkZ] = world.getChunkFromChunkCoords(x, z);
isChunkLoaded[x - minChunkX][z - minChunkZ] = !cachedChunks[x - minChunkX][z - minChunkZ].isEmpty();
if (!isChunkLoaded[x - minChunkX][z - minChunkZ]) {
allLoaded = false;
}
}
}
}
代码示例来源:origin: lawremi/CustomOreGen
public static void chunkForced(World world, ChunkPos location) {
if (forcingChunk) { // prevent infinite recursion when there are multiple chunk loaders
return;
}
forcingChunk = true;
WorldConfig cfg = getWorldConfig(world);
int radius = (cfg.deferredPopulationRange + 15) / 16;
for (int cX = location.x - radius; cX <= location.x + radius; ++cX)
{
for (int cZ = location.z - radius; cZ <= location.z + radius; ++cZ)
{
if (cX != location.x && cZ != location.z) {
world.getChunkFromChunkCoords(cX, cZ);
}
}
}
forcingChunk = false;
}
}
代码示例来源:origin: P3pp3rF1y/AncientWarfare2
private static void addValidTilesInChunkArea(World world, int x1, int y1, int z1, int x2, int y2, int z2, List<TileEntity> tileEntities, int x, int z) {
Chunk chunk = world.getChunkFromChunkCoords(x, z);
for (TileEntity tile : chunk.getTileEntityMap().values()) {
if (!tile.isInvalid() && isTileInArea(x1, y1, z1, x2, y2, z2, tile)) {
tileEntities.add(tile);
}
}
}
代码示例来源:origin: MCTCP/TerrainControl
private Chunk[] loadFourChunks(ChunkCoordinate topLeft)
{
Chunk[] chunkCache = new Chunk[4];
for (int indexX = 0; indexX <= 1; indexX++)
{
for (int indexZ = 0; indexZ <= 1; indexZ++)
{
chunkCache[indexX | (indexZ << 1)] = this.world.getChunkFromChunkCoords(
topLeft.getChunkX() + indexX,
topLeft.getChunkZ() + indexZ
);
}
}
return chunkCache;
}
代码示例来源:origin: MatterOverdrive/MatterOverdrive-Legacy-Edition
public boolean hasToManyAndroids() {
Chunk chunk = world.getChunkFromChunkCoords(chunkCoordX, chunkCoordZ);
int androidCount = 0;
for (int i = 0; i < chunk.getEntityLists().length; i++) {
for (Entity entity : chunk.getEntityLists()[i]) {
if (entity instanceof EntityRougeAndroidMob) {
androidCount++;
if (androidCount > EntityRogueAndroid.MAX_ANDROIDS_PER_CHUNK) {
return true;
}
}
}
}
return false;
}
代码示例来源:origin: Chisel-Team/Chisel
@Override
public void run() {
Chunk chunk = Chisel.proxy.getClientWorld().getChunkFromChunkCoords(message.chunk.x, message.chunk.z);
IChunkData<?> data = INSTANCE.data.get(message.key);
data.readFromNBT(chunk, message.tag);
int x = chunk.x << 4;
int z = chunk.z << 4;
Chisel.proxy.getClientWorld().markBlockRangeForRenderUpdate(x, 0, z, x, 255, z);
}
});
代码示例来源:origin: lawremi/CustomOreGen
private static boolean chunkHasBeenPopulated(World world, int chunkX, int chunkZ) {
// NOTE: We assume the chunk has been populated if it is only on disk,
// because if we load it to check, it will be populated automatically.
return chunkIsLoaded(world, chunkX, chunkZ) ?
world.getChunkFromChunkCoords(chunkX, chunkZ).isTerrainPopulated() :
chunkIsSaved(world, chunkX, chunkZ);
}
代码示例来源:origin: MCTCP/TerrainControl
private Chunk getChunk(int x, int y, int z)
{
if (y < TerrainControl.WORLD_DEPTH || y >= TerrainControl.WORLD_HEIGHT)
return null;
int chunkX = x >> 4;
int chunkZ = z >> 4;
if (this.chunkCache == null)
{
// Blocks requested outside population step
// (Tree growing, /tc spawn, etc.)
return this.world.getChunkFromChunkCoords(chunkX, chunkZ);
}
// Restrict to chunks we are currently populating
Chunk topLeftCachedChunk = this.chunkCache[0];
int indexX = (chunkX - topLeftCachedChunk.x);
int indexZ = (chunkZ - topLeftCachedChunk.z);
if ((indexX == 0 || indexX == 1) && (indexZ == 0 || indexZ == 1))
{
return this.chunkCache[indexX | (indexZ << 1)];
} else
{
// Outside area
if (this.settings.getWorldConfig().populationBoundsCheck)
{
return null;
}
return this.getLoadedChunkWithoutMarkingActive(chunkX, chunkZ);
}
}
代码示例来源:origin: TheCBProject/EnderStorage
public void invert() {
invert_redstone = !invert_redstone;
world.getChunkFromChunkCoords(pos.getX(), pos.getZ()).markDirty();
}
}
代码示例来源:origin: McJtyMods/DeepResonance
private List<EntityPlayerMP> getAllPlayersWatchingBlock(World world, int x, int z) {
List<EntityPlayerMP> ret = new ArrayList<>();
if(world instanceof WorldServer) {
PlayerChunkMap playerManager = ((WorldServer)world).getPlayerChunkMap();
for (EntityPlayerMP player : ((WorldServer) getWorld()).getMinecraftServer().getPlayerList().getPlayers()) {
Chunk chunk = world.getChunkFromChunkCoords(x >> 4, z >> 4);
if (playerManager.isPlayerWatchingChunk(player, chunk.x, chunk.z)) {
ret.add(player);
}
}
}
return ret;
}
代码示例来源:origin: ValkyrienWarfare/Valkyrien-Warfare-Revamped
@Inject(method = "addEntity(Lnet/minecraft/entity/Entity;)V", at = @At("HEAD"), cancellable = true)
public void preAddEntity(Entity entityIn, CallbackInfo callbackInfo) {
World world = this.world;
int i = MathHelper.floor(entityIn.posX / 16.0D);
int j = MathHelper.floor(entityIn.posZ / 16.0D);
if (i == this.x && j == this.z) {
//do nothing, and let vanilla code take over after our injected code is done (now)
} else {
Chunk realChunkFor = world.getChunkFromChunkCoords(i, j);
if (!realChunkFor.isEmpty() && realChunkFor.loaded) {
realChunkFor.addEntity(entityIn);
callbackInfo.cancel(); //don't run the code on this chunk!!!
}
}
}
}
内容来源于网络,如有侵权,请联系作者删除!