--- /dev/null
+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);
+ }
+
+}
--- /dev/null
+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);
+ }
+ }
+
+}
--- /dev/null
+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();
+ }
+
+}
--- /dev/null
+package pcc.addon.crops;
+
+public class ClientProxy extends CommonProxy {
+
+}
--- /dev/null
+package pcc.addon.crops;
+
+public class CommonProxy {
+
+}
--- /dev/null
+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;
+ }
+
+}
--- /dev/null
+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();
+ }
+
+}
--- /dev/null
+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();
+ }
+ }
+
+}
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.
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;
}
}
import java.util.ArrayList;
+/**
+ * @author P.C.C
+ */
public final class ChemiCraftData {
public static final int HYDROGEN = 0;
--- /dev/null
+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();
+ }
+ }
+
+}
package pcc.chemicraft;
-
-public abstract class ChemiCraftRegister {
-
+/**
+ * ChemiCraftの追加のインターフェイスです
+ * @author mozipi,ponkotate
+ */
+public interface ChemiCraftRegister {
public abstract void start();
-
}
--- /dev/null
+package pcc.chemicraft;
+
+public enum EnumLoggingType {
+
+ INFO,
+ ERROR,
+ WARNING,
+ NORMAL;
+
+}
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;
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.
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);
}
@Override
- public void run()
- {
+ public void run() {
while (true) {
if (proxy != null && instance != null) {
this.settingProcessing((FMLPostInitializationEvent) event);
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;
}
}
/**
- * PreInit:
+ * PreInit:<br>
* Configをロードします。
* @param event アノテーション呼び出しにより呼び出す必要なし
*/
cfg.save();
}
- protected void settingProcessing(FMLPostInitializationEvent event)
- {
+ protected void settingProcessing(FMLPostInitializationEvent event) {
this.registerCompounds.start();
this.registerCompoundsHandler.start();
this.registerItem.start();
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));
}
}
-
}
}
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;
}
/**
* 鉱石を追加します。
- * @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(
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,
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;
}
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) {
@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)));
}
-
-
}
}
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) {
@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);
}
-
}
}
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");
}
}
package pcc.chemicraft.base;
-
-
+/**
+ * 化合物を追加します
+ * @author mozipi,ponkotate
+ */
public class ChemiCraftRegisterCompounds extends ChemiCraftBaseRegister {
public ChemiCraftRegisterCompounds(ChemiCraftBase mod) {
import pcc.chemicraft.base.compounds.CompoundWater;
+/**
+ * 化合物のHandlerを設定します
+ * @author mozipi,ponkotate
+ */
public class ChemiCraftRegisterCompoundsHandler extends ChemiCraftBaseRegister {
public ChemiCraftRegisterCompoundsHandler(ChemiCraftBase mod) {
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) {
@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",
import pcc.chemicraft.base.item.ItemRadiationBallet;
import pcc.chemicraft.base.item.ItemRadiationGun;
+/**
+ * アイテムを追加します
+ * @author mozipi,ponkotate
+ */
public class ChemiCraftRegisterItem extends ChemiCraftBaseRegister {
public ChemiCraftRegisterItem(ChemiCraftBase mod) {
@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");
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());
}
import net.minecraft.world.World;
import pcc.chemicraft.util.ICompoundHandler;
+/**
+ * 水の化合物ハンドラーです
+ * @author mozipi
+ */
public class CompoundWater implements ICompoundHandler {
@Override
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;
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);
}
@Override
@SideOnly(Side.CLIENT)
- public int getTabIconItemIndex(){
+ public int getTabIconItemIndex() {
return ChemiCraftBase.instance.blockAtomOres[0].blockID;
}
@Override
@SideOnly(Side.CLIENT)
- public String getTranslatedTabLabel(){
+ public String getTranslatedTabLabel() {
return "AtomsOre";
}
-
}
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;
}
@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;
}
}
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));
}
this.isDead = true;
}
-
}
}
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;
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);
}
@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();
}
@Override
- protected void readEntityFromNBT(NBTTagCompound var1)
- {
-
+ protected void readEntityFromNBT(NBTTagCompound var1) {
+
}
@Override
- protected void writeEntityToNBT(NBTTagCompound var1)
- {
-
+ protected void writeEntityToNBT(NBTTagCompound var1) {
+
}
}
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;
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 {
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) {
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++) {
import pcc.chemicraft.ChemiCraft;
import pcc.chemicraft.base.entity.EntityAtomsGrenade;
+/**
+ * 手榴弾のアイテムです。
+ * @author mozipi
+ */
public class ItemAtomsGrenade extends Item {
public ItemAtomsGrenade(int par1) {
}
@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;
}
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;
}
@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)
);
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;
}
@Override
- public String getTextureFile(){
+ public String getTextureFile() {
return ChemiCraft.ITEM_TEXTURE;
}
import pcc.chemicraft.base.entity.EntityDust;
import pcc.chemicraft.core.ChemiCraftCore;
+/**
+ * 粉塵のアイテムです
+ * @author mozipi
+ */
public class ItemDust extends Item {
public ItemDust(int par1) {
--- /dev/null
+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();
+ }
+
+
+
+}
import pcc.chemicraft.ChemiCraft;
import pcc.chemicraft.core.ChemiCraftCore;
+/**
+ * 放射線中の弾です
+ * @author mozipi
+ */
public class ItemRadiationBallet extends Item {
public ItemRadiationBallet(int par1) {
import pcc.chemicraft.base.ChemiCraftBase;
import pcc.chemicraft.core.ChemiCraftCore;
+/**
+ * 放射線銃です
+ * @author mozipi
+ */
public class ItemRadiationGun extends Item {
+ /**
+ * 次の発射までの遅延
+ */
private short delay;
public ItemRadiationGun(int par1) {
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;
}
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);
@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())];
}
}
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);
}
@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);
}
}
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
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() {
}
}
@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;
}
}
/**
* サーバーとクライアントのデータの同期に必要なクラス
- *
* @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) {
+
}
}
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;
/**
- * 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;
}
private ArrayList<Integer[]> chemicalCombinationAmounts = new ArrayList<Integer[]>();
-
/**
* 化合台の原子の種類のリスト
*/
private ArrayList<String> compoundHandlerItemNames = new ArrayList<String>();
-
/**
* List of compounds handlers.
*/
private ArrayList<ICompoundHandler> compoundHandlers = new ArrayList<ICompoundHandler>();
-
/**
* 化合物の文字列をダメージ値に変換します。
*/
private ArrayList<ItemStack> toolAndWeaponResult = new ArrayList<ItemStack>();
-
/**
* ツール&武器作成台の不定形であるか
*/
* @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);
/**
- * 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);
/**
- * 電気分解台の燃料を追加します
- * @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);
}
}
- 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++) {
formula.getAmonts()[i],
ChemiCraftData.toAtoms(formula.getAtoms()[i]));
}
- this.electrolysisRecipeList.put(
+ this.pyrolysisRecipeList.put(
material,
itemstacks);
}
/**
- * 素材作成台のレシピを追加します
- * @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);
}
* @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;
- 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;
}
return toolAndWeaponSharpless;
}
-
-
- /**
- * setting compound handler.
- * @param handlerItemName
- * @param compoundHandler
- */
- public void settingCompoundHandler(String handlerItemName, ICompoundHandler compoundHandler){
- compoundHandlers.add(compoundHandler);
- compoundHandlerItemNames.add(handlerItemName);
- }
-
}
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;
* 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{
/**
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();
}
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;
}
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,
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();
}
}
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;
}
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) {
@Override
public void start() {
-
- /*
- * 変数に代入
- */
+ //Blockを変数に代入
this.mod.blockPyrolysisTable = new BlockPyrolysisTable(this.mod.pyrolysisTableID, 0, Material.ground).
setHardness(2.0F).
setResistance(0.0F).
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");
import pcc.chemicraft.ChemiCraftData;
import cpw.mods.fml.common.registry.GameRegistry;
+/**
+ * レシピを追加します
+ * @author mozipi,ponkotate
+ */
public class ChemiCraftRegisterCoreRecipe extends ChemiCraftCoreRegister {
public ChemiCraftRegisterCoreRecipe(ChemiCraftCore mod) {
@Override
public void start() {
-
- /*
- * 科学作業台のレシピ
- */
+ //科学作業台のレシピ
GameRegistry.addRecipe(new ItemStack(this.mod.blockPyrolysisTable),
new Object[]{
"XXX", "ZAZ", "ZYZ",
Character.valueOf('Z'), new ItemStack(Block.stone),
Character.valueOf('A'), new ItemStack(Item.pickaxeSteel),
});
- */
+ */
GameRegistry.addRecipe(new ItemStack(this.mod.blockChemicalCraftingTable),
new Object[]{
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
);
}
import pcc.chemicraft.core.item.ItemGasCollectingBottle;
import pcc.chemicraft.util.OldItemFood;
+/**
+ * アイテムを追加します
+ * @author mozipi,ponkotate
+ */
public class ChemiCraftRegisterItem extends ChemiCraftCoreRegister {
public ChemiCraftRegisterItem(ChemiCraftCore mod) {
@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);
}
}.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");
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) {
@Override
public void start() {
- /*
- * MinecraftにTileEntityを登録
- */
GameRegistry.registerTileEntity(TileEntityPyrolysisTable.class, "TileEntityPyrolysisTable");
GameRegistry.registerTileEntity(TileEntityChemicalCombinationTable.class, "TileEntityChemicalCombinationTable");
GameRegistry.registerTileEntity(TileEntityToolAndWeaponCraftingTable.class, "TileEntityToolAndWeaponCraftingTable");
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 {
@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);
}
-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);
-package pcc.chemicraft.util;
+package pcc.chemicraft.core.nbt;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
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");
}
}
@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;
}
}
-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;
-package pcc.chemicraft.util;
+package pcc.chemicraft.core.other;
import net.minecraft.world.WorldProvider;
-package pcc.chemicraft.util;
+package pcc.chemicraft.core.other;
import net.minecraft.world.World;
import net.minecraft.world.WorldType;
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;
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;
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();
}
}
- @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;
- }
-
}
+/*
package pcc.chemicraft.testcase;
import static org.junit.Assert.*;
}
}
+*/
\ No newline at end of file
+/*
package pcc.chemicraft.testcase;
import static org.junit.Assert.*;
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 {
}
}
+*/
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
};
/**
* 液体
*/
- public static final Integer[] LIQUIDS = new Integer[]{
+ public static final Integer[] LIQUIDS = new Integer[] {
35, 80
};
/**
* 不明
*/
- 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
};
* @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;
}
}
- 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;
}
}
- 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;
- 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;
}
}
- 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;
}
}
- 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;
}
}
- 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;
}
}
- 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;
var1 = 92;
break;
case 90:
- switch (var2.getProbability(1, 1)){
+ switch (var2.getProbability(1, 1)) {
case 0:
var1 = 91;
break;
var1 = 84;
break;
case 85:
- switch (var2.getProbability(1, 1)){
+ switch (var2.getProbability(1, 1)) {
case 0:
var1 = 86;
break;
}
break;
case 84:
- switch (var2.getProbability(1, 1)){
+ switch (var2.getProbability(1, 1)) {
case 0:
var1 = 85;
break;
}
break;
case 83:
- switch (var2.getProbability(1, 1)){
+ switch (var2.getProbability(1, 1)) {
case 0:
var1 = 84;
break;
}
break;
case 82:
- switch (var2.getProbability(1, 1)){
+ switch (var2.getProbability(1, 1)) {
case 0:
var1 = 83;
break;
- public static boolean isExisting(String par1){
+ public static boolean isExisting(String par1) {
return false;
}
* @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;
* @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;
}
* @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;
* @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;
* @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;
import net.minecraft.world.World;
import cpw.mods.fml.common.registry.LanguageRegistry;
+/**
+ * 補助クラス
+ * @author mozipi,ponkotate
+ */
public class Auxiliary {
- /**
- * 補助クラス
- * @author mozipi
- *
- */
public static class NameAuxiliary {
/**
import java.util.Comparator;
+/**
+ * 元素情報を比較します。
+ * @author mozipi
+ */
public class ComparatorFormulaPart implements Comparator<FormulaPart> {
@Override
import net.minecraft.item.ItemStack;
-
+/**
+ * ItemStackを比較します。
+ * @author mozipi
+ */
public class ComparatorItemStack implements Comparator {
@Override
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);
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);
var5 = 1;
var6 = null;
} else if (var2[i] == '(') {
- if (var3 != null)
- {
+ if (var3 != null) {
this.setAtom(var3, var4 * var5);
var3 = null;
var4 = 1;
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 {
}
}
- 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()]);
}
package pcc.chemicraft.util;
+/**
+ * 元素情報を格納するクラスです
+ * @author mozipi
+ */
public class FormulaPart {
private String atom;
+++ /dev/null
-package pcc.chemicraft.util;
-
-import static org.junit.Assert.*;
-
-import org.junit.Test;
-
-public class FormulaTestTest
-{
-
- @Test
- public void test()
- {
- fail("まだ実装されていません");
- }
-
-}
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
+/**
+ * 化合物のハンドラーのインターフェイスです。
+ * @author mozipi
+ */
public interface ICompoundHandler {
/**
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) {
}
}
- 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);
}
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>();
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();
}
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;
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;
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);
}
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);
}