本文整理匯總了Java中net.minecraft.world.WorldProvider類的典型用法代碼示例。如果您正苦於以下問題:Java WorldProvider類的具體用法?Java WorldProvider怎麽用?Java WorldProvider使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
WorldProvider類屬於net.minecraft.world包,在下文中一共展示了WorldProvider類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: getChunkLoader
import net.minecraft.world.WorldProvider; //導入依賴的package包/類
/**
* initializes and returns the chunk loader for the specified world provider
*/
public IChunkLoader getChunkLoader(WorldProvider provider)
{
File file1 = this.getWorldDirectory();
if (provider instanceof WorldProviderHell)
{
File file3 = new File(file1, "DIM-1");
file3.mkdirs();
return new AnvilChunkLoader(file3);
}
else if (provider instanceof WorldProviderEnd)
{
File file2 = new File(file1, "DIM1");
file2.mkdirs();
return new AnvilChunkLoader(file2);
}
else
{
return new AnvilChunkLoader(file1);
}
}
示例2: WorldClient
import net.minecraft.world.WorldProvider; //導入依賴的package包/類
public WorldClient(NetHandlerPlayClient p_i45063_1_, WorldSettings p_i45063_2_, int p_i45063_3_, EnumDifficulty p_i45063_4_, Profiler p_i45063_5_)
{
super(new SaveHandlerMP(), new WorldInfo(p_i45063_2_, "MpServer"), WorldProvider.getProviderForDimension(p_i45063_3_), p_i45063_5_, true);
this.sendQueue = p_i45063_1_;
this.getWorldInfo().setDifficulty(p_i45063_4_);
this.provider.registerWorld(this);
this.setSpawnPoint(new BlockPos(8, 64, 8));
this.chunkProvider = this.createChunkProvider();
this.mapStorage = new SaveDataMemoryStorage();
this.calculateInitialSkylight();
this.calculateInitialWeather();
Reflector.postForgeBusEvent(Reflector.WorldEvent_Load_Constructor, new Object[] {this});
if (this.mc.playerController != null && this.mc.playerController.getClass() == PlayerControllerMP.class)
{
this.mc.playerController = new PlayerControllerOF(this.mc, p_i45063_1_);
}
}
示例3: WorldServerProxy
import net.minecraft.world.WorldProvider; //導入依賴的package包/類
public WorldServerProxy(WorldServer realWorld, WorldServer proxyWorld, String modClass) {
super(proxyWorld.getMinecraftServer(), proxyWorld.getSaveHandler(), proxyWorld.getWorldInfo(), proxyWorld.provider.getDimension(), proxyWorld.profiler);
// fix the dimension manager!
net.minecraftforge.common.DimensionManager.setWorld(this.provider.getDimension(), proxyWorld, proxyWorld.getMinecraftServer());
m_realWorld = realWorld;
m_proxyWorld = proxyWorld;
m_modPrefix = Util.getClassDomainFromName(modClass);
InjectionHandler.copyAllFieldsFrom(this, m_realWorld, WorldServer.class);
try {
InjectionHandler.writeFieldOfType(
this,
new WorldProviderProxyServer(m_realWorld.provider, m_proxyWorld.provider, modClass),
WorldProvider.class);
} catch (IllegalAccessException e) {
Util.logger.logException("Unable to set WorldProviderProxyServer", e);
}
}
示例4: getChunkLoader
import net.minecraft.world.WorldProvider; //導入依賴的package包/類
/**
* initializes and returns the chunk loader for the specified world provider
*/
public IChunkLoader getChunkLoader(WorldProvider provider)
{
File file1 = this.getWorldDirectory();
if (provider instanceof WorldProviderHell)
{
File file3 = new File(file1, "DIM-1");
file3.mkdirs();
return new AnvilChunkLoader(file3, this.dataFixer);
}
else if (provider instanceof WorldProviderEnd)
{
File file2 = new File(file1, "DIM1");
file2.mkdirs();
return new AnvilChunkLoader(file2, this.dataFixer);
}
else
{
return new AnvilChunkLoader(file1, this.dataFixer);
}
}
示例5: createProviderFor
import net.minecraft.world.WorldProvider; //導入依賴的package包/類
public static WorldProvider createProviderFor(int dim)
{
try
{
if (dimensions.containsKey(dim))
{
WorldProvider ret = getProviderType(dim).createDimension();
ret.setDimension(dim);
return ret;
}
else
{
throw new RuntimeException(String.format("No WorldProvider bound for dimension %d", dim)); //It's going to crash anyway at this point. Might as well be informative
}
}
catch (Exception e)
{
FMLCommonHandler.instance().getFMLLogger().log(Level.ERROR, String.format("An error occurred trying to create an instance of WorldProvider %d (%s)",
dim, getProviderType(dim)),e);
throw new RuntimeException(e);
}
}
示例6: getChunkLoader
import net.minecraft.world.WorldProvider; //導入依賴的package包/類
/**
* initializes and returns the chunk loader for the specified world provider
*/
public IChunkLoader getChunkLoader(WorldProvider provider)
{
File file1 = this.getWorldDirectory();
if (provider.getSaveFolder() != null)
{
File file3 = new File(file1, provider.getSaveFolder());
file3.mkdirs();
return new AnvilChunkLoader(file3, this.dataFixer);
}
else
{
return new AnvilChunkLoader(file1, this.dataFixer);
}
}
示例7: getWorldID
import net.minecraft.world.WorldProvider; //導入依賴的package包/類
/**
* Gets the name of the current world the player is.
* Returns "single player" is the player is playing single player.
*/
public String getWorldID()
{
if (lastResponse < lastRequest)
{
//No WorldInfo response so just use vanilla world names
WorldProvider provider = Minecraft.getMinecraft().theWorld.provider;
if (provider instanceof WorldProviderEnd)
return "world_the_end";
else if (provider instanceof WorldProviderHell)
return "world_nether";
else
return "world";
}
else
return worldID;
}
示例8: getAirProducts
import net.minecraft.world.WorldProvider; //導入依賴的package包/類
public int getAirProducts()
{
WorldProvider WP = this.worldObj.provider;
if (WP instanceof WorldProviderSpace)
{
ArrayList<IAtmosphericGas> atmos = ((WorldProviderSpace)WP).getCelestialBody().atmosphere;
if (atmos.size() > 0)
{
if (atmos.get(0) == IAtmosphericGas.CO2) return 1;
}
if (atmos.size() > 1)
{
if (atmos.get(1) == IAtmosphericGas.CO2) return 1;
}
if (atmos.size() > 2)
{
if (atmos.get(2) == IAtmosphericGas.CO2) return 1;
}
return 0;
}
return 0;
}
示例9: getAirProducts
import net.minecraft.world.WorldProvider; //導入依賴的package包/類
public int getAirProducts()
{
WorldProvider WP = this.worldObj.provider;
if (WP instanceof WorldProviderSpace)
{
int result = 0;
ArrayList<IAtmosphericGas> atmos = ((WorldProviderSpace)WP).getCelestialBody().atmosphere;
if (atmos.size() > 0)
{
result = this.getIdFromName(atmos.get(0).name().toLowerCase()) + 1;
}
if (atmos.size() > 1)
{
result += 16 * (this.getIdFromName(atmos.get(1).name().toLowerCase()) + 1);
}
if (atmos.size() > 2)
{
result += 256 * (this.getIdFromName(atmos.get(2).name().toLowerCase()) + 1);
}
return result;
}
return 35;
}
示例10: registerProvider
import net.minecraft.world.WorldProvider; //導入依賴的package包/類
/***
* Now returns a boolean to indicate whether registration of the WorldProvider type was successful.
* (If it failed, you should probably set the CelestialBody as unreachable.)
*
* @param id
* @param provider
* @param keepLoaded
* @return <boolean> success
*/
public static boolean registerProvider(int id, Class<? extends WorldProvider> provider, boolean keepLoaded, int defaultID)
{
boolean flag = DimensionManager.registerProviderType(id, provider, keepLoaded);
if (flag)
{
GalacticraftRegistry.worldProviderIDs.add(id);
return true;
}
else
{
GalacticraftRegistry.worldProviderIDs.add(defaultID); //Adding the 0 here preserves the order, important for network compatibility between GC versions
FMLLog.severe("Could not register dimension " + id + " - does it clash with another mod? Change the ID in config.");
return false;
}
}
示例11: noAtmosphericCombustion
import net.minecraft.world.WorldProvider; //導入依賴的package包/類
/**
* Test whether fire can burn in this world's atmosphere (outside any oxygen bubble).
*
* @param provider The WorldProvider for this dimension
*
* @return False if fire burns normally
* True if fire cannot burn in this world
*
*/
public static boolean noAtmosphericCombustion(WorldProvider provider)
{
try
{
if (combusionTestMethod == null)
{
if (oxygenUtilClass == null)
{
oxygenUtilClass = Class.forName("micdoodle8.mods.galacticraft.core.util.OxygenUtil");
}
combusionTestMethod = oxygenUtilClass.getDeclaredMethod("noAtmosphericCombustion", WorldProvider.class);
}
return (Boolean)combusionTestMethod.invoke(null, provider);
}
catch (Exception e)
{
e.printStackTrace();
}
return false;
}
示例12: getProviderForNameServer
import net.minecraft.world.WorldProvider; //導入依賴的package包/類
public static WorldProvider getProviderForNameServer(String par1String)
{
String nameToFind = par1String;
if (par1String.contains("$"))
{
final String[] twoDimensions = par1String.split("\\$");
nameToFind = twoDimensions[0];
}
if (nameToFind == null)
{
return null;
}
for (Map.Entry<Integer, String> element : WorldUtil.dimNames.entrySet())
{
if (nameToFind.equals(element.getValue()))
{
return WorldUtil.getProviderForDimensionServer(element.getKey());
}
}
GCLog.info("Failed to find matching world for '" + par1String + "'");
return null;
}
示例13: getProviderForNameClient
import net.minecraft.world.WorldProvider; //導入依賴的package包/類
@SideOnly(Side.CLIENT)
public static WorldProvider getProviderForNameClient(String par1String)
{
String nameToFind = par1String;
if (par1String.contains("$"))
{
final String[] twoDimensions = par1String.split("\\$");
nameToFind = twoDimensions[0];
}
if (nameToFind == null)
{
return null;
}
for (Map.Entry<Integer, String> element : WorldUtil.dimNames.entrySet())
{
if (nameToFind.equals(element.getValue()))
{
return WorldUtil.getProviderForDimensionClient(element.getKey());
}
}
GCLog.info("Failed to find matching world for '" + par1String + "'");
return null;
}
示例14: createProviderFor
import net.minecraft.world.WorldProvider; //導入依賴的package包/類
public static WorldProvider createProviderFor(int dim)
{
try
{
if (dimensions.containsKey(dim))
{
WorldProvider provider = providers.get(getProviderType(dim)).newInstance();
provider.setDimension(dim);
return provider;
}
else
{
throw new RuntimeException(String.format("No WorldProvider bound for dimension %d", dim)); //It's going to crash anyway at this point. Might as well be informative
}
}
catch (Exception e)
{
FMLCommonHandler.instance().getFMLLogger().log(Level.ERROR, String.format("An error occured trying to create an instance of WorldProvider %d (%s)",
dim, providers.get(getProviderType(dim)).getSimpleName()),e);
throw new RuntimeException(e);
}
}
示例15: onWorldLoad
import net.minecraft.world.WorldProvider; //導入依賴的package包/類
/**
* Hook the weather renderer for the loading world.
*/
@SubscribeEvent(priority = EventPriority.LOWEST)
public static void onWorldLoad(@Nonnull final WorldEvent.Load e) {
if (DSurround.proxy().effectiveSide() == Side.SERVER || !ModOptions.enableWeatherASM)
return;
// Only want to hook if the provider doesn't have special
// weather handling.
final WorldProvider provider = e.getWorld().provider;
final String dimName = provider.getDimensionType().getName();
final IRenderHandler renderer = provider.getWeatherRenderer();
if (renderer == null) {
DSurround.log().info("Setting weather renderer for dimension [%s]", dimName);
provider.setWeatherRenderer(new RenderWeather());
} else {
DSurround.log().info("Not hooking weather renderer for dimension [%s] (%s)", dimName, renderer.getClass());
}
}