本文整理汇总了Java中net.minecraft.world.World.getChunkProvider方法的典型用法代码示例。如果您正苦于以下问题:Java World.getChunkProvider方法的具体用法?Java World.getChunkProvider怎么用?Java World.getChunkProvider使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.minecraft.world.World
的用法示例。
在下文中一共展示了World.getChunkProvider方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: unloadChunk
import net.minecraft.world.World; //导入方法依赖的package包/类
public boolean unloadChunk(ItemStack stack) {
if (!stack.hasTagCompound()) return false;
NBTTagCompound tag = stack.getTagCompound();
if (tag.getBoolean("ignoreClick")) {
tag.removeTag("ignoreClick");
stack.setTagCompound(tag);
return false;
}
int worldId = tag.getInteger("world");
int x = tag.getInteger("x");
int z = tag.getInteger("z");
World world = DimensionManager.getWorld(worldId);
if (world==null) return false;
IChunkProvider provider = world.getChunkProvider();
Chunk chunk = provider.getLoadedChunk(x, z);
if (chunk==null) return false;
if (provider instanceof ChunkProviderServer) {
((ChunkProviderServer) provider).queueUnload(chunk);
return true;
} else {
return false;
}
}
示例2: handleWorldSettings
import net.minecraft.world.World; //导入方法依赖的package包/类
public void handleWorldSettings(World w)
{
try
{
if (w.getChunkProvider() instanceof ChunkProviderServer && w.getWorldType() instanceof WorldTypeExP)
{
ChunkProviderServer cps = (ChunkProviderServer) w.getChunkProvider();
if (cps.chunkGenerator instanceof ChunkGeneratorOverworld)
{
ChunkGeneratorOverworld cpo = (ChunkGeneratorOverworld) cps.chunkGenerator;
for (Field f : ChunkGeneratorOverworld.class.getDeclaredFields())
{
if (f.getType() == ChunkGeneratorSettings.class)
{
f.setAccessible(true);
ChunkGeneratorSettings.Factory factory = new ChunkGeneratorSettings.Factory();
factory.seaLevel = 127;
factory.baseSize = 17.25f;
f.set(cpo, factory.build());
break;
}
}
}
}
}
catch (Exception ex)
{
ex.printStackTrace();
}
}