OSDN Git Service

いろいろした
authormozipi <mozipi_2@yahoo.co.jp>
Mon, 1 Apr 2013 11:09:26 +0000 (20:09 +0900)
committermozipi <mozipi_2@yahoo.co.jp>
Mon, 1 Apr 2013 11:09:26 +0000 (20:09 +0900)
74 files changed:
common/pcc/addon/crops/BlockChemicalCrops.java [new file with mode: 0644]
common/pcc/addon/crops/ChemicalBlockAPI.java [new file with mode: 0644]
common/pcc/addon/crops/ChemicalCrops.java [new file with mode: 0644]
common/pcc/addon/crops/ClientProxy.java [new file with mode: 0644]
common/pcc/addon/crops/CommonProxy.java [new file with mode: 0644]
common/pcc/addon/crops/PlantData.java [new file with mode: 0644]
common/pcc/addon/crops/PlantDataStream.java [new file with mode: 0644]
common/pcc/addon/crops/WorldEventHandler.java [new file with mode: 0644]
common/pcc/chemicraft/ChemiCraft.java
common/pcc/chemicraft/ChemiCraftConfiguration.java
common/pcc/chemicraft/ChemiCraftData.java
common/pcc/chemicraft/ChemiCraftLogging.java [new file with mode: 0644]
common/pcc/chemicraft/ChemiCraftRegister.java
common/pcc/chemicraft/EnumLoggingType.java [new file with mode: 0644]
common/pcc/chemicraft/base/ChemiCraftBase.java
common/pcc/chemicraft/base/ChemiCraftBaseAPI.java
common/pcc/chemicraft/base/ChemiCraftBaseRegister.java
common/pcc/chemicraft/base/ChemiCraftRegisterBaseRecipe.java
common/pcc/chemicraft/base/ChemiCraftRegisterBlock.java
common/pcc/chemicraft/base/ChemiCraftRegisterChemicalRecipe.java
common/pcc/chemicraft/base/ChemiCraftRegisterCompounds.java
common/pcc/chemicraft/base/ChemiCraftRegisterCompoundsHandler.java
common/pcc/chemicraft/base/ChemiCraftRegisterEntitys.java
common/pcc/chemicraft/base/ChemiCraftRegisterItem.java
common/pcc/chemicraft/base/client/ClientProxy.java
common/pcc/chemicraft/base/compounds/CompoundWater.java
common/pcc/chemicraft/base/compounds/FalseItem.java
common/pcc/chemicraft/base/creativetab/CreativeTabAtomOres.java
common/pcc/chemicraft/base/entity/EntityAtomsGrenade.java
common/pcc/chemicraft/base/entity/EntityBlackSmoke.java
common/pcc/chemicraft/base/entity/EntityDust.java
common/pcc/chemicraft/base/gen/WorldGenAtomsOre.java
common/pcc/chemicraft/base/item/ItemAtomsGrenade.java
common/pcc/chemicraft/base/item/ItemBlackSmoke.java
common/pcc/chemicraft/base/item/ItemDust.java
common/pcc/chemicraft/base/item/ItemOreSerarcher.java [new file with mode: 0644]
common/pcc/chemicraft/base/item/ItemRadiationBallet.java
common/pcc/chemicraft/base/item/ItemRadiationGun.java
common/pcc/chemicraft/base/ore/BlockAtomOres.java
common/pcc/chemicraft/base/ore/ItemAtomOres.java
common/pcc/chemicraft/base/render/RenderAtomsGrenade.java
common/pcc/chemicraft/base/render/RenderDust.java
common/pcc/chemicraft/base/system/CommonProxy.java
common/pcc/chemicraft/base/system/PacketHandler.java
common/pcc/chemicraft/core/ChemiCraftAPI.java
common/pcc/chemicraft/core/ChemiCraftCore.java
common/pcc/chemicraft/core/ChemiCraftCoreRegister.java
common/pcc/chemicraft/core/ChemiCraftRegisterBlock.java
common/pcc/chemicraft/core/ChemiCraftRegisterCoreRecipe.java
common/pcc/chemicraft/core/ChemiCraftRegisterItem.java
common/pcc/chemicraft/core/ChemiCraftRegisterTileEntity.java
common/pcc/chemicraft/core/container/ContainerChemicalCraftingTable.java
common/pcc/chemicraft/core/item/ItemCompounds.java
common/pcc/chemicraft/core/nbt/ChemicalNBTRecipe.java [moved from common/pcc/chemicraft/util/ChemicalNBTRecipe.java with 71% similarity]
common/pcc/chemicraft/core/nbt/NBTRecipeGrenade.java [moved from common/pcc/chemicraft/util/NBTRecipeGrenade.java with 51% similarity]
common/pcc/chemicraft/core/other/ChunkProviderChemical.java [moved from common/pcc/chemicraft/util/ChunkProviderChemical.java with 99% similarity]
common/pcc/chemicraft/core/other/WorldProviderChemical.java [moved from common/pcc/chemicraft/util/WorldProviderChemical.java with 85% similarity]
common/pcc/chemicraft/core/other/WorldTypeChemical.java [moved from common/pcc/chemicraft/util/WorldTypeChemical.java with 95% similarity]
common/pcc/chemicraft/core/system/ChemiCraftCraftingManager.java
common/pcc/chemicraft/core/tileentity/TileEntityElectrolysisTable.java
common/pcc/chemicraft/testcase/FormulaTest.java
common/pcc/chemicraft/testcase/MaterialRecipeTest.java
common/pcc/chemicraft/util/AtomInfo.java
common/pcc/chemicraft/util/Auxiliary.java
common/pcc/chemicraft/util/ComparatorFormulaPart.java
common/pcc/chemicraft/util/ComparatorItemStack.java
common/pcc/chemicraft/util/Formula.java
common/pcc/chemicraft/util/FormulaPart.java
common/pcc/chemicraft/util/FormulaTestTest.java [deleted file]
common/pcc/chemicraft/util/ICompoundHandler.java
common/pcc/chemicraft/util/ListHash.java
common/pcc/chemicraft/util/MaterialRecipe.java
common/pcc/chemicraft/util/OldItem.java
common/pcc/chemicraft/util/OldItemFood.java

diff --git a/common/pcc/addon/crops/BlockChemicalCrops.java b/common/pcc/addon/crops/BlockChemicalCrops.java
new file mode 100644 (file)
index 0000000..55fc0bc
--- /dev/null
@@ -0,0 +1,62 @@
+package pcc.addon.crops;
+
+import java.util.Random;
+
+import net.minecraft.block.Block;
+import net.minecraft.block.material.Material;
+import net.minecraft.creativetab.CreativeTabs;
+import net.minecraft.world.World;
+import net.minecraftforge.common.EnumPlantType;
+import net.minecraftforge.common.IPlantable;
+import cpw.mods.fml.relauncher.Side;
+import cpw.mods.fml.relauncher.SideOnly;
+
+public class BlockChemicalCrops extends Block implements IPlantable {
+
+       private int plantID;
+       private int plantMetadata;
+       private String textureFile;
+
+       public BlockChemicalCrops(int par1, int par2, Material par3Material) {
+               super(par1, par2, par3Material);
+               this.setCreativeTab(CreativeTabs.tabBlock);
+               this.setTickRandomly(true);
+       }
+
+       @Override
+       public EnumPlantType getPlantType(World world, int x, int y, int z) {
+               return EnumPlantType.Crop;
+       }
+
+       @Override
+       public int getPlantID(World world, int x, int y, int z) {
+               return ChemicalCrops.dataStream.getID(world.getWorldInfo().getWorldName(), world.getWorldInfo().getDimension(), x, y, z);
+       }
+
+       @Override
+       public int getPlantMetadata(World world, int x, int y, int z) {
+               return ChemicalCrops.dataStream.getMeta(world.getWorldInfo().getWorldName(), world.getWorldInfo().getDimension(), x, y, z);
+       }
+
+       @Override
+       public String getTextureFile() {
+               return "";
+       }
+
+       public void setPlantIDAndMetadata(String worldName, int dimID, int x, int y, int z, int id, int meta) {
+               ChemicalCrops.dataStream.setData(worldName, dimID, x, y, z, id, meta);
+       }
+
+       @Override
+       public void updateTick(World par1World, int par2, int par3, int par4, Random par5Random) {
+               super.updateTick(par1World, par2, par3, par4, par5Random);
+       }
+
+       @Override
+       public void breakBlock(World par1World, int par2, int par3, int par4,
+                       int par5, int par6) {
+               super.breakBlock(par1World, par2, par3, par4, par5, par6);
+               ChemicalCrops.dataStream.remove(par1World.getWorldInfo().getWorldName(), par1World.getWorldInfo().getDimension(), par2, par3, par4);
+       }
+
+}
diff --git a/common/pcc/addon/crops/ChemicalBlockAPI.java b/common/pcc/addon/crops/ChemicalBlockAPI.java
new file mode 100644 (file)
index 0000000..6382635
--- /dev/null
@@ -0,0 +1,14 @@
+package pcc.addon.crops;
+
+import net.minecraft.world.World;
+
+public class ChemicalBlockAPI {
+
+       public static void setBlock(World par1World, int x, int y, int z, int id, int meta, int pID, int pMeta) {
+               par1World.setBlock(x, y, z, ChemicalCrops.instance.cropsID);
+               if (!par1World.isRemote) {
+                       ChemicalCrops.instance.getCrops().setPlantIDAndMetadata(par1World.getWorldInfo().getWorldName(), par1World.getWorldInfo().getDimension(), x, y, z, pID, pMeta);
+               }
+       }
+
+}
diff --git a/common/pcc/addon/crops/ChemicalCrops.java b/common/pcc/addon/crops/ChemicalCrops.java
new file mode 100644 (file)
index 0000000..2adff52
--- /dev/null
@@ -0,0 +1,117 @@
+package pcc.addon.crops;
+
+import java.awt.Canvas;
+import java.io.IOException;
+
+import net.minecraft.block.Block;
+import net.minecraft.block.material.Material;
+import net.minecraft.client.Minecraft;
+import net.minecraftforge.common.Configuration;
+import net.minecraftforge.common.MinecraftForge;
+import cpw.mods.fml.common.Mod;
+import cpw.mods.fml.common.Mod.Init;
+import cpw.mods.fml.common.Mod.Instance;
+import cpw.mods.fml.common.Mod.PreInit;
+import cpw.mods.fml.common.SidedProxy;
+import cpw.mods.fml.common.event.FMLInitializationEvent;
+import cpw.mods.fml.common.event.FMLPreInitializationEvent;
+import cpw.mods.fml.common.network.NetworkMod;
+import cpw.mods.fml.common.registry.GameRegistry;
+
+@Mod(modid="ChemicalCrops", name="ChemicalCrops(ChemiCraft-Addon)", version="v1.0.0")
+@NetworkMod(clientSideRequired = true, serverSideRequired = false)
+public class ChemicalCrops {
+
+       @Instance("ChemicalCrops")
+       public static ChemicalCrops instance;
+
+       @SidedProxy(clientSide = "pcc.addon.crops.ClientProxy", serverSide = "pcc.addon.crops.CommonProxy")
+       public static CommonProxy proxy;
+
+       /**
+        * CropsのBlockID
+        */
+       public int cropsID;
+
+       /**
+        * ChemicalCropsの変数。<br>
+        * ここに入るインスタンスはBlockChemicalCropsと保証されます。
+        */
+       private Block blockCrops;
+
+       /**
+        * プラントデータ書き込み&読み込みのストリーム
+        */
+       public static final PlantDataStream dataStream = new PlantDataStream(System.getProperty("user.dir") + "/saves/", "ChemicalCrops.dat");
+
+       /**
+        * プラントデータ自動セーブ用のスレッド
+        */
+       private Thread thread;
+
+       public ChemicalCrops() {
+               this.thread = new Thread() {
+                       @Override
+                       public void run() {
+                               while (true) {
+                                       try {
+                                               dataStream.createDataOutputStream();
+                                               dataStream.write();
+                                       } catch (IOException e1) {
+                                               e1.printStackTrace();
+                                       }
+                                       try {
+                                               Thread.sleep(2000);
+                                       } catch (InterruptedException e) {
+                                               e.printStackTrace();
+                                       }
+                               }
+                       }
+               };
+
+       }
+
+       @PreInit
+       public void preInit(FMLPreInitializationEvent event) {
+               Configuration cfg = new Configuration(event.getSuggestedConfigurationFile());
+               cfg.load();
+               this.cropsID = cfg.getBlock("CropsID", 2700).getInt();
+               cfg.save();
+       }
+
+       @Init
+       public void init(FMLInitializationEvent event) {
+               //イベント登録
+               MinecraftForge.EVENT_BUS.register(new WorldEventHandler());
+
+               //Blockのインスタンス作成
+               this.blockCrops = new BlockChemicalCrops(this.cropsID, 1, Material.glass).setBlockName("BlockCrops");
+
+               //Minecraftに登録
+               GameRegistry.registerBlock(this.blockCrops, "BlockCrops");
+       }
+
+       public BlockChemicalCrops getCrops() {
+               return (BlockChemicalCrops) this.blockCrops;
+       }
+
+       /**
+        * プラントデータ自動セーブを開始します。<br>
+        * すでに停止している場合はNullPointerExceptionをスローします。
+        */
+       public void startAutoSave() {
+               try {
+                       this.thread.start();
+               } catch (IllegalThreadStateException e) {
+               }
+       }
+
+       /**
+        * プラントデータ自動セーブを停止します。<br>
+        * 開始していない、もしくはすでに停止している場合はNullPointerExceptionをスローします。
+        */
+       public void stopAutoSave() {
+               this.thread.stop();
+       }
+
+}
diff --git a/common/pcc/addon/crops/ClientProxy.java b/common/pcc/addon/crops/ClientProxy.java
new file mode 100644 (file)
index 0000000..49b13a4
--- /dev/null
@@ -0,0 +1,5 @@
+package pcc.addon.crops;
+
+public class ClientProxy extends CommonProxy {
+
+}
diff --git a/common/pcc/addon/crops/CommonProxy.java b/common/pcc/addon/crops/CommonProxy.java
new file mode 100644 (file)
index 0000000..03d696f
--- /dev/null
@@ -0,0 +1,5 @@
+package pcc.addon.crops;
+
+public class CommonProxy {
+
+}
diff --git a/common/pcc/addon/crops/PlantData.java b/common/pcc/addon/crops/PlantData.java
new file mode 100644 (file)
index 0000000..4fb8fae
--- /dev/null
@@ -0,0 +1,108 @@
+package pcc.addon.crops;
+
+import java.util.ArrayList;
+
+public class PlantData {
+
+       private String worldName;
+       private int dimID;
+       private int x;
+       private int y;
+       private int z;
+       private int id;
+       private int meta;
+       private ArrayList<String> others = new ArrayList<String>();
+
+       public PlantData(String worldName, int dimID, int x, int y, int z, int id, int meta) {
+               super();
+               this.worldName = worldName;
+               this.dimID = dimID;
+               this.x = x;
+               this.y = y;
+               this.z = z;
+               this.id = id;
+               this.meta = meta;
+       }
+
+       public void setWorldName(String worldName) {
+               this.worldName = worldName;
+       }
+
+       public void setDimID(int dimID) {
+               this.dimID = dimID;
+       }
+
+       public void setX(int x) {
+               this.x = x;
+       }
+
+       public void setY(int y) {
+               this.y = y;
+       }
+
+       public void setZ(int z) {
+               this.z = z;
+       }
+
+       public void setId(int id) {
+               this.id = id;
+       }
+
+       public void setMeta(int meta) {
+               this.meta = meta;
+       }
+
+       public String getWorldName() {
+               return worldName;
+       }
+
+       public int getDimID() {
+               return this.dimID;
+       }
+
+       public int getX() {
+               return x;
+       }
+
+       public int getY() {
+               return y;
+       }
+
+       public int getZ() {
+               return z;
+       }
+
+       public int getId() {
+               return id;
+       }
+
+       public int getMeta() {
+               return meta;
+       }
+
+       public ArrayList<String> getOthers() {
+               return others;
+       }
+
+       public void add(String data) {
+               this.others.add(data);
+       }
+
+       public void addAll(ArrayList<String> datas) {
+               this.others = datas;
+       }
+
+       @Override
+       public boolean equals(Object obj) {
+               PlantData p = (PlantData) obj;
+               if (p.getWorldName().equals(this.worldName)
+                               && p.getDimID() == this.dimID
+                               && p.getX() == this.x
+                               && p.getY() == this.y
+                               && p.getZ() == this.z) {
+                       return true;
+               }
+               return false;
+       }
+
+}
diff --git a/common/pcc/addon/crops/PlantDataStream.java b/common/pcc/addon/crops/PlantDataStream.java
new file mode 100644 (file)
index 0000000..656265a
--- /dev/null
@@ -0,0 +1,220 @@
+package pcc.addon.crops;
+
+import java.io.BufferedReader;
+import java.io.BufferedWriter;
+import java.io.File;
+import java.io.FileReader;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.Iterator;
+
+public class PlantDataStream {
+
+       private String dirPath;
+       private String filePath;
+
+       private BufferedReader input;
+       private BufferedWriter output;
+
+       private File file;
+
+       private HashSet<PlantData> plantDataHash = new HashSet<PlantData>();
+
+       public PlantDataStream(String dirPath, String filePath) {
+               this.dirPath = dirPath;
+               this.filePath = filePath;
+       }
+
+       public void createDataInputStream() throws IOException {
+               this.file = new File(this.dirPath + this.filePath);
+               if (!this.file.exists()) {
+                       this.file.createNewFile();
+               }
+
+               if (this.file.canRead()) {
+                       if (this.file.canWrite()) {
+                               this.input = new BufferedReader(
+                                               new FileReader(this.file)
+                                               );
+                       } else {
+                               throw new IOException("You don't have Write Permission.");
+                       }
+               } else {
+                       throw new IOException("You don't have Read Permission.");
+               }
+       }
+
+       public void createDataOutputStream() throws IOException {
+               this.file = new File(this.dirPath + this.filePath);
+               if (!this.file.exists()) {
+                       this.file.createNewFile();
+               }
+
+               if (this.file.canRead()) {
+                       if (this.file.canWrite()) {
+                               this.output = new BufferedWriter(
+                                               new FileWriter(this.file)
+                                               );
+                       } else {
+                               throw new IOException("You don't have Write Permission.");
+                       }
+               } else {
+                       throw new IOException("You don't have Read Permission.");
+               }
+       }
+
+       public void read() throws IOException {
+               String readData = null;
+               while ((readData = this.input.readLine()) != null) {
+                       String[] datas = readData.split("#");
+                       if (datas.length < 6) {
+                               continue;
+                       }
+                       String worldName = datas[0];
+                       int dimID = Integer.parseInt(datas[1]);
+                       int x = Integer.parseInt(datas[2]);
+                       int y = Integer.parseInt(datas[3]);
+                       int z = Integer.parseInt(datas[4]);
+                       int id = Integer.parseInt(datas[5]);
+                       int meta = Integer.parseInt(datas[6]);
+                       PlantData p = new PlantData(worldName, dimID, x, y, z, id, meta);
+                       for (int i = 0; i < datas.length - 7; i++) {
+                               p.add(datas[7 + i]);
+                       }
+                       this.plantDataHash.add(p);
+               }
+               this.input.close();
+       }
+
+       public void write() throws IOException {
+               try {
+                       for (PlantData p: this.plantDataHash) {
+                               String result = "";
+                               String worldName = p.getWorldName();
+                               int dimID = p.getDimID();
+                               int x = p.getX();
+                               int y = p.getY();
+                               int z = p.getZ();
+                               int id = p.getId();
+                               int meta = p.getMeta();
+                               ArrayList<String> others = p.getOthers();
+
+                               result = result + worldName + "#";
+                               result = result + dimID + "#";
+                               result = result + x + "#";
+                               result = result + y + "#";
+                               result = result + z + "#";
+                               result = result + id + "#";
+                               result = result + meta + "#";
+                               for (int i = 0; i < others.size(); i++) {
+                                       result = result + others.get(i) + "#";
+                               }
+                               this.output.newLine();
+                               this.output.write(result);
+                               this.output.flush();
+                       }
+               } catch (IOException e) {
+               }
+               this.output.close();
+       }
+
+       public String get(String worldName, int dimID, int x, int y, int z, int dataID) {
+               for (PlantData p: this.plantDataHash) {
+                       PlantData newPlantData = new PlantData(worldName, dimID, x, y, z, 0, 0);
+                       if (p.equals(newPlantData)) {
+                               return p.getOthers().get(dataID);
+                       }
+               }
+               System.out.println("Data not found");
+               return null;
+       }
+
+       public int getID(String worldName, int dimID, int x, int y, int z) {
+               for (PlantData p: this.plantDataHash) {
+                       PlantData newPlantData = new PlantData(worldName, dimID, x, y, z, 0, 0);
+                       if (p.equals(newPlantData)) {
+                               return p.getId();
+                       }
+               }
+               System.out.println("ID not found");
+               return -1;
+       }
+
+       public int getMeta(String worldName, int dimID, int x, int y, int z) {
+               for (PlantData p: this.plantDataHash) {
+                       PlantData newPlantData = new PlantData(worldName, dimID, x, y, z, 0, 0);
+                       if (p.equals(newPlantData)) {
+                               return p.getMeta();
+                       }
+               }
+               System.out.println("Meta not found");
+               return -1;
+       }
+
+       public void set(String worldName, int dimID, int x, int y, int z, String data) {
+               for (PlantData p: this.plantDataHash) {
+                       PlantData newPlantData = new PlantData(worldName, dimID, x, y, z, 0, 0);
+                       if (p.equals(newPlantData)) {
+                               p.add(data);
+                               return;
+                       }
+               }
+               PlantData newPlantData = new PlantData(worldName, dimID, x, y, z, 0, 0);
+               newPlantData.add(data);
+               this.plantDataHash.add(newPlantData);
+       }
+
+       public void setID(String worldName, int dimID, int x, int y, int z, int id) {
+               for (PlantData p: this.plantDataHash) {
+                       PlantData newPlantData = new PlantData(worldName, dimID, x, y, z, 0, 0);
+                       if (p.equals(newPlantData)) {
+                               p.setId(id);
+                               return;
+                       }
+               }
+               PlantData newPlantData = new PlantData(worldName, dimID, x, y, z, id, 0);
+               this.plantDataHash.add(newPlantData);
+       }
+
+       public void setMeta(String worldName, int dimID, int x, int y, int z, int meta) {
+               for (PlantData p: this.plantDataHash) {
+                       PlantData newPlantData = new PlantData(worldName, dimID, x, y, z, 0, 0);
+                       if (p.equals(newPlantData)) {
+                               p.setMeta(meta);
+                               return;
+                       }
+               }
+               PlantData newPlantData = new PlantData(worldName, dimID, x, y, z, 0, meta);
+               this.plantDataHash.add(newPlantData);
+       }
+
+       public void setData(String worldName, int dimID, int x, int y, int z, int id, int meta) {
+               for (PlantData p: this.plantDataHash) {
+                       PlantData newPlantData = new PlantData(worldName, dimID, x, y, z, 0, 0);
+                       if (p.equals(newPlantData)) {
+                               p.setId(id);
+                               p.setMeta(meta);
+                               return;
+                       }
+               }
+               PlantData newPlantData = new PlantData(worldName, dimID, x, y, z, id, meta);
+               this.plantDataHash.add(newPlantData);
+       }
+
+       public void remove(String worldName, int dimID, int x, int y, int z) {
+               for (PlantData p: this.plantDataHash) {
+                       PlantData newPlantData = new PlantData(worldName, dimID, x, y, z, 0, 0);
+                       if (p.equals(newPlantData)) {
+                               this.plantDataHash.remove(p);
+                               return;
+                       }
+               }
+       }
+
+       public void clearPlantDataHash() {
+               this.plantDataHash.clear();
+       }
+
+}
diff --git a/common/pcc/addon/crops/WorldEventHandler.java b/common/pcc/addon/crops/WorldEventHandler.java
new file mode 100644 (file)
index 0000000..cc9fd56
--- /dev/null
@@ -0,0 +1,34 @@
+package pcc.addon.crops;
+
+import java.io.IOException;
+
+import net.minecraftforge.event.ForgeSubscribe;
+import net.minecraftforge.event.world.WorldEvent.Load;
+import net.minecraftforge.event.world.WorldEvent.Save;
+
+public class WorldEventHandler {
+
+       @ForgeSubscribe
+       public void event(Load event) {
+               try {
+                       ChemicalCrops.dataStream.createDataInputStream();
+                       ChemicalCrops.dataStream.createDataOutputStream();
+                       ChemicalCrops.dataStream.read();
+                       ChemicalCrops.instance.startAutoSave();
+               } catch (IOException e) {
+                       e.printStackTrace();
+               }
+       }
+
+       @ForgeSubscribe
+       public void event(Save event) {
+               try {
+                       ChemicalCrops.instance.stopAutoSave();
+                       ChemicalCrops.dataStream.write();
+                       ChemicalCrops.dataStream.clearPlantDataHash();
+               } catch (IOException e) {
+                       e.printStackTrace();
+               }
+       }
+
+}
index 73341a8..6515fe0 100644 (file)
@@ -7,8 +7,10 @@ import pcc.chemicraft.util.Auxiliary.MathAuxiliary;
 import pcc.chemicraft.util.Auxiliary.NameAuxiliary;
 import cpw.mods.fml.common.event.FMLStateEvent;
 
-public abstract class ChemiCraft implements Runnable
-{
+/**
+ * @author P.C.C
+ */
+public abstract class ChemiCraft implements Runnable {
 
        /**
         * this is Thread on ChemiCraft.
index c4a08f2..bbe02dd 100644 (file)
@@ -1,19 +1,33 @@
 package pcc.chemicraft;
 
+/**
+ * @author mozipi
+ */
 public class ChemiCraftConfiguration {
 
+       /**
+        * the Now ID.
+        */
        private int nowID;
 
        public ChemiCraftConfiguration(int baseID) {
                this.nowID = baseID;
        }
 
+       /**
+        * 現在のIDを取得します。
+        * @return 現在のID
+        */
        public int getNowID() {
                return this.nowID;
        }
 
+       /**
+        * IDを1つ追加します
+        * @return 追加後のID
+        */
        public int additionID() {
-               return this.nowID++;
+               return ++this.nowID;
        }
 
 }
index e6f0c1f..2a7faa9 100644 (file)
@@ -2,6 +2,9 @@ package pcc.chemicraft;
 
 import java.util.ArrayList;
 
+/**
+ * @author P.C.C
+ */
 public final class ChemiCraftData {
 
        public static final int HYDROGEN = 0;
diff --git a/common/pcc/chemicraft/ChemiCraftLogging.java b/common/pcc/chemicraft/ChemiCraftLogging.java
new file mode 100644 (file)
index 0000000..6afb0c8
--- /dev/null
@@ -0,0 +1,74 @@
+package pcc.chemicraft;
+
+import java.io.BufferedOutputStream;
+import java.io.BufferedWriter;
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.FileOutputStream;
+import java.io.FileWriter;
+import java.io.IOException;
+
+public class ChemiCraftLogging {
+
+       private FileWriter outStream;
+       private String directoryPath;
+       private File file;
+
+       public ChemiCraftLogging(String directoryPath) {
+               this.directoryPath = directoryPath;
+       }
+
+       public void startLogging() {
+               this.file = new File(this.directoryPath + "/ChemiCraft.log");
+               if (!this.file.exists()) {
+                       try {
+                               this.file.createNewFile();
+                       } catch (IOException e) {
+                               e.printStackTrace();
+                       }
+               }
+
+               try {
+                       this.outStream = new FileWriter(this.file);
+               } catch (FileNotFoundException e) {
+                       e.printStackTrace();
+               } catch (IOException e) {
+                       e.printStackTrace();
+               }
+       }
+
+       public void write(String writeStr) {
+               String s = writeStr;
+               try {
+                       this.outStream.write(writeStr);
+               } catch (IOException e) {
+                       e.printStackTrace();
+               }
+       }
+
+       public void write(String writeStr, EnumLoggingType type) {
+               String s = writeStr;
+               switch (type) {
+               case NORMAL:
+                       break;
+               case ERROR:
+                       s = "[Error]" + s;
+                       break;
+               case WARNING:
+                       s = "[Warning]" + s;
+                       break;
+               case INFO:
+                       s = "[Info]" + s;
+                       break;
+               default:
+                       throw new IllegalStateException();
+               }
+               try {
+                       this.outStream.write(s + "\n");
+                       this.outStream.flush();
+               } catch (IOException e) {
+                       e.printStackTrace();
+               }
+       }
+
+}
index f923198..88b9180 100644 (file)
@@ -1,8 +1,9 @@
 package pcc.chemicraft;
 
-
-public abstract class ChemiCraftRegister {
-
+/**
+ * ChemiCraftの追加のインターフェイスです
+ * @author mozipi,ponkotate
+ */
+public interface ChemiCraftRegister {
        public abstract void start();
-
 }
diff --git a/common/pcc/chemicraft/EnumLoggingType.java b/common/pcc/chemicraft/EnumLoggingType.java
new file mode 100644 (file)
index 0000000..473f858
--- /dev/null
@@ -0,0 +1,10 @@
+package pcc.chemicraft;
+
+public enum EnumLoggingType {
+
+       INFO,
+       ERROR,
+       WARNING,
+       NORMAL;
+
+}
index e6b9a4c..77909d9 100644 (file)
@@ -12,11 +12,13 @@ import net.minecraftforge.oredict.OreDictionary;
 import pcc.chemicraft.ChemiCraft;
 import pcc.chemicraft.ChemiCraftConfiguration;
 import pcc.chemicraft.ChemiCraftRegister;
+import pcc.chemicraft.EnumLoggingType;
 import pcc.chemicraft.base.creativetab.CreativeTabAtomOres;
 import pcc.chemicraft.base.gen.WorldGenAtomsOre;
 import pcc.chemicraft.base.system.CommonProxy;
 import pcc.chemicraft.base.system.PacketHandler;
 import pcc.chemicraft.core.ChemiCraftAPI;
+import pcc.chemicraft.core.ChemiCraftCore;
 import cpw.mods.fml.common.Loader;
 import cpw.mods.fml.common.Mod;
 import cpw.mods.fml.common.ModContainer;
@@ -31,10 +33,9 @@ import cpw.mods.fml.common.event.FMLPreInitializationEvent;
 import cpw.mods.fml.common.network.NetworkMod;
 import cpw.mods.fml.common.registry.GameRegistry;
 
-@Mod(modid = "ChemiCraftBase", name = "ChemiCraftBase", version = "beta")
-@NetworkMod(clientSideRequired = true, serverSideRequired = true, versionBounds = "1.4.6", channels = "chemicraftbase", packetHandler = PacketHandler.class)
-public class ChemiCraftBase extends ChemiCraft
-{
+@Mod(modid = "ChemiCraftBase", name = "ChemiCraftBase", version = "beta1")
+@NetworkMod(clientSideRequired = true, serverSideRequired = true, versionBounds = "1.4.7", channels = "chemicraftbase", packetHandler = PacketHandler.class)
+public class ChemiCraftBase extends ChemiCraft {
 
        /**
         * this is ChemiCraft instance.
@@ -98,8 +99,7 @@ public class ChemiCraftBase extends ChemiCraft
        public ChemiCraftRegister registerRecipe;
        public ChemiCraftRegister registerEntitys;
 
-       public ChemiCraftBase()
-       {
+       public ChemiCraftBase() {
                this.registerCompounds = new ChemiCraftRegisterCompounds(this);
                this.registerCompoundsHandler = new ChemiCraftRegisterCompoundsHandler(this);
                this.registerItem = new ChemiCraftRegisterItem(this);
@@ -126,8 +126,7 @@ public class ChemiCraftBase extends ChemiCraft
        }
 
        @Override
-       public void run()
-       {
+       public void run() {
                while (true) {
                        if (proxy != null && instance != null) {
                                this.settingProcessing((FMLPostInitializationEvent) event);
@@ -143,7 +142,8 @@ public class ChemiCraftBase extends ChemiCraft
                                        List<ModContainer> mod = Loader.instance().getModList();
                                        ModContainer finalMod = mod.get(mod.size()-1);
                                        ModState finalModState = Loader.instance().getModState(finalMod);
-                                       if (finalModState == ModState.AVAILABLE) {
+                                       if (finalModState == ModState.POSTINITIALIZED) {
+                                               ChemiCraftCore.logger.write("ChemiCraftBase>APIProcessing", EnumLoggingType.INFO);
                                                apiProcessing((FMLPostInitializationEvent) event);
                                                break;
                                        }
@@ -155,7 +155,7 @@ public class ChemiCraftBase extends ChemiCraft
        }
 
        /**
-        * PreInit:
+        * PreInit:<br>
         * Configをロードします。
         * @param event アノテーション呼び出しにより呼び出す必要なし
         */
@@ -183,8 +183,7 @@ public class ChemiCraftBase extends ChemiCraft
                cfg.save();
        }
 
-       protected void settingProcessing(FMLPostInitializationEvent event)
-       {
+       protected void settingProcessing(FMLPostInitializationEvent event) {
                this.registerCompounds.start();
                this.registerCompoundsHandler.start();
                this.registerItem.start();
@@ -196,16 +195,22 @@ public class ChemiCraftBase extends ChemiCraft
 
        private void apiProcessing(final FMLPostInitializationEvent event) {
                // API用の処理
-               for (int i = 0; i < apiBase.getAtomOresName().sizeKeysList(); i++)
-               {
-                       for (int j = 0; j < apiBase.getAtomOresName().sizeElementsList(apiBase.getAtomOresName().getKeyList(i)); j++)
-                       {
-                               this.nameAuxiliary.addName(new ItemStack(blockAtomOres[i / 16], 0, i - i / 16 * 16), apiBase.getAtomOresLanguage().get(apiBase.getAtomOresName().getKeyList(i), j), apiBase.getAtomOresName().get(apiBase.getAtomOresName().getKeyList(i), j));
-                               OreDictionary.registerOre("ore" + apiBase.getAtomOresName().getKeyList(i), new ItemStack(blockAtomOres[i / 16], 1, i - i / 16 * 16));
+               for (int i = 0; i < apiBase.getAtomOresName().sizeKeysList(); i++) {
+                       for (int j = 0; j < apiBase.getAtomOresName().sizeElementsList(apiBase.getAtomOresName().getKeyList(i)); j++) {
+                               ChemiCraftCore.logger.write("OreAddName:" + "Name-" + apiBase.getAtomOresName().get(apiBase.getAtomOresName().getKeyList(i), j) +
+                                               "/Lang-" + apiBase.getAtomOresLanguage().get(apiBase.getAtomOresName().getKeyList(i), j),
+                                               EnumLoggingType.INFO);
+
+                               this.nameAuxiliary.addName(
+                                               new ItemStack(
+                                                               blockAtomOres[i / 16], 0, i - i / 16 * 16),
+                                                               apiBase.getAtomOresLanguage().get(apiBase.getAtomOresName().getKeyList(i), j),
+                                                               apiBase.getAtomOresName().get(apiBase.getAtomOresName().getKeyList(i), j));
+                               OreDictionary.registerOre("ore" + apiBase.getAtomOresName().getKeyList(i),
+                                               new ItemStack(blockAtomOres[i / 16], 1, i - i / 16 * 16));
                                GameRegistry.registerWorldGenerator(apiBase.getAtomOres().get(i));
                        }
                }
-
        }
 
 }
index 5d17a5b..bf8412e 100644 (file)
@@ -9,12 +9,23 @@ import pcc.chemicraft.util.AtomInfo;
 import pcc.chemicraft.util.Formula;
 import pcc.chemicraft.util.ListHash;
 
-public class ChemiCraftBaseAPI
-{
+/**
+ * ChemiCraftBaseのAPIを提供するクラスです。<br>
+ * ChemiCraftBaseを使用したAPIを作成する場合、このクラスを使用します。
+ * @author mozipi,ponkotate
+ */
+public class ChemiCraftBaseAPI {
 
+       /**
+        * APIのインスタンス
+        */
        private static ChemiCraftBaseAPI instance = new ChemiCraftBaseAPI();
 
 
+       /**
+        * APIのインスタンスを返します。
+        * @return APIのインスタンス
+        */
        public static ChemiCraftBaseAPI instance(){
                return instance;
        }
@@ -46,12 +57,12 @@ public class ChemiCraftBaseAPI
 
        /**
         * 鉱石を追加します。
-        * @param par1Name
-        * @param par2Formula
-        * @param par3Id
-        * @param par4Size
-        * @param par5Frequency
-        * @param par6PosY
+        * @param par1Name 鉱石名(Oreは自動で語尾につけられます)
+        * @param par2Formula 化学式
+        * @param par3Id 鉱石のID
+        * @param par4Size 鉱石の塊の大きさ
+        * @param par5Frequency 生成率(frequency/Chunk)
+        * @param par6PosY 鉱石が生成される高度(nowY < PosY == Generate)
         */
        public void addAtomOres(String par1Name, Formula par2Formula, int par3Id, int par4Size, int par5Frequency, int par6PosY){
                atomOresList.add(
@@ -61,17 +72,26 @@ public class ChemiCraftBaseAPI
                                                par4Size,
                                                par5Frequency,
                                                par6PosY));
+
                atomOresFormulasHash.put(par1Name, par2Formula);
 
                String var7 = par1Name;
-               if (!var7.contains(" Ore")){
+               if (!var7.contains(" Ore")) {
                        var7 = var7.concat(" Ore");
                }
+
                addAtomOresLanguage(par1Name, var7, "en_US");
        }
 
 
 
+       /**
+        * 鉱石を追加します。
+        * @param par1Name 鉱石名(Oreは自動で語尾につけられます)
+        * @param par2Formula 化学式
+        * @param par3Id 鉱石のID
+        * @param par4Enum 鉱石生成の情報が入ったEnum
+        */
        public void addAtomOres(String par1Name, Formula par2Formula, int par3Id, EnumOreSpawnFrequency par4Enum){
                addAtomOres(
                                par1Name,
index 461d91e..eee7177 100644 (file)
@@ -2,12 +2,18 @@ package pcc.chemicraft.base;
 
 import pcc.chemicraft.ChemiCraftRegister;
 
-public abstract class ChemiCraftBaseRegister extends ChemiCraftRegister
-{
+/**
+ * ChemiCraftBaseの追加の親クラスです
+ * @author mozipi,ponkotate
+ */
+public abstract class ChemiCraftBaseRegister implements ChemiCraftRegister {
+
+       /**
+        * MODのインスタンス
+        */
        protected ChemiCraftBase mod;
 
-       public ChemiCraftBaseRegister(ChemiCraftBase mod)
-       {
+       public ChemiCraftBaseRegister(ChemiCraftBase mod) {
                this.mod = mod;
        }
 
index aafca7e..c420904 100644 (file)
@@ -7,9 +7,13 @@ import net.minecraft.item.ItemStack;
 import net.minecraft.util.EntityDamageSource;
 import net.minecraftforge.oredict.OreDictionary;
 import pcc.chemicraft.core.ChemiCraftCore;
+import pcc.chemicraft.core.nbt.NBTRecipeGrenade;
 import pcc.chemicraft.util.Formula;
-import pcc.chemicraft.util.NBTRecipeGrenade;
 
+/**
+ * レシピを追加します
+ * @author mozipi,ponkotate
+ */
 public class ChemiCraftRegisterBaseRecipe extends ChemiCraftBaseRegister {
 
        public ChemiCraftRegisterBaseRecipe(ChemiCraftBase mod) {
@@ -18,79 +22,94 @@ public class ChemiCraftRegisterBaseRecipe extends ChemiCraftBaseRegister {
 
        @Override
        public void start() {
+               //化合物のレシピ
+               this.mod.api.addChemicalCombinationRecipe(
+                               new ItemStack(ChemiCraftCore.instance.itemCompounds, 1, this.mod.api.getCompound("SodiumChloride")),
+                               new Formula("NaOH"));
 
-               /*
-                * 化合物のレシピ
-                */
-               this.mod.api.addChemicalCombinationRecipe(new ItemStack(ChemiCraftCore.instance.itemCompounds, 1, this.mod.api.getCompound("SodiumChloride")), new Formula("NaOH"));
-               this.mod.api.addChemicalCombinationRecipe(new ItemStack(ChemiCraftCore.instance.itemCompounds, 1, this.mod.api.getCompound("ChlorousAcid")), new Formula("HO2Cl"));
-
-               /*
-                * 既存物のレシピ
-                */
-               // Block
-               this.mod.api.addReversibleOfPyrolysis(new ItemStack(Block.stone), new Formula("SiO2"));
-               this.mod.api.addReversibleOfPyrolysis(new ItemStack(Block.dirt), new Formula("SiI2O2"));
-               this.mod.api.addReversibleOfElectrolysis(new ItemStack(Block.wood), new Formula("C6H10O5"));
-               this.mod.api.addReversibleOfPyrolysis(new ItemStack(Block.glass), new Formula("SiCO2"));
-               this.mod.api.addReversibleOfPyrolysis(new ItemStack(Block.tnt), new Formula("C7H5N3O6"));
-
-               // Item
-               this.mod.api.addElectrolysisDecompositionRecipe(new ItemStack(Item.bucketWater), new Formula("H2O"));
-               this.mod.api.addElectrolysisDecompositionRecipe(new ItemStack(Item.potion, 1, 0), new Formula("H2O"));
-               this.mod.api.addChemicalCombinationRecipe(new ItemStack(Item.sugar), new Formula("C12H22O11"));
-
-               // 鉱石
-               this.mod.api.addPyrolysisDecompositionRecipe(new ItemStack(Block.oreCoal), new Formula("C"));
-               this.mod.api.addPyrolysisDecompositionRecipe(new ItemStack(Item.coal), new Formula("C"));
+               this.mod.api.addChemicalCombinationRecipe(
+                               new ItemStack(ChemiCraftCore.instance.itemCompounds, 1, this.mod.api.getCompound("ChlorousAcid")),
+                               new Formula("HO2Cl"));
+
+               //既存物のレシピ
                this.mod.api.addChemicalCombinationRecipe(new ItemStack(Item.diamond),
                                new Formula("C64Si16"));
-               this.mod.api.addReversibleOfPyrolysis(new ItemStack(Item.emerald), new Formula("Be3Al2Si6O18"));
 
-               /*
-                * 他Mod使用時レシピ
-                */
-               this.mod.api.addPyrolysisDecompositionRecipe(
-                               OreDictionary.getOres("oreCopper"), new Formula("Cu"));
+               this.mod.api.addChemicalCombinationRecipe(new ItemStack(Item.sugar),
+                               new Formula("C12H22O11"));
 
-               /*
-                * 素材制作代のレシピ
-                */
-               //手榴弾の追加
-               this.mod.api.addMaterialRecipe(new ItemStack[] {
-                               null,
-                               new ItemStack(Block.stone),
-                               null,
-                               new ItemStack(Block.stone),
-                               new ItemStack(Item.gunpowder),
-                               new ItemStack(Block.stone),
-                               null,
-                               new ItemStack(Block.stone),
-                               null
-               },
-               new ItemStack(this.mod.itemAtomGrenade, 16, 0),
-               new NBTRecipeGrenade()
-                               );
+               this.mod.api.addElectrolysisDecompositionRecipe(new ItemStack(Item.bucketWater),
+                               new Formula("H2O"));
+
+               this.mod.api.addElectrolysisDecompositionRecipe(new ItemStack(Item.potion, 1, 0),
+                               new Formula("H2O"));
+
+               this.mod.api.addPyrolysisDecompositionRecipe(new ItemStack(Block.oreCoal),
+                               new Formula("C"));
+
+               this.mod.api.addPyrolysisDecompositionRecipe(new ItemStack(Item.coal),
+                               new Formula("C"));
+
+               this.mod.api.addReversibleOfElectrolysis(new ItemStack(Block.wood),
+                               new Formula("C6H10O5"));
 
-               this.mod.api.addSharplessMaterialRecipe(new ItemStack[] {
+               this.mod.api.addReversibleOfPyrolysis(new ItemStack(Block.dirt),
+                               new Formula("SiI2O2"));
+
+               this.mod.api.addReversibleOfPyrolysis(new ItemStack(Block.glass),
+                               new Formula("SiCO2"));
+
+               this.mod.api.addReversibleOfPyrolysis(new ItemStack(Block.stone),
+                               new Formula("SiO2"));
+
+               this.mod.api.addReversibleOfPyrolysis(new ItemStack(Block.tnt),
+                               new Formula("C7H5N3O6"));
+
+               this.mod.api.addReversibleOfPyrolysis(new ItemStack(Item.emerald),
+                               new Formula("Be3Al2Si6O18"));
+
+
+               //他MOD使用時のレシピ
+               //RP2-------------------------------------------------------------------------------------------------------------
+               this.mod.api.addPyrolysisDecompositionRecipe(
+                               OreDictionary.getOres("oreCopper"), new Formula("Cu"));
+               //------------------------------------------------------------------------------------------------------------------
+
+               //素材制作台のレシピ
+               this.mod.api.addMaterialRecipe(
+                               new ItemStack[] {
+                                               null,
+                                               new ItemStack(Block.stone),
+                                               null,
+                                               new ItemStack(Block.stone),
+                                               new ItemStack(Item.gunpowder),
+                                               new ItemStack(Block.stone),
+                                               null,
+                                               new ItemStack(Block.stone),
+                                               null
+                               },
+                               new ItemStack(this.mod.itemAtomGrenade, 16, 0),
+                               new NBTRecipeGrenade());
+
+               this.mod.api.addSharplessMaterialRecipe(
+                               new ItemStack[] {
+                                               new ItemStack(this.mod.itemAtomGrenade, 1, 0),
+                               },
                                new ItemStack(this.mod.itemAtomGrenade, 1, 0),
-               },
-               new ItemStack(this.mod.itemAtomGrenade, 1, 0),
-               new NBTRecipeGrenade()
+                               new NBTRecipeGrenade()
                                );
 
-               /*
-                * 分解台のレシピ
-                */
-               this.mod.api.addElectrolysisDecompositionRecipe(new ItemStack(ChemiCraftCore.instance.itemCompounds, 1, this.mod.api.getCompound("Water")),
+               //分解台のレシピ
+               this.mod.api.addElectrolysisDecompositionRecipe(
+                               new ItemStack(ChemiCraftCore.instance.itemCompounds, 1, this.mod.api.getCompound("Water")),
                                new Formula("H2O"));
 
-               for (int i = 0; i < this.mod.apiBase.getAtomOresName().sizeKeysList(); i++){
-                       this.mod.api.addPyrolysisDecompositionRecipe(new ItemStack(this.mod.blockAtomOres[i / 16], 1, i - i / 16 * 16),
-                       this.mod.apiBase.getAtomOresFormulas().get(this.mod.apiBase.getAtomOresName().getKeyList(i)));
+               //鉱石分解の追加
+               for (int i = 0; i < this.mod.apiBase.getAtomOresName().sizeKeysList(); i++) {
+                       this.mod.api.addPyrolysisDecompositionRecipe(
+                                       new ItemStack(this.mod.blockAtomOres[i / 16], 1, i - i / 16 * 16),
+                                       this.mod.apiBase.getAtomOresFormulas().get(this.mod.apiBase.getAtomOresName().getKeyList(i)));
                }
-
-
        }
 
 }
index 0f6662b..733e3f9 100644 (file)
@@ -7,6 +7,10 @@ import pcc.chemicraft.base.ore.BlockAtomOres;
 import pcc.chemicraft.base.ore.ItemAtomOres;
 import cpw.mods.fml.common.registry.GameRegistry;
 
+/**
+ * Blockを追加します
+ * @author mozipi,ponkotate
+ */
 public class ChemiCraftRegisterBlock extends ChemiCraftBaseRegister {
 
        public ChemiCraftRegisterBlock(ChemiCraftBase mod) {
@@ -15,21 +19,16 @@ public class ChemiCraftRegisterBlock extends ChemiCraftBaseRegister {
 
        @Override
        public void start() {
-
-               /*
-                * 変数に代入
-                */
-               for (int i = 0; i < this.mod.blockAtomOres.length; i++)
-               {
+               //鉱石を変数に代入
+               for (int i = 0; i < this.mod.blockAtomOres.length; i++) {
                        this.mod.blockAtomOres[i] = new BlockAtomOres(this.mod.atomOresID[i]).
-                                       setHardness(3.0F).
-                                       setResistance(0.0F).
-                                       setStepSound(Block.soundStoneFootstep).
-                                       setBlockName("AtomsOre" + i);
+                                       setHardness(3.0F).setResistance(0.0F).
+                                       setStepSound(Block.soundStoneFootstep).setBlockName("AtomsOre" + i);
+                       //鉱石をMinecraftに登録
                        GameRegistry.registerBlock(this.mod.blockAtomOres[i], ItemAtomOres.class, "AtomsOre" + i);
+                       //回収&最適に破壊できるピッケルのレベルを設定
                        MinecraftForge.setBlockHarvestLevel(this.mod.blockAtomOres[i], "pickaxe", 2);
                }
-
        }
 
 }
index c5a5e01..d2fbda0 100644 (file)
@@ -5,29 +5,29 @@ import pcc.chemicraft.core.ChemiCraftCore;
 import pcc.chemicraft.util.AtomInfo;
 import pcc.chemicraft.util.Formula;
 
-public class ChemiCraftRegisterChemicalRecipe extends ChemiCraftBaseRegister
-{
+/**
+ * 科学的なレシピを追加します
+ * @author mozipi,ponkotate
+ */
+public class ChemiCraftRegisterChemicalRecipe extends ChemiCraftBaseRegister {
 
-       public ChemiCraftRegisterChemicalRecipe(ChemiCraftBase mod)
-       {
+       public ChemiCraftRegisterChemicalRecipe(ChemiCraftBase mod) {
                super(mod);
        }
 
        @Override
-       public void start()
-       {
-               // 元素入手手段
-
-               // 鉱石群
-               for (int i = 0; i < this.mod.chemicalData.ATOMSLIST.length; i++)
-               {
-                       if (AtomInfo.isSolid(i + 1) && !AtomInfo.isLanthanoid(i + 1) && !AtomInfo.isActinoid(i + 1))
-                       {
+       public void start() {
+               // 鉱石を追加
+               for (int i = 0; i < this.mod.chemicalData.ATOMSLIST.length; i++) {
+                       if (AtomInfo.isSolid(i + 1) && !AtomInfo.isLanthanoid(i + 1)
+                                       && !AtomInfo.isActinoid(i + 1)) {
+                               //鉱石をAPIに追加
                                this.mod.apiBase.addAtomOres(
                                                ChemiCraftCore.ATOMSNAME[i],
                                                new Formula(this.mod.chemicalData.ATOMSLIST[i]),
                                                this.mod.atomOresID[this.mod.apiBase.getAtomOresLastIndex()],
                                                EnumOreSpawnFrequency.NORMAL);
+                               //日本語名で追加
                                this.mod.apiBase.addAtomOresLanguage(ChemiCraftCore.ATOMSNAME[i], ChemiCraftCore.ATOMSNAMEJP[i] + "鉱石", "ja_JP");
                        }
                }
index 3f65819..d7105ae 100644 (file)
@@ -1,7 +1,9 @@
 package pcc.chemicraft.base;
 
-
-
+/**
+ * 化合物を追加します
+ * @author mozipi,ponkotate
+ */
 public class ChemiCraftRegisterCompounds extends ChemiCraftBaseRegister {
 
        public ChemiCraftRegisterCompounds(ChemiCraftBase mod) {
index 0ebb8ae..f1a1800 100644 (file)
@@ -2,6 +2,10 @@ package pcc.chemicraft.base;
 
 import pcc.chemicraft.base.compounds.CompoundWater;
 
+/**
+ * 化合物のHandlerを設定します
+ * @author mozipi,ponkotate
+ */
 public class ChemiCraftRegisterCompoundsHandler extends ChemiCraftBaseRegister {
 
        public ChemiCraftRegisterCompoundsHandler(ChemiCraftBase mod) {
index 381ef00..ae2a45a 100644 (file)
@@ -1,10 +1,15 @@
 package pcc.chemicraft.base;
 
 import net.minecraft.src.ModLoader;
+import pcc.chemicraft.base.entity.EntityAtomsGrenade;
 import pcc.chemicraft.base.entity.EntityDust;
 import cpw.mods.fml.common.registry.EntityRegistry;
 import cpw.mods.fml.common.registry.LanguageRegistry;
 
+/**
+ * Entityを登録します
+ * @author mozipi,ponkotate
+ */
 public class ChemiCraftRegisterEntitys extends ChemiCraftBaseRegister {
 
        public ChemiCraftRegisterEntitys(ChemiCraftBase mod) {
@@ -13,6 +18,16 @@ public class ChemiCraftRegisterEntitys extends ChemiCraftBaseRegister {
 
        @Override
        public void start() {
+               //手榴弾
+               LanguageRegistry.instance().addStringLocalization("entity.AtomsGrenade.name", "en_US", "AtomsGrenade");
+               EntityRegistry.registerModEntity(EntityAtomsGrenade.class,
+                               "AtomsGrenade",
+                               ModLoader.getUniqueEntityId(),
+                               this.mod,
+                               250,
+                               1,
+                               false);
+               //粉塵
                LanguageRegistry.instance().addStringLocalization("entity.Dust.name", "en_US", "Dust");
                EntityRegistry.registerModEntity(EntityDust.class,
                                "Dust",
index 2982592..fc60582 100644 (file)
@@ -6,6 +6,10 @@ import pcc.chemicraft.base.item.ItemDust;
 import pcc.chemicraft.base.item.ItemRadiationBallet;
 import pcc.chemicraft.base.item.ItemRadiationGun;
 
+/**
+ * アイテムを追加します
+ * @author mozipi,ponkotate
+ */
 public class ChemiCraftRegisterItem extends ChemiCraftBaseRegister {
 
        public ChemiCraftRegisterItem(ChemiCraftBase mod) {
@@ -14,18 +18,14 @@ public class ChemiCraftRegisterItem extends ChemiCraftBaseRegister {
 
        @Override
        public void start() {
-               /*
-                * 代入
-                */
+               //アイテムを変数に代入
                this.mod.itemAtomGrenade = new ItemAtomsGrenade(this.mod.atomGrenadeID).setItemName("grenade").setIconIndex(1);
                this.mod.itemDust = new ItemDust(this.mod.dustID).setItemName("dust").setIconIndex(12);
                this.mod.itemRadiationGun = new ItemRadiationGun(this.mod.radiationGunID).setIconIndex(4).setItemName("RadiationGun");
                this.mod.itemRadiationBallet = new ItemRadiationBallet(this.mod.radiationBalletID).setIconIndex(5).setItemName("RadiationBallet");
                this.mod.itemBlackSmoke = new ItemBlackSmoke(this.mod.blackSmokeID).setIconIndex(7).setItemName("BlackSmoke");
 
-               /*
-                * 名前登録&Minecraftに登録
-                */
+               //名前を登録&Minecraftに登録
                this.mod.nameAuxiliary.addName(this.mod.itemAtomGrenade, "AtomGrenade");
                this.mod.nameAuxiliary.addName(this.mod.itemAtomGrenade, "ja_JP", "元素手榴弾");
                this.mod.nameAuxiliary.addName(this.mod.itemDust, "dust");
index bf14a07..e19a400 100644 (file)
@@ -7,18 +7,19 @@ import pcc.chemicraft.base.render.RenderDust;
 import pcc.chemicraft.base.system.CommonProxy;
 import cpw.mods.fml.client.registry.RenderingRegistry;
 
-public class ClientProxy extends CommonProxy
-{
+/**
+ * クライアントプロキシを設定するクラスです
+ * @author mozipi,ponkotate,りりごん
+ */
+public class ClientProxy extends CommonProxy {
 
        @Override
-       public void registerTextures()
-       {
-               
+       public void registerTextures() {
+
        }
 
        @Override
-       public void registerRenderInformation()
-       {
+       public void registerRenderInformation() {
                RenderingRegistry.registerEntityRenderingHandler(EntityAtomsGrenade.class, new RenderAtomsGrenade(0.5F));
                RenderingRegistry.registerEntityRenderingHandler(EntityDust.class, new RenderDust());
        }
index 40d4cc2..3d86aec 100644 (file)
@@ -6,6 +6,10 @@ import net.minecraft.item.ItemStack;
 import net.minecraft.world.World;
 import pcc.chemicraft.util.ICompoundHandler;
 
+/**
+ * 水の化合物ハンドラーです
+ * @author mozipi
+ */
 public class CompoundWater implements ICompoundHandler {
 
        @Override
index 537e9be..bcd84b8 100644 (file)
@@ -7,11 +7,12 @@ import net.minecraft.util.MovingObjectPosition;
 import net.minecraft.util.Vec3;
 import net.minecraft.world.World;
 
-public class FalseItem
-{
+/**
+ * @author ponkotate
+ */
+public class FalseItem {
 
-       protected MovingObjectPosition getMovingObjectPositionFromPlayer(World par1World, EntityPlayer par2EntityPlayer, boolean par3)
-       {
+       protected MovingObjectPosition getMovingObjectPositionFromPlayer(World par1World, EntityPlayer par2EntityPlayer, boolean par3) {
                float var4 = 1.0F;
                float var5 = par2EntityPlayer.prevRotationPitch + (par2EntityPlayer.rotationPitch - par2EntityPlayer.prevRotationPitch) * var4;
                float var6 = par2EntityPlayer.prevRotationYaw + (par2EntityPlayer.rotationYaw - par2EntityPlayer.prevRotationYaw) * var4;
index 9e4cbad..e37e31c 100644 (file)
@@ -5,11 +5,13 @@ import pcc.chemicraft.base.ChemiCraftBase;
 import cpw.mods.fml.relauncher.Side;
 import cpw.mods.fml.relauncher.SideOnly;
 
-public class CreativeTabAtomOres extends CreativeTabs
-{
+/**
+ * ChemiCraftの鉱石のクリエイティブタブです
+ * @author mozipi,ponkotate
+ */
+public class CreativeTabAtomOres extends CreativeTabs {
 
-       public CreativeTabAtomOres(String type)
-       {
+       public CreativeTabAtomOres(String type) {
                super(type);
        }
 
@@ -17,7 +19,7 @@ public class CreativeTabAtomOres extends CreativeTabs
 
        @Override
        @SideOnly(Side.CLIENT)
-       public int getTabIconItemIndex(){
+       public int getTabIconItemIndex() {
                return ChemiCraftBase.instance.blockAtomOres[0].blockID;
        }
 
@@ -25,9 +27,8 @@ public class CreativeTabAtomOres extends CreativeTabs
 
        @Override
        @SideOnly(Side.CLIENT)
-       public String getTranslatedTabLabel(){
+       public String getTranslatedTabLabel() {
                return "AtomsOre";
        }
 
-
 }
index cf3749d..5f5bf19 100644 (file)
@@ -10,14 +10,21 @@ import net.minecraft.util.DamageSource;
 import net.minecraft.util.MovingObjectPosition;
 import net.minecraft.world.World;
 
-public class EntityAtomsGrenade extends EntityThrowable
-{
+/**
+ * 手榴弾です
+ * @author mozipi,ponkotate
+ */
+public class EntityAtomsGrenade extends EntityThrowable {
 
        private float explodeSize;
        private boolean isExplode;
        private boolean onFire;
        private boolean isNuke;
 
+    public EntityAtomsGrenade(World par1World) {
+        super(par1World);
+    }
+
        public EntityAtomsGrenade(World par1World, EntityLiving par2EntityLiving, boolean par3, boolean par4, boolean par5) {
                super(par1World, par2EntityLiving);
                this.isExplode = par3;
@@ -26,20 +33,19 @@ public class EntityAtomsGrenade extends EntityThrowable
        }
 
        @Override
-       public void onUpdate(){
+       public void onUpdate() {
                super.onUpdate();
        }
 
        @SuppressWarnings("unchecked")
        @Override
-       protected void onImpact(MovingObjectPosition par1MovingObjectPosition)
-       {
+       protected void onImpact(MovingObjectPosition par1MovingObjectPosition) {
 
-               if(isExplode){
+               if(isExplode) {
                        this.explodeSize = 3.0F;
                }
 
-               if(isNuke){
+               if(isNuke) {
                        this.explodeSize = 35.0F;
                }
 
@@ -49,18 +55,18 @@ public class EntityAtomsGrenade extends EntityThrowable
                }
 
                if (!this.worldObj.isRemote && !isNuke) {
-                       this.worldObj.newExplosion((Entity)null, this.posX, this.posY, this.posZ, explodeSize, onFire, true);
+                       this.worldObj.newExplosion((Entity) null, this.posX, this.posY, this.posZ, explodeSize, onFire, true);
                        this.isDead = true;
-               }else if(!this.worldObj.isRemote && isNuke){
-                       this.worldObj.newExplosion((Entity)null, this.posX, this.posY, this.posZ, explodeSize, onFire, true);
+               } else if(!this.worldObj.isRemote && isNuke) {
+                       this.worldObj.newExplosion((Entity) null, this.posX, this.posY, this.posZ, explodeSize, onFire, true);
                        Iterator<EntityLiving> itr = this.worldObj.getEntitiesWithinAABB(EntityLiving.class, this.boundingBox.expand(30, 30, 30)).iterator();
-                       while(itr.hasNext()){
+                       while(itr.hasNext()) {
                                EntityLiving entity = itr.next();
                                double dx = Math.abs(entity.posX - this.posX);
                                double dy = Math.abs(entity.posY - this.posY);
                                double dz = Math.abs(entity.posZ - this.posZ);
-                               int distance = (int)Math.sqrt( Math.pow(dx, 2) + Math.pow(dy, 2) + Math.pow(dz, 2) );
-                               if(30 - distance >= 0){
+                               int distance = (int) Math.sqrt(Math.pow(dx, 2) + Math.pow(dy, 2) + Math.pow(dz, 2) );
+                               if(30 - distance >= 0) {
                                        entity.addPotionEffect(new PotionEffect(2, (60 + (30 - distance)) * 20, (30 - distance) / 5));
                                        entity.addPotionEffect(new PotionEffect(4, (60 + (30 - distance)) * 20, (30 - distance) / 5));
                                        entity.addPotionEffect(new PotionEffect(18, (60 + (30 - distance)) * 20, (30 - distance) / 5));
@@ -69,7 +75,6 @@ public class EntityAtomsGrenade extends EntityThrowable
                        }
                        this.isDead = true;
                }
-
        }
 
 }
index beba66e..72eff2c 100644 (file)
@@ -10,8 +10,12 @@ import net.minecraft.entity.player.EntityPlayer;
 import net.minecraft.nbt.NBTTagCompound;
 import net.minecraft.world.World;
 
-public class EntityBlackSmoke extends Entity
-{
+/**
+ * なんか黒い煙みたいなのが出てくるやつです<br>
+ * Warning:WIP!!
+ * @author ponkotate
+ */
+public class EntityBlackSmoke extends Entity {
 
        private final int TIME = 5 * 20;
 
@@ -19,15 +23,13 @@ public class EntityBlackSmoke extends Entity
 
        private int restTime;
 
-       public EntityBlackSmoke(EntityPlayer par1EntityPlayer, World par2World, double par3, double par4, double par5)
-       {
+       public EntityBlackSmoke(EntityPlayer par1EntityPlayer, World par2World, double par3, double par4, double par5) {
                super(par2World);
                this.posX = par3;
                this.posY = par4;
                this.posZ = par5;
-
                this.restTime = TIME;
-               //for (Entity var5:MathAuxiliary.getTriangleEntitys(par2World, par3, par4, par5, Math.atan2(par1EntityPlayer.posZ - this.posZ, par1EntityPlayer.posX - this.posX), 0.0D, 120.0D, 10.0D)){
+
                for (Entity var5:(ArrayList<Entity>)par2World.loadedEntityList){
                        if (var5 instanceof EntityMob){
                                this.invisibilityMobsMap.put((EntityMob)var5, TIME);
@@ -36,15 +38,13 @@ public class EntityBlackSmoke extends Entity
        }
 
        @Override
-       protected void entityInit()
-       {
-               
+       protected void entityInit() {
+
        }
 
        @Override
-       public void onUpdate()
-       {
-               if (this.restTime < 0){
+       public void onUpdate() {
+               if (this.restTime < 0) {
                        this.setDead();
                }
                Iterator<EntityMob> var1 = this.invisibilityMobsMap.keySet().iterator();
@@ -59,15 +59,13 @@ public class EntityBlackSmoke extends Entity
        }
 
        @Override
-       protected void readEntityFromNBT(NBTTagCompound var1)
-       {
-               
+       protected void readEntityFromNBT(NBTTagCompound var1) {
+
        }
 
        @Override
-       protected void writeEntityToNBT(NBTTagCompound var1)
-       {
-               
+       protected void writeEntityToNBT(NBTTagCompound var1) {
+
        }
 
 }
index 3880c23..cf9e67d 100644 (file)
@@ -5,6 +5,11 @@ import net.minecraft.nbt.NBTTagCompound;
 import net.minecraft.util.MathHelper;
 import net.minecraft.world.World;
 
+/**
+ * 粉塵です。<br>
+ * 時間差で爆発します。
+ * @author mozipi,ponkotate
+ */
 public class EntityDust extends Entity {
 
        private final float explodeSize = 2.0F;
@@ -34,7 +39,7 @@ public class EntityDust extends Entity {
                                this.rad += 0.5;
                                if (this.deadDelay % 4 == 0) {
                                        this.explode(this.rad, false);
-                               } else if (this.deadDelay % 6 == 0){
+                               } else if (this.deadDelay % 6 == 0) {
                                        this.explode(this.rad, true);
                                }
                        } else {
index 7acf7f1..f10a99d 100644 (file)
@@ -7,9 +7,20 @@ import net.minecraft.world.chunk.IChunkProvider;
 import net.minecraft.world.gen.feature.WorldGenMinable;
 import cpw.mods.fml.common.IWorldGenerator;
 
+/**
+ * 鉱石生成のインスタンスです
+ * @author mozipi,ponkotate,つやぴん
+ */
 public class WorldGenAtomsOre extends WorldGenMinable implements IWorldGenerator {
 
+       /**
+        * 生成率
+        */
        private int frequency;
+
+       /**
+        * 鉱石生成の高度
+        */
        private int posY;
 
        public WorldGenAtomsOre(int id, int meta, int size, int frequency, int posY) {
@@ -23,7 +34,7 @@ public class WorldGenAtomsOre extends WorldGenMinable implements IWorldGenerator
                this.frequency = frequency.getFrequency();
                this.posY = posY;
        }
-       
+
        @Override
        public void generate(Random par1Random, int par2ChunkX, int par3ChunkZ, World par4World, IChunkProvider par5ChunkGenerator, IChunkProvider par6ChunkProvider) {
                for (int i = 0; i < this.frequency; i++) {
index 6a72e32..6050964 100644 (file)
@@ -11,6 +11,10 @@ import net.minecraft.world.World;
 import pcc.chemicraft.ChemiCraft;
 import pcc.chemicraft.base.entity.EntityAtomsGrenade;
 
+/**
+ * 手榴弾のアイテムです。
+ * @author mozipi
+ */
 public class ItemAtomsGrenade extends Item {
 
        public ItemAtomsGrenade(int par1) {
@@ -18,8 +22,8 @@ public class ItemAtomsGrenade extends Item {
        }
 
        @Override
-       public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer){
-               if(par1ItemStack.stackSize <= 0){
+       public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) {
+               if (par1ItemStack.stackSize <= 0) {
                        return null;
                }
 
@@ -27,25 +31,27 @@ public class ItemAtomsGrenade extends Item {
                boolean var2 = false;
                boolean var3 = false;
 
-               if(par1ItemStack.stackTagCompound != null){
+               if (par1ItemStack.stackTagCompound != null) {
                        NBTTagList var4 = par1ItemStack.getTagCompound().getTagList("Effect");
 
-                       for(int i = 0;i < 3;i++){
-                               if(!((NBTTagCompound)var4.tagAt(0)).getString("GrenadeEffect" + i).equals("")){
-                                       if(((NBTTagCompound)var4.tagAt(0)).getString("GrenadeEffect" + i).equals("Hydrogen")){
+                       for (int i = 0;i < 3;i++) {
+                               if (!((NBTTagCompound)var4.tagAt(0)).getString("GrenadeEffect" + i).equals("")) {
+                                       if (((NBTTagCompound)var4.tagAt(0)).getString("GrenadeEffect" + i).equals("Hydrogen")) {
                                                var1 = true;
                                        }
-                                       if(((NBTTagCompound)var4.tagAt(0)).getString("GrenadeEffect" + i).equals("Carbon")){
+                                       if (((NBTTagCompound)var4.tagAt(0)).getString("GrenadeEffect" + i).equals("Carbon")) {
                                                var2 = true;
                                        }
-                                       if(((NBTTagCompound)var4.tagAt(0)).getString("GrenadeEffect" + i).equals("Uranium")){
+                                       if (((NBTTagCompound)var4.tagAt(0)).getString("GrenadeEffect" + i).equals("Uranium")) {
                                                var3 = true;
                                        }
                                }
                        }
                }
-               EntityAtomsGrenade entity = new EntityAtomsGrenade(par2World, par3EntityPlayer, var1, var2, var3);
-               par2World.spawnEntityInWorld(entity);
+               if (!par2World.isRemote) {
+                       EntityAtomsGrenade entity = new EntityAtomsGrenade(par2World, par3EntityPlayer, var1, var2, var3);
+                       par2World.spawnEntityInWorld(entity);
+               }
                par1ItemStack.stackSize--;
                return par1ItemStack;
        }
@@ -53,11 +59,11 @@ public class ItemAtomsGrenade extends Item {
        @Override
        public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4) {
                ItemStack var2 = new ItemStack(this);
-               if(par1ItemStack.hasTagCompound()){
+               if (par1ItemStack.hasTagCompound()) {
                        NBTTagList var1 = par1ItemStack.getTagCompound().getTagList("Effect");
 
-                       for(int i = 0;i < 3;i++){
-                               if(!((NBTTagCompound)var1.tagAt(0)).getString("GrenadeEffect" + i).equals("")){
+                       for (int i = 0;i < 3;i++) {
+                               if (!((NBTTagCompound)var1.tagAt(0)).getString("GrenadeEffect" + i).equals("")) {
                                        par3List.add(
                                                        ((NBTTagCompound)var1.tagAt(0)).getString("GrenadeEffect" + i)
                                                        );
index f14c829..477d30b 100644 (file)
@@ -11,25 +11,25 @@ import pcc.chemicraft.ChemiCraft;
 import pcc.chemicraft.base.entity.EntityBlackSmoke;
 import pcc.chemicraft.core.ChemiCraftCore;
 
-
-public class ItemBlackSmoke extends Item
-{
+/**
+ * なんか黒い煙のアイテムです。
+ * @author ponkotate
+ */
+public class ItemBlackSmoke extends Item {
 
        public HashMap<EntityMob, Integer> invisibilityMobsMap = new HashMap<EntityMob, Integer>();
 
-       public ItemBlackSmoke(int par1)
-       {
+       public ItemBlackSmoke(int par1) {
                super(par1);
                this.setCreativeTab(ChemiCraftCore.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)
-       {
+       public boolean onItemUse(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, World par3World, int par4, int par5, int par6, int par7, float par8, float par9, float par10) {
                double var11 = par4 + 0.5D;
                double var12 = par5;
                double var13 = par6 + 0.5D;
-               switch(par7){
+               switch(par7) {
                        case 0:
                                var12--;
                                break;
@@ -54,7 +54,7 @@ public class ItemBlackSmoke extends Item
        }
 
        @Override
-       public String getTextureFile(){
+       public String getTextureFile() {
                return ChemiCraft.ITEM_TEXTURE;
        }
 
index 5469081..35d6dce 100644 (file)
@@ -7,6 +7,10 @@ import net.minecraft.world.World;
 import pcc.chemicraft.base.entity.EntityDust;
 import pcc.chemicraft.core.ChemiCraftCore;
 
+/**
+ * 粉塵のアイテムです
+ * @author mozipi
+ */
 public class ItemDust extends Item {
 
        public ItemDust(int par1) {
diff --git a/common/pcc/chemicraft/base/item/ItemOreSerarcher.java b/common/pcc/chemicraft/base/item/ItemOreSerarcher.java
new file mode 100644 (file)
index 0000000..d7ca81a
--- /dev/null
@@ -0,0 +1,50 @@
+package pcc.chemicraft.base.item;
+
+import pcc.chemicraft.base.ChemiCraftBase;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.item.Item;
+import net.minecraft.item.ItemStack;
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraft.world.World;
+
+public class ItemOreSerarcher extends Item {
+
+       public ItemOreSerarcher(int par1) {
+               super(par1);
+               this.setMaxStackSize(1);
+       }
+
+       @Override
+       public boolean onItemUse(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, World par3World, int par4, int par5, int par6, int par7, float par8, float par9, float par10) {
+               for (int i = 0; i < ChemiCraftBase.instance.atomOresID.length; i++) {
+                       if (par3World.getBlockId(par4, par5, par6) == ChemiCraftBase.instance.atomOresID[i]) {
+                               if (par1ItemStack.getTagCompound() == null) par1ItemStack.stackTagCompound = new NBTTagCompound();
+                               par1ItemStack.getTagCompound().setString("OreName", ChemiCraftBase.instance.blockAtomOres[i].getBlockName());
+                       }
+               }
+               return true;
+       }
+
+       @Override
+       public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) {
+               return par1ItemStack;
+       }
+
+
+
+       @Override
+       public String getItemNameIS(ItemStack par1ItemStack) {
+               if (par1ItemStack.getTagCompound() != null) {
+                       return super.getItemName() + "." + par1ItemStack.getTagCompound().getString("OreName");
+               }
+               return super.getItemName();
+       }
+
+       @Override
+       public boolean getShareTag() {
+               return super.getShareTag();
+       }
+
+
+
+}
index 370fae8..4ca241f 100644 (file)
@@ -4,6 +4,10 @@ import net.minecraft.item.Item;
 import pcc.chemicraft.ChemiCraft;
 import pcc.chemicraft.core.ChemiCraftCore;
 
+/**
+ * 放射線中の弾です
+ * @author mozipi
+ */
 public class ItemRadiationBallet extends Item {
 
        public ItemRadiationBallet(int par1) {
index 80db90b..ffa02ab 100644 (file)
@@ -13,8 +13,15 @@ import pcc.chemicraft.ChemiCraft;
 import pcc.chemicraft.base.ChemiCraftBase;
 import pcc.chemicraft.core.ChemiCraftCore;
 
+/**
+ * 放射線銃です
+ * @author mozipi
+ */
 public class ItemRadiationGun extends Item {
 
+       /**
+        * 次の発射までの遅延
+        */
        private short delay;
 
        public ItemRadiationGun(int par1) {
index 9e46de7..1a38df1 100644 (file)
@@ -11,49 +11,45 @@ import pcc.chemicraft.core.ChemiCraftCore;
 import cpw.mods.fml.relauncher.Side;
 import cpw.mods.fml.relauncher.SideOnly;
 
-public class BlockAtomOres extends Block
-{
+/**
+ * 鉱石のクラスです
+ * @author mozipi,ponkotate
+ */
+public class BlockAtomOres extends Block {
 
-       public BlockAtomOres(int id)
-       {
+       public BlockAtomOres(int id) {
                super(id, Material.rock);
                this.setCreativeTab(ChemiCraftBase.instance.creativeTabAtomsOre);
        }
 
        @Override
-       public int getBlockTextureFromSideAndMetadata(int par1, int par2)
-       {
+       public int getBlockTextureFromSideAndMetadata(int par1, int par2) {
                return (this.blockID - ChemiCraftBase.instance.atomOresID[0]) * 16 + par2;
        }
 
        @Override
-       public int damageDropped(int par1)
-       {
+       public int damageDropped(int par1) {
                return par1;
        }
 
-       public static int getBlockFromDye(int par0)
-       {
+       public static int getBlockFromDye(int par0) {
                return ~par0 & 15;
        }
 
-       public static int getDyeFromBlock(int par0)
-       {
+       public static int getDyeFromBlock(int par0) {
                return ~par0 & 15;
        }
 
        @Override
        @SideOnly(Side.CLIENT)
-       public void getSubBlocks(int par1, CreativeTabs par2CreativeTabs, List par3List)
-       {
+       public void getSubBlocks(int par1, CreativeTabs par2CreativeTabs, List par3List) {
                for (int var4 = 0; var4 < 16; ++var4) {
                        par3List.add(new ItemStack(par1, 1, var4));
                }
        }
 
        @Override
-       public String getTextureFile()
-       {
+       public String getTextureFile() {
                return ChemiCraftCore.instance.BLOCK_ATOMS_ORE_TEXTURE;
        }
 
index 29a7be6..07330d8 100644 (file)
@@ -7,11 +7,13 @@ import pcc.chemicraft.base.ChemiCraftBase;
 import cpw.mods.fml.relauncher.Side;
 import cpw.mods.fml.relauncher.SideOnly;
 
-public class ItemAtomOres extends ItemBlock
-{
+/**
+ * 鉱石のアイテム版です
+ * @author mozipi
+ */
+public class ItemAtomOres extends ItemBlock {
 
-       public ItemAtomOres(int par1)
-       {
+       public ItemAtomOres(int par1) {
                super(par1);
                this.setMaxDamage(0);
                this.setHasSubtypes(true);
@@ -19,20 +21,17 @@ public class ItemAtomOres extends ItemBlock
 
        @Override
        @SideOnly(Side.CLIENT)
-       public int getIconFromDamage(int par1)
-       {
+       public int getIconFromDamage(int par1) {
                return ChemiCraftBase.instance.blockAtomOres[0].getBlockTextureFromSideAndMetadata(2, BlockAtomOres.getBlockFromDye(par1));
        }
 
        @Override
-       public int getMetadata(int par1)
-       {
+       public int getMetadata(int par1) {
                return par1;
        }
 
        @Override
-       public String getItemNameIS(ItemStack par1ItemStack)
-       {
+       public String getItemNameIS(ItemStack par1ItemStack) {
                return super.getItemName() + "." + ItemDye.dyeColorNames[BlockAtomOres.getBlockFromDye(par1ItemStack.getItemDamage())];
        }
 }
index 5fa0974..379c39a 100644 (file)
@@ -12,18 +12,20 @@ import pcc.chemicraft.core.ChemiCraftCore;
 import cpw.mods.fml.relauncher.Side;
 import cpw.mods.fml.relauncher.SideOnly;
 
+/**
+ * 手榴弾のRenderクラスです
+ * @author mozipi
+ */
 @SideOnly(Side.CLIENT)
 public class RenderAtomsGrenade extends Render {
 
        private float field_77002_a;
 
-       public RenderAtomsGrenade(float par1)
-       {
+       public RenderAtomsGrenade(float par1) {
                this.field_77002_a = par1;
        }
 
-       public void doRenderAtomsGrenade(EntityAtomsGrenade par1AtomGrenade, double par2, double par4, double par6, float par8, float par9)
-       {
+       public void doRenderAtomsGrenade(EntityAtomsGrenade par1AtomGrenade, double par2, double par4, double par6, float par8, float par9) {
                GL11.glPushMatrix();
                GL11.glTranslatef((float)par2, (float)par4, (float)par6);
                GL11.glEnable(GL12.GL_RESCALE_NORMAL);
@@ -53,8 +55,7 @@ public class RenderAtomsGrenade extends Render {
        }
 
        @Override
-       public void doRender(Entity par1Entity, double par2, double par4, double par6, float par8, float par9)
-       {
+       public void doRender(Entity par1Entity, double par2, double par4, double par6, float par8, float par9) {
                this.doRenderAtomsGrenade((EntityAtomsGrenade)par1Entity, par2, par4, par6, par8, par9);
        }
 }
index 0146a15..67fe6c6 100644 (file)
@@ -7,9 +7,17 @@ import net.minecraft.entity.Entity;
 import org.lwjgl.opengl.GL11;
 import org.lwjgl.opengl.GL12;
 
+import cpw.mods.fml.relauncher.Side;
+import cpw.mods.fml.relauncher.SideOnly;
+
 import pcc.chemicraft.base.entity.EntityDust;
 import pcc.chemicraft.core.ChemiCraftCore;
 
+/**
+ * 粉塵のRenderです
+ * @author mozipi
+ */
+@SideOnly(Side.CLIENT)
 public class RenderDust extends RenderEntity {
 
        @Override
index d4e1707..7a56e6b 100644 (file)
@@ -4,9 +4,12 @@ import net.minecraft.entity.player.EntityPlayer;
 import net.minecraft.world.World;
 import cpw.mods.fml.common.network.IGuiHandler;
 
-public class CommonProxy  implements IGuiHandler
-{
-       public void registerTextures(){
+/**
+ * 共通のプロキシを設定するクラスです
+ * @author mozipi,ponkotate
+ */
+public class CommonProxy  implements IGuiHandler {
+       public void registerTextures() {
 
        }
 
@@ -14,14 +17,12 @@ public class CommonProxy  implements IGuiHandler
        }
 
        @Override
-       public Object getServerGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z)
-       {
+       public Object getServerGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) {
                return null;
        }
 
        @Override
-       public Object getClientGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z)
-       {
+       public Object getClientGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) {
                return null;
        }
 }
index 4252032..e525ad6 100644 (file)
@@ -7,16 +7,13 @@ import cpw.mods.fml.common.network.Player;
 
 /**
  * サーバーとクライアントのデータの同期に必要なクラス
- *
  * @author Lilly
- *
  */
 public class PacketHandler implements IPacketHandler {
 
        @Override
-       public void onPacketData(INetworkManager manager, Packet250CustomPayload packet, Player player)
-       {
-               
+       public void onPacketData(INetworkManager manager, Packet250CustomPayload packet, Player player) {
+
        }
 
 }
index 22f8b7a..c7a3303 100644 (file)
@@ -7,8 +7,9 @@ import java.util.HashMap;
 import net.minecraft.item.Item;
 import net.minecraft.item.ItemStack;
 import pcc.chemicraft.ChemiCraftData;
+import pcc.chemicraft.EnumLoggingType;
+import pcc.chemicraft.core.nbt.ChemicalNBTRecipe;
 import pcc.chemicraft.core.system.ChemiCraftCraftingManager;
-import pcc.chemicraft.util.ChemicalNBTRecipe;
 import pcc.chemicraft.util.Formula;
 import pcc.chemicraft.util.ICompoundHandler;
 import pcc.chemicraft.util.ListHash;
@@ -16,19 +17,23 @@ import pcc.chemicraft.util.MaterialRecipe;
 
 
 /**
- * ChemiCraftのAPI
- * 基本的にAddonはこのクラスのインスタンスを使う
+ * ChemiCraftのAPIを提供するクラスです<br>
+ * ChemiCraftのAPIを作成する場合はこのクラスを使用します<br>
  * @author mozipi
  *
  */
 public class ChemiCraftAPI {
 
        /**
-        * Instance of the ChemiCraftAPI.
+        * APIのインスタンス
         */
        private static ChemiCraftAPI instance = new ChemiCraftAPI();
 
 
+       /**
+        * APIのインスタンスを返します
+        * @return APIのインスタンス
+        */
        public static ChemiCraftAPI instance(){
                return instance;
        }
@@ -40,7 +45,6 @@ public class ChemiCraftAPI {
        private ArrayList<Integer[]> chemicalCombinationAmounts = new ArrayList<Integer[]>();
 
 
-
        /**
         * 化合台の原子の種類のリスト
         */
@@ -65,14 +69,12 @@ public class ChemiCraftAPI {
        private ArrayList<String> compoundHandlerItemNames = new ArrayList<String>();
 
 
-
        /**
         * List of compounds handlers.
         */
        private ArrayList<ICompoundHandler> compoundHandlers = new ArrayList<ICompoundHandler>();
 
 
-
        /**
         * 化合物の文字列をダメージ値に変換します。
         */
@@ -127,7 +129,6 @@ public class ChemiCraftAPI {
        private ArrayList<ItemStack> toolAndWeaponResult = new ArrayList<ItemStack>();
 
 
-
        /**
         * ツール&武器作成台の不定形であるか
         */
@@ -141,6 +142,8 @@ public class ChemiCraftAPI {
         * @param result 結果
         */
        public void addChemicalCombinationRecipe(ItemStack result, Formula formula){
+               ChemiCraftCore.logger.write("addChemicalCombinationRecipe:" + "Result-" + result.getItemName() + "/Material-" + formula.getAtoms().toString()
+                               , EnumLoggingType.INFO);
                chemicalCombinationAtoms.add(formula.getAtoms());
                chemicalCombinationAmounts.add(formula.getAmonts());
                chemicalCombinationResult.add(result);
@@ -149,29 +152,39 @@ public class ChemiCraftAPI {
 
 
        /**
-        * add compound.
-        * @param name compound name.
+        * 化合物を追加します
+        * @param name 化合物の名前
         */
        public void addCompound(String name){
+               ChemiCraftCore.logger.write("addCompound:" + name
+                               , EnumLoggingType.INFO);
                compoundsNameListHash.add("en_US", name);
                compoundHash.put(name, compoundHash.size());
        }
 
 
        /**
-        * add compound corresponding to the language.
-        * @param lang Language to the corresponding
-        * @param englishName compound name
-        * @param langName compound name(specified language)
+        * 既に登録された化合物に対して別の言語をを追加します
+        * @param lang 別言語名
+        * @param englishName 英語名
+        * @param langName 別言語への名前
         */
        public void addCompound(String lang, String englishName, String langName){
+               ChemiCraftCore.logger.write("addCompound(MultiLang):" + "lang-" + lang + "/name-" + englishName + "/langToName-" + langName
+                               , EnumLoggingType.INFO);
                addCompound(englishName);
                addCompoundLanguage(lang, langName);
        }
 
 
 
-       public void addCompoundLanguage(String lang, String langName){
+       /**
+        * 単体で使用すると異常が発生するため、API以外での使用を固く非推奨する
+        * @param lang 言語名
+        * @param langName 言語への名前
+        */
+       @Deprecated
+       private void addCompoundLanguage(String lang, String langName){
                compoundsNameListHash.add(
                                lang,
                                langName);
@@ -180,22 +193,38 @@ public class ChemiCraftAPI {
 
 
        /**
-        * 電気分解台の燃料を追加します
-        * @param itemstack 燃料のItemStack
-        * @param burnTime 燃焼時間(tick * rate)
+        * 電気分解台のレシピを追加します
+        * @param material 素材
+        * @param formula 化学式(結果)
         */
-       public void addElectrolysisDecompositionFuel(ItemStack itemstack, int burnTime) {
-               this.electrolysisFuelList.put(
-                               itemstack,
-                               burnTime);
+       public void addElectrolysisDecompositionRecipe(ItemStack material, Formula formula) {
+               ChemiCraftCore.logger.write("addElectrolysisRecipe:" + "Material-" + material.getItemName() + "/Result-" + formula.getAtoms().toString(),
+                               EnumLoggingType.INFO);
+
+               ItemStack[] itemstacks =
+                               new ItemStack[formula.getAtoms().length];
+               for (int i = 0; i < itemstacks.length; i++) {
+                       itemstacks[i] =
+                                       new ItemStack(
+                                                       ChemiCraftCore.instance.itemAtoms,
+                                                       formula.getAmonts()[i],
+                                                       ChemiCraftData.toAtoms(formula.getAtoms()[i]));
+               }
+               this.electrolysisRecipeList.put(
+                               material,
+                               itemstacks);
        }
 
 
 
+       /**
+        * 電気分解台のレシピを追加します
+        * @param material 素材 (すべて結果は同じになります)
+        * @param formula 化学式(結果)
+        */
        public void addElectrolysisDecompositionRecipe(ArrayList<ItemStack> material, Formula formula) {
-               for (ItemStack item : material)
-        {
-                       if (item != null){
+               for (ItemStack item : material) {
+                       if (item != null) {
                                addElectrolysisDecompositionRecipe(item, formula);
                        }
         }
@@ -203,7 +232,15 @@ public class ChemiCraftAPI {
 
 
 
-       public void addElectrolysisDecompositionRecipe(ItemStack material, Formula formula) {
+       /**
+        * 熱分解台のレシピを追加します
+        * @param material 素材
+        * @param formula 化学式(結果)
+        */
+       public void addPyrolysisDecompositionRecipe(ItemStack material, Formula formula) {
+               ChemiCraftCore.logger.write("addPyrolysisRecipe:" + "Material-" + material.getItemName() + "/Result-" + formula.getAtoms().toString(),
+                               EnumLoggingType.INFO);
+
                ItemStack[] itemstacks =
                                new ItemStack[formula.getAtoms().length];
                for (int i = 0; i < itemstacks.length; i++) {
@@ -213,7 +250,7 @@ public class ChemiCraftAPI {
                                                        formula.getAmonts()[i],
                                                        ChemiCraftData.toAtoms(formula.getAtoms()[i]));
                }
-               this.electrolysisRecipeList.put(
+               this.pyrolysisRecipeList.put(
                                material,
                                itemstacks);
        }
@@ -221,35 +258,54 @@ public class ChemiCraftAPI {
 
 
        /**
-        * 素材作成台のレシピを追加します
-        * @param materials 素材
-        * @param result 結果
-        * @param nbtRecipe NBT(Nullの場合はなし)
+        * 熱分解台のレシピを追加します
+        * @param material 素材 (すべて結果は同じになります)
+        * @param formula 化学式(結果)
         */
-       public void addMaterialRecipe(ItemStack[] materials, ItemStack result, ChemicalNBTRecipe nbtRecipe){
-               materialRecipe.add(
-                               new MaterialRecipe(
-                                               result,
-                                               materials,
-                                               nbtRecipe,
-                                               false));
+       public void addPyrolysisDecompositionRecipe(ArrayList<ItemStack> material, Formula formula) {
+               for (ItemStack item : material) {
+                       if (item != null) {
+                               addPyrolysisDecompositionRecipe(item, formula);
+                               return;
+                       }
+        }
        }
 
 
 
        /**
-        * 素材作成台の不定形レシピを追加します
-        * @param materials 素材
-        * @param result 結果
-        * @param nbtRecipe NBT(Nullの場合はなし)
+        * 化合,熱分解,電気分解ができるレシピを追加します
+        * @param materialAndResult 素材(分解)と結果(化合)
+        * @param formula 化学式(分解なら結果に。化合なら素材に)
         */
-       public void addSharplessMaterialRecipe(ItemStack[] materials, ItemStack result, ChemicalNBTRecipe nbtRecipe){
-               materialRecipe.add(
-                               new MaterialRecipe(
-                                               result,
-                                               materials,
-                                               nbtRecipe,
-                                               true));
+       public void addReversible(ItemStack materialAndResult, Formula formula){
+               addChemicalCombinationRecipe(materialAndResult, formula);
+               addPyrolysisDecompositionRecipe(materialAndResult, formula);
+               addElectrolysisDecompositionRecipe(materialAndResult, formula);
+       }
+
+
+
+       /**
+        * 化合,電気分解ができるレシピを追加します
+        * @param materialAndResult 素材(分解)と結果(化合)
+        * @param formula 化学式(分解なら結果に。化合なら素材に)
+        */
+       public void addReversibleOfElectrolysis(ItemStack result, Formula formula){
+               addChemicalCombinationRecipe(result, formula);
+               addElectrolysisDecompositionRecipe(result, formula);
+       }
+
+
+
+       /**
+        * 化合,熱分解ができるレシピを追加します
+        * @param materialAndResult 素材(分解)と結果(化合)
+        * @param formula 化学式(分解なら結果に。化合なら素材に)
+        */
+       public void addReversibleOfPyrolysis(ItemStack result, Formula formula){
+               addChemicalCombinationRecipe(result, formula);
+               addPyrolysisDecompositionRecipe(result, formula);
        }
 
 
@@ -259,118 +315,142 @@ public class ChemiCraftAPI {
         * @param itemstack 燃料のItemStack
         * @param burnTime 燃焼時間(tick * rate)
         */
-       public void addPyrolysisDecompositionFuel(ItemStack itemstack, int burnTime) {
-               this.pyrolysisFuelList.put(
+       public void addElectrolysisDecompositionFuel(ItemStack itemstack, int burnTime) {
+               ChemiCraftCore.logger.write("addElectrolysisFuel:" + "Fuel-" + itemstack.getItemName() + "/BurnTime-" + burnTime,
+                               EnumLoggingType.INFO);
+
+               this.electrolysisFuelList.put(
                                itemstack,
                                burnTime);
        }
 
 
 
-       public void addPyrolysisDecompositionRecipe(ArrayList<ItemStack> material, Formula formula) {
-               for (ItemStack item : material)
-        {
-                       if (item != null){
-                               addPyrolysisDecompositionRecipe(item, formula);
-                               return;
-                       }
-        }
+       /**
+        * 熱分解台の燃料を追加します
+        * @param itemstack 燃料のItemStack
+        * @param burnTime 燃焼時間(tick * rate)
+        */
+       public void addPyrolysisDecompositionFuel(ItemStack itemstack, int burnTime) {
+               ChemiCraftCore.logger.write("addPyrolysisFuel:" + "Fuel-" + itemstack.getItemName() + "/BurnTime-" + burnTime,
+                               EnumLoggingType.INFO);
+
+               this.pyrolysisFuelList.put(
+                               itemstack,
+                               burnTime);
        }
 
 
 
        /**
-        * 電気分解台のレシピを追加します
-        * @param material 素材
-        * @param integers 原子の元素番号の配列
-        * @param integers2 原子のできる数の配列
+        * 素材作成台のレシピを追加します
+        * @param materials 素材
+        * @param result 結果
+        * @param nbtRecipe NBT(Nullの場合はなし)
         */
-       public void addPyrolysisDecompositionRecipe(ItemStack material, Formula formula) {
-               ItemStack[] itemstacks =
-                               new ItemStack[formula.getAtoms().length];
-               for (int i = 0; i < itemstacks.length; i++) {
-                       itemstacks[i] =
-                                       new ItemStack(
-                                                       ChemiCraftCore.instance.itemAtoms,
-                                                       formula.getAmonts()[i],
-                                                       ChemiCraftData.toAtoms(formula.getAtoms()[i]));
-               }
-               this.pyrolysisRecipeList.put(
-                               material,
-                               itemstacks);
-       }
+       public void addMaterialRecipe(ItemStack[] materials, ItemStack result, ChemicalNBTRecipe nbtRecipe){
+               ChemiCraftCore.logger.write("addMaterialRecipe:" + "Materials-" + materials.toString() + "/Result-" + result.getItemName() + "/NBT-" + nbtRecipe,
+                               EnumLoggingType.INFO);
 
+               materialRecipe.add(
+                               new MaterialRecipe(
+                                               result,
+                                               materials,
+                                               nbtRecipe,
+                                               false));
+       }
 
 
-       public void addReversible(ItemStack result, Formula formula){
-               addChemicalCombinationRecipe(result, formula);
-               addPyrolysisDecompositionRecipe(result, formula);
-               addElectrolysisDecompositionRecipe(result, formula);
-       }
 
+       /**
+        * 素材作成台の不定形レシピを追加します
+        * @param materials 素材
+        * @param result 結果
+        * @param nbtRecipe NBT(Nullの場合はなし)
+        */
+       public void addSharplessMaterialRecipe(ItemStack[] materials, ItemStack result, ChemicalNBTRecipe nbtRecipe){
+               ChemiCraftCore.logger.write("addMaterialRecipe:" + "Materials-" + materials.toString() + "/Result-" + result.getItemName() + "/NBT-" + nbtRecipe,
+                               EnumLoggingType.INFO);
 
-       public void addReversibleOfElectrolysis(ItemStack result, Formula formula){
-               addChemicalCombinationRecipe(result, formula);
-               addElectrolysisDecompositionRecipe(result, formula);
+               materialRecipe.add(
+                               new MaterialRecipe(
+                                               result,
+                                               materials,
+                                               nbtRecipe,
+                                               true));
        }
 
 
 
-       public void addReversibleOfPyrolysis(ItemStack result, Formula formula){
-               addChemicalCombinationRecipe(result, formula);
-               addPyrolysisDecompositionRecipe(result, formula);
+       /**
+        * 化合物のハンドラーを設定します。<br>
+        * CompoundHandlerを実装したクラスをcompoundHandlerに入れることによってhandlerItemNameで指定した<br>
+        * 化合物にハンドラーをつけることができます。
+        * @param handlerItemName ハンドラーをつける化合物の英語名
+        * @param compoundHandler ハンドラー
+        */
+       public void settingCompoundHandler(String handlerItemName, ICompoundHandler compoundHandler){
+               ChemiCraftCore.logger.write("settingCompoundHandler:" + "Name-" + handlerItemName + "/CompoundHandler-" + compoundHandler,
+                               EnumLoggingType.INFO);
+
+               compoundHandlers.add(compoundHandler);
+               compoundHandlerItemNames.add(handlerItemName);
        }
 
 
 
        /**
-        * ツール&武器作成台の不定形レシピを追加します
+        * ツール&武器作成台のレシピを追加します<br>
+        * 未作成であり、動作しません
         * @param materials 素材
         * @param result 結果
         */
-       public void addSharplessToolAndWeaponRecipe(ItemStack[] materials, ItemStack result) {
+       @Deprecated
+       public void addToolAndWeaponRecipe(ItemStack[] materials, ItemStack result) {
                toolAndWeaponMaterials.add(materials);
                toolAndWeaponResult.add(result);
-               toolAndWeaponSharpless.add(true);
+               toolAndWeaponSharpless.add(false);
        }
 
 
 
        /**
-        * ツール&武器作成台のレシピを追加します
+        * ツール&武器作成台の不定形レシピを追加します<br>
+        *       * 未作成であり、動作しません
         * @param materials 素材
         * @param result 結果
         */
-       public void addToolAndWeaponRecipe(ItemStack[] materials, ItemStack result) {
+       @Deprecated
+       public void addSharplessToolAndWeaponRecipe(ItemStack[] materials, ItemStack result) {
                toolAndWeaponMaterials.add(materials);
                toolAndWeaponResult.add(result);
-               toolAndWeaponSharpless.add(false);
+               toolAndWeaponSharpless.add(true);
        }
 
 
 
        //以下システム関連//////////////////////////////////////////////////////
 
-       public ArrayList<Integer[]> getChemicalCombinationAmounts(){
+       public ArrayList<Integer[]> getChemicalCombinationAmounts() {
                return chemicalCombinationAmounts;
        }
 
 
 
-       public ArrayList<String[]> getChemicalCombinationAtoms(){
+       public ArrayList<String[]> getChemicalCombinationAtoms() {
                return chemicalCombinationAtoms;
        }
 
 
 
-       public ArrayList<ItemStack> getChemicalCombinationResult(){
+       public ArrayList<ItemStack> getChemicalCombinationResult() {
                return chemicalCombinationResult;
        }
 
 
 
-       public int getCompound(String key){
-               if(compoundHash.get(key) != null){
+       public int getCompound(String key) {
+               if (compoundHash.get(key) != null) {
                        return compoundHash.get(key);
                } else {
                        return -1;
@@ -379,62 +459,57 @@ public class ChemiCraftAPI {
 
 
 
-       public ArrayList<ICompoundHandler> getCompoundHandler(){
+       public ArrayList<ICompoundHandler> getCompoundHandler() {
                compoundHandlers.trimToSize();
                return compoundHandlers;
-
        }
 
 
 
-       public ArrayList<String> getCompoundHandlerItemName(){
+       public ArrayList<String> getCompoundHandlerItemName() {
                compoundHandlerItemNames.trimToSize();
                return compoundHandlerItemNames;
        }
 
 
 
-       public ListHash<String, String> getCompoundsName(){
+       public ListHash<String, String> getCompoundsName() {
                return compoundsNameListHash;
        }
 
 
 
-       public ChemiCraftCraftingManager getCraftingManager(){
+       public ChemiCraftCraftingManager getCraftingManager() {
                return chemiCraftCraftingManager;
        }
 
 
 
-       public HashMap<ItemStack, Integer> getElectrolysisFuelList()
-       {
+       public HashMap<ItemStack, Integer> getElectrolysisFuelList() {
                return electrolysisFuelList;
        }
 
 
 
-       public HashMap<ItemStack, ItemStack[]> getElectrolysisRecipeList()
-       {
+       public HashMap<ItemStack, ItemStack[]> getElectrolysisRecipeList() {
                return electrolysisRecipeList;
        }
 
 
 
-       public ArrayList<MaterialRecipe> getMaterialRecipe(){
+       public ArrayList<MaterialRecipe> getMaterialRecipe() {
                return materialRecipe;
        }
 
 
 
-       public HashMap<ItemStack, Integer> getPyrolysisFuelList()
-       {
+       public HashMap<ItemStack, Integer> getPyrolysisFuelList() {
                return pyrolysisFuelList;
        }
 
 
 
-       public HashMap<ItemStack, ItemStack[]> getPyrolysisRecipeList()
-       {
+       public HashMap<ItemStack, ItemStack[]> getPyrolysisRecipeList() {
                return pyrolysisRecipeList;
        }
 
@@ -456,16 +531,4 @@ public class ChemiCraftAPI {
                return toolAndWeaponSharpless;
        }
 
-
-
-       /**
-        * setting compound handler.
-        * @param handlerItemName
-        * @param compoundHandler
-        */
-       public void settingCompoundHandler(String handlerItemName, ICompoundHandler compoundHandler){
-               compoundHandlers.add(compoundHandler);
-               compoundHandlerItemNames.add(handlerItemName);
-       }
-
 }
index f4ae874..3f9044f 100644 (file)
@@ -5,17 +5,23 @@ import java.util.Iterator;
 import java.util.List;
 
 import net.minecraft.block.Block;
+import net.minecraft.client.Minecraft;
 import net.minecraft.creativetab.CreativeTabs;
 import net.minecraft.entity.Entity;
 import net.minecraft.entity.player.EntityPlayer;
 import net.minecraft.item.Item;
 import net.minecraft.item.ItemStack;
+import net.minecraft.server.MinecraftServer;
 import net.minecraft.util.EntityDamageSource;
+import net.minecraftforge.client.MinecraftForgeClient;
 import net.minecraftforge.common.Configuration;
+import net.minecraftforge.common.MinecraftForge;
 import net.minecraftforge.common.Property;
 import pcc.chemicraft.ChemiCraft;
 import pcc.chemicraft.ChemiCraftConfiguration;
+import pcc.chemicraft.ChemiCraftLogging;
 import pcc.chemicraft.ChemiCraftRegister;
+import pcc.chemicraft.EnumLoggingType;
 import pcc.chemicraft.core.creativetab.CreativeTabChemiCraft;
 import pcc.chemicraft.core.debug.CommandDeleteItem;
 import pcc.chemicraft.core.debug.CommandGenDebugRoom;
@@ -42,8 +48,8 @@ import cpw.mods.fml.common.registry.LanguageRegistry;
  * ChemiCraft本体
  * @author P.C.C.
  */
-@Mod(modid = "ChemiCraft", name = "ChemiCraft", version = "beta")
-@NetworkMod(clientSideRequired = true, serverSideRequired = true, versionBounds = "1.4.6", channels = "chemicraftcore", packetHandler = PacketHandler.class)
+@Mod(modid = "ChemiCraft", name = "ChemiCraft", version = "Beta1")
+@NetworkMod(clientSideRequired = true, serverSideRequired = true, versionBounds = "1.4.7", channels = "chemicraftcore", packetHandler = PacketHandler.class)
 public class ChemiCraftCore extends ChemiCraft{
 
        /**
@@ -145,12 +151,18 @@ public class ChemiCraftCore extends ChemiCraft{
        public ChemiCraftRegister registerTileEntity;
        public ChemiCraftRegister registerRecipe;
 
+       /**
+        * Logging用のインスタンス
+        */
+       public static final ChemiCraftLogging logger = new ChemiCraftLogging(System.getProperty("user.dir"));
+
        public ChemiCraftCore() {
+               this.api.getCompoundsName().createHash("en_US");
                this.registerItem = new ChemiCraftRegisterItem(this);
                this.registerBlock = new ChemiCraftRegisterBlock(this);
                this.registerTileEntity = new ChemiCraftRegisterTileEntity(this);
                this.registerRecipe = new ChemiCraftRegisterCoreRecipe(this);
-
+               this.logger.startLogging();
                //this.sinVisualizer  = new SinVisualizer();
        }
 
@@ -243,7 +255,8 @@ public class ChemiCraftCore extends ChemiCraft{
                                        List<ModContainer> mod = Loader.instance().getModList();
                                        ModContainer finalMod = mod.get(mod.size()-1);
                                        ModState finalModState = Loader.instance().getModState(finalMod);
-                                       if (finalModState == ModState.AVAILABLE) {
+                                       if (finalModState == ModState.POSTINITIALIZED) {
+                                               ChemiCraftCore.logger.write("ChemiCraftCore>APIProcessing", EnumLoggingType.INFO);
                                                apiProcessing((FMLInitializationEvent) event);
                                                break;
                                        }
@@ -277,6 +290,9 @@ public class ChemiCraftCore extends ChemiCraft{
                        String lang = langcompoundsItr.next();
                        ArrayList<String> names = this.api.getCompoundsName().get(lang);
                        for (int i = 0; i < names.size(); i++) {
+                               ChemiCraftCore.logger.write("CompoundAddName:" + "Name-" + names.get(i) + "/Damage-" + i + "/Lang-" + lang,
+                                               EnumLoggingType.INFO);
+
                                LanguageRegistry.instance().addNameForObject(
                                                new ItemStack(this.itemCompounds, 1, i),
                                                lang,
@@ -291,16 +307,16 @@ public class ChemiCraftCore extends ChemiCraft{
        public static EntityDamageSource getRadiationDamageSource(Entity par1Entity){
                return new EntityDamageSource("radiation", par1Entity){
                        @Override
-                       public String getDeathMessage(EntityPlayer par1EntityPlayer){
+                       public String getDeathMessage(EntityPlayer par1EntityPlayer) {
                                return par1EntityPlayer.username + " is dead by radiation.";
-                               }
-                       };
+                       }
+               };
        }
 
 
 
        private void debug(final FMLInitializationEvent event) {
-               this.proxy.registerTickHandler();
+               //this.proxy.registerTickHandler();
        }
 
 }
index 5a8ab4a..ef57032 100644 (file)
@@ -2,13 +2,15 @@ package pcc.chemicraft.core;
 
 import pcc.chemicraft.ChemiCraftRegister;
 
-public abstract class ChemiCraftCoreRegister extends ChemiCraftRegister
-{
+/**
+ * ChemiCraftCoreの追加の親クラスです
+ * @author mozipi,ponkotate
+ */
+public abstract class ChemiCraftCoreRegister implements ChemiCraftRegister {
 
        protected ChemiCraftCore mod;
 
-       public ChemiCraftCoreRegister(ChemiCraftCore mod)
-       {
+       public ChemiCraftCoreRegister(ChemiCraftCore mod) {
                this.mod = mod;
        }
 
index 71c449d..4b62438 100644 (file)
@@ -9,6 +9,10 @@ import pcc.chemicraft.core.block.BlockPyrolysisTable;
 import pcc.chemicraft.core.block.BlockToolAndWeaponCraftingTable;
 import cpw.mods.fml.common.registry.GameRegistry;
 
+/**
+ * Blockを追加します
+ * @author mozipi,ponkotate
+ */
 public class ChemiCraftRegisterBlock extends ChemiCraftCoreRegister {
 
        public ChemiCraftRegisterBlock(ChemiCraftCore mod) {
@@ -17,10 +21,7 @@ public class ChemiCraftRegisterBlock extends ChemiCraftCoreRegister {
 
        @Override
        public void start() {
-
-               /*
-                * 変数に代入
-                */
+               //Blockを変数に代入
                this.mod.blockPyrolysisTable = new BlockPyrolysisTable(this.mod.pyrolysisTableID, 0, Material.ground).
                                setHardness(2.0F).
                                setResistance(0.0F).
@@ -49,18 +50,14 @@ public class ChemiCraftRegisterBlock extends ChemiCraftCoreRegister {
                                setStepSound(Block.soundStoneFootstep).
                                setBlockName("ChemicalCraftingTable");
 
-               /*
-                * Minecraftに登録
-                */
+               //Minecraftに登録
                GameRegistry.registerBlock(this.mod.blockPyrolysisTable, "BlockPyrolysisTable");
                GameRegistry.registerBlock(this.mod.blockChemicalCombinationTable, "BlockChemicalCombinationTable");
                // GameRegistry.registerBlock(this.mod.blockToolAndWeaponCraftingTable, "BlockToolAndWeaponCraftingTable");
                GameRegistry.registerBlock(this.mod.blockChemicalCraftingTable, "BlockMaterialCraftingTable");
                GameRegistry.registerBlock(this.mod.blockElectrolysisTable, "BlockElectrolysisTable");
 
-               /*
-                * 名前登録
-                */
+               //名前登録
                this.mod.nameAuxiliary.addName(this.mod.blockPyrolysisTable, "PyrolysisTable");
                this.mod.nameAuxiliary.addName(this.mod.blockPyrolysisTable, "ja_JP", "熱分解台");
                this.mod.nameAuxiliary.addName(this.mod.blockChemicalCombinationTable, "ChemicalCombinationTable");
index 55e040e..14ac23c 100644 (file)
@@ -6,6 +6,10 @@ import net.minecraft.item.ItemStack;
 import pcc.chemicraft.ChemiCraftData;
 import cpw.mods.fml.common.registry.GameRegistry;
 
+/**
+ * レシピを追加します
+ * @author mozipi,ponkotate
+ */
 public class ChemiCraftRegisterCoreRecipe extends ChemiCraftCoreRegister {
 
        public ChemiCraftRegisterCoreRecipe(ChemiCraftCore mod) {
@@ -14,10 +18,7 @@ public class ChemiCraftRegisterCoreRecipe extends ChemiCraftCoreRegister {
 
        @Override
        public void start() {
-
-               /*
-                * 科学作業台のレシピ
-                */
+               //科学作業台のレシピ
                GameRegistry.addRecipe(new ItemStack(this.mod.blockPyrolysisTable),
                                new Object[]{
                        "XXX", "ZAZ", "ZYZ",
@@ -54,7 +55,7 @@ public class ChemiCraftRegisterCoreRecipe extends ChemiCraftCoreRegister {
                        Character.valueOf('Z'), new ItemStack(Block.stone),
                        Character.valueOf('A'), new ItemStack(Item.pickaxeSteel),
                });
-               */
+                */
 
                GameRegistry.addRecipe(new ItemStack(this.mod.blockChemicalCraftingTable),
                                new Object[]{
@@ -73,37 +74,36 @@ public class ChemiCraftRegisterCoreRecipe extends ChemiCraftCoreRegister {
                        Character.valueOf('Z'), new ItemStack(Item.ingotIron),
                });
 
-               /*
-                * 素材制作代のレシピ
-                */
-               //化学電池の追加
-               this.mod.api.addMaterialRecipe(new ItemStack[] {
-                               null,
-                               null,
-                               null,
-                               new ItemStack(this.mod.itemAtoms, 1, this.mod.chemicalData.ZINC),
-                               null,
-                               new ItemStack(this.mod.itemAtoms, 1, this.mod.chemicalData.COPPER),
-                               new ItemStack(Item.bucketWater),
-                               new ItemStack(Item.bucketWater),
-                               new ItemStack(Item.bucketWater),
-               },
-               new ItemStack(this.mod.itemChemicalCells, 1, 0),
-               null);
+               //素材制作台のレシピ
+               this.mod.api.addMaterialRecipe(
+                               new ItemStack[] {
+                                               null,
+                                               null,
+                                               null,
+                                               new ItemStack(this.mod.itemAtoms, 1, this.mod.chemicalData.ZINC),
+                                               null,
+                                               new ItemStack(this.mod.itemAtoms, 1, this.mod.chemicalData.COPPER),
+                                               new ItemStack(Item.bucketWater),
+                                               new ItemStack(Item.bucketWater),
+                                               new ItemStack(Item.bucketWater),
+                               },
+                               new ItemStack(this.mod.itemChemicalCells, 1, 0),
+                               null);
 
-               this.mod.api.addMaterialRecipe(new ItemStack[] {
-                               new ItemStack(this.mod.itemAtoms, 1, ChemiCraftData.toAtoms("Na")),
-                               new ItemStack(this.mod.itemAtoms, 1, ChemiCraftData.toAtoms("C")),
-                               new ItemStack(this.mod.itemAtoms, 1, ChemiCraftData.toAtoms("I")),
-                               null,
-                               new ItemStack(Item.appleRed),
-                               null,
-                               null,
-                               null,
-                               null,
-               }, 
-               new ItemStack(this.mod.itemPear),
-               null
+               this.mod.api.addMaterialRecipe(
+                               new ItemStack[] {
+                                               new ItemStack(this.mod.itemAtoms, 1, ChemiCraftData.toAtoms("Na")),
+                                               new ItemStack(this.mod.itemAtoms, 1, ChemiCraftData.toAtoms("C")),
+                                               new ItemStack(this.mod.itemAtoms, 1, ChemiCraftData.toAtoms("I")),
+                                               null,
+                                               new ItemStack(Item.appleRed),
+                                               null,
+                                               null,
+                                               null,
+                                               null,
+                               },
+                               new ItemStack(this.mod.itemPear),
+                               null
                                );
 
        }
index b7ae662..1106be2 100644 (file)
@@ -8,6 +8,10 @@ import pcc.chemicraft.core.item.ItemCompounds;
 import pcc.chemicraft.core.item.ItemGasCollectingBottle;
 import pcc.chemicraft.util.OldItemFood;
 
+/**
+ * アイテムを追加します
+ * @author mozipi,ponkotate
+ */
 public class ChemiCraftRegisterItem extends ChemiCraftCoreRegister {
 
        public ChemiCraftRegisterItem(ChemiCraftCore mod) {
@@ -16,9 +20,7 @@ public class ChemiCraftRegisterItem extends ChemiCraftCoreRegister {
 
        @Override
        public void start() {
-               /*
-                * 代入
-                */
+               //Itemを変数に代入
                this.mod.itemAtoms = new ItemAtoms(this.mod.atomsID).setItemName("atoms");
                this.mod.itemCompounds = new ItemCompounds(this.mod.compoundsID).setItemName("compounds");
                this.mod.itemGasCollectingBottle = new ItemGasCollectingBottle(this.mod.gasCollectingBottleID).setItemName("gasCollectingBottle").setIconIndex(0);
@@ -29,9 +31,7 @@ public class ChemiCraftRegisterItem extends ChemiCraftCoreRegister {
                                }
                        }.setIconIndex(11).setCreativeTab(CreativeTabs.tabFood).setItemName("Pear");
 
-               /*
-                * 名前登録&Minecraftに登録
-                */
+                       //名前登録&Minecraftに登録
                this.mod.nameAuxiliary.addName(this.mod.itemAtoms, ChemiCraftCore.ATOMSNAME);
                this.mod.nameAuxiliary.addName(this.mod.itemAtoms, "ja_JP", ChemiCraftCore.ATOMSNAMEJP);
                this.mod.nameAuxiliary.addName(this.mod.itemGasCollectingBottle, "GasCollectingBottle");
index 38d61f1..f91e241 100644 (file)
@@ -7,6 +7,10 @@ import pcc.chemicraft.core.tileentity.TileEntityPyrolysisTable;
 import pcc.chemicraft.core.tileentity.TileEntityToolAndWeaponCraftingTable;
 import cpw.mods.fml.common.registry.GameRegistry;
 
+/**
+ * TileEntityを追加します
+ * @author mozipi,ponkotate
+ */
 public class ChemiCraftRegisterTileEntity extends ChemiCraftCoreRegister {
 
        public ChemiCraftRegisterTileEntity(ChemiCraftCore mod) {
@@ -15,9 +19,6 @@ public class ChemiCraftRegisterTileEntity extends ChemiCraftCoreRegister {
 
        @Override
        public void start() {
-               /*
-                * MinecraftにTileEntityを登録
-                */
                GameRegistry.registerTileEntity(TileEntityPyrolysisTable.class, "TileEntityPyrolysisTable");
                GameRegistry.registerTileEntity(TileEntityChemicalCombinationTable.class, "TileEntityChemicalCombinationTable");
                GameRegistry.registerTileEntity(TileEntityToolAndWeaponCraftingTable.class, "TileEntityToolAndWeaponCraftingTable");
index 6b4fd7c..8fffd67 100644 (file)
@@ -11,9 +11,9 @@ import pcc.chemicraft.core.ChemiCraftCore;
 import pcc.chemicraft.core.inventory.InventoryChemicalCraftingMaterial;
 import pcc.chemicraft.core.inventory.InventoryChemicalCraftingNBT;
 import pcc.chemicraft.core.inventory.InventoryChemicalCraftingResult;
+import pcc.chemicraft.core.nbt.ChemicalNBTRecipe;
 import pcc.chemicraft.core.slot.SlotChemicalCraftingTableResult;
 import pcc.chemicraft.core.tileentity.TileEntityChemicalCraftingTable;
-import pcc.chemicraft.util.ChemicalNBTRecipe;
 
 public class ContainerChemicalCraftingTable extends Container {
 
index c0d8bfb..d6220d2 100644 (file)
@@ -75,8 +75,7 @@ public class ItemCompounds extends Item {
        @SideOnly(Side.CLIENT)
        @Override
        public void getSubItems(int par1, CreativeTabs par2CreativeTabs, List par3List){
-               for(int type = 0; type < ChemiCraftAPI.instance().getCompoundsName().get("en_US").size(); type++)
-               {
+               for(int type = 0; type < ChemiCraftAPI.instance().getCompoundsName().get("en_US").size(); type++) {
                        par3List.add(new ItemStack(par1, 1, type));
                        this.setIconIndex(type);
                }
@@ -1,8 +1,8 @@
-package pcc.chemicraft.util;
+package pcc.chemicraft.core.nbt;
 
 import net.minecraft.item.ItemStack;
 
-public abstract class ChemicalNBTRecipe {
+public interface ChemicalNBTRecipe {
 
        public abstract void setNBT(ItemStack[] materials, ItemStack result);
 
@@ -1,4 +1,4 @@
-package pcc.chemicraft.util;
+package pcc.chemicraft.core.nbt;
 
 import net.minecraft.item.ItemStack;
 import net.minecraft.nbt.NBTTagCompound;
@@ -6,31 +6,30 @@ import net.minecraft.nbt.NBTTagList;
 import pcc.chemicraft.ChemiCraftData;
 import pcc.chemicraft.core.ChemiCraftCore;
 
-public class NBTRecipeGrenade extends ChemicalNBTRecipe {
+public class NBTRecipeGrenade implements ChemicalNBTRecipe {
 
        @Override
        public void setNBT(ItemStack[] materials, ItemStack result) {
-               if(result.stackTagCompound == null){
+               if (result.stackTagCompound == null) {
                        result.stackTagCompound = new NBTTagCompound();
                }
 
-               if (!result.stackTagCompound.hasKey("Effect"))
-               {
+               if (!result.stackTagCompound.hasKey("Effect")) {
                        result.stackTagCompound.setTag("Effect", new NBTTagList("Effect"));
                }
 
                NBTTagList tagList = (NBTTagList) result.getTagCompound().getTag("Effect");
                NBTTagCompound tag = new NBTTagCompound();
 
-               for(int i = 0;i < materials.length;i++){
-                       if(materials[i] != null){
-                               if(materials[i].itemID-256 == ChemiCraftCore.instance.atomsID && materials[i].getItemDamage() == ChemiCraftData.HYDROGEN){
+               for (int i = 0;i < materials.length;i++) {
+                       if (materials[i] != null) {
+                               if (materials[i].itemID-256 == ChemiCraftCore.instance.atomsID && materials[i].getItemDamage() == ChemiCraftData.HYDROGEN) {
                                        tag.setString("GrenadeEffect" + i, "Hydrogen");
                                }
-                               if(materials[i].itemID-256 == ChemiCraftCore.instance.atomsID && materials[i].getItemDamage() == ChemiCraftData.CARBON){
+                               if (materials[i].itemID-256 == ChemiCraftCore.instance.atomsID && materials[i].getItemDamage() == ChemiCraftData.CARBON) {
                                        tag.setString("GrenadeEffect" + i, "Carbon");
                                }
-                               if(materials[i].itemID-256 == ChemiCraftCore.instance.atomsID && materials[i].getItemDamage() == ChemiCraftData.URANIUM){
+                               if (materials[i].itemID-256 == ChemiCraftCore.instance.atomsID && materials[i].getItemDamage() == ChemiCraftData.URANIUM) {
                                        tag.setString("GrenadeEffect" + i, "Uranium");
                                }
                        }
@@ -42,18 +41,18 @@ public class NBTRecipeGrenade extends ChemicalNBTRecipe {
        @Override
        public ItemStack[] getMatchItems(ItemStack[] materials) {
                ItemStack[] var1 = new ItemStack[materials.length];
-               for(int i = 0;i < var1.length;i++){
-                       if(materials[i] != null){
-                               if(materials[i].getItemDamage() == ChemiCraftData.HYDROGEN){
+               for (int i = 0;i < var1.length;i++) {
+                       if (materials[i] != null) {
+                               if (materials[i].getItemDamage() == ChemiCraftData.HYDROGEN) {
                                        var1[i] = materials[i];
-                               }else if(materials[i].getItemDamage() == ChemiCraftData.CARBON){
+                               } else if (materials[i].getItemDamage() == ChemiCraftData.CARBON) {
                                        var1[i] = materials[i];
-                               }else if(materials[i].getItemDamage() == ChemiCraftData.URANIUM){
+                               } else if (materials[i].getItemDamage() == ChemiCraftData.URANIUM) {
                                        var1[i] = materials[i];
-                               }else{
+                               } else {
                                        var1[i] = null;
                                }
-                       }else{
+                       } else {
                                var1[i] = null;
                        }
                }
@@ -1,4 +1,4 @@
-package pcc.chemicraft.util;
+package pcc.chemicraft.core.other;
 
 import static net.minecraftforge.event.terraingen.InitMapGenEvent.EventType.CAVE;
 import static net.minecraftforge.event.terraingen.InitMapGenEvent.EventType.MINESHAFT;
@@ -1,4 +1,4 @@
-package pcc.chemicraft.util;
+package pcc.chemicraft.core.other;
 
 import net.minecraft.world.World;
 import net.minecraft.world.WorldType;
index 8d39ada..9cdab9b 100644 (file)
@@ -12,7 +12,7 @@ import pcc.chemicraft.core.inventory.InventoryChemicalCraftingMaterial;
 import pcc.chemicraft.core.inventory.InventoryChemicalCraftingNBT;
 import pcc.chemicraft.core.inventory.InventoryChemicalCraftingResult;
 import pcc.chemicraft.core.inventory.InventoryToolAndWeaponCraftingTableMaterial;
-import pcc.chemicraft.util.ChemicalNBTRecipe;
+import pcc.chemicraft.core.nbt.ChemicalNBTRecipe;
 import pcc.chemicraft.util.ComparatorFormulaPart;
 import pcc.chemicraft.util.ComparatorItemStack;
 import pcc.chemicraft.util.FormulaPart;
index be4c866..e5adc0a 100644 (file)
@@ -1,8 +1,5 @@
 package pcc.chemicraft.core.tileentity;
 
-import ic2.api.Direction;
-import ic2.api.energy.tile.IEnergySink;
-
 import java.io.DataOutputStream;
 import java.util.Iterator;
 import java.util.Random;
@@ -20,8 +17,7 @@ import pcc.chemicraft.core.system.PacketHandler;
 
 import com.google.common.io.ByteArrayDataInput;
 
-public class TileEntityElectrolysisTable extends TileEntity implements IEnergySink
-{
+public class TileEntityElectrolysisTable extends TileEntity {
 
        private InventoryElectrolysisMaterial invm = new InventoryElectrolysisMaterial();
        private InventoryElectrolysisResult invr = new InventoryElectrolysisResult();
@@ -438,34 +434,4 @@ public class TileEntityElectrolysisTable extends TileEntity implements IEnergySi
                }
        }
 
-       @Override
-       public boolean acceptsEnergyFrom(TileEntity emitter, Direction direction)
-       {
-               return true;
-       }
-
-       @Override
-       public boolean isAddedToEnergyNet()
-       {
-               return true;
-       }
-
-       @Override
-       public int demandsEnergy()
-       {
-               return 0;
-       }
-
-       @Override
-       public int injectEnergy(Direction directionFrom, int amount)
-       {
-               return 0;
-       }
-
-       @Override
-       public int getMaxSafeInput()
-       {
-               return 32;
-       }
-
 }
index 556a7b7..4b116f6 100644 (file)
@@ -1,3 +1,4 @@
+/*
 package pcc.chemicraft.testcase;
 
 import static org.junit.Assert.*;
@@ -26,3 +27,4 @@ public class FormulaTest extends Formula {
        }
 
 }
+*/
\ No newline at end of file
index b083782..fd79f6a 100644 (file)
@@ -1,3 +1,4 @@
+/*
 package pcc.chemicraft.testcase;
 
 import static org.junit.Assert.*;
@@ -8,7 +9,7 @@ import org.junit.Test;
 
 import pcc.chemicraft.base.ChemiCraftBase;
 import pcc.chemicraft.core.inventory.InventoryChemicalCraftingMaterial;
-import pcc.chemicraft.util.ChemicalNBTRecipe;
+import pcc.chemicraft.core.nbt.ChemicalNBTRecipe;
 import pcc.chemicraft.util.MaterialRecipe;
 
 public class MaterialRecipeTest extends MaterialRecipe {
@@ -46,3 +47,4 @@ public class MaterialRecipeTest extends MaterialRecipe {
        }
 
 }
+*/
index b6ab74e..ec3f7a7 100644 (file)
@@ -9,17 +9,16 @@ import cpw.mods.fml.relauncher.Side;
 import cpw.mods.fml.relauncher.SideOnly;
 
 /**
- * いろいろなデータを格納しメソッドによってチェックするクラス
- * 使用する場合はItemAtomInfoContainerを継承することを推奨
+ * いろいろなデータを格納しメソッドによってチェックするクラス。<br>
+ * 使用する場合はItemAtomInfoContainerを継承することを推奨します。
  * @author ponkotate
- *
  */
 public final class AtomInfo {
 
        /**
         * 気体
         */
-       public static final Integer[] GASES = new Integer[]{
+       public static final Integer[] GASES = new Integer[] {
                1, 2, 7, 8, 9, 10, 17, 18, 36, 54, 86
        };
 
@@ -27,7 +26,7 @@ public final class AtomInfo {
        /**
         * 液体
         */
-       public static final Integer[] LIQUIDS = new Integer[]{
+       public static final Integer[] LIQUIDS = new Integer[] {
                35, 80
        };
 
@@ -35,22 +34,22 @@ public final class AtomInfo {
        /**
         * 不明
         */
-       public static final Integer[] UNKNOWN = new Integer[]{
+       public static final Integer[] UNKNOWN = new Integer[] {
                98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118
        };
 
 
-       public static final Integer[] LANTHANOID = new Integer[]{
+       public static final Integer[] LANTHANOID = new Integer[] {
                57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71
        };
 
 
-       public static final Integer[] ACTINOID = new Integer[]{
+       public static final Integer[] ACTINOID = new Integer[] {
                89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103
        };
 
 
-       public static final Integer[] UNOFFICIAL = new Integer[]{
+       public static final Integer[] UNOFFICIAL = new Integer[] {
                113, 114, 115, 116, 117, 118
        };
 
@@ -94,29 +93,26 @@ public final class AtomInfo {
         * @param par2EntityPlayer EntityPlayerのインスタンス
         */
        public void update(World par1World, EntityPlayer par2EntityPlayer){
-               //this.world = par1World;
-               //this.entityPlayer = par2EntityPlayer;
-
                this.posX = (int) par2EntityPlayer.posX;
                this.posY = (int) par2EntityPlayer.posY;
                this.posZ = (int) par2EntityPlayer.posZ;
 
                this.biomeName = par1World.getBiomeGenForCoords(posX, posZ).biomeName;
 
-               if (par1World.isThundering()){
+               if (par1World.isThundering()) {
                        this.weather = "Thunder";
-               }else if(par1World.isRaining()){
+               } else if(par1World.isRaining()) {
                        this.weather = "Rain";
-               }else{
+               } else {
                        this.weather = "Sun";
                }
        }
 
 
 
-       public static boolean isGas(int par1){
-               for (int var2:GASES){
-                       if (par1 == var2){
+       public static boolean isGas(int par1) {
+               for (int var2:GASES) {
+                       if (par1 == var2) {
                                return true;
                        }
                }
@@ -125,9 +121,9 @@ public final class AtomInfo {
 
 
 
-       public static boolean isLiquid(int par1){
-               for (int var2:LIQUIDS){
-                       if (par1 == var2){
+       public static boolean isLiquid(int par1) {
+               for (int var2:LIQUIDS) {
+                       if (par1 == var2) {
                                return true;
                        }
                }
@@ -136,8 +132,8 @@ public final class AtomInfo {
 
 
 
-       public static boolean isSolid(int par1){
-               if (!isGas(par1) && !isLiquid(par1) && !isUnknown(par1)){
+       public static boolean isSolid(int par1) {
+               if (!isGas(par1) && !isLiquid(par1) && !isUnknown(par1)) {
                        return true;
                }
                return false;
@@ -145,9 +141,9 @@ public final class AtomInfo {
 
 
 
-       public static boolean isUnknown(int par1){
-               for (int var2:UNKNOWN){
-                       if (par1 == var2){
+       public static boolean isUnknown(int par1) {
+               for (int var2:UNKNOWN) {
+                       if (par1 == var2) {
                                return true;
                        }
                }
@@ -156,9 +152,9 @@ public final class AtomInfo {
 
 
 
-       public static boolean isLanthanoid(int par1){
-               for (int var2:LANTHANOID){
-                       if (par1 == var2){
+       public static boolean isLanthanoid(int par1) {
+               for (int var2:LANTHANOID) {
+                       if (par1 == var2) {
                                return true;
                        }
                }
@@ -167,9 +163,9 @@ public final class AtomInfo {
 
 
 
-       public static boolean isActinoid(int par1){
-               for (int var2:ACTINOID){
-                       if (par1 == var2){
+       public static boolean isActinoid(int par1) {
+               for (int var2:ACTINOID) {
+                       if (par1 == var2) {
                                return true;
                        }
                }
@@ -178,9 +174,9 @@ public final class AtomInfo {
 
 
 
-       public static boolean isUnofficial(int par1){
-               for (int var2:UNOFFICIAL){
-                       if (par1 == var2){
+       public static boolean isUnofficial(int par1) {
+               for (int var2:UNOFFICIAL) {
+                       if (par1 == var2) {
                                return true;
                        }
                }
@@ -189,16 +185,16 @@ public final class AtomInfo {
 
 
 
-       public static boolean isRI(int par1){
+       public static boolean isRI(int par1) {
                return collapseUraniumSeries(par1) != -1;
        }
 
 
 
-       public static int collapseUraniumSeries(int par1){
+       public static int collapseUraniumSeries(int par1) {
                int var1 = 0;
                Probability var2 = new Probability();
-               switch (par1){
+               switch (par1) {
                        case 92:
                                var1 = 90;
                                break;
@@ -206,7 +202,7 @@ public final class AtomInfo {
                                var1 = 92;
                                break;
                        case 90:
-                               switch (var2.getProbability(1, 1)){
+                               switch (var2.getProbability(1, 1)) {
                                        case 0:
                                                var1 = 91;
                                                break;
@@ -222,7 +218,7 @@ public final class AtomInfo {
                                var1 = 84;
                                break;
                        case 85:
-                               switch (var2.getProbability(1, 1)){
+                               switch (var2.getProbability(1, 1)) {
                                        case 0:
                                                var1 = 86;
                                                break;
@@ -232,7 +228,7 @@ public final class AtomInfo {
                                }
                                break;
                        case 84:
-                               switch (var2.getProbability(1, 1)){
+                               switch (var2.getProbability(1, 1)) {
                                        case 0:
                                                var1 = 85;
                                                break;
@@ -242,7 +238,7 @@ public final class AtomInfo {
                                }
                                break;
                        case 83:
-                               switch (var2.getProbability(1, 1)){
+                               switch (var2.getProbability(1, 1)) {
                                        case 0:
                                                var1 = 84;
                                                break;
@@ -252,7 +248,7 @@ public final class AtomInfo {
                                }
                                break;
                        case 82:
-                               switch (var2.getProbability(1, 1)){
+                               switch (var2.getProbability(1, 1)) {
                                        case 0:
                                                var1 = 83;
                                                break;
@@ -275,7 +271,7 @@ public final class AtomInfo {
 
 
 
-       public static boolean isExisting(String par1){
+       public static boolean isExisting(String par1) {
                return false;
        }
 
@@ -286,7 +282,7 @@ public final class AtomInfo {
         * @param biomeName 比較するBiomeの名前
         * @return Biomeが一致しているか
         */
-       public boolean isEquivalentBiome(String biomeName){
+       public boolean isEquivalentBiome(String biomeName) {
                if(this.biomeName != null){
                        if(this.biomeName.equals(biomeName)){
                                return true;
@@ -307,14 +303,14 @@ public final class AtomInfo {
         * @param weather 比較する天候
         * @return 天候が一致しているか
         */
-       public boolean isEquivalentWeather(String weather){
-               if(this.weather != null){
-                       if(this.weather.equals(weather)){
+       public boolean isEquivalentWeather(String weather) {
+               if (this.weather != null) {
+                       if (this.weather.equals(weather)) {
                                return true;
-                       }else{
+                       } else {
                                return false;
                        }
-               }else{
+               } else {
                        System.err.println("AtonInfo:データが入っていません。updateメソッドでデータを入れてください");
                        return false;
                }
@@ -328,8 +324,8 @@ public final class AtomInfo {
         * @return 指定されたY軸より高いか
         */
        @SideOnly(Side.CLIENT)
-       public boolean isOverY(int par1){
-               if(this.posY >= par1){
+       public boolean isOverY(int par1) {
+               if (this.posY >= par1) {
                        return true;
                }else{
                        return false;
@@ -344,8 +340,8 @@ public final class AtomInfo {
         * @return 指定されたY軸と同等かどうか
         */
        @SideOnly(Side.CLIENT)
-       public boolean isEquivalentY(int par1){
-               if(this.posY == par1){
+       public boolean isEquivalentY(int par1) {
+               if (this.posY == par1) {
                        return true;
                }else{
                        return false;
@@ -360,8 +356,8 @@ public final class AtomInfo {
         * @return 指定されたY軸より低いか
         */
        @SideOnly(Side.CLIENT)
-       public boolean isBelowY(int par1){
-               if(this.posY <= par1){
+       public boolean isBelowY(int par1) {
+               if (this.posY <= par1) {
                        return true;
                }else{
                        return false;
index 1e1b23f..b65ebc6 100644 (file)
@@ -9,13 +9,12 @@ import net.minecraft.item.ItemStack;
 import net.minecraft.world.World;
 import cpw.mods.fml.common.registry.LanguageRegistry;
 
+/**
+ * 補助クラス
+ * @author mozipi,ponkotate
+ */
 public class Auxiliary {
 
-       /**
-        * 補助クラス
-        * @author mozipi
-        *
-        */
        public static class NameAuxiliary {
 
                /**
index 66c2c52..e5eafbc 100644 (file)
@@ -2,6 +2,10 @@ package pcc.chemicraft.util;
 
 import java.util.Comparator;
 
+/**
+ * 元素情報を比較します。
+ * @author mozipi
+ */
 public class ComparatorFormulaPart implements Comparator<FormulaPart> {
 
        @Override
index 96c4849..5fb525d 100644 (file)
@@ -4,7 +4,10 @@ import java.util.Comparator;
 
 import net.minecraft.item.ItemStack;
 
-
+/**
+ * ItemStackを比較します。
+ * @author mozipi
+ */
 public class ComparatorItemStack implements Comparator {
 
        @Override
index e145ecf..2a9faba 100644 (file)
@@ -4,45 +4,42 @@ import java.util.ArrayList;
 
 import pcc.chemicraft.ChemiCraftData;
 
-public class Formula
-{
+/**
+ * 化学式から元素と数を取り出してArrayListに格納します。
+ * @author ponkotate
+ */
+public class Formula {
 
        private ArrayList<String> atoms = new ArrayList<String>();
        private ArrayList<Integer> amonts = new ArrayList<Integer>();
 
-       public Formula(String par1)
-       {
+       public Formula(String par1) {
                this.run(par1);
        }
 
-       public Formula(String[] par1, Integer[] par2)
-       {
+       public Formula(String[] par1, Integer[] par2) {
                this.setAtoms(par1, par2);
        }
 
-       public Formula(ArrayList<String> par1, ArrayList<Integer> par2)
-       {
+       public Formula(ArrayList<String> par1, ArrayList<Integer> par2) {
                this.atoms = par1;
                this.amonts = par2;
        }
 
-       public void run(String par1)
-       {
+       public void run(String par1) {
                char[] var2 = par1.toCharArray();
                String var3 = null;
                int var4 = 0;
                int var5 = 1;
                Formula var6 = null;
 
-               for (int i = 0; i < var2.length; i++)
-               {
-                       if (Character.isLetter(var2[i])){
-                               if (Character.isUpperCase(var2[i])){
-                                       if (var4 < 0){
+               for (int i = 0; i < var2.length; i++) {
+                       if (Character.isLetter(var2[i])) {
+                               if (Character.isUpperCase(var2[i])) {
+                                       if (var4 < 0) {
                                                var4 = 1;
                                        }
-                                       if (var3 != null)
-                                       {
+                                       if (var3 != null) {
                                                this.setAtom(var3,  var4 * var5);
                                        } else if (var6 != null) {
                                                this.setAtoms(var6.getAtoms(), var6.getAmonts(), var4 * var5);
@@ -60,8 +57,7 @@ public class Formula
                                        var5 = Integer.valueOf(Character.toString(var2[i]));
                                }
                        } else if (var2[i] == '・') {
-                               if (var3 != null)
-                               {
+                               if (var3 != null) {
                                        this.setAtom(var3,  var4 * var5);
                                } else if (var6 != null) {
                                        this.setAtoms(var6.getAtoms(), var6.getAmonts(), var4 * var5);
@@ -71,8 +67,7 @@ public class Formula
                                var5 = 1;
                                var6 = null;
                        } else if (var2[i] == '(') {
-                               if (var3 != null)
-                               {
+                               if (var3 != null) {
                                        this.setAtom(var3,  var4 * var5);
                                        var3 = null;
                                        var4 = 1;
@@ -85,27 +80,24 @@ public class Formula
                                throw new IllegalArgumentException();
                        }
                }
-               if (var3 != null)
-               {
+               if (var3 != null) {
                        this.setAtom(var3,  var4 * var5);
                }
        }
 
-       public boolean isAtom(String par1)
-       {
-               for (String var2:ChemiCraftData.ATOMSLIST){
-                       if (par1.equalsIgnoreCase(var2)){
+       public boolean isAtom(String par1) {
+               for (String var2:ChemiCraftData.ATOMSLIST) {
+                       if (par1.equalsIgnoreCase(var2)) {
                                return true;
                        }
                }
                return false;
        }
 
-       public void setAtom(String par1,  int par2)
-       {
-               if (isAtom(par1)){
+       public void setAtom(String par1,  int par2) {
+               if (isAtom(par1)) {
                        int var3 = this.atoms.indexOf(par1);
-                       if (var3 == -1){
+                       if (var3 == -1) {
                                this.atoms.add(par1);
                                this.amonts.add(par2);
                        } else {
@@ -116,34 +108,27 @@ public class Formula
                }
        }
 
-       public void setAtom(String par1,  char par2)
-       {
+       public void setAtom(String par1,  char par2) {
                setAtom(par1, Integer.valueOf(Character.toString(par2)));
        }
 
-       public void setAtoms(String[] par1, Integer[] par2)
-       {
+       public void setAtoms(String[] par1, Integer[] par2) {
                setAtoms(par1, par2, 1);
        }
-       public void setAtoms(String[] par1, Integer[] par2, int par3)
-       {
-               if (par1.length != par2.length)
-               {
+       public void setAtoms(String[] par1, Integer[] par2, int par3) {
+               if (par1.length != par2.length) {
                        throw new IndexOutOfBoundsException();
                }
-               for (int i = 0; i < par1.length; i++)
-               {
+               for (int i = 0; i < par1.length; i++) {
                        this.setAtom(par1[i], par2[i] * par3);
                }
        }
 
-       public String[] getAtoms()
-       {
+       public String[] getAtoms() {
                return atoms.toArray(new String[atoms.size()]);
        }
 
-       public Integer[] getAmonts()
-       {
+       public Integer[] getAmonts() {
                return amonts.toArray(new Integer[amonts.size()]);
        }
 
index 9067c91..61a2a86 100644 (file)
@@ -1,5 +1,9 @@
 package pcc.chemicraft.util;
 
+/**
+ * 元素情報を格納するクラスです
+ * @author mozipi
+ */
 public class FormulaPart {
 
        private String atom;
diff --git a/common/pcc/chemicraft/util/FormulaTestTest.java b/common/pcc/chemicraft/util/FormulaTestTest.java
deleted file mode 100644 (file)
index 3e6f97f..0000000
+++ /dev/null
@@ -1,16 +0,0 @@
-package pcc.chemicraft.util;
-
-import static org.junit.Assert.*;
-
-import org.junit.Test;
-
-public class FormulaTestTest
-{
-
-       @Test
-       public void test()
-       {
-               fail("まだ実装されていません");
-       }
-
-}
index 4257843..76fd87c 100644 (file)
@@ -5,6 +5,10 @@ import net.minecraft.entity.player.EntityPlayer;
 import net.minecraft.item.ItemStack;
 import net.minecraft.world.World;
 
+/**
+ * 化合物のハンドラーのインターフェイスです。
+ * @author mozipi
+ */
 public interface ICompoundHandler {
 
        /**
index 0213a60..1b3e990 100644 (file)
@@ -9,19 +9,17 @@ import java.util.ListIterator;
 import java.util.Map;
 import java.util.Set;
 
-public class ListHash<K, E>
-{
-       /**
-        * @author Ponkotate version:1.0.0 dev
-        *
-        *         Create ArrayList in HashMap.
-        */
+/**
+ * @author Ponkotate version:1.0.0 dev
+ *
+ *         Create ArrayList in HashMap.
+ */
+public class ListHash<K, E> {
 
        protected ArrayList<K> keysList = new ArrayList<K>();
        protected HashMap<K, ArrayList<E>> elementsHash = new HashMap<K, ArrayList<E>>();
 
-       public boolean add(K par1Key, E par2Element)
-       {
+       public boolean add(K par1Key, E par2Element) {
                try {
                        return this.elementsHash.get(par1Key).add(par2Element);
                } catch (Exception e) {
@@ -29,53 +27,51 @@ public class ListHash<K, E>
                }
        }
 
-       public boolean addAll(K par1Key, Collection<? extends E> par2Collection)
-       {
+       public boolean addAll(K par1Key, Collection<? extends E> par2Collection) {
                return this.elementsHash.get(par1Key).addAll(par2Collection);
        }
 
-       public boolean addAll(K par1Key, int par2Index, Collection<? extends E> par3Collection)
-       {
+       public boolean addAll(K par1Key, int par2Index, Collection<? extends E> par3Collection) {
                return this.elementsHash.get(par1Key).addAll(par2Index, par3Collection);
        }
 
-       public void clear()
-       {
+       public boolean createHash(K par1Key) {
+               if (this.elementsHash.put(par1Key, new ArrayList<E>()) != null) {
+                       return false;
+               }
+               this.keysList.add(par1Key);
+               return true;
+       }
+
+       public void clear() {
                this.elementsHash.clear();
        }
 
-       public boolean containsKey(K par1Key)
-       {
+       public boolean containsKey(K par1Key) {
                return this.elementsHash.containsKey(par1Key);
        }
 
-       public boolean containsValue(K par1Key)
-       {
+       public boolean containsValue(K par1Key) {
                return this.elementsHash.containsValue(par1Key);
        }
 
-       public boolean contains(K par1Key, E par2Element)
-       {
+       public boolean contains(K par1Key, E par2Element) {
                return this.elementsHash.get(par1Key).contains(par2Element);
        }
 
-       public boolean containsAll(K par1Key, Collection<?> par2Collection)
-       {
+       public boolean containsAll(K par1Key, Collection<?> par2Collection) {
                return this.elementsHash.get(par1Key).containsAll(par2Collection);
        }
 
-       public Set<java.util.Map.Entry<K, E>> entrySet()
-       {
+       public Set<java.util.Map.Entry<K, E>> entrySet() {
                return this.entrySet();
        }
 
-       public K getKeyList(int par1Index)
-       {
+       public K getKeyList(int par1Index) {
                return this.keysList.get(par1Index);
        }
 
-       public E get(K par1Key, int par2Index)
-       {
+       public E get(K par1Key, int par2Index) {
                return this.elementsHash.get(par1Key).get(par2Index);
        }
 
@@ -83,53 +79,43 @@ public class ListHash<K, E>
                return this.elementsHash.get(par1Key);
        }
 
-       public int indexOf(K par1Key, E par2Element)
-       {
+       public int indexOf(K par1Key, E par2Element) {
                return this.elementsHash.get(par1Key).indexOf(par2Element);
        }
 
-       public boolean isKeysListEmpty(K par1Key)
-       {
+       public boolean isKeysListEmpty(K par1Key) {
                return this.elementsHash.get(par1Key).isEmpty();
        }
 
-       public boolean isElementsHashEmpty()
-       {
+       public boolean isElementsHashEmpty() {
                return this.elementsHash.isEmpty();
        }
 
-       public Iterator<K> iterator()
-       {
+       public Iterator<K> iterator() {
                return this.keysList.iterator();
        }
 
-       public Iterator<E> iterator(K par1Key)
-       {
+       public Iterator<E> iterator(K par1Key) {
                return this.elementsHash.get(par1Key).iterator();
        }
 
-       public int lastIndexOf(K par1Key, E par2Element)
-       {
+       public int lastIndexOf(K par1Key, E par2Element) {
                return this.elementsHash.get(par1Key).lastIndexOf(par2Element);
        }
 
-       public ListIterator<E> listIterator(K par1Key)
-       {
+       public ListIterator<E> listIterator(K par1Key) {
                return this.elementsHash.get(par1Key).listIterator();
        }
 
-       public ListIterator<E> listIterator(K par1Key, int par2Index)
-       {
+       public ListIterator<E> listIterator(K par1Key, int par2Index) {
                return this.elementsHash.get(par1Key).listIterator(par2Index);
        }
 
-       public Set<K> keySet()
-       {
+       public Set<K> keySet() {
                return this.elementsHash.keySet();
        }
 
-       public boolean put(K par1Key, E par2Element)
-       {
+       public boolean put(K par1Key, E par2Element) {
                this.keysList.add(par1Key);
 
                ArrayList<E> elementList = new ArrayList<E>();
@@ -137,75 +123,61 @@ public class ListHash<K, E>
                return this.add(par1Key, par2Element);
        }
 
-       public void putAll(Map<? extends K, ? extends ArrayList<E>> par1Map)
-       {
+       public void putAll(Map<? extends K, ? extends ArrayList<E>> par1Map) {
                this.elementsHash.putAll(par1Map);
        }
 
-       public ArrayList<E> remove(K par1Key)
-       {
+       public ArrayList<E> remove(K par1Key) {
                return this.elementsHash.remove(par1Key);
        }
 
-       public boolean remove(K par1Key, E par2Element)
-       {
+       public boolean remove(K par1Key, E par2Element) {
                return this.elementsHash.get(par1Key).remove(par2Element);
        }
 
-       public E remove(K par1Key, int par2Index)
-       {
+       public E remove(K par1Key, int par2Index) {
                return this.elementsHash.get(par1Key).remove(par2Index);
        }
 
-       public boolean removeAll(K par1Key, Collection<?> par2Collection)
-       {
+       public boolean removeAll(K par1Key, Collection<?> par2Collection) {
                return this.elementsHash.get(par1Key).removeAll(par2Collection);
        }
 
-       public boolean retainAll(K par1Key, Collection<?> par2Collection)
-       {
+       public boolean retainAll(K par1Key, Collection<?> par2Collection) {
                return this.elementsHash.get(par1Key).retainAll(par2Collection);
        }
 
-       public E set(K par1Key, int par2Index, E par3Element)
-       {
+       public E set(K par1Key, int par2Index, E par3Element) {
                return this.elementsHash.get(par1Key).set(par2Index, par3Element);
        }
 
-       public int sizeElementsHash()
-       {
+       public int sizeElementsHash() {
                return this.elementsHash.size();
        }
 
-       public int sizeKeysList()
-       {
+       public int sizeKeysList() {
                return this.keysList.size();
        }
 
-       public int sizeElementsList(K par1Key)
-       {
+       public int sizeElementsList(K par1Key) {
                return this.elementsHash.get(par1Key).size();
        }
 
-       public List<E> subList(K par1Key, int par2FromIndex, int par3ToIndex)
-       {
+       public List<E> subList(K par1Key, int par2FromIndex, int par3ToIndex) {
                return this.elementsHash.get(par1Key).subList(
                                par2FromIndex,
                                par3ToIndex);
        }
 
-       public E[] toArray(K par1Key)
-       {
+       public E[] toArray(K par1Key) {
                return (E[])this.elementsHash.get(par1Key).toArray();
        }
 
-       public <T> T[] toArray(K par1Key, T[] par2Array)
-       {
+       public <T> T[] toArray(K par1Key, T[] par2Array) {
                return this.elementsHash.get(par1Key).toArray(par2Array);
        }
 
-       public Collection<ArrayList<E>> values()
-       {
+       public Collection<ArrayList<E>> values() {
                return this.elementsHash.values();
        }
 
index 43c5e4c..c404739 100644 (file)
@@ -6,8 +6,13 @@ import java.util.Arrays;
 import net.minecraft.item.ItemStack;
 import pcc.chemicraft.core.ChemiCraftCore;
 import pcc.chemicraft.core.inventory.InventoryChemicalCraftingMaterial;
+import pcc.chemicraft.core.nbt.ChemicalNBTRecipe;
 import pcc.chemicraft.util.Auxiliary.ArrayAuxiliary;
 
+/**
+ * 素材制作台のレシピを格納するクラスです
+ * @author mozipi
+ */
 public class MaterialRecipe {
 
        private ChemicalNBTRecipe nbtRecipe;
@@ -22,67 +27,76 @@ public class MaterialRecipe {
                this.isSharpless = par4;
        }
 
+       /**
+        * インベントリの中にあるアイテムとレシピの内容が一致するかどうか判定します。<br>
+        * @param par1IInventory Inventory
+        * @return 一致したばあいはthis.resultを。それ以外はnull
+        */
        @SuppressWarnings("unchecked")
        public ItemStack match(InventoryChemicalCraftingMaterial par1IInventory){
                ArrayList<ItemStack> invItemsArray = new ArrayList<ItemStack>();
                ItemStack[] invItems;
-               for(int i = 0;i < par1IInventory.getSizeInventory();i++){
+               for (int i = 0;i < par1IInventory.getSizeInventory();i++) {
                        invItemsArray.add(par1IInventory.getStackInSlot(i));
                }
                invItems = invItemsArray.toArray(new ItemStack[invItemsArray.size()]);
 
-               if(isSharpless){
+               if (isSharpless) {
                        Arrays.sort(invItems, new ComparatorItemStack());
                        Arrays.sort(this.material, new ComparatorItemStack());
                        invItems = (ItemStack[]) ArrayAuxiliary.deleteNull(invItems);
-                       if(invItems.length != this.material.length) return null;
-                       for(int i = 0;i < this.material.length;i++){
-                               if(this.material[i].itemID != invItems[i].itemID) return null;
-                               if(this.material[i].getItemDamage() != invItems[i].getItemDamage()) return null;
+                       if (invItems.length != this.material.length) return null;
+                       for (int i = 0;i < this.material.length;i++) {
+                               if (this.material[i].itemID != invItems[i].itemID) return null;
+                               if (this.material[i].getItemDamage() != invItems[i].getItemDamage()) return null;
                        }
                        return this.result;
-               }else{
-                       if(this.material.length != invItems.length) return null;
-                       for(int i = 0;i < this.material.length;i++){
-                               if(this.material[i] == null && invItems[i] != null) return null;
-                               if(this.material[i] != null && invItems[i] == null) return null;
-                               if(this.material[i] != null && invItems[i] != null){
-                                       if(this.material[i].itemID != invItems[i].itemID) return null;
-                                       if(this.material[i].getItemDamage() != invItems[i].getItemDamage()) return null;
+               } else {
+                       if (this.material.length != invItems.length) return null;
+                       for (int i = 0;i < this.material.length;i++) {
+                               if (this.material[i] == null && invItems[i] != null) return null;
+                               if (this.material[i] != null && invItems[i] == null) return null;
+                               if (this.material[i] != null && invItems[i] != null){
+                                       if (this.material[i].itemID != invItems[i].itemID) return null;
+                                       if (this.material[i].getItemDamage() != invItems[i].getItemDamage()) return null;
                                }
                        }
                        return this.result;
                }
        }
 
+       /**
+        * NBTが一致するかどうか判定します
+        * @param par1IInventory Inventory
+        * @return 一致したらthis.nbt。それ以外はnull
+        */
        @SuppressWarnings("unchecked")
        public ChemicalNBTRecipe nbtMatch(InventoryChemicalCraftingMaterial par1IInventory){
                ArrayList<ItemStack> invItemsArray = new ArrayList<ItemStack>();
                ItemStack[] invItems;
-               for(int i = 0;i < par1IInventory.getSizeInventory();i++){
+               for (int i = 0;i < par1IInventory.getSizeInventory();i++) {
                        invItemsArray.add(par1IInventory.getStackInSlot(i));
                }
                invItems = invItemsArray.toArray(new ItemStack[invItemsArray.size()]);
 
-               if(isSharpless){
+               if (isSharpless) {
                        Arrays.sort(invItems, new ComparatorItemStack());
                        Arrays.sort(this.material, new ComparatorItemStack());
                        invItems = (ItemStack[]) ArrayAuxiliary.deleteNull(invItems);
-                       if(invItems.length != this.material.length) return null;
-                       for(int i = 0;i < this.material.length;i++){
-                               if(this.material[i].itemID != invItems[i].itemID) return null;
-                               if(this.material[i].getItemDamage() != invItems[i].getItemDamage()) return null;
+                       if (invItems.length != this.material.length) return null;
+                       for (int i = 0;i < this.material.length;i++) {
+                               if (this.material[i].itemID != invItems[i].itemID) return null;
+                               if (this.material[i].getItemDamage() != invItems[i].getItemDamage()) return null;
                        }
-                       System.out.println(this.nbtRecipe);
                        return this.nbtRecipe;
                }else{
-                       if(this.material.length != invItems.length) return null;
-                       for(int i = 0;i < this.material.length;i++){
-                               if(this.material[i] == null && invItems[i] != null) return null;
-                               if(this.material[i] != null && invItems[i] == null) return null;
-                               if(this.material[i] != null && invItems[i] != null){
-                                       if(this.material[i].itemID != invItems[i].itemID) return null;
-                                       if(this.material[i].getItemDamage() != invItems[i].getItemDamage()) return null;
+                       if (this.material.length != invItems.length) return null;
+                       for (int i = 0;i < this.material.length;i++) {
+                               if (this.material[i] == null && invItems[i] != null) return null;
+                               if (this.material[i] != null && invItems[i] == null) return null;
+                               if (this.material[i] != null && invItems[i] != null) {
+                                       if (this.material[i].itemID != invItems[i].itemID) return null;
+                                       if (this.material[i].getItemDamage() != invItems[i].getItemDamage()) return null;
                                }
                        }
                        return this.nbtRecipe;
index 3090a22..2a2ef8c 100644 (file)
@@ -2,11 +2,9 @@ package pcc.chemicraft.util;
 
 import net.minecraft.item.Item;
 
-public class OldItem extends Item
-{
+public class OldItem extends Item {
 
-       public OldItem(int par1)
-       {
+       public OldItem(int par1) {
                super(par1);
        }
 
index bc6e221..046c475 100644 (file)
@@ -2,16 +2,13 @@ package pcc.chemicraft.util;
 
 import net.minecraft.item.ItemFood;
 
-public class OldItemFood extends ItemFood
-{
+public class OldItemFood extends ItemFood {
 
-       public OldItemFood(int par1, int par2, float par3, boolean par4)
-       {
+       public OldItemFood(int par1, int par2, float par3, boolean par4) {
                super(par1, par2, par3, par4);
        }
 
-       public OldItemFood(int par1, int par2, boolean par3)
-       {
+       public OldItemFood(int par1, int par2, boolean par3) {
                super(par1, par2, par3);
        }