当前位置: 首页>>代码示例>>Java>>正文


Java AnvilChunkLoader类代码示例

本文整理汇总了Java中net.minecraft.world.chunk.storage.AnvilChunkLoader的典型用法代码示例。如果您正苦于以下问题:Java AnvilChunkLoader类的具体用法?Java AnvilChunkLoader怎么用?Java AnvilChunkLoader使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


AnvilChunkLoader类属于net.minecraft.world.chunk.storage包,在下文中一共展示了AnvilChunkLoader类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: queueChunkLoad

import net.minecraft.world.chunk.storage.AnvilChunkLoader; //导入依赖的package包/类
public static void queueChunkLoad(World world, AnvilChunkLoader loader, ChunkProviderServer provider, int x, int z, Runnable runnable)
{
    QueuedChunk key = new QueuedChunk(x, z, world);
    ChunkIOProvider task = tasks.get(key);
    if (task == null)
    {
        task = new ChunkIOProvider(key, loader, provider);
        task.addCallback(runnable); // Add before calling execute for thread safety
        tasks.put(key, task);
        pool.execute(task);
    }
    else
    {
        task.addCallback(runnable);
    }
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:17,代码来源:ChunkIOExecutor.java

示例2: callStage1

import net.minecraft.world.chunk.storage.AnvilChunkLoader; //导入依赖的package包/类
public Chunk callStage1(QueuedChunk queuedChunk) throws RuntimeException {
	AnvilChunkLoader loader = queuedChunk.loader;
	Object[] data = null;
	try {
		data = loader.loadChunk__Async(queuedChunk.world, queuedChunk.x, queuedChunk.z);
	} catch (IOException e) {
		e.printStackTrace();
	}

	if (data != null) {
		queuedChunk.compound = (net.minecraft.nbt.NBTTagCompound) data[1];
		return (net.minecraft.world.chunk.Chunk) data[0];
	}

	return null;
}
 
开发者ID:OreCruncher,项目名称:Jiffy,代码行数:17,代码来源:ChunkIOProvider.java

示例3: getSaveFile

import net.minecraft.world.chunk.storage.AnvilChunkLoader; //导入依赖的package包/类
public File getSaveFile(ISaveHandler saveHandler, World world, String name, boolean backup) {
	File worldDir = new File(saveHandler.getWorldDirectoryName());
	IChunkLoader loader = saveHandler.getChunkLoader(world.provider);
	if((loader instanceof AnvilChunkLoader)) {
		worldDir = ((AnvilChunkLoader) loader).chunkSaveLocation;
	}
	File file = new File(worldDir, name + (backup ? ".bak" : ""));
	if(!file.exists()) {
		try {
			file.createNewFile();
		} catch(Exception e) {
			e.printStackTrace();
		}
	}
	return file;
}
 
开发者ID:ElConquistador,项目名称:ElConQore,代码行数:17,代码来源:EQSaveHandler.java

示例4: getCachedEntity

import net.minecraft.world.chunk.storage.AnvilChunkLoader; //导入依赖的package包/类
public Entity getCachedEntity()
{
    if (this.cachedEntity == null)
    {
        this.cachedEntity = AnvilChunkLoader.readWorldEntity(this.randomEntity.getNbt(), this.getSpawnerWorld(), false);

        if (this.randomEntity.getNbt().getSize() == 1 && this.randomEntity.getNbt().hasKey("id", 8) && this.cachedEntity instanceof EntityLiving)
        {
            ((EntityLiving)this.cachedEntity).onInitialSpawn(this.getSpawnerWorld().getDifficultyForLocation(new BlockPos(this.cachedEntity)), (IEntityLivingData)null);
        }
    }

    return this.cachedEntity;
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:15,代码来源:MobSpawnerBaseLogic.java

示例5: syncChunkLoad

import net.minecraft.world.chunk.storage.AnvilChunkLoader; //导入依赖的package包/类
public static Chunk syncChunkLoad(World world, AnvilChunkLoader loader, ChunkProviderServer provider, int x, int z)
{
    QueuedChunk key = new QueuedChunk(x, z, world);
    ChunkIOProvider task = tasks.remove(key); // Remove task because we will call the sync callbacks directly
    if (task != null)
    {
        if (!pool.remove(task)) // If it wasn't in the pool, and run hasn't finished, then wait for the async thread.
        {
            synchronized(task)
            {
                while (!task.runFinished())
                {
                    try
                    {
                        task.wait();
                    }
                    catch (InterruptedException e)
                    {
                        e.printStackTrace(); // Something happened? Log it?
                    }
                }
            }
        }
        else
        {
            // If the task was not run yet we still need to load the chunk
            task.run();
        }
    }
    else
    {
        task = new ChunkIOProvider(key, loader, provider);
        task.run();
    }
    task.syncCallback();
    return task.getChunk();
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:38,代码来源:ChunkIOExecutor.java

示例6: getCachedEntity

import net.minecraft.world.chunk.storage.AnvilChunkLoader; //导入依赖的package包/类
@SideOnly(Side.CLIENT)
public Entity getCachedEntity()
{
    if (this.cachedEntity == null)
    {
        this.cachedEntity = AnvilChunkLoader.readWorldEntity(this.randomEntity.getNbt(), this.getSpawnerWorld(), false);

        if (this.randomEntity.getNbt().getSize() == 1 && this.randomEntity.getNbt().hasKey("id", 8) && this.cachedEntity instanceof EntityLiving)
        {
            ((EntityLiving)this.cachedEntity).onInitialSpawn(this.getSpawnerWorld().getDifficultyForLocation(new BlockPos(this.cachedEntity)), (IEntityLivingData)null);
        }
    }

    return this.cachedEntity;
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:16,代码来源:MobSpawnerBaseLogic.java

示例7: getWorldDirectory

import net.minecraft.world.chunk.storage.AnvilChunkLoader; //导入依赖的package包/类
@Nullable
public static File getWorldDirectory(World world)
{
    IChunkProvider chunkProvider = world.getChunkProvider();

    if (chunkProvider instanceof ChunkProviderServer)
    {
        ChunkProviderServer chunkProviderServer = (ChunkProviderServer) chunkProvider;
        IChunkLoader chunkLoader = chunkProviderServer.chunkLoader;

        if (chunkLoader instanceof AnvilChunkLoader)
        {
            return ((AnvilChunkLoader) chunkLoader).chunkSaveLocation;
        }

        return null;
    }
    // If this method gets called before ChunkProviderServer has been set yet,
    // then we mimic the vanilla code in AnvilSaveHandler#getChunkLoader() to get the directory.
    else
    {
        File mainWorldDir = world.getSaveHandler().getWorldDirectory();
        String dimensionDir = world.provider.getSaveFolder();

        if (dimensionDir != null)
        {
            mainWorldDir = new File(mainWorldDir, dimensionDir);
            mainWorldDir.mkdirs();
        }

        return mainWorldDir;
    }
}
 
开发者ID:maruohon,项目名称:justenoughdimensions,代码行数:34,代码来源:WorldFileUtils.java

示例8: QueuedChunk

import net.minecraft.world.chunk.storage.AnvilChunkLoader; //导入依赖的package包/类
public QueuedChunk(int x, int z, AnvilChunkLoader loader, World world, ChunkProviderServer provider) {
    this.x = x;
    this.z = z;
    this.loader = loader;
    this.world = world;
    this.provider = provider;
}
 
开发者ID:OreCruncher,项目名称:Jiffy,代码行数:8,代码来源:QueuedChunk.java

示例9: getChunkLoader

import net.minecraft.world.chunk.storage.AnvilChunkLoader; //导入依赖的package包/类
/**
 * @author jamierocks - 30th October 2016
 * @reason Use the Canary directory structure
 */
@Overwrite
public IChunkLoader getChunkLoader(WorldProvider provider) {
    if (provider instanceof WorldProviderHell) {
        return new AnvilChunkLoader(new File(this.getWorldDirectory(), this.getWorldDirectoryName() + "_" + DimensionType.NETHER.getName()));
    } else if (provider instanceof WorldProviderEnd) {
        return new AnvilChunkLoader(new File(this.getWorldDirectory(), this.getWorldDirectoryName() + "_" + DimensionType.END.getName()));
    } else {
        return new AnvilChunkLoader(new File(this.getWorldDirectory(), this.getWorldDirectoryName() + "_" + DimensionType.NORMAL.getName()));
    }
}
 
开发者ID:NeptunePowered,项目名称:NeptuneMod,代码行数:15,代码来源:MixinAnvilSaveHandler.java

示例10: importTileEntities

import net.minecraft.world.chunk.storage.AnvilChunkLoader; //导入依赖的package包/类
/** Load the previously saved TileEntities and add them to the Chunk **/
public static void importTileEntities( Chunk chunk )
{
	File chunkSaveLocation = (File) Reflexion.stealField( AnvilChunkLoader.class, File.class ).get(chunkLoader);
	DataInputStream dis = RegionFileCache.getChunkInputStream( chunkSaveLocation, chunk.xPosition, chunk.zPosition );
	try
	{
		NBTTagCompound chunkNBT = CompressedStreamTools.read( dis );
		NBTTagCompound levelNBT = chunkNBT.getCompoundTag( "Level" );
		// The official code checks if the chunk is in the right location. Should I too?.
		NBTTagList tileEntitiesNBT = levelNBT.getTagList( "TileEntities" );
		for( int i = 0; i < tileEntitiesNBT.tagCount(); i++ )
		{
			NBTTagCompound tileEntityNBT = (NBTTagCompound) tileEntitiesNBT.tagAt( i );
			TileEntity te = TileEntity.createAndLoadEntity( tileEntityNBT );
			String entityType = getTEName(te);
			if(( isImportableTileEntity( te ) ))
			{
			  if( ! newTileEntities.contains( new ChunkPosition( te.xCoord, te.yCoord, te.zCoord ) ) )
			  {
			  	wc.setBlockTileEntity( te.xCoord, te.yCoord, te.zCoord, te );
			  	chatDebug("Loaded TE: " + entityType + " at " + te.xCoord + " " + te.yCoord + " " + te.zCoord );
			  }
			  else
				{
			  	chatDebug( "Dropping old TE: " + entityType + " at " + te.xCoord + " " + te.yCoord + " " + te.zCoord );
				}
			}
			else 
			{
				chatDebug( "TE is not importable: " + entityType + " at " + te.xCoord + " " + te.yCoord + " " + te.zCoord );
			}
		}
	}
	catch ( Exception e ) { } // Couldn't load the old chunk. Nothing unusual. Happens with every not downloaded chunk.
}
 
开发者ID:xurei,项目名称:forge_world_downloader,代码行数:37,代码来源:WDL.java

示例11: func_75763_a

import net.minecraft.world.chunk.storage.AnvilChunkLoader; //导入依赖的package包/类
public IChunkLoader func_75763_a(WorldProvider p_75763_1_) {
   File var2 = this.func_75765_b();
   File var3;
   if(p_75763_1_ instanceof WorldProviderHell) {
      var3 = new File(var2, "DIM-1");
      var3.mkdirs();
      return new AnvilChunkLoader(var3);
   } else if(p_75763_1_ instanceof WorldProviderEnd) {
      var3 = new File(var2, "DIM1");
      var3.mkdirs();
      return new AnvilChunkLoader(var3);
   } else {
      return new AnvilChunkLoader(var2);
   }
}
 
开发者ID:HATB0T,项目名称:RuneCraftery,代码行数:16,代码来源:AnvilSaveHandler.java

示例12: getWorldSaveDir

import net.minecraft.world.chunk.storage.AnvilChunkLoader; //导入依赖的package包/类
protected static File getWorldSaveDir(World world) {
	ISaveHandler worldSaver = world.getSaveHandler();
	if (worldSaver.getChunkLoader(world.provider) instanceof AnvilChunkLoader) {
		return ((AnvilChunkLoader) worldSaver.getChunkLoader(world.provider)).chunkSaveLocation;
	}
	return null;
}
 
开发者ID:GotoLink,项目名称:Generatormods,代码行数:8,代码来源:BuildingExplorationHandler.java

示例13: chunkIsSaved

import net.minecraft.world.chunk.storage.AnvilChunkLoader; //导入依赖的package包/类
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;
}
 
开发者ID:lawremi,项目名称:CustomOreGen,代码行数:12,代码来源:ServerState.java

示例14: ChunkIOProvider

import net.minecraft.world.chunk.storage.AnvilChunkLoader; //导入依赖的package包/类
ChunkIOProvider(QueuedChunk chunk, AnvilChunkLoader loader, ChunkProviderServer provider)
{
    this.chunkInfo = chunk;
    this.loader = loader;
    this.provider = provider;
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:7,代码来源:ChunkIOProvider.java

示例15: createFixer

import net.minecraft.world.chunk.storage.AnvilChunkLoader; //导入依赖的package包/类
public static DataFixer createFixer()
{
    DataFixer datafixer = new DataFixer(512);
    WorldInfo.registerFixes(datafixer);
    EntityPlayer.registerFixesPlayer(datafixer);
    AnvilChunkLoader.registerFixes(datafixer);
    ItemStack.registerFixes(datafixer);
    EntityArmorStand.registerFixesArmorStand(datafixer);
    EntityArrow.registerFixesArrow(datafixer);
    EntityBat.registerFixesBat(datafixer);
    EntityBlaze.registerFixesBlaze(datafixer);
    EntityCaveSpider.registerFixesCaveSpider(datafixer);
    EntityChicken.registerFixesChicken(datafixer);
    EntityCow.registerFixesCow(datafixer);
    EntityCreeper.registerFixesCreeper(datafixer);
    EntityDragonFireball.registerFixesDragonFireball(datafixer);
    EntityDragon.registerFixesDragon(datafixer);
    EntityEnderman.registerFixesEnderman(datafixer);
    EntityEndermite.registerFixesEndermite(datafixer);
    EntityFallingBlock.registerFixesFallingBlock(datafixer);
    EntityLargeFireball.registerFixesLargeFireball(datafixer);
    EntityFireworkRocket.registerFixesFireworkRocket(datafixer);
    EntityGhast.registerFixesGhast(datafixer);
    EntityGiantZombie.registerFixesGiantZombie(datafixer);
    EntityGuardian.registerFixesGuardian(datafixer);
    EntityHorse.registerFixesHorse(datafixer);
    EntityItem.registerFixesItem(datafixer);
    EntityItemFrame.registerFixesItemFrame(datafixer);
    EntityMagmaCube.registerFixesMagmaCube(datafixer);
    EntityMinecartChest.registerFixesMinecartChest(datafixer);
    EntityMinecartCommandBlock.registerFixesMinecartCommand(datafixer);
    EntityMinecartFurnace.registerFixesMinecartFurnace(datafixer);
    EntityMinecartHopper.registerFixesMinecartHopper(datafixer);
    EntityMinecartEmpty.registerFixesMinecartEmpty(datafixer);
    EntityMinecartMobSpawner.registerFixesMinecartMobSpawner(datafixer);
    EntityMinecartTNT.registerFixesMinecartTNT(datafixer);
    EntityLiving.registerFixesMob(datafixer);
    EntityMob.registerFixesMonster(datafixer);
    EntityMooshroom.registerFixesMooshroom(datafixer);
    EntityOcelot.registerFixesOcelot(datafixer);
    EntityPig.registerFixesPig(datafixer);
    EntityPigZombie.registerFixesPigZombie(datafixer);
    EntityRabbit.registerFixesRabbit(datafixer);
    EntitySheep.registerFixesSheep(datafixer);
    EntityShulker.registerFixesShulker(datafixer);
    EntitySilverfish.registerFixesSilverfish(datafixer);
    EntitySkeleton.registerFixesSkeleton(datafixer);
    EntitySlime.registerFixesSlime(datafixer);
    EntitySmallFireball.registerFixesSmallFireball(datafixer);
    EntitySnowman.registerFixesSnowman(datafixer);
    EntitySnowball.registerFixesSnowball(datafixer);
    EntitySpectralArrow.registerFixesSpectralArrow(datafixer);
    EntitySpider.registerFixesSpider(datafixer);
    EntitySquid.registerFixesSquid(datafixer);
    EntityEgg.registerFixesEgg(datafixer);
    EntityEnderPearl.registerFixesEnderPearl(datafixer);
    EntityExpBottle.registerFixesExpBottle(datafixer);
    EntityPotion.registerFixesPotion(datafixer);
    EntityTippedArrow.registerFixesTippedArrow(datafixer);
    EntityVillager.registerFixesVillager(datafixer);
    EntityIronGolem.registerFixesIronGolem(datafixer);
    EntityWitch.registerFixesWitch(datafixer);
    EntityWither.registerFixesWither(datafixer);
    EntityWitherSkull.registerFixesWitherSkull(datafixer);
    EntityWolf.registerFixesWolf(datafixer);
    EntityZombie.registerFixesZombie(datafixer);
    TileEntityPiston.registerFixesPiston(datafixer);
    TileEntityFlowerPot.registerFixesFlowerPot(datafixer);
    TileEntityFurnace.registerFixesFurnace(datafixer);
    TileEntityChest.registerFixesChest(datafixer);
    TileEntityDispenser.registerFixes(datafixer);
    TileEntityDropper.registerFixesDropper(datafixer);
    TileEntityBrewingStand.registerFixesBrewingStand(datafixer);
    TileEntityHopper.registerFixesHopper(datafixer);
    BlockJukebox.registerFixesJukebox(datafixer);
    TileEntityMobSpawner.registerFixesMobSpawner(datafixer);
    registerFixes(datafixer);
    return datafixer;
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:80,代码来源:DataFixesManager.java


注:本文中的net.minecraft.world.chunk.storage.AnvilChunkLoader类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。