this.itemCompounds = new ItemCompounds(this.compoundsID).setItemName("compounds");
this.itemGasCollectingBottle = new ItemGasCollectingBottle(this.gasCollectingBottleID).setItemName("gasCollectingBottle").setIconIndex(0);
this.itemAtomGrenade = new ItemAtomsGrenade(this.atomGrenadeID).setItemName("grenade").setIconIndex(1);
- this.itemChemicalCells = new ItemChemiCell(this.chemicalCellsID).setItemName("chemiCell");
+ this.itemChemicalCells = new ItemChemiCell(this.chemicalCellsID).setItemName("chemiCell").setIconIndex(3);
// BlockをMinecraftに登録します
GameRegistry.registerBlock(this.blockPyrolysisTable, "BlockPyrolysisTable");
api.addAtomOresLanguage("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, 200, 50); // BeAl2O4
- api.addAtomsOreLanguage("Chrysoberyl", "金緑石", "ja_JP");
api.addAtomOres("Beryl", new String[]{"Be", "Al", "Si", "O"}, new Integer[]{3, 2, 6, 18}, this.atomOresID[api.getAtomOresLastIndex()], 5, 1, 50); // Be3Al2Si6O18
api.addAtomOresLanguage("Beryl", "緑柱石", "ja_JP");
api.addAtomOres("Chrysoberyl", new String[]{"Be", "Al", "O"}, new Integer[]{1, 2, 4}, this.atomOresID[api.getAtomOresLastIndex()], 5, 1, 50); // BeAl2O4
this.api.addChemicalCombinationRecipe(new String[]{"H", "O", "Cl"}, new Integer[]{1, 2, 1}, new ItemStack(this.itemCompounds, 1, this.api.getCompound("ChlorousAcid")));
this.api.addChemicalCombinationRecipe(new String[]{"H", "O"}, new Integer[]{2, 1}, new ItemStack(this.itemCompounds, 1, this.api.getCompound("Water")));
+ //化学電池の追加
+ this.api.addMaterialRecipe(new ItemStack[] {
+ null,
+ null,
+ null,
+ new ItemStack(this.itemAtoms, 1, ChemiCraftData.ZINC),
+ null,
+ new ItemStack(this.itemAtoms, 1, ChemiCraftData.COPPER),
+ new ItemStack(Item.bucketWater),
+ new ItemStack(Item.bucketWater),
+ new ItemStack(Item.bucketWater),
+ },
+ new ItemStack(this.itemChemicalCells, 1, 0),
+ null);
+
//手榴弾の追加
this.api.addMaterialRecipe(new ItemStack[] {
null,
new NBTRecipeGrenade()
);
- this.api.addDecompositionRecipe(new ItemStack(Item.potion, 1, 0),
+ this.api.addPyrolysisDecompositionRecipe(new ItemStack(Item.potion, 1, 0),
new Integer[] {ChemiCraftData.HYDROGEN, ChemiCraftData.OXYGEN},
new Integer[] {2, 1});
- this.api.addDecompositionRecipe(new ItemStack(this.itemCompounds, 1, this.api.getCompound("Water")),
+ this.api.addPyrolysisDecompositionRecipe(new ItemStack(this.itemCompounds, 1, this.api.getCompound("Water")),
new Integer[] {ChemiCraftData.HYDROGEN, ChemiCraftData.OXYGEN},
new Integer[] {2, 1});
for (int i = 0; i < api.getAtomOresName().sizeKeysList(); i++){
- this.api.addDecompositionRecipe(new ItemStack(this.blockAtomOres[i / 16], 1, i - i / 16 * 16),
+ this.api.addPyrolysisDecompositionRecipe(new ItemStack(this.blockAtomOres[i / 16], 1, i - i / 16 * 16),
api.getAtomOresAtoms().get(api.getAtomOresName().getKeyList(i)),
api.getAtomOresAmounts().get(api.getAtomOresName().getKeyList(i)));
}
- this.api.addDecompositionFuel(new ItemStack(Item.coal), 2000*8);
+ this.api.addPyrolysisDecompositionFuel(new ItemStack(Item.coal), 2000*8);
}
private void apiProcessing(final FMLPostInitializationEvent event) {
import net.minecraft.item.ItemStack;
import pcc.chemicraft.gen.WorldGenAtomsOre;
import pcc.chemicraft.system.ChemiCraftCraftingManager;
+import pcc.chemicraft.tileentity.TileEntityElectrolysisTable;
import pcc.chemicraft.tileentity.TileEntityPyrolysisTable;
import pcc.chemicraft.util.ChemicalNBTRecipe;
import pcc.chemicraft.util.ICompoundHandler;
/**
+ * 電池
+ */
+ private HashMap<ItemStack, Integer> chemicalCellsList = new HashMap<ItemStack, Integer>();
+
+
+ /**
* 電池言語リスト
*/
private ListHash<String, String> chemicalCellsLangListHash = new ListHash<String, String>();
private ListHash<String, String> chemicalCellsNameListHash = new ListHash<String, String>();
- private HashMap<ItemStack, Integer> chemicalCellsFuelList = new HashMap<ItemStack, Integer>();
-
-
/**
* 化合台の原子の数のリスト
public void addAtomOres(String par1Name, String[] par2Atoms, Integer[] par3Amounts, int par4Id, int par5Size, int par6Frequency, int par7PosY){
- addAtomOres(par1Name, ChemiCraftData.toAtoms(par2Atoms), par3Amounts, par7PosY, par7PosY, par7PosY, par7PosY);
+ addAtomOres(par1Name, ChemiCraftData.toAtoms(par2Atoms), par3Amounts, par4Id, par5Size, par6Frequency, par7PosY);
}
* @param par1Name
*/
public void addChemicalCell(Item par1ChemicalCell, String par2Name, int par3OperationTime){
- chemicalCellsFuelList.put(new ItemStack(par1ChemicalCell, 0, chemicalCellsNameListHash.sizeKeysList()), par3OperationTime);
+ chemicalCellsList.put(new ItemStack(par1ChemicalCell, 0, chemicalCellsNameListHash.sizeKeysList()), par3OperationTime);
addChemicalCellLanguage(par2Name, "en_US", par2Name);
}
* @param itemstack 燃料のItemStack
* @param burnTime 燃焼時間(tick * rate)
*/
- public void addDecompositionFuel(ItemStack itemstack, int burnTime) {
+ public void addPyrolysisDecompositionFuel(ItemStack itemstack, int burnTime) {
TileEntityPyrolysisTable.addFuel(itemstack, burnTime);
}
* @param integers 原子の元素番号の配列
* @param integers2 原子のできる数の配列
*/
- public void addDecompositionRecipe(ItemStack material, Integer[] integers, Integer[] integers2) {
+ public void addPyrolysisDecompositionRecipe(ItemStack material, Integer[] integers, Integer[] integers2) {
ItemStack[] itemstacks = new ItemStack[integers.length];
for (int i = 0; i < itemstacks.length; i++) {
itemstacks[i] = new ItemStack(ChemiCraft.instance.itemAtoms,integers2[i], integers[i]);
+ public void addElectrolysisDecompositionRecipe(ItemStack material, Integer[] integers, Integer[] integers2) {
+ ItemStack[] itemstacks = new ItemStack[integers.length];
+ for (int i = 0; i < itemstacks.length; i++) {
+ itemstacks[i] = new ItemStack(ChemiCraft.instance.itemAtoms,integers2[i], integers[i]);
+ }
+ TileEntityElectrolysisTable.addRecipe(material, itemstacks);
+ }
+
+
+
/**
* 素材作成台のレシピを追加します
* @param materials 素材
- public HashMap<ItemStack, Integer> getChemicalCellsFuelList(){
- return chemicalCellsFuelList;
+ public HashMap<ItemStack, Integer> getChemicalCellsList(){
+ return chemicalCellsList;
}
import net.minecraft.world.World;
import pcc.chemicraft.container.ContainerChemicalCombinationTable;
import pcc.chemicraft.container.ContainerChemicalCraftingTable;
+import pcc.chemicraft.container.ContainerElectrolysisTable;
import pcc.chemicraft.container.ContainerPyrolysisTable;
import pcc.chemicraft.container.ContainerToolAndWeaponCraftingTable;
import pcc.chemicraft.debug.DebugTick;
import pcc.chemicraft.tileentity.TileEntityChemicalCombinationTable;
import pcc.chemicraft.tileentity.TileEntityChemicalCraftingTable;
+import pcc.chemicraft.tileentity.TileEntityElectrolysisTable;
import pcc.chemicraft.tileentity.TileEntityPyrolysisTable;
import pcc.chemicraft.tileentity.TileEntityToolAndWeaponCraftingTable;
import cpw.mods.fml.common.network.IGuiHandler;
TileEntity tileEntity = world.getBlockTileEntity(x, y, z);
if (tileEntity instanceof TileEntityPyrolysisTable) {
return new ContainerPyrolysisTable(player, (TileEntityPyrolysisTable) tileEntity);
+ }else if(tileEntity instanceof TileEntityElectrolysisTable){
+ return new ContainerElectrolysisTable(player, (TileEntityElectrolysisTable) tileEntity);
}else if(tileEntity instanceof TileEntityChemicalCombinationTable){
return new ContainerChemicalCombinationTable(player, (TileEntityChemicalCombinationTable) tileEntity);
}else if(tileEntity instanceof TileEntityToolAndWeaponCraftingTable){
@Override
public void updateEntity()
{
- boolean var1 = this.worldObj.canBlockSeeTheSky(xCoord, yCoord + 1, zCoord);
- if (this.worldObj.getBlockId(xCoord, yCoord-1, zCoord) == Block.fire.blockID) {
- if (this.heat < 1700) {
- if (this.worldObj.isRaining() && var1 && !this.worldObj.isThundering()) {
- this.heat += 0.1F;
- } else if (this.worldObj.isThundering() && var1) {
- this.heat += 0.25F;
- } else {
- this.heat += 0.5F;
- }
- } else {
- this.heat = 1700;
- }
- } else {
- if (this.heat > 0) {
- if(this.worldObj.isRaining() && var1 && !this.worldObj.isThundering()) {
- this.heat -= 0.25F;
- } else if(this.worldObj.isThundering() && var1) {
- this.heat -= 0.5F;
- } else {
- this.heat -= 0.05F;
- }
- } else {
- this.heat = 0;
- }
- }
-
if (this.fuelRestTime >= 0) {
this.burnTime += 10 * CENTER_HEAT / this.heat;
this.fuelRestTime -= 10 * CENTER_HEAT / this.heat;
ItemStack materialItem = this.invm.getStackInSlot(0);
if (materialItem != null) {
if (this.isInItemCheck(itemstackMaterial)) {
- //var2 = true;
if (itemstackMaterial.itemID == materialItem.itemID && itemstackMaterial.getItemDamage() == materialItem.getItemDamage()) {
this.inItem(itemstackMaterial);
if (materialItem.stackSize > 1) {
this.burnTime = 0;
}
- boolean var3 = false;
+ boolean var1 = false;
if (this.heat > MIN_HEAT) {
Iterator<ItemStack> itMaterial = recipeList.keySet().iterator();
while (itMaterial.hasNext()) {
ItemStack materialItem = this.invm.getStackInSlot(0);
if (materialItem != null) {
if (this.isInItemCheck(itemstackMaterial)) {
- //var2 = true;
if (itemstackMaterial.itemID == materialItem.itemID && itemstackMaterial.getItemDamage() == materialItem.getItemDamage()) {
- var3 = true;
+ var1 = true;
if (this.fuelRestTime <= 0) {
- Iterator<ItemStack> itFuel = ChemiCraftAPI.instance().getChemicalCellsFuelList().keySet().iterator();
+ Iterator<ItemStack> itFuel = ChemiCraftAPI.instance().getChemicalCellsList().keySet().iterator();
while (itFuel.hasNext()) {
ItemStack itemstackFuel = itFuel.next();
ItemStack fuelItem = this.invf.getStackInSlot(0);
if (fuelItem != null) {
if (itemstackFuel.itemID == fuelItem.itemID && itemstackFuel.getItemDamage() == fuelItem.getItemDamage()) {
- this.fuelRestTime = ChemiCraftAPI.instance().getChemicalCellsFuelList().get(itemstackFuel);
+ this.fuelRestTime = ChemiCraftAPI.instance().getChemicalCellsList().get(itemstackFuel);
if (fuelItem.stackSize > 1) {
this.invf.setInventorySlotContents(0, new ItemStack(fuelItem.itemID, --fuelItem.stackSize, fuelItem.getItemDamage()));
break;
}
} else {
this.burnTime = 0;
- //var2 = false;
}
}
- if (!var3) {
+ if (!var1) {
this.burnTime = 0;
}
}
}
}
+ public static void addRecipe(ItemStack material, ItemStack[] result) {
+ recipeList.put(material, result);
+ }
+
}
import java.util.Map;
import java.util.Set;
-/**
- * ListHashは型Kに対応したArrayListに型Eを追加する機能を提供します。<br>
- *
- * このクラスを作成すると、まず<br>
- * <pre>
- * HashMap<K, ArrayList<E>>
- * </pre>
- * が生成されます。<br>
- * 型KはHashMapやTreeMapを使った時とように使用します。<br>
- * 型EはArrayListの型を指定します。<br>
- * <br>
- * <h2>構造解説:</h2>
- * HashMapの型VがArrayListになっており、ArrayListの型Eがこのクラスの型Eになります。<br>
- * HashMapでは型Vを値として入れなければいけませんが、ListHashではこのクラスの型EをArrayListに入れることができます。<br>
- *
- * @author mozipi
- *
- * @param <K> Key
- * @param <E> Element
- */
public class ListHash<K, E>
{
/**
* @author Ponkotate version:1.0.0 dev
- *
+ *
* Create ArrayList in HashMap.
*/