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


Java GameData類代碼示例

本文整理匯總了Java中cpw.mods.fml.common.registry.GameData的典型用法代碼示例。如果您正苦於以下問題:Java GameData類的具體用法?Java GameData怎麽用?Java GameData使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


GameData類屬於cpw.mods.fml.common.registry包,在下文中一共展示了GameData類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: preInit

import cpw.mods.fml.common.registry.GameData; //導入依賴的package包/類
public static void preInit() {
        if(ModConfig.enableAdditionalNodeTypes) {
            try {
                ItemBlock item = (ItemBlock) Item.getItemFromBlock(ConfigBlocks.blockAiry);

                item.field_150939_a = RegisteredBlocks.blockNode;

                //Hacky way
                FMLControlledNamespacedRegistry<Block> registry = GameData.getBlockRegistry();
                registry.underlyingIntegerMap.field_148749_a.put(RegisteredBlocks.blockNode, Block.getIdFromBlock(ConfigBlocks.blockAiry));
                registry.underlyingIntegerMap.field_148748_b.set(Block.getIdFromBlock(ConfigBlocks.blockAiry), RegisteredBlocks.blockNode);
                ((BiMap)registry.field_148758_b).forcePut(RegisteredBlocks.blockNode, registry.field_148758_b.get(ConfigBlocks.blockAiry));

                registry.underlyingIntegerMap.field_148749_a.remove(ConfigBlocks.blockAiry);

                ConfigBlocks.blockAiry = RegisteredBlocks.blockNode;
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
}
 
開發者ID:makeoo,項目名稱:Gadomancy,代碼行數:22,代碼來源:ModSubstitutions.java

示例2: initializeMods

import cpw.mods.fml.common.registry.GameData; //導入依賴的package包/類
public void initializeMods()
{
    progressBar.step("Initializing mods Phase 2");
    // Mod controller should be in the initialization state here
    modController.distributeStateMessage(LoaderState.INITIALIZATION);
    progressBar.step("Initializing mods Phase 3");
    modController.transition(LoaderState.POSTINITIALIZATION, false);
    modController.distributeStateMessage(FMLInterModComms.IMCEvent.class);
    ItemStackHolderInjector.INSTANCE.inject();
    modController.distributeStateMessage(LoaderState.POSTINITIALIZATION);
    progressBar.step("Finishing up");
    modController.transition(LoaderState.AVAILABLE, false);
    modController.distributeStateMessage(LoaderState.AVAILABLE);
    GameData.freezeData();
    // Dump the custom registry data map, if necessary
    GameData.dumpRegistry(minecraftDir);
    FMLLog.info("Forge Mod Loader has successfully loaded %d mod%s", mods.size(), mods.size() == 1 ? "" : "s");
    progressBar.step("Completing Minecraft initialization");
}
 
開發者ID:SchrodingersSpy,項目名稱:TRHS_Club_Mod_2016,代碼行數:20,代碼來源:Loader.java

示例3: nerfStandardRecipes

import cpw.mods.fml.common.registry.GameData; //導入依賴的package包/類
@Override
protected void nerfStandardRecipes ()
{
    for (Item item : (Iterable<Item>) GameData.getItemRegistry())
    {
        if ((item instanceof ItemTool || item instanceof ItemSword) && !isBBTool(item))
        {
            String repairMaterial = BetterBeginningsHandler.getToolRepairMaterial(item);

            if (!Strings.isNullOrEmpty(repairMaterial) && !OreDictionary.getOres(repairMaterial).isEmpty())
            {
                nerfToolRecipe(new ItemStack(item), repairMaterial);
            }
        }
    }
}
 
開發者ID:UndeadZeratul,項目名稱:TWBB-Tweaks,代碼行數:17,代碼來源:ToolRecipeTweaks.java

示例4: readItemStackFromData

import cpw.mods.fml.common.registry.GameData; //導入依賴的package包/類
protected ItemStack readItemStackFromData(DataInputStream data) throws IOException {
	ItemStack itemstack = null;

	String itemName = data.readUTF();

	if (!itemName.isEmpty()) {
		Item item = GameData.getItemRegistry().getRaw(itemName);
		byte stackSize = data.readByte();
		short meta = data.readShort();
		itemstack = new ItemStack(item, stackSize, meta);

		if (item.isDamageable() || item.getShareTag()) {
			itemstack.stackTagCompound = this.readNBTTagCompound(data);
		}
	}

	return itemstack;
}
 
開發者ID:MagicBees,項目名稱:MagicBees,代碼行數:19,代碼來源:EventBase.java

示例5: writeNBT

import cpw.mods.fml.common.registry.GameData; //導入依賴的package包/類
@TileEvent(TileEventType.WORLD_NBT_WRITE)
public void writeNBT(NBTTagCompound cmp){
    cmp.setInteger(NBTKeys.storedMana.toString(), currMana);
    NBTTagCompound inv = new NBTTagCompound();
    for (int i = 0; i < inventory.length; i++){
        if (inventory[i] == null) continue;
        NBTTagCompound slot = new NBTTagCompound();
        slot.setInteger(NBTKeys.amount.toString(), inventory[i].stackSize);
        slot.setString(NBTKeys.item.toString(), GameData.getItemRegistry().getNameForObject(inventory[i].getItem()));
        slot.setInteger(NBTKeys.metadata.toString(), inventory[i].getItemDamage());
        if (inventory[i].hasTagCompound())
            slot.setString(NBTKeys.nbt.toString(), inventory[i].getTagCompound().toString());
        else
            slot.setString(NBTKeys.nbt.toString(), "");
        inv.setTag("#" + i, slot);
    }
    cmp.setTag(NBTKeys.inventory.toString(), inv);


}
 
開發者ID:ParadoxCodersTeam,項目名稱:Botanic-Energistics,代碼行數:21,代碼來源:TileAERuneAssembler.java

示例6: blockListToBlockNames

import cpw.mods.fml.common.registry.GameData; //導入依賴的package包/類
protected String[] blockListToBlockNames(final List<Block> blockList) {
  if ((blockList == null) || blockList.isEmpty()) {
    return new String[0];
  } else {
    final String[] result = new String[blockList.size()];
    int index = 0;
    for (final Block block : blockList) {
      final String blockname = GameData.getBlockRegistry().getNameForObject(block);
      if (blockname != null) {
        result[index] = blockname;
        ++index;
      } else {
        DaVincing.log.warn("Ignoring invalid block configuration entry: %s", Utils.blockToString(block));
      }
    }
    Arrays.sort(result);
    return result;
  }
}
 
開發者ID:twothe,項目名稱:DaVincing,代碼行數:20,代碼來源:Config.java

示例7: getItemName

import cpw.mods.fml.common.registry.GameData; //導入依賴的package包/類
public static String getItemName(String s)
{
	// If this name is a number we parse the number then check the item registry for an item with that ID.
	// If the ID is valid we'll get the name, if not we'll get a null.
	// If the name isn't a number just return the name again.
	
	try
	{
		RegistryNamespaced rn = GameData.getItemRegistry();
		int id = Integer.parseInt(s);
		
		if(rn.containsId(id))
			return rn.getNameForObject(rn.getObjectById(id));
		else
			return null;
	}
	catch (NumberFormatException e) {}
	return s;
}
 
開發者ID:Rotatceps,項目名稱:EE3Helper,代碼行數:20,代碼來源:Helper.java

示例8: readCustomNBT

import cpw.mods.fml.common.registry.GameData; //導入依賴的package包/類
@Override
public void readCustomNBT(NBTTagCompound compound) {
    String parentType = compound.getString("parentType");
    if(parentType.length() > 0) {
        Block block = GameData.getBlockRegistry().getObject(parentType);
        if(block != null && compound.hasKey("parent") && compound.hasKey("parentMetadata")) {
            NBTTagCompound data = compound.getCompoundTag("parent");
            int metadata = compound.getInteger("parentMetadata");
            TileEntity tile = block.createTileEntity(getWorldObj(), metadata);
            if(tile instanceof TileJarFillable) {
                placedOn = ForgeDirection.getOrientation(compound.getInteger("placedOn"));
                tile.readFromNBT(data);
                init((TileJarFillable) tile, block, metadata, placedOn);
            }
        }
    }

    if(!isValid() && !getWorldObj().isRemote) {
        getWorldObj().setBlockToAir(xCoord, yCoord, zCoord);
    }
}
 
開發者ID:makeoo,項目名稱:Gadomancy,代碼行數:22,代碼來源:TileStickyJar.java

示例9: readMovementInfo

import cpw.mods.fml.common.registry.GameData; //導入依賴的package包/類
@Override
public void readMovementInfo(IMovingBlock block, NBTTagCompound tag) {

    block.setBlock(GameData.getBlockRegistry().getObject(tag.getString("block")));
    block.setMetadata(tag.getInteger("metadata"));
    TileEntity te = block.getTileEntity();

    if (tag.hasKey("data") && (te != null || block.getBlock() instanceof ITileEntityProvider)) {
        if (te == null) {
            te = ((ITileEntityProvider) block.getBlock()).createNewTileEntity(FakeWorld.getFakeWorld((MovingBlock) block),
                    block.getMetadata());
            System.out.println("creating!");
        }
        if (te != null) {
            te.readFromNBT(tag.getCompoundTag("data"));
            block.setTileEntity(te);
        }
    }

    ((MovingBlock) block).setRenderList(-1);
}
 
開發者ID:amadornes,項目名稱:Framez,代碼行數:22,代碼來源:MovementDataProviderDefault.java

示例10: getItem

import cpw.mods.fml.common.registry.GameData; //導入依賴的package包/類
/**
 * Returns the ItemStack with the name specified, or air if nothing is found.
 * @param name The name of the item to get.
 * @return The item with the name, or an item that is bound to that name.
 */
public static ItemStack getItem(String name) {
	if (GameData.getBlockRegistry().containsKey(name)) {
		return new ItemStack(GameData.getBlockRegistry().getObject(name));
	} else if (GameData.getItemRegistry().containsKey(name)) {
		return new ItemStack(GameData.getItemRegistry().getObject(name));
	} else {
		if (name.matches("(?i)(class|kit|character).*(icon)*"))
			return AllKits.getIcon(Vars.get("kit"));
		else if (name.matches("(?i)sab.*winner"))
			return InfoSab.getWinnerIcon();
		else {
			for (String s : icons.keySet()) {
				if (name.matches(s))
					return icons.get(s);
			}
			return new ItemStack(Blocks.air);
		}
	}
}
 
開發者ID:NomNuggetNom,項目名稱:mcpvp-mod,代碼行數:25,代碼來源:CustomAlert.java

示例11: postInit

import cpw.mods.fml.common.registry.GameData; //導入依賴的package包/類
@Override public void postInit() {
	for (Object o : GameData.getItemRegistry()) {
		if (o instanceof Item) { // should always be true, but just to be sure
			Item i = (Item) o;
			try {
				Masses.calculateMass(i, 0, 32767);
			} catch (StackOverflowError error) {
				continue;
			} catch (Exception e) {
				e.printStackTrace();
				System.err.println("Dazed and confused, but trying to continue");
				continue;
			}
		}
	}
	Masses.bake();
}
 
開發者ID:unascribed,項目名稱:Farrago,代碼行數:18,代碼來源:ServerProxy.java

示例12: init

import cpw.mods.fml.common.registry.GameData; //導入依賴的package包/類
public static void init(){
	ConfigHandler.init(DimensionGuard.config);

	Table<String,String,ItemStack> customStacks = ReflectionHelper.getPrivateValue(GameData.class, null, "customItemStacks");
	Map<String,ItemStack> customItemStacks = new LinkedHashMap<String, ItemStack>();

	for (Table.Cell<String, String,ItemStack> cell: customStacks.cellSet())
	{
		customItemStacks.put(cell.getRowKey()+":"+cell.getColumnKey(),cell.getValue());
	}

	addDisabledItems(true, customItemStacks);
	addDisabledItems(false, customItemStacks);
	addDisabledEntity(true);
	addDisabledEntity(false);
}
 
開發者ID:hilburn,項目名稱:DimensionGuard,代碼行數:17,代碼來源:DisabledHandler.java

示例13: deserialize

import cpw.mods.fml.common.registry.GameData; //導入依賴的package包/類
@Override
public ItemStack deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) throws JsonParseException {
    if (!json.isJsonObject()) {
        return null;
    }

    JsonObject jsonObject = json.getAsJsonObject();

    int stackSize = jsonObject.has(STACK_SIZE) ? jsonObject.get(STACK_SIZE).getAsInt() : DEFAULT_STACK_SIZE;
    int itemDamage = jsonObject.has(ITEM_DAMAGE) ? jsonObject.get(ITEM_DAMAGE).getAsInt() : DEFAULT_ITEM_DAMAGE;

    if (jsonObject.has(BLOCK)) {
        Block block = GameData.getBlockRegistry().getObject(jsonObject.get(BLOCK).getAsString());
        return new ItemStack(block, stackSize, itemDamage);
    } else if (jsonObject.has(ITEM)) {
        Item item = GameData.getItemRegistry().getObject(jsonObject.get(ITEM).getAsString());
        return new ItemStack(item, stackSize, itemDamage);
    }

    return null;
}
 
開發者ID:Lunatrius,項目名稱:DynIMC,代碼行數:22,代碼來源:ItemStackDeserializer.java

示例14: callbackIdDifferenceResponse

import cpw.mods.fml.common.registry.GameData; //導入依賴的package包/類
public void callbackIdDifferenceResponse(boolean response)
{
    if (response)
    {
        serverShouldBeKilledQuietly = false;
        GameData.releaseGate(true);
        client.continueWorldLoading();
    }
    else
    {
        serverShouldBeKilledQuietly = true;
        GameData.releaseGate(false);
        // Reset and clear the client state
        client.func_71403_a((WorldClient)null);
        client.func_71373_a(null);
    }
}
 
開發者ID:HATB0T,項目名稱:RuneCraftery,代碼行數:18,代碼來源:FMLClientHandler.java

示例15: execute

import cpw.mods.fml.common.registry.GameData; //導入依賴的package包/類
@Override
public void execute(INetworkManager network, FMLNetworkHandler handler, NetHandler netHandler, String userName)
{
    byte[] allData = Bytes.concat(partials);
    GameData.initializeServerGate(1);
    try
    {
        NBTTagCompound serverList = CompressedStreamTools.func_74792_a(allData);
        NBTTagList list = serverList.func_74761_m("List");
        Set<ItemData> itemData = GameData.buildWorldItemData(list);
        GameData.validateWorldSave(itemData);
        MapDifference<Integer, ItemData> serverDifference = GameData.gateWorldLoadingForValidation();
        if (serverDifference!=null)
        {
            FMLCommonHandler.instance().disconnectIDMismatch(serverDifference, netHandler, network);

        }
    }
    catch (IOException e)
    {
    }
}
 
開發者ID:HATB0T,項目名稱:RuneCraftery,代碼行數:23,代碼來源:ModIdMapPacket.java


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