本文整理汇总了Java中net.minecraftforge.common.DimensionManager.getNextFreeDimId方法的典型用法代码示例。如果您正苦于以下问题:Java DimensionManager.getNextFreeDimId方法的具体用法?Java DimensionManager.getNextFreeDimId怎么用?Java DimensionManager.getNextFreeDimId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.minecraftforge.common.DimensionManager
的用法示例。
在下文中一共展示了DimensionManager.getNextFreeDimId方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: bindSpaceStationToNewDimension
import net.minecraftforge.common.DimensionManager; //导入方法依赖的package包/类
public static SpaceStationWorldData bindSpaceStationToNewDimension(World world, EntityPlayerMP player, int homePlanetID)
{
int dynamicProviderID = -1;
int staticProviderID = -1;
for (Satellite satellite : GalaxyRegistry.getRegisteredSatellites().values())
{
if (satellite.getParentPlanet().getDimensionID() == homePlanetID)
{
dynamicProviderID = satellite.getDimensionID();
staticProviderID = satellite.getDimensionIdStatic();
}
}
if (dynamicProviderID == -1 || staticProviderID == -1)
{
throw new RuntimeException("Space station being bound on bad provider IDs!");
}
int newID = DimensionManager.getNextFreeDimId();
SpaceStationWorldData data = WorldUtil.createSpaceStation(world, newID, homePlanetID, dynamicProviderID, staticProviderID, player);
dimNames.put(newID, "Space Station " + newID);
GCPlayerStats stats = GCPlayerStats.get(player);
stats.spaceStationDimensionData.put(homePlanetID, newID);
GalacticraftCore.packetPipeline.sendTo(new PacketSimple(EnumSimplePacket.C_UPDATE_SPACESTATION_CLIENT_ID, new Object[] { WorldUtil.spaceStationDataToString(stats.spaceStationDimensionData) }), player);
return data;
}
示例2: createDim
import net.minecraftforge.common.DimensionManager; //导入方法依赖的package包/类
public static int createDim(DimData dimData) {
int dimId = DimensionManager.getNextFreeDimId();
DimensionType type = DimensionType.register("technicaldimensions", dimData.name, dimId, CustomWorldProvider.class, false);
dimData.type = type;
dimData.id = dimId;
Random random = new Random();
dimData.seed = random.nextLong();
DimensionManager.registerDimension(dimId, type);
dimDataHashMap.put(dimId, dimData);
dimDataList.add(dimData);
return dimId;
}
示例3: DungeonOrc
import net.minecraftforge.common.DimensionManager; //导入方法依赖的package包/类
public static void init()
{
Main.DIM_ID = DimensionManager.getNextFreeDimId();
Main.DUNGEONS = new ArrayList<Dungeon>();
Main.DUNGEONS.add(new DungeonOrc());
Main.DUNGEONS.add(new DungeonGraveyard());
Main.log("Initializing Dungeons...");
Main.log("Dungeon loaded");
}
示例4: onJoinWorld
import net.minecraftforge.common.DimensionManager; //导入方法依赖的package包/类
@SubscribeEvent
public void onJoinWorld(EntityJoinWorldEvent event) {
if (event.getEntity() instanceof EntityItem && !(event.getEntity() instanceof EntityItemMalgraTool)) {
EntityItem entityItem = (EntityItem) event.getEntity();
if (entityItem.getItem().getItem() == net.minecraft.init.Items.DIAMOND_PICKAXE) {
event.setCanceled(true);
ItemStack malgraPickaxe = new ItemStack(Items.malgraPickaxe);
malgraPickaxe.setTagCompound(new NBTTagCompound());
malgraPickaxe.getTagCompound().setInteger("malgra", ((MalgraTool)malgraPickaxe.getItem()).getMaxMalgra());
EntityItemMalgraTool newEntity = new EntityItemMalgraTool(event.getWorld(), event.getEntity().posX, event.getEntity().posY, event.getEntity().posZ, ((EntityItem) event.getEntity()).getItem(), malgraPickaxe);
event.getWorld().spawnEntity(newEntity);
NBTTagCompound nbt = new NBTTagCompound();
event.getEntity().writeToNBTOptional(nbt);
newEntity.readFromNBT(nbt);
}
}
if (event.getEntity() instanceof EntityPlayerMP) {
PacketDispatcher.sendTo(new SyncManaData(event.getEntity().getCapability(CapabilityMana.MANA, null)), (EntityPlayerMP) event.getEntity());
PacketDispatcher.sendTo(new SyncResearchPoints(event.getEntity().getCapability(CapabilityResearchPoints.RESEARCHPOINTS, null)), (EntityPlayerMP) event.getEntity());
PacketDispatcher.sendTo(new SyncResearchActivites(event.getEntity().getCapability(CapabilityResearchActivites.RESEARCHACTIVITIES, null)), (EntityPlayerMP) event.getEntity());
if(ResearchDimensions.get(event.getWorld()).researchDimIDs.get(event.getEntity().getUniqueID().toString()) == null) {
int researchDimID = DimensionManager.getNextFreeDimId();
DimensionType researchDim = DimensionType.register("research" + event.getEntity().getUniqueID().toString(), "", researchDimID, WorldProviderResearch.class, false);
DimensionManager.registerDimension(researchDimID, researchDim);
ResearchDimensions.get(event.getWorld()).researchDimIDs.put(event.getEntity().getUniqueID().toString(), researchDimID);
ResearchDimensions.get(event.getWorld()).researchDimTypes.put(researchDimID, researchDim);
Iterator it = ResearchDimensions.get(event.getWorld()).researchDimIDs.entrySet().iterator();
while (it.hasNext()) {
Map.Entry pair = (Map.Entry)it.next();
if(FMLCommonHandler.instance().getSide() == Side.SERVER)
PacketDispatcher.sendTo(new SyncResearchDimensions((String)pair.getKey(), (Integer)pair.getValue()), (EntityPlayerMP) event.getEntity());
}
ResearchDimensions.get(event.getWorld()).markDirty();
}
}
}
示例5: init
import net.minecraftforge.common.DimensionManager; //导入方法依赖的package包/类
public static void init() {
darkVoidId = DimensionManager.getNextFreeDimId();
darkVoidType = DimensionType.register("Dark Void", "_darkVoid", darkVoidId, WorldProviderDarkVoid.class, false);
DimensionManager.registerDimension(darkVoidId, darkVoidType);
}