net.minecraft.world.World.getChunkProvider()方法的使用及代码示例

x33g5p2x  于2022-02-02 转载在 其他  
字(6.8k)|赞(0)|评价(0)|浏览(196)

本文整理了Java中net.minecraft.world.World.getChunkProvider()方法的一些代码示例,展示了World.getChunkProvider()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。World.getChunkProvider()方法的具体详情如下:
包路径:net.minecraft.world.World
类名称:World
方法名:getChunkProvider

World.getChunkProvider介绍

暂无

代码示例

代码示例来源:origin: EngineHub/WorldEdit

  1. @Override
  2. public boolean regenerate(Region region, EditSession editSession) {
  3. IChunkProvider provider = getWorld().getChunkProvider();
  4. if (!(provider instanceof ChunkProviderServer)) {
  5. return false;

代码示例来源:origin: AppliedEnergistics/Applied-Energistics-2

  1. /**
  2. * Check for a controller at this coordinates as well as is it loaded.
  3. *
  4. * @return true if there is a loaded controller
  5. */
  6. private boolean checkController( final BlockPos pos )
  7. {
  8. if( this.world.getChunkProvider().getLoadedChunk( pos.getX() >> 4, pos.getZ() >> 4 ) != null )
  9. {
  10. return this.world.getTileEntity( pos ) instanceof TileController;
  11. }
  12. return false;
  13. }
  14. }

代码示例来源:origin: AppliedEnergistics/Applied-Energistics-2

  1. private TileEntity getTileEntity( final TileEntity self, final BlockPos pos )
  2. {
  3. final World w = self.getWorld();
  4. if( w.getChunkProvider().getLoadedChunk( pos.getX() >> 4, pos.getZ() >> 4 ) != null )
  5. {
  6. return w.getTileEntity( pos );
  7. }
  8. return null;
  9. }

代码示例来源:origin: AppliedEnergistics/Applied-Energistics-2

  1. private TileEntity getTileEntity( final TileEntity self, final BlockPos pos )
  2. {
  3. final World w = self.getWorld();
  4. if( w.getChunkProvider().getLoadedChunk( pos.getX() >> 4, pos.getZ() >> 4 ) != null )
  5. {
  6. return w.getTileEntity( pos );
  7. }
  8. return null;
  9. }

代码示例来源:origin: thraaawn/CompactMachines

  1. @Override
  2. protected IChunkProvider createChunkProvider() {
  3. return realWorld.getChunkProvider();
  4. }

代码示例来源:origin: AppliedEnergistics/Applied-Energistics-2

  1. /**
  2. * Checks if the bus can actually do something.
  3. *
  4. * Currently this tests if the chunk for the target is actually loaded.
  5. *
  6. * @return true, if the the bus should do its work.
  7. */
  8. protected boolean canDoBusWork()
  9. {
  10. final TileEntity self = this.getHost().getTile();
  11. final BlockPos selfPos = self.getPos().offset( this.getSide().getFacing() );
  12. final int xCoordinate = selfPos.getX();
  13. final int zCoordinate = selfPos.getZ();
  14. final World world = self.getWorld();
  15. return world != null && world.getChunkProvider().getLoadedChunk( xCoordinate >> 4, zCoordinate >> 4 ) != null;
  16. }

代码示例来源:origin: SleepyTrousers/EnderIO

  1. @Override
  2. public @Nonnull IChunkProvider getChunkProvider() {
  3. return wrapped.getChunkProvider();
  4. }

代码示例来源:origin: lawremi/CustomOreGen

  1. private static boolean chunkIsSaved(World world, int chunkX, int chunkZ) {
  2. if (world.getChunkProvider() instanceof ChunkProviderServer) {
  3. IChunkLoader loader = ((ChunkProviderServer)world.getChunkProvider()).chunkLoader;
  4. if (loader instanceof AnvilChunkLoader) {
  5. //if (((AnvilChunkLoader) loader).chunkExists(world, chunkX, chunkZ))
  6. // CustomOreGenBase.log.info("[" + chunkX + "," + chunkZ + "]: saved on disk");
  7. return ((AnvilChunkLoader) loader).chunkExists(world, chunkX, chunkZ);
  8. }
  9. }
  10. return false;
  11. }

代码示例来源:origin: AppliedEnergistics/Applied-Energistics-2

  1. if( w.getChunkProvider().getLoadedChunk( cx, cz ) != null )

代码示例来源:origin: amadornes/MCMultiPart

  1. @Override
  2. public IChunkProvider getChunkProvider() {
  3. return getActualWorld().getChunkProvider();
  4. }

代码示例来源:origin: amadornes/MCMultiPart

  1. @Override
  2. protected IChunkProvider createChunkProvider() {
  3. return getActualWorld().getChunkProvider();
  4. }

代码示例来源:origin: ValkyrienWarfare/Valkyrien-Warfare-Revamped

  1. public void unloadShipChunksFromWorld() {
  2. ChunkProviderServer provider = (ChunkProviderServer) worldObj.getChunkProvider();
  3. for (int x = ownedChunks.minX; x <= ownedChunks.maxX; x++) {
  4. for (int z = ownedChunks.minZ; z <= ownedChunks.maxZ; z++) {
  5. provider.queueUnload(claimedChunks[x - ownedChunks.minX][z - ownedChunks.minZ]);
  6. // Ticket ticket =
  7. // ValkyrienWarfareMod.physicsManager.getManagerForWorld(this.worldObj).chunkLoadingTicket;
  8. // So fucking laggy!
  9. // ForgeChunkManager.unforceChunk(manager.chunkLoadingTicket, new ChunkPos(x,
  10. // z));
  11. // MinecraftForge.EVENT_BUS.post(new UnforceChunkEvent(ticket, new ChunkPos(x,
  12. // z)));
  13. }
  14. }
  15. }

代码示例来源:origin: lawremi/CustomOreGen

  1. private static boolean chunkIsLoaded(World world, int chunkX, int chunkZ) {
  2. return world.getChunkProvider().getLoadedChunk(chunkX, chunkZ) != null;
  3. }

代码示例来源:origin: MCTCP/TerrainControl

  1. public Chunk getLoadedChunkWithoutMarkingActive(int chunkX, int chunkZ)
  2. {
  3. ChunkProviderServer chunkProviderServer = (ChunkProviderServer) this.world.getChunkProvider();
  4. long i = ChunkPos.asLong(chunkX, chunkZ);
  5. return chunkProviderServer.id2ChunkMap.get(i);
  6. }

代码示例来源:origin: IntellectualSites/PlotSquared

  1. public Chunk getChunk(World world, int x, int z) {
  2. net.minecraft.world.chunk.Chunk chunk = ((net.minecraft.world.World) world).getChunkProvider().provideChunk(x, z);
  3. if (chunk != null && !chunk.isLoaded()) {
  4. chunk.onLoad();
  5. }
  6. return chunk;
  7. }

代码示例来源:origin: ValkyrienWarfare/Valkyrien-Warfare-Revamped

  1. private void replaceOuterChunksWithAir() {
  2. for (int x = ownedChunks.minX - 1; x <= ownedChunks.maxX + 1; x++) {
  3. for (int z = ownedChunks.minZ - 1; z <= ownedChunks.maxZ + 1; z++) {
  4. if (x == ownedChunks.minX - 1 || x == ownedChunks.maxX + 1 || z == ownedChunks.minZ - 1
  5. || z == ownedChunks.maxZ + 1) {
  6. // This is satisfied for the chunks surrounding a Ship, do fill it with empty
  7. // space
  8. Chunk chunk = new Chunk(worldObj, x, z);
  9. ChunkProviderServer provider = (ChunkProviderServer) worldObj.getChunkProvider();
  10. chunk.dirty = true;
  11. provider.id2ChunkMap.put(ChunkPos.asLong(x, z), chunk);
  12. }
  13. }
  14. }
  15. }

代码示例来源:origin: ForestryMC/ForestryMC

  1. @Override
  2. public Set<IMultiblockComponent> detachAllBlocks() {
  3. IChunkProvider chunkProvider = world.getChunkProvider();
  4. for (IMultiblockComponent part : connectedParts) {
  5. BlockPos partCoord = part.getCoordinates();
  6. if (chunkProvider.getLoadedChunk(partCoord.getX() >> 4, partCoord.getZ() >> 4) != null) {
  7. onDetachBlock(part);
  8. }
  9. }
  10. Set<IMultiblockComponent> detachedParts = connectedParts;
  11. connectedParts = new HashSet<>();
  12. return detachedParts;
  13. }

代码示例来源:origin: Electrical-Age/ElectricalAge

  1. public boolean canCreateGhostAt(World world, int x, int y, int z) {
  2. if (!world.getChunkProvider().chunkExists(x >> 4, z >> 4)) {
  3. return false;
  4. } else if (world.getBlock(x, y, z) != Blocks.air && !world.getBlock(x, y, z).isReplaceable(world, x, y, z)) {
  5. return false;
  6. } else return true;
  7. }

代码示例来源:origin: cabaletta/baritone

  1. public BlockStateInterface(World world, WorldData worldData, boolean copyLoadedChunks) {
  2. this.worldData = worldData;
  3. Long2ObjectMap<Chunk> worldLoaded = ((IChunkProviderClient) world.getChunkProvider()).loadedChunks();
  4. if (copyLoadedChunks) {
  5. this.loadedChunks = new Long2ObjectOpenHashMap<>(worldLoaded); // make a copy that we can safely access from another thread
  6. } else {
  7. this.loadedChunks = worldLoaded; // this will only be used on the main thread
  8. }
  9. this.useTheRealWorld = !Baritone.settings().pathThroughCachedOnly.get();
  10. if (!Minecraft.getMinecraft().isCallingFromMinecraftThread()) {
  11. throw new IllegalStateException();
  12. }
  13. }

代码示例来源:origin: Nividica/ThaumicEnergistics

  1. public TileEntity getConnectedTE() {
  2. TileEntity self = this.host.getTile();
  3. World w = self.getWorld();
  4. BlockPos pos = self.getPos().offset(this.side.getFacing());
  5. if (w.getChunkProvider().getLoadedChunk(pos.getX() >> 4, pos.getZ() >> 4) != null) {
  6. return w.getTileEntity(pos);
  7. }
  8. return null;
  9. }

相关文章

World类方法