當前位置: 首頁>>代碼示例>>Java>>正文


Java DimensionManager.getNextFreeDimId方法代碼示例

本文整理匯總了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;
}
 
開發者ID:4Space,項目名稱:4Space-5,代碼行數:25,代碼來源:WorldUtil.java

示例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;
}
 
開發者ID:modmuss50,項目名稱:TechnicalDimensions,代碼行數:14,代碼來源:ModDimensions.java

示例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");
}
 
開發者ID:GhostMonk3408,項目名稱:MidgarCrusade,代碼行數:13,代碼來源:Dungeon.java

示例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();

           }
	}

}
 
開發者ID:Ohrm,項目名稱:Malgra,代碼行數:44,代碼來源:MalgraEventHandler.java

示例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);
}
 
開發者ID:KodyJKing,項目名稱:RandomToolKit,代碼行數:6,代碼來源:ModDimensions.java


注:本文中的net.minecraftforge.common.DimensionManager.getNextFreeDimId方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。