import net.minecraft.item.ItemStack;
import net.minecraftforge.common.Configuration;
import net.minecraftforge.common.Property;
+import net.minecraftforge.oredict.OreDictionary;
import pcc.chemicraft.block.BlockChemicalCombinationTable;
import pcc.chemicraft.block.BlockChemicalCraftingTable;
import pcc.chemicraft.block.BlockElectrolysisTable;
import pcc.chemicraft.block.BlockToolAndWeaponCraftingTable;
import pcc.chemicraft.compounds.CompoundDebug;
import pcc.chemicraft.compounds.CompoundWater;
+import pcc.chemicraft.creativetab.CreativeTabAtomsOre;
+import pcc.chemicraft.creativetab.CreativeTabChemiCraft;
import pcc.chemicraft.debug.CommandDeleteItem;
import pcc.chemicraft.debug.CommandGenDebugRoom;
import pcc.chemicraft.debug.CommandSetTile;
import pcc.chemicraft.util.Auxiliary;
import pcc.chemicraft.util.Auxiliary.ArrayAuxiliary;
import pcc.chemicraft.util.Auxiliary.NameAuxiliary;
-import pcc.chemicraft.util.CreativeTabAtoms;
import pcc.chemicraft.util.NBTRecipeGrenade;
import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.SidedProxy;
/**
* ChemiCraftのCreativeTab.
*/
- public static final CreativeTabs creativeTab = new CreativeTabAtoms("ChemiCraft");
+ public static final CreativeTabs creativeTabChemiCraft = new CreativeTabChemiCraft("ChemiCraft");
+ public static final CreativeTabs creativeTabAtomsOre = new CreativeTabAtomsOre("AtomsOre");
/**
* ItemID.
public int toolAndWeaponCraftingTableID;
public int chemicalCraftingTableID;
- public int[] atomsOreID = new int[1];
+ public int[] atomsOreID = new int[16];
/**
* GUIID.
});
//鉱石を追加します
- api.addAtomsOre("Petalite", this.atomsOreID[0], 0, 5, 5, 20); //ペタル石を追加
+
+ // リチウム
+ api.addAtomsOre("Petalite", this.atomsOreID[api.getAtomsOreIndex()], 5, 10, 50); // LiAlSi4O10
api.addAtomsOreLanguage("Petalite", "ペタル石", "ja_JP");
+ api.addAtomsOre("Spodumene", this.atomsOreID[api.getAtomsOreIndex()], 5, 15, 50); // LiAlSi2O6
+ api.addAtomsOreLanguage("Spodumene", "リチア輝石", "ja_JP");
+
+ // ベリリウム
+ api.addAtomsOre("Beryl", this.atomsOreID[api.getAtomsOreIndex()], 5, 20, 50); // Be3Al2Si6O18
+ api.addAtomsOreLanguage("Beryl", "緑柱石", "ja_JP");
+ api.addAtomsOre("Chrysoberyl", this.atomsOreID[api.getAtomsOreIndex()], 5, 20, 50); // BeAl2O4
+ api.addAtomsOreLanguage("Chrysoberyl", "金緑石", "ja_JP");
+
+ // ホウ素
+ api.addAtomsOre("Ulexite", this.atomsOreID[api.getAtomsOreIndex()], 5, 20, 50); // NaCaB5O6(OH)6・5H2O
+ api.addAtomsOreLanguage("Ulexite", "ウレキサイト", "ja_JP"); // ホウ酸塩鉱石
+
+ // フッ素
+ api.addAtomsOre("Fluorite", this.atomsOreID[api.getAtomsOreIndex()], 5, 20, 50); // CaF2
+ api.addAtomsOreLanguage("Fluorite", "蛍石", "ja_JP");
+ api.addAtomsOre("Cryolite", this.atomsOreID[api.getAtomsOreIndex()], 5, 20, 50); // Na3AlF6
+ api.addAtomsOreLanguage("Cryolite", "氷晶石", "ja_JP");
+
+ // ナトリウム
+ api.addAtomsOre("RockSalt", this.atomsOreID[api.getAtomsOreIndex()], 5, 20, 50); // NaCl
+ api.addAtomsOreLanguage("RockSalt", "岩塩", "ja_JP");
+
+ // マグネシウム
+ api.addAtomsOre("Dolomite", this.atomsOreID[api.getAtomsOreIndex()], 5, 20, 50); // CaMg(CO3)2
+ api.addAtomsOreLanguage("Dolomite", "苦灰石", "ja_JP");
+ api.addAtomsOre("Magnesite", this.atomsOreID[api.getAtomsOreIndex()], 5, 20, 50); // MgCO3
+ api.addAtomsOreLanguage("Magnesite", "菱苦土石", "ja_JP");
+
+ // アルミニウム
+ api.addAtomsOre("Gibbsite", this.atomsOreID[api.getAtomsOreIndex()], 5, 20, 50); // Al(OH)3
+ api.addAtomsOreLanguage("Gibbsite", "ギブス石", "ja_JP");
+ api.addAtomsOre("Ruby", this.atomsOreID[api.getAtomsOreIndex()], 5, 20, 50); // Al2O3
+ api.addAtomsOreLanguage("Ruby", "ルビー", "ja_JP");
+ api.addAtomsOre("Sapphire", this.atomsOreID[api.getAtomsOreIndex()], 5, 20, 50); // Al2O3
+ api.addAtomsOreLanguage("Sapphire", "サファイア", "ja_JP");
+
+ // ケイ素
+ api.addAtomsOre("Quartz", this.atomsOreID[api.getAtomsOreIndex()], 5, 20, 50); // SiO2
+ api.addAtomsOreLanguage("Quartz", "石英", "ja_JP");
+
+ // リン
+ api.addAtomsOre("Fluorapatite", this.atomsOreID[api.getAtomsOreIndex()], 5, 20, 50); // Ca5(PO4)3F
+ api.addAtomsOreLanguage("Fluorapatite", "フッ素リン灰石", "ja_JP");
+ api.addAtomsOre("Chlorapatite", this.atomsOreID[api.getAtomsOreIndex()], 5, 20, 50); // Ca5(PO4)3Cl
+ api.addAtomsOreLanguage("Chlorapatite", "塩素燐灰石", "ja_JP");
+ api.addAtomsOre("Hydroxylapatite", this.atomsOreID[api.getAtomsOreIndex()], 5, 20, 50); // Ca5(PO4)3(OH)
+ api.addAtomsOreLanguage("Hydroxylapatite", "水酸燐灰石", "ja_JP");
//化合物を追加します
- api.addLangCompound("ja_JP", "ChlorousAcid", "亜塩素酸");
+ api.addCompound("ja_JP", "ChlorousAcid", "亜塩素酸");
- api.addLangCompound("ja_JP", "SodiumChloride", "塩化ナトリウム");
- api.addLangCompound("ja_JP", "SodiumBicarbonate", "重曹");
+ api.addCompound("ja_JP", "SodiumChloride", "塩化ナトリウム");
+ api.addCompound("ja_JP", "SodiumBicarbonate", "重曹");
- api.addLangCompound("ja_JP", "CarbonMonoxide", "一酸化炭素");
- api.addLangCompound("ja_JP", "CarbonDioxide", "二酸化炭素");
- api.addLangCompound("ja_JP", "Water", "水");
+ api.addCompound("ja_JP", "CarbonMonoxide", "一酸化炭素");
+ api.addCompound("ja_JP", "CarbonDioxide", "二酸化炭素");
+ api.addCompound("ja_JP", "Water", "水");
//化合物のHandlerを設定します
private void apiProcessing(final FMLPostInitializationEvent event) {
// API用の処理
- this.nameAuxiliary.addName(itemCompounds, api.getCompoundsName().toArray());
- for (int i = 0; i < api.getCompoundsLang().size(); i++) {
- this.nameAuxiliary.addName(itemCompounds, api.getCompoundsLang().get(i), api.getCompoundsLangName().toArray());
+ for (int i = 0; i < api.getCompoundsName().sizeKeysList(); i++)
+ {
+ for (int j = 0; j < api.getCompoundsName().sizeElementsList(api.getCompoundsName().getKeyList(i)); j++)
+ {
+ this.nameAuxiliary.addName(new ItemStack(itemCompounds, 0, i), api.getCompoundsLang().get(api.getCompoundsName().getKeyList(i), j), api.getCompoundsName().get(api.getCompoundsName().getKeyList(i), j));
+ }
}
- for (int i = 0; i < blockAtomsOre.length; i++)
+ for (int i = 0; i < api.getAtomsOreNameListHash().sizeKeysList(); i++)
{
- for (int j = 0; j < api.getAtomsOreNameListHash().sizeKeysList(); j++)
+ for (int j = 0; j < api.getAtomsOreNameListHash().sizeElementsList(api.getAtomsOreNameListHash().getKeyList(i)); j++)
{
- for (int k = 0; k < api.getAtomsOreNameListHash().sizeElementsList(api.getAtomsOreNameListHash().getKeyList(j)); k++)
- {
- this.nameAuxiliary.addName(new ItemStack(blockAtomsOre[i], 0, j), api.getAtomsOreLangListHash().get(api.getAtomsOreNameListHash().getKeyList(j), k), api.getAtomsOreNameListHash().get(api.getAtomsOreNameListHash().getKeyList(j), k));
- }
+ this.nameAuxiliary.addName(new ItemStack(blockAtomsOre[i / 16], 0, i - i / 16 * 16), api.getAtomsOreLangListHash().get(api.getAtomsOreNameListHash().getKeyList(i), j), api.getAtomsOreNameListHash().get(api.getAtomsOreNameListHash().getKeyList(i), j));
+ OreDictionary.registerOre("ore" + api.getAtomsOreNameListHash().getKeyList(i), new ItemStack(blockAtomsOre[i / 16], 1, i - i / 16 * 16));
}
}
- //鉱石の生成
- for (int i = 0; i < api.getAtomsOreIDList().size(); i++) {
+
+ for (int i = 0; i < api.getAtomsOres().size(); i++)
+ {
GameRegistry.registerWorldGenerator(api.getAtomsOres().get(i));
}
+
}
private void debug(final FMLPostInitializationEvent event) {
/**
* List of compounds names.
*/
- private ArrayList<String> compoundsNameList = new ArrayList<String>();
-
-
- /**
- * List of compounds names(Some kind of language).
- */
- private ArrayList<String> compoundsLangNameList = new ArrayList<String>();
+ private ListHash<String, String> compoundsNameListHash = new ListHash<String, String>();
/**
* List of compounds the language names.
*/
- private ArrayList<String> compoundsLangList = new ArrayList<String>();
+ private ListHash<String, String> compoundsLangListHash = new ListHash<String, String>();
/**
/**
- * 鉱石IDリスト
- */
- private ArrayList<Integer> atomsOreIDList = new ArrayList<Integer>();
-
-
- /**
* 鉱石の言語リスト
*/
private ListHash<String, String> atomsOreLangListHash = new ListHash<String, String>();
* @param name compound name.
*/
public void addCompound(String name){
- addLangCompound("", name, "");
+ compoundsNameListHash.add(name, name);
+ compoundsLangListHash.add(name, "en_US");
+ compoundHash.put(name, compoundHash.size());
}
* @param englishName compound name
* @param langName compound name(specified language)
*/
- public void addLangCompound(String lang, String englishName, String langName){
- compoundsNameList.add(englishName);
- compoundsLangNameList.add(langName);
- compoundsLangList.add(lang);
- compoundHash.put(englishName, compoundHash.size());
+ public void addCompound(String lang, String englishName, String langName){
+ addCompound(englishName);
+ addCompoundLanguage(lang, englishName, langName);
+ }
+
+
+
+ public void addCompoundLanguage(String lang, String englishName, String langName){
+ compoundsNameListHash.add(englishName, langName);
+ compoundsLangListHash.add(englishName, lang);
}
/**
* 鉱石を追加します
* @param name 鉱石名
- * @param id 鉱石ID
- * @param meta 鉱石メタデータ
* @param size 一度に生成される量
* @param frequency 生成頻度
* @param posY Y座標
*/
public void addAtomsOre(String par1Name, int par2Id, int par3Size, int par4Frequency, int par5PosY){
- addAtomsOre(par1Name, par2Id, 0, par3Size, par4Frequency, par5PosY);
- }
-
-
- public void addAtomsOre(String par1Name, int par2Id, int par3Meta, int par4Size, int par5Frequency, int par6PosY){
- atomsOreNameListHash.add(par1Name, par1Name);
- atomsOreIDList.add(par2Id);
- atomsOreLangListHash.add(par1Name, "en_US");
- atomsOres.add(new WorldGenAtomsOre(par2Id, par3Meta, par4Size, par5Frequency, par6PosY));
+ atomsOres.add(new WorldGenAtomsOre(par2Id, getAtomsOreMetaOfIndex(), par3Size, par4Frequency, par5PosY));
+ addAtomsOreLanguage(par1Name, par1Name, "en_US");
}
- public ArrayList<String> getCompoundsName(){
- compoundsNameList.trimToSize();
- return compoundsNameList;
+ public ListHash<String, String> getCompoundsName(){
+ return compoundsNameListHash;
}
- public ArrayList<String> getCompoundsLangName(){
- compoundsLangNameList.trimToSize();
- return compoundsLangNameList;
- }
-
-
-
- public ArrayList<String> getCompoundsLang(){
- compoundsLangList.trimToSize();
- return compoundsLangList;
+ public ListHash<String, String> getCompoundsLang(){
+ return compoundsLangListHash;
}
- public ArrayList<Integer> getAtomsOreIDList(){
- return atomsOreIDList;
+ public ListHash<String, String> getAtomsOreLangListHash(){
+ return atomsOreLangListHash;
}
- public ListHash<String, String> getAtomsOreLangListHash(){
- return atomsOreLangListHash;
+ public int getAtomsOreIndex(){
+ return atomsOreNameListHash.sizeKeysList() / 16;
+ }
+
+
+
+ public int getAtomsOreMetaOfIndex(){
+ return atomsOreNameListHash.sizeKeysList() - getAtomsOreIndex() * 16;
}
public BlockChemicalCombinationTable(int par1, int par2, Material par3Material) {
super(par1, par2, par3Material);
- this.setCreativeTab(ChemiCraft.creativeTab);
+ this.setCreativeTab(ChemiCraft.creativeTabChemiCraft);
}
@Override
public BlockChemicalCraftingTable(int par1, int par2, Material par3Material) {
super(par1, par2, par3Material);
- this.setCreativeTab(ChemiCraft.creativeTab);
+ this.setCreativeTab(ChemiCraft.creativeTabChemiCraft);
}
public BlockElectrolysisTable(int par1, int par2, Material par3Material)
{
super(par1, par2, par3Material);
- this.setCreativeTab(ChemiCraft.creativeTab);
+ this.setCreativeTab(ChemiCraft.creativeTabChemiCraft);
}
@Override
public BlockPyrolysisTable(int par1, int par2, Material par3Material) {
super(par1, par2, par3Material);
- this.setCreativeTab(ChemiCraft.creativeTab);
+ this.setCreativeTab(ChemiCraft.creativeTabChemiCraft);
}
@Override
public BlockToolAndWeaponCraftingTable(int par1, int par2, Material par3Material) {
super(par1, par2, par3Material);
- this.setCreativeTab(ChemiCraft.creativeTab);
+ this.setCreativeTab(ChemiCraft.creativeTabChemiCraft);
}
@Override
--- /dev/null
+package pcc.chemicraft.creativetab;
+
+import net.minecraft.creativetab.CreativeTabs;
+import pcc.chemicraft.ChemiCraft;
+import cpw.mods.fml.relauncher.Side;
+import cpw.mods.fml.relauncher.SideOnly;
+
+public class CreativeTabAtomsOre extends CreativeTabs
+{
+
+ public CreativeTabAtomsOre(String type)
+ {
+ super(type);
+ }
+
+
+
+ @Override
+ @SideOnly(Side.CLIENT)
+ public int getTabIconItemIndex(){
+ return ChemiCraft.instance.blockAtomsOre[0].blockID;
+ }
+
+
+
+ @Override
+ @SideOnly(Side.CLIENT)
+ public String getTranslatedTabLabel(){
+ return "AtomsOre";
+ }
+
+
+}
-package pcc.chemicraft.util;
+package pcc.chemicraft.creativetab;
import net.minecraft.creativetab.CreativeTabs;
import pcc.chemicraft.ChemiCraft;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
-public class CreativeTabAtoms extends CreativeTabs {
+public class CreativeTabChemiCraft extends CreativeTabs {
- public CreativeTabAtoms(String type){
+ public CreativeTabChemiCraft(String type){
super(type);
}
+
@Override
@SideOnly(Side.CLIENT)
public int getTabIconItemIndex(){
@Override
@SideOnly(Side.CLIENT)
public String getTranslatedTabLabel(){
- return "Atoms";
+ return "ChemiCraft";
}
}
public class WorldGenAtomsOre extends WorldGenMinable implements IWorldGenerator
{
- private int id;
- private int meta;
- private int size;
private int frequency;
private int posY;
- public WorldGenAtomsOre(int id, int size, int frequency, int posY)
+ public WorldGenAtomsOre(int id, int meta, int size, int frequency, int posY)
{
- super(id, size);
+ super(id, meta, size);
this.frequency = frequency;
this.posY = posY;
}
- public WorldGenAtomsOre(int id, int meta, int size, int frequency, int posY)
- {
- this(id, size, frequency, posY);
- this.meta = meta;
- }
-
@Override
public void generate(Random par1Random, int par2ChunkX, int par3ChunkZ, World par4World, IChunkProvider par5ChunkGenerator, IChunkProvider par6ChunkProvider)
{
this.maxStackSize = 64;
this.setHasSubtypes(true);
this.setMaxDamage(0);
- this.setCreativeTab(ChemiCraft.instance.creativeTab);
+ this.setCreativeTab(ChemiCraft.instance.creativeTabChemiCraft);
}
super(par1);
this.setHasSubtypes(true);
this.setMaxDamage(0);
- this.setCreativeTab(ChemiCraft.instance.creativeTab);
+ this.setCreativeTab(ChemiCraft.instance.creativeTabChemiCraft);
}
@Override
public boolean onItemUse(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, World par3World, int par4, int par5, int par6, int par7, float par8, float par9, float par10) {
try {
for(int i=0;i < ChemiCraftAPI.instance().getCompoundHandlerItemName().size();i++){
- if(ChemiCraftAPI.instance().getCompoundsName().get(par1ItemStack.getItemDamage()).equals(ChemiCraftAPI.instance().getCompoundHandlerItemName().get(i))){
+ if(ChemiCraftAPI.instance().getCompoundsName().getKeyList(par1ItemStack.getItemDamage()).equals(ChemiCraftAPI.instance().getCompoundHandlerItemName().get(i))){
return ChemiCraftAPI.instance().getCompoundHandler().get(i).onItemUseHandler(par1ItemStack, par2EntityPlayer, par3World, par4, par5, par6, par7, par8, par9, par10);
}
}
{
try {
for(int i=0;i < ChemiCraftAPI.instance().getCompoundHandlerItemName().size();i++){
- if(ChemiCraftAPI.instance().getCompoundsName().get(par1ItemStack.getItemDamage()).equals(ChemiCraftAPI.instance().getCompoundHandlerItemName().get(i))){
+ if(ChemiCraftAPI.instance().getCompoundsName().getKeyList(par1ItemStack.getItemDamage()).equals(ChemiCraftAPI.instance().getCompoundHandlerItemName().get(i))){
ChemiCraftAPI.instance().getCompoundHandler().get(i).onItemRightClickHandler(par1ItemStack, par2World, par3EntityPlayer);
}
}
public void onUpdate(ItemStack par1ItemStack, World par2World, Entity par3Entity, int par4, boolean par5){
try {
for(int i=0;i < ChemiCraftAPI.instance().getCompoundHandlerItemName().size();i++){
- if(ChemiCraftAPI.instance().getCompoundsName().get(par1ItemStack.getItemDamage()).equals(ChemiCraftAPI.instance().getCompoundHandlerItemName().get(i))){
+ if(ChemiCraftAPI.instance().getCompoundsName().getKeyList(par1ItemStack.getItemDamage()).equals(ChemiCraftAPI.instance().getCompoundHandlerItemName().get(i))){
ChemiCraftAPI.instance().getCompoundHandler().get(i).onUpdateHandler(par1ItemStack, par2World, par3Entity, par4, par5);
}
}
@SideOnly(Side.CLIENT)
@Override
public void getSubItems(int par1, CreativeTabs par2CreativeTabs, List par3List){
- for(int type = 0; type < ChemiCraftAPI.instance().getCompoundsName().toArray().length; type++)
+ for(int type = 0; type < ChemiCraftAPI.instance().getCompoundsName().sizeKeysList(); type++)
{
par3List.add(new ItemStack(par1, 1, type));
this.setIconIndex(type);
@Override
public String getItemNameIS(ItemStack par1ItemStack){
try {
- return super.getItemName() + "." + ChemiCraftAPI.instance().getCompoundsName().toArray()[par1ItemStack.getItemDamage()];
+ return super.getItemName() + "." + ChemiCraftAPI.instance().getCompoundsName().getKeyList(par1ItemStack.getItemDamage());
} catch (ArrayIndexOutOfBoundsException e) {
par1ItemStack.stackSize = 0;
}
public int getIconFromDamage(int par1){
try {
for(int i=0;i < ChemiCraftAPI.instance().getCompoundHandlerItemName().size();i++){
- if(ChemiCraftAPI.instance().getCompoundsName().get(par1).equals(ChemiCraftAPI.instance().getCompoundHandlerItemName().get(i))){
+ if(ChemiCraftAPI.instance().getCompoundsName().getKeyList(par1).equals(ChemiCraftAPI.instance().getCompoundHandlerItemName().get(i))){
return ChemiCraftAPI.instance().getCompoundHandler().get(i).getIconIndexHandler();
}
}
super(id);
this.setMaxStackSize(1);
this.setMaxDamage(2);
- this.setCreativeTab(ChemiCraft.instance.creativeTab);
+ this.setCreativeTab(ChemiCraft.instance.creativeTabChemiCraft);
}
@Override
public BlockAtomsOre(int id)
{
super(id, Material.rock);
- this.setCreativeTab(ChemiCraft.instance.creativeTab);
+ this.setCreativeTab(ChemiCraft.instance.creativeTabAtomsOre);
}
@Override
package pcc.chemicraft.ore;
-import pcc.chemicraft.ChemiCraft;
-import net.minecraft.block.Block;
import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemDye;
import net.minecraft.item.ItemStack;
+import pcc.chemicraft.ChemiCraft;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;