本文整理匯總了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();
}
}