本文整理了Java中net.minecraft.world.World.getChunkProvider()
方法的一些代码示例,展示了World.getChunkProvider()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。World.getChunkProvider()
方法的具体详情如下:
包路径:net.minecraft.world.World
类名称:World
方法名:getChunkProvider
暂无
代码示例来源:origin: EngineHub/WorldEdit
@Override
public boolean regenerate(Region region, EditSession editSession) {
IChunkProvider provider = getWorld().getChunkProvider();
if (!(provider instanceof ChunkProviderServer)) {
return false;
代码示例来源:origin: AppliedEnergistics/Applied-Energistics-2
/**
* Check for a controller at this coordinates as well as is it loaded.
*
* @return true if there is a loaded controller
*/
private boolean checkController( final BlockPos pos )
{
if( this.world.getChunkProvider().getLoadedChunk( pos.getX() >> 4, pos.getZ() >> 4 ) != null )
{
return this.world.getTileEntity( pos ) instanceof TileController;
}
return false;
}
}
代码示例来源:origin: AppliedEnergistics/Applied-Energistics-2
private TileEntity getTileEntity( final TileEntity self, final BlockPos pos )
{
final World w = self.getWorld();
if( w.getChunkProvider().getLoadedChunk( pos.getX() >> 4, pos.getZ() >> 4 ) != null )
{
return w.getTileEntity( pos );
}
return null;
}
代码示例来源:origin: AppliedEnergistics/Applied-Energistics-2
private TileEntity getTileEntity( final TileEntity self, final BlockPos pos )
{
final World w = self.getWorld();
if( w.getChunkProvider().getLoadedChunk( pos.getX() >> 4, pos.getZ() >> 4 ) != null )
{
return w.getTileEntity( pos );
}
return null;
}
代码示例来源:origin: thraaawn/CompactMachines
@Override
protected IChunkProvider createChunkProvider() {
return realWorld.getChunkProvider();
}
代码示例来源:origin: AppliedEnergistics/Applied-Energistics-2
/**
* Checks if the bus can actually do something.
*
* Currently this tests if the chunk for the target is actually loaded.
*
* @return true, if the the bus should do its work.
*/
protected boolean canDoBusWork()
{
final TileEntity self = this.getHost().getTile();
final BlockPos selfPos = self.getPos().offset( this.getSide().getFacing() );
final int xCoordinate = selfPos.getX();
final int zCoordinate = selfPos.getZ();
final World world = self.getWorld();
return world != null && world.getChunkProvider().getLoadedChunk( xCoordinate >> 4, zCoordinate >> 4 ) != null;
}
代码示例来源:origin: SleepyTrousers/EnderIO
@Override
public @Nonnull IChunkProvider getChunkProvider() {
return wrapped.getChunkProvider();
}
代码示例来源:origin: lawremi/CustomOreGen
private static boolean chunkIsSaved(World world, int chunkX, int chunkZ) {
if (world.getChunkProvider() instanceof ChunkProviderServer) {
IChunkLoader loader = ((ChunkProviderServer)world.getChunkProvider()).chunkLoader;
if (loader instanceof AnvilChunkLoader) {
//if (((AnvilChunkLoader) loader).chunkExists(world, chunkX, chunkZ))
// CustomOreGenBase.log.info("[" + chunkX + "," + chunkZ + "]: saved on disk");
return ((AnvilChunkLoader) loader).chunkExists(world, chunkX, chunkZ);
}
}
return false;
}
代码示例来源:origin: AppliedEnergistics/Applied-Energistics-2
if( w.getChunkProvider().getLoadedChunk( cx, cz ) != null )
代码示例来源:origin: amadornes/MCMultiPart
@Override
public IChunkProvider getChunkProvider() {
return getActualWorld().getChunkProvider();
}
代码示例来源:origin: amadornes/MCMultiPart
@Override
protected IChunkProvider createChunkProvider() {
return getActualWorld().getChunkProvider();
}
代码示例来源:origin: ValkyrienWarfare/Valkyrien-Warfare-Revamped
public void unloadShipChunksFromWorld() {
ChunkProviderServer provider = (ChunkProviderServer) worldObj.getChunkProvider();
for (int x = ownedChunks.minX; x <= ownedChunks.maxX; x++) {
for (int z = ownedChunks.minZ; z <= ownedChunks.maxZ; z++) {
provider.queueUnload(claimedChunks[x - ownedChunks.minX][z - ownedChunks.minZ]);
// Ticket ticket =
// ValkyrienWarfareMod.physicsManager.getManagerForWorld(this.worldObj).chunkLoadingTicket;
// So fucking laggy!
// ForgeChunkManager.unforceChunk(manager.chunkLoadingTicket, new ChunkPos(x,
// z));
// MinecraftForge.EVENT_BUS.post(new UnforceChunkEvent(ticket, new ChunkPos(x,
// z)));
}
}
}
代码示例来源:origin: lawremi/CustomOreGen
private static boolean chunkIsLoaded(World world, int chunkX, int chunkZ) {
return world.getChunkProvider().getLoadedChunk(chunkX, chunkZ) != null;
}
代码示例来源:origin: MCTCP/TerrainControl
public Chunk getLoadedChunkWithoutMarkingActive(int chunkX, int chunkZ)
{
ChunkProviderServer chunkProviderServer = (ChunkProviderServer) this.world.getChunkProvider();
long i = ChunkPos.asLong(chunkX, chunkZ);
return chunkProviderServer.id2ChunkMap.get(i);
}
代码示例来源:origin: IntellectualSites/PlotSquared
public Chunk getChunk(World world, int x, int z) {
net.minecraft.world.chunk.Chunk chunk = ((net.minecraft.world.World) world).getChunkProvider().provideChunk(x, z);
if (chunk != null && !chunk.isLoaded()) {
chunk.onLoad();
}
return chunk;
}
代码示例来源:origin: ValkyrienWarfare/Valkyrien-Warfare-Revamped
private void replaceOuterChunksWithAir() {
for (int x = ownedChunks.minX - 1; x <= ownedChunks.maxX + 1; x++) {
for (int z = ownedChunks.minZ - 1; z <= ownedChunks.maxZ + 1; z++) {
if (x == ownedChunks.minX - 1 || x == ownedChunks.maxX + 1 || z == ownedChunks.minZ - 1
|| z == ownedChunks.maxZ + 1) {
// This is satisfied for the chunks surrounding a Ship, do fill it with empty
// space
Chunk chunk = new Chunk(worldObj, x, z);
ChunkProviderServer provider = (ChunkProviderServer) worldObj.getChunkProvider();
chunk.dirty = true;
provider.id2ChunkMap.put(ChunkPos.asLong(x, z), chunk);
}
}
}
}
代码示例来源:origin: ForestryMC/ForestryMC
@Override
public Set<IMultiblockComponent> detachAllBlocks() {
IChunkProvider chunkProvider = world.getChunkProvider();
for (IMultiblockComponent part : connectedParts) {
BlockPos partCoord = part.getCoordinates();
if (chunkProvider.getLoadedChunk(partCoord.getX() >> 4, partCoord.getZ() >> 4) != null) {
onDetachBlock(part);
}
}
Set<IMultiblockComponent> detachedParts = connectedParts;
connectedParts = new HashSet<>();
return detachedParts;
}
代码示例来源:origin: Electrical-Age/ElectricalAge
public boolean canCreateGhostAt(World world, int x, int y, int z) {
if (!world.getChunkProvider().chunkExists(x >> 4, z >> 4)) {
return false;
} else if (world.getBlock(x, y, z) != Blocks.air && !world.getBlock(x, y, z).isReplaceable(world, x, y, z)) {
return false;
} else return true;
}
代码示例来源:origin: cabaletta/baritone
public BlockStateInterface(World world, WorldData worldData, boolean copyLoadedChunks) {
this.worldData = worldData;
Long2ObjectMap<Chunk> worldLoaded = ((IChunkProviderClient) world.getChunkProvider()).loadedChunks();
if (copyLoadedChunks) {
this.loadedChunks = new Long2ObjectOpenHashMap<>(worldLoaded); // make a copy that we can safely access from another thread
} else {
this.loadedChunks = worldLoaded; // this will only be used on the main thread
}
this.useTheRealWorld = !Baritone.settings().pathThroughCachedOnly.get();
if (!Minecraft.getMinecraft().isCallingFromMinecraftThread()) {
throw new IllegalStateException();
}
}
代码示例来源:origin: Nividica/ThaumicEnergistics
public TileEntity getConnectedTE() {
TileEntity self = this.host.getTile();
World w = self.getWorld();
BlockPos pos = self.getPos().offset(this.side.getFacing());
if (w.getChunkProvider().getLoadedChunk(pos.getX() >> 4, pos.getZ() >> 4) != null) {
return w.getTileEntity(pos);
}
return null;
}
内容来源于网络,如有侵权,请联系作者删除!