net.minecraft.world.chunk.ChunkStatus Java Examples

The following examples show how to use net.minecraft.world.chunk.ChunkStatus. 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: MixinClientChunkManager.java    From multiconnect with MIT License 6 votes vote down vote up
@Inject(method = "loadChunkFromPacket", at = @At("RETURN"))
private void onLoadChunkFromPacket(int x, int z, BiomeArray biomes, PacketByteBuf buf, CompoundTag heightmaps, int verticalStripBitmask, boolean bl, CallbackInfoReturnable<WorldChunk> ci) {
    if (ConnectionInfo.protocolVersion <= Protocols.V1_12_2) {
        if (ci.getReturnValue() != null) {
            synchronized (LOCK) {
                UpgradeData upgradeData = ChunkUpgrader.fixChunk(ci.getReturnValue());
                ((IUpgradableChunk) ci.getReturnValue()).multiconnect_setClientUpgradeData(upgradeData);
                for (int dx = -1; dx <= 1; dx++) {
                    for (int dz = -1; dz <= 1; dz++) {
                        WorldChunk chunk = getChunk(x + dx, z + dz, ChunkStatus.FULL, false);
                        if (chunk != null)
                            ((IUpgradableChunk) chunk).multiconnect_onNeighborLoaded();
                    }
                }
            }
        }
    }
}
 
Example #2
Source File: EatBreadcrumbsGoal.java    From the-hallow with MIT License 5 votes vote down vote up
@Override
protected boolean isTargetPos(WorldView world, BlockPos pos) {
	Chunk chunk1 = world.getChunk(pos.getX() >> 4, pos.getZ() >> 4, ChunkStatus.FULL, false);
	if (chunk1 == null) {
		return false;
	} else {
		return chunk1.getBlockState(pos).getBlock() == this.targetBlock && chunk1.getBlockState(pos.up()).isAir() && chunk1.getBlockState(pos.up(2)).isAir();
	}
}
 
Example #3
Source File: MixinWorld.java    From multiconnect with MIT License 5 votes vote down vote up
@Override
public Biome multiconnect_getBiome_1_14_4(int x, int z) {
    Chunk chunk = getChunk(x >> 4, z >> 4, ChunkStatus.BIOMES, false);
    if (chunk instanceof IBiomeStorage_1_14_4)
        return ((IBiomeStorage_1_14_4) chunk).multiconnect_getBiome_1_14_4(x & 15, z & 15);
    return null;
}
 
Example #4
Source File: MixinWorldChunk.java    From multiconnect with MIT License 5 votes vote down vote up
@Override
public void multiconnect_onNeighborLoaded() {
    if (clientUpgradeData != null) {
        for (int dx = -1; dx <= 1; dx++) {
            for (int dz = -1; dz <= 1; dz++) {
                if (world.getChunk(pos.x + dx, pos.z + dz, ChunkStatus.FULL, false) == null) {
                    return;
                }
            }
        }
        clientUpgradeData.upgrade((WorldChunk) (Object) this);
        clientUpgradeData = null;
    }
}
 
Example #5
Source File: ChunkHolder_scarpetChunkCreationMixin.java    From fabric-carpet with MIT License 5 votes vote down vote up
@Override
public CompletableFuture<Either<Chunk, ChunkHolder.Unloaded>> setDefaultProtoChunk(ChunkPos chpos, ThreadExecutor<Runnable> executor)
{
    int i = ChunkStatus.EMPTY.getIndex();
    CompletableFuture<Either<Chunk, ChunkHolder.Unloaded>> completableFuture2 = CompletableFuture.supplyAsync(
            () -> Either.left(new ProtoChunk(chpos, UpgradeData.NO_UPGRADE_DATA)),
            executor
    );
    updateFuture(completableFuture2);
    futuresByStatus.set(i, completableFuture2);
    return completableFuture2;
}
 
Example #6
Source File: StructureFeatureMixin.java    From fabric-carpet with MIT License 5 votes vote down vote up
private StructureStart forceStructureStart(IWorld worldIn, ChunkGenerator <? extends ChunkGeneratorConfig > generator, Random rand, long packedChunkPos)
{
    ChunkPos chunkpos = new ChunkPos(packedChunkPos);
    StructureStart structurestart;

    Chunk ichunk = worldIn.getChunk(chunkpos.x, chunkpos.z, ChunkStatus.STRUCTURE_STARTS, false);

    if (ichunk != null)
    {
        structurestart = ichunk.getStructureStart(this.getName());

        if (structurestart != null && structurestart != StructureStart.DEFAULT)
        {
            return structurestart;
        }
    }
    Biome biome_1 = generator.getBiomeSource().getBiomeForNoiseGen((chunkpos.getStartX() + 9) >> 2, 0, (chunkpos.getStartZ() + 9) >> 2 );
    StructureStart structurestart1 = getStructureStartFactory().create((StructureFeature)(Object)this, chunkpos.x, chunkpos.z, BlockBox.empty(),0,generator.getSeed());
    structurestart1.initialize(generator, ((ServerWorld)worldIn).getStructureManager() , chunkpos.x, chunkpos.z, biome_1);
    structurestart = structurestart1.hasChildren() ? structurestart1 : StructureStart.DEFAULT;

    if (structurestart.hasChildren())
    {
        worldIn.getChunk(chunkpos.x, chunkpos.z).setStructureStart(this.getName(), structurestart);
    }

    //long2objectmap.put(packedChunkPos, structurestart);
    return structurestart;
}
 
Example #7
Source File: MixinChunkStatus.java    From patchwork-api with GNU Lesser General Public License v2.1 4 votes vote down vote up
@Override
public IForgeRegistryEntry<ChunkStatus> setRegistryName(Identifier name) {
	this.registryName = name;

	return this;
}
 
Example #8
Source File: MixinChunkStatus.java    From patchwork-api with GNU Lesser General Public License v2.1 4 votes vote down vote up
public Identifier getRegistryName() {
	ChunkStatus chunkStatus = (ChunkStatus) (Object) this;

	return Identifiers.getOrFallback(Registry.CHUNK_STATUS, chunkStatus, registryName);
}
 
Example #9
Source File: MixinChunkStatus.java    From patchwork-api with GNU Lesser General Public License v2.1 4 votes vote down vote up
public Class<ChunkStatus> getRegistryType() {
	return ChunkStatus.class;
}
 
Example #10
Source File: MixinWorld.java    From multiconnect with MIT License votes vote down vote up
@Shadow public abstract Chunk getChunk(int x, int z, ChunkStatus status, boolean boolean_1); 
Example #11
Source File: MixinClientChunkManager.java    From multiconnect with MIT License votes vote down vote up
@Shadow public abstract WorldChunk getChunk(int x, int z, ChunkStatus status, boolean create); 
Example #12
Source File: ThreadedAnvilChunkStorage_scarpetChunkCreationMixin.java    From fabric-carpet with MIT License votes vote down vote up
@Shadow public abstract CompletableFuture<Either<Chunk, ChunkHolder.Unloaded>> createChunkFuture(ChunkHolder chunkHolder, ChunkStatus chunkStatus);