From 483cb8fa46224cd524b1e8a4b0b84a243b323aa2 Mon Sep 17 00:00:00 2001 From: ponkotate Date: Sun, 13 Jan 2013 17:55:50 +0900 Subject: [PATCH] =?utf8?q?common=E3=81=A8src=E7=B5=B1=E5=90=88=E3=80=82?= =?utf8?q?=E9=9B=BB=E8=A7=A3=E6=A9=9F=E4=B8=AD=E9=80=94=E5=8D=8A=E7=AB=AF?= =?utf8?q?=E3=81=AA=E3=81=AE=E3=81=A7=E6=B3=A8=E6=84=8F=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- .../inventory/InventoryPyrolysisTableFuel.java | 112 -- common/chemicraft/slot/SlotPyrolysisTableFuel.java | 12 - {common => src}/chemicraft/ChemiCraft.java | 706 ++++++------ {common => src}/chemicraft/ChemiCraftAPI.java | 0 {common => src}/chemicraft/ChemiCraftData.java | 0 .../block/BlockChemicalCombinationTable.java | 0 .../block/BlockChemicalCraftingTable.java | 0 .../chemicraft/block/BlockDecompositionTable.java | 10 +- src/chemicraft/block/BlockElectrolysisTable.java | 31 + .../block/BlockToolAndWeaponCraftingTable.java | 0 src/chemicraft/client/ClientProxy.java | 15 +- .../chemicraft/compounds/CompoundWater.java | 0 .../ContainerChemicalCombinationTable.java | 0 .../container/ContainerChemicalCraftingTable.java | 0 .../container/ContainerDecompositionTable.java | 8 +- .../container/ContainerElectrolysisTable.java | 68 ++ .../ContainerToolAndWeaponCraftingTable.java | 0 .../chemicraft/debug/CommandDeleteItem.java | 0 .../chemicraft/debug/CommandGenDebugRoom.java | 0 .../chemicraft/debug/CommandSetTile.java | 90 +- .../chemicraft/debug/CompoundHandlerTest.java | 0 .../chemicraft/debug/SetBlockSupport.java | 1190 ++++++++++---------- .../chemicraft/entity/EntityAtomsGrenade.java | 0 .../gui/GuiChemicalCombinationTable.java | 0 .../chemicraft/gui/GuiChemicalCraftingTable.java | 0 .../chemicraft/gui/GuiDecompositionTable.java | 13 +- src/chemicraft/gui/GuiElectrolysisTable.java | 24 + .../gui/GuiToolAndWeaponCraftingTable.java | 0 .../InventoryChemicalCombinationTableMaterial.java | 0 .../InventoryChemicalCombinationTableResult.java | 0 .../InventoryChemicalCraftingMaterial.java | 0 .../inventory/InventoryChemicalCraftingNBT.java | 0 .../inventory/InventoryChemicalCraftingResult.java | 0 .../InventoryDecompositionTableMaterial.java | 4 +- .../InventoryDecompositionTableResult.java | 4 +- .../inventory/InventoryElectrolysisFuel.java | 98 ++ .../inventory/InventoryElectrolysisMaterial.java | 98 ++ .../inventory/InventoryElectrolysisResult.java | 98 ++ ...nventoryToolAndWeaponCraftingTableMaterial.java | 0 .../InventoryToolAndWeaponCraftingTableResult.java | 0 .../chemicraft/item/ItemAtomInfoContainer.java | 38 +- {common => src}/chemicraft/item/ItemAtoms.java | 0 .../chemicraft/item/ItemAtomsGrenade.java | 0 {common => src}/chemicraft/item/ItemCompounds.java | 0 .../chemicraft/item/ItemGasCollectingBottle.java | 2 +- .../chemicraft/render/RenderAtomsGrenade.java | 0 .../slot/SlotChemicalCombinationTableMaterial.java | 0 .../slot/SlotChemicalCombinationTableResult.java | 0 .../slot/SlotChemicalCraftingTableResult.java | 0 .../slot/SlotDecompositionTableMaterial.java | 12 + .../slot/SlotDecompositionTableResult.java | 4 +- .../chemicraft/slot/SlotElectrolysisFuel.java | 5 +- src/chemicraft/slot/SlotElectrolysisMaterial.java | 13 + src/chemicraft/slot/SlotElectrolysisResult.java | 13 + .../slot/SlotToolAndWeaponCraftingTableResult.java | 0 .../system/ChemiCraftCraftingManager.java | 0 {common => src}/chemicraft/system/CommonProxy.java | 12 +- .../chemicraft/system/PacketHandler.java | 392 +++---- .../TileEntityChemicalCombinationTable.java | 1 - .../TileEntityChemicalCraftingTable.java | 0 .../tileentity/TileEntityDecompositionTable.java | 17 +- .../tileentity/TileEntityElectrolysisTable.java | 57 + .../TileEntityToolAndWeaponCraftingTable.java | 0 {common => src}/chemicraft/util/AtomInfo.java | 324 +++--- {common => src}/chemicraft/util/Auxiliary.java | 380 +++---- .../chemicraft/util/ChemicalNBTRecipe.java | 0 .../chemicraft/util/ComparatorFormulaPart.java | 0 .../chemicraft/util/ComparatorItemStack.java | 0 .../chemicraft/util/CreativeTabAtoms.java | 0 {common => src}/chemicraft/util/FormulaPart.java | 0 .../chemicraft/util/ICompoundHandler.java | 106 +- .../chemicraft/util/MaterialRecipe.java | 0 .../chemicraft/util/MathHelperPlus.java | 0 .../chemicraft/util/NBTRecipeGrenade.java | 0 74 files changed, 2185 insertions(+), 1772 deletions(-) delete mode 100644 common/chemicraft/inventory/InventoryPyrolysisTableFuel.java delete mode 100644 common/chemicraft/slot/SlotPyrolysisTableFuel.java rename {common => src}/chemicraft/ChemiCraft.java (85%) rename {common => src}/chemicraft/ChemiCraftAPI.java (100%) rename {common => src}/chemicraft/ChemiCraftData.java (100%) rename {common => src}/chemicraft/block/BlockChemicalCombinationTable.java (100%) rename {common => src}/chemicraft/block/BlockChemicalCraftingTable.java (100%) rename common/chemicraft/block/BlockPyrolysisTable.java => src/chemicraft/block/BlockDecompositionTable.java (76%) create mode 100644 src/chemicraft/block/BlockElectrolysisTable.java rename {common => src}/chemicraft/block/BlockToolAndWeaponCraftingTable.java (100%) rename {common => src}/chemicraft/compounds/CompoundWater.java (100%) rename {common => src}/chemicraft/container/ContainerChemicalCombinationTable.java (100%) rename {common => src}/chemicraft/container/ContainerChemicalCraftingTable.java (100%) rename common/chemicraft/container/ContainerPyrolysisTable.java => src/chemicraft/container/ContainerDecompositionTable.java (57%) create mode 100644 src/chemicraft/container/ContainerElectrolysisTable.java rename {common => src}/chemicraft/container/ContainerToolAndWeaponCraftingTable.java (100%) rename {common => src}/chemicraft/debug/CommandDeleteItem.java (100%) rename {common => src}/chemicraft/debug/CommandGenDebugRoom.java (100%) rename {common => src}/chemicraft/debug/CommandSetTile.java (97%) rename {common => src}/chemicraft/debug/CompoundHandlerTest.java (100%) rename {common => src}/chemicraft/debug/SetBlockSupport.java (96%) rename {common => src}/chemicraft/entity/EntityAtomsGrenade.java (100%) rename {common => src}/chemicraft/gui/GuiChemicalCombinationTable.java (100%) rename {common => src}/chemicraft/gui/GuiChemicalCraftingTable.java (100%) rename common/chemicraft/gui/GuiPyrolysisTable.java => src/chemicraft/gui/GuiDecompositionTable.java (51%) create mode 100644 src/chemicraft/gui/GuiElectrolysisTable.java rename {common => src}/chemicraft/gui/GuiToolAndWeaponCraftingTable.java (100%) rename {common => src}/chemicraft/inventory/InventoryChemicalCombinationTableMaterial.java (100%) rename {common => src}/chemicraft/inventory/InventoryChemicalCombinationTableResult.java (100%) rename {common => src}/chemicraft/inventory/InventoryChemicalCraftingMaterial.java (100%) rename {common => src}/chemicraft/inventory/InventoryChemicalCraftingNBT.java (100%) rename {common => src}/chemicraft/inventory/InventoryChemicalCraftingResult.java (100%) rename common/chemicraft/inventory/InventoryPyrolysisTableMaterial.java => src/chemicraft/inventory/InventoryDecompositionTableMaterial.java (94%) rename common/chemicraft/inventory/InventoryPyrolysisTableResult.java => src/chemicraft/inventory/InventoryDecompositionTableResult.java (94%) create mode 100644 src/chemicraft/inventory/InventoryElectrolysisFuel.java create mode 100644 src/chemicraft/inventory/InventoryElectrolysisMaterial.java create mode 100644 src/chemicraft/inventory/InventoryElectrolysisResult.java rename {common => src}/chemicraft/inventory/InventoryToolAndWeaponCraftingTableMaterial.java (100%) rename {common => src}/chemicraft/inventory/InventoryToolAndWeaponCraftingTableResult.java (100%) rename {common => src}/chemicraft/item/ItemAtomInfoContainer.java (93%) rename {common => src}/chemicraft/item/ItemAtoms.java (100%) rename {common => src}/chemicraft/item/ItemAtomsGrenade.java (100%) rename {common => src}/chemicraft/item/ItemCompounds.java (100%) rename {common => src}/chemicraft/item/ItemGasCollectingBottle.java (98%) rename {common => src}/chemicraft/render/RenderAtomsGrenade.java (100%) rename {common => src}/chemicraft/slot/SlotChemicalCombinationTableMaterial.java (100%) rename {common => src}/chemicraft/slot/SlotChemicalCombinationTableResult.java (100%) rename {common => src}/chemicraft/slot/SlotChemicalCraftingTableResult.java (100%) create mode 100644 src/chemicraft/slot/SlotDecompositionTableMaterial.java rename common/chemicraft/slot/SlotPyrolysisTableResult.java => src/chemicraft/slot/SlotDecompositionTableResult.java (64%) rename common/chemicraft/slot/SlotPyrolysisTableMaterial.java => src/chemicraft/slot/SlotElectrolysisFuel.java (51%) create mode 100644 src/chemicraft/slot/SlotElectrolysisMaterial.java create mode 100644 src/chemicraft/slot/SlotElectrolysisResult.java rename {common => src}/chemicraft/slot/SlotToolAndWeaponCraftingTableResult.java (100%) rename {common => src}/chemicraft/system/ChemiCraftCraftingManager.java (100%) rename {common => src}/chemicraft/system/CommonProxy.java (75%) rename {common => src}/chemicraft/system/PacketHandler.java (91%) rename {common => src}/chemicraft/tileentity/TileEntityChemicalCombinationTable.java (99%) rename {common => src}/chemicraft/tileentity/TileEntityChemicalCraftingTable.java (100%) rename common/chemicraft/tileentity/TileEntityPyrolysisTable.java => src/chemicraft/tileentity/TileEntityDecompositionTable.java (55%) create mode 100644 src/chemicraft/tileentity/TileEntityElectrolysisTable.java rename {common => src}/chemicraft/tileentity/TileEntityToolAndWeaponCraftingTable.java (100%) rename {common => src}/chemicraft/util/AtomInfo.java (95%) rename {common => src}/chemicraft/util/Auxiliary.java (96%) rename {common => src}/chemicraft/util/ChemicalNBTRecipe.java (100%) rename {common => src}/chemicraft/util/ComparatorFormulaPart.java (100%) rename {common => src}/chemicraft/util/ComparatorItemStack.java (100%) rename {common => src}/chemicraft/util/CreativeTabAtoms.java (100%) rename {common => src}/chemicraft/util/FormulaPart.java (100%) rename {common => src}/chemicraft/util/ICompoundHandler.java (95%) rename {common => src}/chemicraft/util/MaterialRecipe.java (100%) rename {common => src}/chemicraft/util/MathHelperPlus.java (100%) rename {common => src}/chemicraft/util/NBTRecipeGrenade.java (100%) diff --git a/common/chemicraft/inventory/InventoryPyrolysisTableFuel.java b/common/chemicraft/inventory/InventoryPyrolysisTableFuel.java deleted file mode 100644 index 1f4c5be..0000000 --- a/common/chemicraft/inventory/InventoryPyrolysisTableFuel.java +++ /dev/null @@ -1,112 +0,0 @@ -package chemicraft.inventory; - -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.inventory.Container; -import net.minecraft.inventory.IInventory; -import net.minecraft.item.ItemStack; - -public class InventoryPyrolysisTableFuel implements IInventory { - - private ItemStack[] inventory = new ItemStack[1]; - private Container eventHandler; - - public void setEventHandler(Container par1){ - this.eventHandler = par1; - } - - @Override - public int getSizeInventory() { - return this.inventory.length; - } - - @Override - public ItemStack getStackInSlot(int var1) { - return this.inventory[var1]; - } - - @Override - public ItemStack decrStackSize(int var1, int var2) { - if (this.inventory[var1] != null) - { - ItemStack var3; - - if (this.inventory[var1].stackSize <= var2) - { - var3 = this.inventory[var1]; - this.inventory[var1] = null; - this.onInventoryChanged(); - return var3; - } - else - { - var3 = this.inventory[var1].splitStack(var2); - - if (this.inventory[var1].stackSize == 0) - { - this.inventory[var1] = null; - } - - this.onInventoryChanged(); - return var3; - } - } - else - { - return null; - } - } - - @Override - public ItemStack getStackInSlotOnClosing(int var1) { - if (this.inventory[var1] != null) - { - ItemStack var2 = this.inventory[var1]; - this.inventory[var1] = null; - return var2; - } - else - { - return null; - } - } - - @Override - public void setInventorySlotContents(int var1, ItemStack var2) { - this.inventory[var1] = var2; - - if (var2 != null && var2.stackSize > this.getInventoryStackLimit()) - { - var2.stackSize = this.getInventoryStackLimit(); - } - - this.onInventoryChanged(); - } - - @Override - public String getInvName() { - return "PyrolysisTableFuel"; - } - - @Override - public int getInventoryStackLimit() { - return 64; - } - - @Override - public void onInventoryChanged() { - if(this.eventHandler != null) this.eventHandler.onCraftMatrixChanged(this); - } - - @Override - public boolean isUseableByPlayer(EntityPlayer var1) { - return true; - } - - @Override - public void openChest() { - } - - @Override - public void closeChest() { - } -} diff --git a/common/chemicraft/slot/SlotPyrolysisTableFuel.java b/common/chemicraft/slot/SlotPyrolysisTableFuel.java deleted file mode 100644 index a2ab846..0000000 --- a/common/chemicraft/slot/SlotPyrolysisTableFuel.java +++ /dev/null @@ -1,12 +0,0 @@ -package chemicraft.slot; - -import net.minecraft.inventory.IInventory; -import net.minecraft.inventory.Slot; - -public class SlotPyrolysisTableFuel extends Slot { - - public SlotPyrolysisTableFuel(IInventory par1IInventory, int par2, int par3, int par4) { - super(par1IInventory, par2, par3, par4); - } - -} diff --git a/common/chemicraft/ChemiCraft.java b/src/chemicraft/ChemiCraft.java similarity index 85% rename from common/chemicraft/ChemiCraft.java rename to src/chemicraft/ChemiCraft.java index 06bbe9a..227555e 100644 --- a/common/chemicraft/ChemiCraft.java +++ b/src/chemicraft/ChemiCraft.java @@ -1,343 +1,363 @@ -package chemicraft; - -import ic2.api.energy.event.EnergyTileEvent; -import ic2.api.energy.event.EnergyTileLoadEvent; -import net.minecraft.block.Block; -import net.minecraft.block.material.Material; -import net.minecraft.creativetab.CreativeTabs; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraftforge.common.Configuration; -import net.minecraftforge.common.Property; -import chemicraft.block.BlockChemicalCombinationTable; -import chemicraft.block.BlockChemicalCraftingTable; -import chemicraft.block.BlockPyrolysisTable; -import chemicraft.block.BlockToolAndWeaponCraftingTable; -import chemicraft.compounds.CompoundWater; -import chemicraft.debug.CommandDeleteItem; -import chemicraft.debug.CommandGenDebugRoom; -import chemicraft.debug.CommandSetTile; -import chemicraft.item.ItemAtoms; -import chemicraft.item.ItemAtomsGrenade; -import chemicraft.item.ItemCompounds; -import chemicraft.item.ItemGasCollectingBottle; -import chemicraft.system.CommonProxy; -import chemicraft.system.PacketHandler; -import chemicraft.tileentity.TileEntityChemicalCombinationTable; -import chemicraft.tileentity.TileEntityChemicalCraftingTable; -import chemicraft.tileentity.TileEntityPyrolysisTable; -import chemicraft.tileentity.TileEntityToolAndWeaponCraftingTable; -import chemicraft.util.Auxiliary; -import chemicraft.util.Auxiliary.ArrayAuxiliary; -import chemicraft.util.Auxiliary.NameAuxiliary; -import chemicraft.util.CreativeTabAtoms; -import chemicraft.util.NBTRecipeGrenade; -import cpw.mods.fml.common.Mod; -import cpw.mods.fml.common.SidedProxy; -import cpw.mods.fml.common.event.FMLPostInitializationEvent; -import cpw.mods.fml.common.event.FMLPreInitializationEvent; -import cpw.mods.fml.common.event.FMLServerStartingEvent; -import cpw.mods.fml.common.network.NetworkMod; -import cpw.mods.fml.common.network.NetworkRegistry; -import cpw.mods.fml.common.registry.GameRegistry; - -/** - * ChemiCraft本体 - * @author P.C.C. - * - */ -@Mod(modid = "chemiCraft", name = "ChemiCraft", version = "beta") -@NetworkMod(clientSideRequired = true, serverSideRequired = true, versionBounds = "1.4.6", channels = "chemicraft", packetHandler = PacketHandler.class) -public class ChemiCraft { - - public static final String[] ATOMSNAME = { - "Hydrogen", "Helium", "Lithium", "Beryllium", "Boron", "Carbon", "Nitrogen", "Oxygen", "Fluorine", "Neon", "Sodium", "Magnesium", "Aluminium", "Silicon", - "Phosphorus", "Sulfur", "Chlorine", "Argon", "Potassium", "Calcium", "Scandium", "Titanium", "Vanadium", "Chromium", "Manganese", "Iron", "Cobalt", "Nickel", "Copper", "Zinc", "Gallium", - "Germanium", "Arsenic", "Selenium", "Bromine", "Krypton", "Rubidium", "Strontium", "Yttorium", "Zirconium", "Niobium", "Molybdenum", "Technetium", "Ruthenium", "Rhodium", "Palladium", - "Silver", "Cadmium", "Indium", "Tin", "Antimony", "Tellurium", "Iodine", "Xenon", "Caesium", "Barium", "Lanthanum", "Cerium", "Praseodymium", "Neodymium", "Promethium", "Samarium", - "Europium", "Gadolinium", "Terbium", "Dysprosium", "Holmium", "Erbium", "Thulium", "Ytterbium", "Lutetium", "Hafnium", "Tantalum", "Tungsten", "Rhenium", "Osmium", "Iridium", "Platinum", - "Gold", "Mercury", "Thallium", "Lead", "Bismuth", "Polonium", "Astatine", "Radon", "Francium", "Radium", "Actinium", "Thorium", "Protactinium", "Uranium", "Neptunium", "Plutonium", - "Americium", "Curium", "Berkelium", "Californium", "Einsteinium", "Fermium", "Mendelevium", "Nobelium", "Lawrencium", "Rutherfordium", "Dubnium", "Seaborgium", "Bohrium", "Hassium", - "Meitnerium", "Darmstadtium", "Roentgenium", "Copernicium", "Ununtrium", "Ununquadium", "Ununpentium", "Ununhexium", "Ununseptium", "Ununoctium" }; - - public static final String[] ATOMSNAMEJP = { - "水素", "ヘリウム", "リチウム", "ベリウム", "ホウ素", "炭素", "窒素", "酸素", "フッ素", "ネオン", "ナトリウム", "マグネシウム", "アルミニウム", "ケイ素", "リン", "硫黄", "塩素", "アルゴン", "カリウム", "カルシウム", "スカンジウム", - "チタン", "バナジウム", "クロム", "マンガン", "鉄", "コバルト", "ニッケル", "銅", "亜鉛", "ガリウム", "ゲルマニウム", "ヒ素", "セレン", "臭素", "クリプトン", "ルビジウム", "ストロンチウム", "イットリウム", "ジルコニウム", "ニオブ", "モリブデン", "テクネチウム", "ルテニウム", - "ロジウム", "パラジウム", "銀", "カドミウム", "インジウム", "スズ", "アンチモン", "テルル", "ヨウ素", "キセノン", "セシウム", "バリウム", "ランタン", "セリウム", "プラセオジム", "ネオジム", "プロメチウム", "サマリウム", "ユウロビウム", "ガドリニウム", "テルビウム", "ジスプロニウム", - "ホルミウム", "エルビウム", "ツリウム", "イッテルビウム", "ルテチウム", "ハフニウム", "タンタル", "タングステン", "レニウム", "オスミウム", "イリジウム", "白金", "金", "水銀", "タリウム", "鉛", "ビスマス", "ポロニウム", "アスタチン", "ラドン", "フランシウム", "ラジウム", - "アクチニウム", "トリウム", "プロトアクチウム", "ウラン", "ネプツニウム", "プルトニウム", "アメリシウム", "キュリウム", "バークリウム", "カルホルニウム", "アインスタイニウム", "フェルミウム", "メンデレビウム", "ノーベリウム", "ローレンシウム", "ラサホージウム", "ドブニウム", "シーボーギウム", - "ボーリウム", "ハッシウム", "マイトネリウム", "ダームスタチウム", "レントゲニウム", "コペルニシウム", "ウンウントリウム", "ウンウンクアジウム", "ウンウンペンチウム", "ウンウンヘキシウム", "ウンウンセプチウム", "ウンウンオクチウム" }; - - /** - * このmodのインスタンス - */ - @Mod.Instance("chemiCraft") - public static ChemiCraft instance; - - /** - * ChemiCraftのProxy. - */ - @SidedProxy(clientSide = "chemicraft.client.ClientProxy", serverSide = "chemicraft.system.CommonProxy") - public static CommonProxy proxy; - - /** - * ChemiCraftのCreativeTab. - */ - public static final CreativeTabs creativeTab = new CreativeTabAtoms("ChemiCraft"); - - /** - * ItemID. - */ - public int atomsID; - public int compoundsID; - public int gasCollectingBottleID; - public int atomGrenadeID; - - /** - * BlockID. - */ - public int pyrolysisTableID; - public int chemicalConbinationTableID; - public int toolAndWeaponCraftingTableID; - public int chemicalCraftingTableID; - - /** - * GUIID. - */ - public int guiPyrolysisTableID; - public int guiChemicalCombinationTableID; - public int guiToolAndWeaponCraftingTableID; - public int guiChemicalCraftingTableID; - - /** - * Block型変数. - */ - public Block blockPyrolysisTable; - public Block blockChemicalCombinationTable; - public Block blockToolAndWeaponCraftingTable; - public Block blockChemicalCraftingTable; - - /** - * Item型変数. - */ - public Item itemAtoms; - public Item itemCompounds; - public Item itemGasCollectingBottle; - public Item itemAtomGrenade; - - /** - * このmodで使用するTextureのパス. - */ - public String itemAtomsTexture = "/chemicraft/items/Atoms.png"; - public String itemCompoundsTexture = "/chemicraft/items/Compounds.png"; - public String itemTexture = "/chemicraft/items/items.png"; - public String blockChemicalCraftingTableTexture = "/chemicraft/blocks/cctable.png"; - public String guiPyrolysisTexture = "/chemicraft/guis/Pyrolysis.png"; - public String guiChemicalCombinationTexture = "/chemicraft/guis/ChemicalCombination.png"; - public String guiToolAndWeaponCraftingTexture = "/chemicraft/guis/ToolAndWeaponCrafting.png"; - public String guiChemicalCraftingTexture = "/chemicraft/guis/MaterialCrafting.png"; - - /** - * このmodに必要な補助クラスのインスタンス. - */ - public Auxiliary auxiliary = new Auxiliary(); - public NameAuxiliary nameAuxiliary = new NameAuxiliary(); - public ArrayAuxiliary arrayAuxiliary = new ArrayAuxiliary(); - - private ChemiCraftAPI api = ChemiCraftAPI.getInstance(); - private ChemiCraftData chemicalData = new ChemiCraftData(); - - @Mod.PreInit - public void chemiPreLoadMethod(final FMLPreInitializationEvent event) { - Configuration cfg = new Configuration(event.getSuggestedConfigurationFile()); - cfg.load(); - - Property pyrolysisTableIDProp = cfg.getBlock("PyrolysisTable", 2400); - Property chemicalCombinationTableIDProp = cfg.getBlock("ChemicalCombinationID", 2401); - Property toolAndWeaponCraftingTableIDProp = cfg.getBlock("ToolAndWeaponCraftingTableID", 2402); - Property chemicalCraftingTableIDProp = cfg.getBlock("ChemicalCraftingTableID", 2403); - - Property atomsIDProp = cfg.getItem("AtomsID", 25000); - Property compoundsIDProp = cfg.getItem("CompoundsID", 25001); - Property gasCollectingBottleIDProp = cfg.getItem("gasCollectingBottleID", 25002); - Property atomGrenadeIDProp = cfg.getItem("AtomGrenadeID", 25003); - - Property guiPyrolysisTableIDProp = cfg.get("GUI", "GUIPyrolysisID", 1000); - Property guiChemicalCombinationTableIDProp = cfg.get("GUI", "GUIChemicalCombinationTableID", 1001); - Property guiToolAndWeaponCraftingTableIDProp = cfg.get("GUI", "GUIToolAndWeaponCraftingTableID", 1002); - Property guiChemicalCraftingTableIDProp = cfg.get("GUI", "GUIChemicalCraftingTableID", 1003); - - - this.pyrolysisTableID = pyrolysisTableIDProp.getInt(); - this.chemicalConbinationTableID = chemicalCombinationTableIDProp.getInt(); - this.toolAndWeaponCraftingTableID = toolAndWeaponCraftingTableIDProp.getInt(); - this.chemicalCraftingTableID = chemicalCraftingTableIDProp.getInt(); - this.atomsID = atomsIDProp.getInt(); - this.compoundsID = compoundsIDProp.getInt(); - this.gasCollectingBottleID = gasCollectingBottleIDProp.getInt(); - this.atomGrenadeID = atomGrenadeIDProp.getInt(); - this.guiPyrolysisTableID = guiPyrolysisTableIDProp.getInt(); - this.guiChemicalCombinationTableID = guiChemicalCombinationTableIDProp.getInt(); - this.guiToolAndWeaponCraftingTableID = guiToolAndWeaponCraftingTableIDProp.getInt(); - this.guiChemicalCraftingTableID = guiChemicalCraftingTableIDProp.getInt(); - - cfg.save(); - } - - @Mod.ServerStarting - public void serverStarting(final FMLServerStartingEvent event) { - event.registerServerCommand(new CommandSetTile()); - event.registerServerCommand(new CommandDeleteItem()); - event.registerServerCommand(new CommandGenDebugRoom()); - } - - @Mod.PostInit - public void chemiPostLoadMethod(final FMLPostInitializationEvent event) { - this.settingProcessing(event); - this.apiProcessing(event); - this.debug(event); - } - - private void settingProcessing(final FMLPostInitializationEvent event) { - - // Blockを追加します - this.blockPyrolysisTable = new BlockPyrolysisTable(this.pyrolysisTableID, 0, Material.ground). - setHardness(2.0F). - setResistance(0.0F). - setStepSound(Block.soundStoneFootstep). - setBlockName("PyrolysisTable"); - this.blockChemicalCombinationTable = new BlockChemicalCombinationTable(this.chemicalConbinationTableID, 0, Material.ground). - setHardness(2.0F). - setResistance(0.0F). - setStepSound(Block.soundStoneFootstep). - setBlockName("ChemicalCombinationTable"); - this.blockToolAndWeaponCraftingTable = new BlockToolAndWeaponCraftingTable(this.toolAndWeaponCraftingTableID, 0, Material.ground). - setHardness(2.0F). - setResistance(0.0F). - setStepSound(Block.soundStoneFootstep). - setBlockName("ToolAndWeaponCraftingTable"); - this.blockChemicalCraftingTable = new BlockChemicalCraftingTable(chemicalCraftingTableID, 0, Material.ground). - setHardness(2.0F). - setResistance(0.0F). - setStepSound(Block.soundStoneFootstep). - setBlockName("ChemicalCraftingTable"); - - // Itemを追加します - this.itemAtoms = new ItemAtoms(this.atomsID).setItemName("atoms"); - this.itemCompounds = new ItemCompounds(this.compoundsID).setItemName("compounds"); - this.itemGasCollectingBottle = new ItemGasCollectingBottle(this.gasCollectingBottleID).setItemName("gasCollectingBottle").setIconIndex(0); - this.itemAtomGrenade = new ItemAtomsGrenade(this.atomGrenadeID).setItemName("grenade").setIconIndex(1); - - // BlockをMinecraftに登録します - GameRegistry.registerBlock(this.blockPyrolysisTable, "BlockPyrolysisTable"); - GameRegistry.registerBlock(this.blockChemicalCombinationTable, "BlockChemicalCombinationTable"); - GameRegistry.registerBlock(this.blockToolAndWeaponCraftingTable, "BlockToolAndWeaponCraftingTable"); - GameRegistry.registerBlock(this.blockChemicalCraftingTable, "BlockMaterialCraftingTable"); - - // Blockの名前を設定します - this.nameAuxiliary.addName(this.blockPyrolysisTable, "PyrolysisTable"); - this.nameAuxiliary.addName(this.blockPyrolysisTable, "ja_JP", "熱分解台"); - this.nameAuxiliary.addName(this.blockChemicalCombinationTable, "ChemicalCombinationTable"); - this.nameAuxiliary.addName(this.blockChemicalCombinationTable, "ja_JP", "化合台"); - this.nameAuxiliary.addName(blockToolAndWeaponCraftingTable, "ToolAndWeaponCraftingTable"); - this.nameAuxiliary.addName(blockToolAndWeaponCraftingTable, "ja_JP", "ツール&武器製作台"); - this.nameAuxiliary.addName(blockChemicalCraftingTable, "ChemicalCraftingTable"); - this.nameAuxiliary.addName(blockChemicalCraftingTable, "ja_JP", "素材製作台"); - - // Itemの名前を設定します - this.nameAuxiliary.addName(this.itemAtoms, ATOMSNAME); - this.nameAuxiliary.addName(this.itemAtoms, "ja_JP", ATOMSNAMEJP); - this.nameAuxiliary.addName(this.itemGasCollectingBottle, "GasCollectingBottle"); - this.nameAuxiliary.addName(this.itemGasCollectingBottle, "ja_JP", "集気瓶"); - this.nameAuxiliary.addName(this.itemAtomGrenade, "AtomGrenade"); - this.nameAuxiliary.addName(this.itemAtomGrenade, "元素手榴弾"); - - // TileEntityを追加します - GameRegistry.registerTileEntity(TileEntityPyrolysisTable.class, "TileEntityPyrolysisTable"); - GameRegistry.registerTileEntity(TileEntityChemicalCombinationTable.class, "TileEntityChemicalCombinationTable"); - GameRegistry.registerTileEntity(TileEntityToolAndWeaponCraftingTable.class, "TileEntityToolAndWeaponCraftingTable"); - GameRegistry.registerTileEntity(TileEntityChemicalCraftingTable.class, "TileEntityChemicalCraftingTable"); - - // GUIを追加します - NetworkRegistry.instance().registerGuiHandler(instance, proxy); - - // 描画関係の読み込み - proxy.registerRenderInformation(); - - //化学作業台類のレシピを追加します - GameRegistry.addRecipe(new ItemStack(this.blockPyrolysisTable), - new Object[]{ - "XYX", "ZAZ", "ZZZ", - Character.valueOf('X'), new ItemStack(Item.ingotIron), - Character.valueOf('Y'), new ItemStack(Block.workbench), - Character.valueOf('Z'), new ItemStack(Block.stone), - Character.valueOf('A'), new ItemStack(Item.bucketLava), - }); - GameRegistry.addRecipe(new ItemStack(this.blockChemicalCombinationTable), - new Object[]{ - "XYX", "ZAZ", "ZZZ", - Character.valueOf('X'), new ItemStack(Item.ingotIron), - Character.valueOf('Y'), new ItemStack(Block.workbench), - Character.valueOf('Z'), new ItemStack(Block.stone), - Character.valueOf('A'), new ItemStack(Block.obsidian), - }); - GameRegistry.addRecipe(new ItemStack(this.blockToolAndWeaponCraftingTable), - new Object[]{ - "XYX", "ZAZ", "ZZZ", - Character.valueOf('X'), new ItemStack(Item.ingotIron), - Character.valueOf('Y'), new ItemStack(Block.workbench), - Character.valueOf('Z'), new ItemStack(Block.stone), - Character.valueOf('A'), new ItemStack(Item.pickaxeSteel), - }); - GameRegistry.addRecipe(new ItemStack(this.blockChemicalCraftingTable), - new Object[]{ - "XYX", "ZAZ", "ZZZ", - Character.valueOf('X'), new ItemStack(Item.ingotIron), - Character.valueOf('Y'), new ItemStack(Block.workbench), - Character.valueOf('Z'), new ItemStack(Block.stone), - Character.valueOf('A'), new ItemStack(this.itemAtoms, 1, 0), - }); - - // 化合物を追加します - api.addLangCompound("ja_JP", "CarbonMonoxide", "一酸化炭素"); - api.addLangCompound("ja_JP", "CarbonDioxide", "二酸化炭素"); - api.addLangCompound("ja_JP", "Water", "水"); - api.addCompound("Test"); - - - //化合物のHandlerを設定します - api.settingCompoundHandler("Water", new CompoundWater()); - - //化合物のレシピを追加します - api.addChemicalCombinationRecipe(new String[]{"H", "O"}, new Integer[]{2, 1}, new ItemStack(this.itemCompounds, 1, api.getCompound("Water"))); - - //手榴弾の追加 - 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.itemAtomGrenade, 16, 0), - new NBTRecipeGrenade() - ); - } - - private void apiProcessing(final FMLPostInitializationEvent event) { - // API用の処理 - this.nameAuxiliary.addName(itemCompounds, api.getInstance().getCompoundsName().toArray()); - for (int i = 0; i < api.getCompoundsLang().size(); i++) { - this.nameAuxiliary.addName(itemCompounds, api.getCompoundsLang().get(i), api.getInstance().getCompoundsLangName().toArray()); - } - } - - private void debug(final FMLPostInitializationEvent event) { - } - -} +package chemicraft; + +import net.minecraft.block.Block; +import net.minecraft.block.material.Material; +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraftforge.common.Configuration; +import net.minecraftforge.common.Property; +import chemicraft.block.BlockChemicalCombinationTable; +import chemicraft.block.BlockChemicalCraftingTable; +import chemicraft.block.BlockDecompositionTable; +import chemicraft.block.BlockElectrolysisTable; +import chemicraft.block.BlockToolAndWeaponCraftingTable; +import chemicraft.compounds.CompoundWater; +import chemicraft.debug.CommandDeleteItem; +import chemicraft.debug.CommandGenDebugRoom; +import chemicraft.debug.CommandSetTile; +import chemicraft.item.ItemAtoms; +import chemicraft.item.ItemAtomsGrenade; +import chemicraft.item.ItemCompounds; +import chemicraft.item.ItemGasCollectingBottle; +import chemicraft.system.CommonProxy; +import chemicraft.system.PacketHandler; +import chemicraft.tileentity.TileEntityChemicalCombinationTable; +import chemicraft.tileentity.TileEntityChemicalCraftingTable; +import chemicraft.tileentity.TileEntityDecompositionTable; +import chemicraft.tileentity.TileEntityElectrolysisTable; +import chemicraft.tileentity.TileEntityToolAndWeaponCraftingTable; +import chemicraft.util.Auxiliary; +import chemicraft.util.Auxiliary.ArrayAuxiliary; +import chemicraft.util.Auxiliary.NameAuxiliary; +import chemicraft.util.CreativeTabAtoms; +import chemicraft.util.NBTRecipeGrenade; +import cpw.mods.fml.common.Mod; +import cpw.mods.fml.common.SidedProxy; +import cpw.mods.fml.common.event.FMLPostInitializationEvent; +import cpw.mods.fml.common.event.FMLPreInitializationEvent; +import cpw.mods.fml.common.event.FMLServerStartingEvent; +import cpw.mods.fml.common.network.NetworkMod; +import cpw.mods.fml.common.network.NetworkRegistry; +import cpw.mods.fml.common.registry.GameRegistry; + +/** + * ChemiCraft本体 + * @author P.C.C. + * + */ +@Mod(modid = "chemiCraft", name = "ChemiCraft", version = "beta") +// ID,名前,バージョン +@NetworkMod(clientSideRequired = true, serverSideRequired = true, versionBounds = "1.4.6", channels = "chemicraft", packetHandler = PacketHandler.class) +// クライアント、サーバー共に必要 1.3.2用 +public class ChemiCraft { + + public static final String[] ATOMSNAME = { + "Hydrogen", "Helium", "Lithium", "Beryllium", "Boron", "Carbon", "Nitrogen", "Oxygen", "Fluorine", "Neon", "Sodium", "Magnesium", "Aluminium", "Silicon", + "Phosphorus", "Sulfur", "Chlorine", "Argon", "Potassium", "Calcium", "Scandium", "Titanium", "Vanadium", "Chromium", "Manganese", "Iron", "Cobalt", "Nickel", "Copper", "Zinc", "Gallium", + "Germanium", "Arsenic", "Selenium", "Bromine", "Krypton", "Rubidium", "Strontium", "Yttorium", "Zirconium", "Niobium", "Molybdenum", "Technetium", "Ruthenium", "Rhodium", "Palladium", + "Silver", "Cadmium", "Indium", "Tin", "Antimony", "Tellurium", "Iodine", "Xenon", "Caesium", "Barium", "Lanthanum", "Cerium", "Praseodymium", "Neodymium", "Promethium", "Samarium", + "Europium", "Gadolinium", "Terbium", "Dysprosium", "Holmium", "Erbium", "Thulium", "Ytterbium", "Lutetium", "Hafnium", "Tantalum", "Tungsten", "Rhenium", "Osmium", "Iridium", "Platinum", + "Gold", "Mercury", "Thallium", "Lead", "Bismuth", "Polonium", "Astatine", "Radon", "Francium", "Radium", "Actinium", "Thorium", "Protactinium", "Uranium", "Neptunium", "Plutonium", + "Americium", "Curium", "Berkelium", "Californium", "Einsteinium", "Fermium", "Mendelevium", "Nobelium", "Lawrencium", "Rutherfordium", "Dubnium", "Seaborgium", "Bohrium", "Hassium", + "Meitnerium", "Darmstadtium", "Roentgenium", "Copernicium", "Ununtrium", "Ununquadium", "Ununpentium", "Ununhexium", "Ununseptium", "Ununoctium" }; + + public static final String[] ATOMSNAMEJP = { + "水素", "ヘリウム", "リチウム", "ベリウム", "ホウ素", "炭素", "窒素", "酸素", "フッ素", "ネオン", "ナトリウム", "マグネシウム", "アルミニウム", "ケイ素", "リン", "硫黄", "塩素", "アルゴン", "カリウム", "カルシウム", "スカンジウム", + "チタン", "バナジウム", "クロム", "マンガン", "鉄", "コバルト", "ニッケル", "銅", "亜鉛", "ガリウム", "ゲルマニウム", "ヒ素", "セレン", "臭素", "クリプトン", "ルビジウム", "ストロンチウム", "イットリウム", "ジルコニウム", "ニオブ", "モリブデン", "テクネチウム", "ルテニウム", + "ロジウム", "パラジウム", "銀", "カドミウム", "インジウム", "スズ", "アンチモン", "テルル", "ヨウ素", "キセノン", "セシウム", "バリウム", "ランタン", "セリウム", "プラセオジム", "ネオジム", "プロメチウム", "サマリウム", "ユウロビウム", "ガドリニウム", "テルビウム", "ジスプロニウム", + "ホルミウム", "エルビウム", "ツリウム", "イッテルビウム", "ルテチウム", "ハフニウム", "タンタル", "タングステン", "レニウム", "オスミウム", "イリジウム", "白金", "金", "水銀", "タリウム", "鉛", "ビスマス", "ポロニウム", "アスタチン", "ラドン", "フランシウム", "ラジウム", + "アクチニウム", "トリウム", "プロトアクチウム", "ウラン", "ネプツニウム", "プルトニウム", "アメリシウム", "キュリウム", "バークリウム", "カルホルニウム", "アインスタイニウム", "フェルミウム", "メンデレビウム", "ノーベリウム", "ローレンシウム", "ラサホージウム", "ドブニウム", "シーボーギウム", + "ボーリウム", "ハッシウム", "マイトネリウム", "ダームスタチウム", "レントゲニウム", "コペルニシウム", "ウンウントリウム", "ウンウンクアジウム", "ウンウンペンチウム", "ウンウンヘキシウム", "ウンウンセプチウム", "ウンウンオクチウム" }; + + /** + * このmodのインスタンス + */ + @Mod.Instance("chemiCraft") + public static ChemiCraft instance; + + /** + * ChemiCraftのProxy. + */ + @SidedProxy(clientSide = "chemicraft.client.ClientProxy", serverSide = "chemicraft.system.CommonProxy") + public static CommonProxy proxy; + + /** + * ChemiCraftのCreativeTab. + */ + public static final CreativeTabs creativeTab = new CreativeTabAtoms("ChemiCraft"); + + /** + * ItemID. + */ + public int atomsID; + public int compoundsID; + public int gasCollectingBottleID; + public int atomGrenadeID; + + /** + * BlockID. + */ + public int decompositionTableID; + public int chemicalConbinationTableID; + public int toolAndWeaponCraftingTableID; + public int chemicalCraftingTableID; + public int electrolysisTableID; + + /** + * GUIID. + */ + public int guiDecompositionTableID; + public int guiChemicalCombinationTableID; + public int guiToolAndWeaponCraftingTableID; + public int guiChemicalCraftingTableID; + public int guiElectrolysisTableID; + + /** + * Block型変数. + */ + public Block blockDecompositionTable; + public Block blockChemicalCombinationTable; + public Block blockToolAndWeaponCraftingTable; + public Block blockChemicalCraftingTable; + public Block blockElectrolysisTable; + + /** + * Item型変数. + */ + public Item itemAtoms; + public Item itemCompounds; + public Item itemGasCollectingBottle; + public Item itemAtomGrenade; + + /** + * このmodで使用するTextureのパス. + */ + public String itemAtomsTexture = "/chemicraft/items/Atoms.png"; + public String itemCompoundsTexture = "/chemicraft/items/Compounds.png"; + public String itemTexture = "/chemicraft/items/items.png"; + public String blockChemicalCraftingTableTexture = "/chemicraft/blocks/CCTable.png"; + public String guiDecompositionTexture = "/chemicraft/guis/Decomposition.png"; + public String guiChemicalCombinationTexture = "/chemicraft/guis/ChemicalCombination.png"; + public String guiToolAndWeaponCraftingTexture = "/chemicraft/guis/ToolAndWeaponCrafting.png"; + public String guiChemicalCraftingTexture = "/chemicraft/guis/MaterialCrafting.png"; + public String guiElectrolysisTableTexture = "/chemicraft/guis/ElectrolysisTable.png"; + + /** + * このmodに必要な補助クラスのインスタンス. + */ + public Auxiliary auxiliary = new Auxiliary(); + public NameAuxiliary nameAuxiliary = new NameAuxiliary(); + public ArrayAuxiliary arrayAuxiliary = new ArrayAuxiliary(); + + private ChemiCraftAPI api = ChemiCraftAPI.getInstance(); + private ChemiCraftData chemicalData = new ChemiCraftData(); + + @Mod.PreInit + public void chemiPreLoadMethod(final FMLPreInitializationEvent event) { + Configuration cfg = new Configuration(event.getSuggestedConfigurationFile()); + cfg.load(); + + Property decompositionTableIDProp = cfg.getBlock("DecompositionTable", 2400); + Property chemicalCombinationTableIDProp = cfg.getBlock("ChemicalCombinationID", 2401); + Property toolAndWeaponCraftingTableIDProp = cfg.getBlock("ToolAndWeaponCraftingTableID", 2402); + Property chemicalCraftingTableIDProp = cfg.getBlock("ChemicalCraftingTableID", 2403); + Property electrolysisTableIDProp = cfg.getBlock("ElectrolysisTableID", 2404); + + Property atomsIDProp = cfg.getItem("AtomsID", 25000); + Property compoundsIDProp = cfg.getItem("CompoundsID", 25001); + Property gasCollectingBottleIDProp = cfg.getItem("gasCollectingBottleID", 25002); + Property atomGrenadeIDProp = cfg.getItem("AtomGrenadeID", 25003); + + Property guiDecompositionTableIDProp = cfg.get("GUI", "GUIChemicalCraftingTableID", 1000); + Property guiChemicalCombinationTableIDProp = cfg.get("GUI", "GUIChemicalCombinationTableID", 1001); + Property guiToolAndWeaponCraftingTableIDProp = cfg.get("GUI", "GUIToolAndWeaponCraftingTableID", 1002); + Property guiChemicalCraftingTableIDProp = cfg.get("GUI", "GUIChemicalCraftingTableID", 1003); + Property guiElectrolysisTableIDProp = cfg.get("GUI", "GUIElectrolysisTableID", 1004); + + + this.decompositionTableID = decompositionTableIDProp.getInt(); + this.chemicalConbinationTableID = chemicalCombinationTableIDProp.getInt(); + this.toolAndWeaponCraftingTableID = toolAndWeaponCraftingTableIDProp.getInt(); + this.chemicalCraftingTableID = chemicalCraftingTableIDProp.getInt(); + this.electrolysisTableID = electrolysisTableIDProp.getInt(); + this.atomsID = atomsIDProp.getInt(); + this.compoundsID = compoundsIDProp.getInt(); + this.gasCollectingBottleID = gasCollectingBottleIDProp.getInt(); + this.atomGrenadeID = atomGrenadeIDProp.getInt(); + this.guiDecompositionTableID = guiDecompositionTableIDProp.getInt(); + this.guiChemicalCombinationTableID = guiChemicalCombinationTableIDProp.getInt(); + this.guiToolAndWeaponCraftingTableID = guiToolAndWeaponCraftingTableIDProp.getInt(); + this.guiChemicalCraftingTableID = guiChemicalCraftingTableIDProp.getInt(); + this.guiElectrolysisTableID = guiElectrolysisTableIDProp.getInt(); + + cfg.save(); + } + + @Mod.ServerStarting + public void serverStarting(final FMLServerStartingEvent event) { + event.registerServerCommand(new CommandSetTile()); + event.registerServerCommand(new CommandDeleteItem()); + event.registerServerCommand(new CommandGenDebugRoom()); + } + + @Mod.PostInit + public void chemiPostLoadMethod(final FMLPostInitializationEvent event) { + this.settingProcessing(event); + this.apiProcessing(event); + this.debug(event); + } + + private void settingProcessing(final FMLPostInitializationEvent event) { + + // Blockを追加します + this.blockDecompositionTable = new BlockDecompositionTable(this.decompositionTableID, 0, Material.ground). + setHardness(2.0F). + setResistance(0.0F). + setStepSound(Block.soundStoneFootstep). + setBlockName("DecompositionTable"); + this.blockChemicalCombinationTable = new BlockChemicalCombinationTable(this.chemicalConbinationTableID, 0, Material.ground). + setHardness(2.0F). + setResistance(0.0F). + setStepSound(Block.soundStoneFootstep). + setBlockName("ChemicalCombinationTable"); + this.blockToolAndWeaponCraftingTable = new BlockToolAndWeaponCraftingTable(this.toolAndWeaponCraftingTableID, 0, Material.ground). + setHardness(2.0F). + setResistance(0.0F). + setStepSound(Block.soundStoneFootstep). + setBlockName("ToolAndWeaponCraftingTable"); + this.blockChemicalCraftingTable = new BlockChemicalCraftingTable(chemicalCraftingTableID, 0, Material.ground). + setHardness(2.0F). + setResistance(0.0F). + setStepSound(Block.soundStoneFootstep). + setBlockName("ChemicalCraftingTable"); + this.blockElectrolysisTable = new BlockElectrolysisTable(electrolysisTableID, 0, Material.ground). + setHardness(2.0F). + setResistance(0.0F). + setStepSound(Block.soundStoneFootstep). + setBlockName("ElectrolysisTable"); + + // Itemを追加します + this.itemAtoms = new ItemAtoms(this.atomsID).setItemName("atoms"); + this.itemCompounds = new ItemCompounds(this.compoundsID).setItemName("compounds"); + this.itemGasCollectingBottle = new ItemGasCollectingBottle(this.gasCollectingBottleID).setItemName("gasCollectingBottle").setIconIndex(0); + this.itemAtomGrenade = new ItemAtomsGrenade(this.atomGrenadeID).setItemName("grenade").setIconIndex(1); + + // BlockをMinecraftに登録します + GameRegistry.registerBlock(this.blockDecompositionTable, "BlockDecompositionTable"); + GameRegistry.registerBlock(this.blockChemicalCombinationTable, "BlockChemicalCombinationTable"); + GameRegistry.registerBlock(this.blockToolAndWeaponCraftingTable, "BlockToolAndWeaponCraftingTable"); + GameRegistry.registerBlock(this.blockChemicalCraftingTable, "BlockMaterialCraftingTable"); + GameRegistry.registerBlock(this.blockElectrolysisTable, "ElectrolysisTable"); + + // Blockの名前を設定します + this.nameAuxiliary.addName(this.blockDecompositionTable, "DecompositionTable"); + this.nameAuxiliary.addName(this.blockDecompositionTable, "ja_JP", "分解台"); + this.nameAuxiliary.addName(this.blockChemicalCombinationTable, "ChemicalCombinationTable"); + this.nameAuxiliary.addName(this.blockChemicalCombinationTable, "ja_JP", "化合台"); + this.nameAuxiliary.addName(blockToolAndWeaponCraftingTable, "ToolAndWeaponCraftingTable"); + this.nameAuxiliary.addName(blockToolAndWeaponCraftingTable, "ja_JP", "ツール&武器製作台"); + this.nameAuxiliary.addName(blockChemicalCraftingTable, "ChemicalCraftingTable"); + this.nameAuxiliary.addName(blockChemicalCraftingTable, "ja_JP", "素材製作台"); + this.nameAuxiliary.addName(this.blockElectrolysisTable, "ElectrolysisTable"); + this.nameAuxiliary.addName(this.blockElectrolysisTable, "ja_JP", "電気分解台"); + + // Itemの名前を設定します + this.nameAuxiliary.addName(this.itemAtoms, ATOMSNAME); + this.nameAuxiliary.addName(this.itemAtoms, "ja_JP", ATOMSNAMEJP); + this.nameAuxiliary.addName(this.itemGasCollectingBottle, "GasCollectingBottle"); + this.nameAuxiliary.addName(this.itemGasCollectingBottle, "ja_JP", "集気瓶"); + this.nameAuxiliary.addName(this.itemAtomGrenade, "AtomGrenade"); + this.nameAuxiliary.addName(this.itemAtomGrenade, "元素手榴弾"); + + // TileEntityを追加します + GameRegistry.registerTileEntity(TileEntityDecompositionTable.class, "DecompositionTable"); + GameRegistry.registerTileEntity(TileEntityChemicalCombinationTable.class, "TileEntityChemicalCombinationTable"); + GameRegistry.registerTileEntity(TileEntityToolAndWeaponCraftingTable.class, "TileEntityToolAndWeaponCraftingTable"); + GameRegistry.registerTileEntity(TileEntityChemicalCraftingTable.class, "TileEntityChemicalCraftingTable"); + GameRegistry.registerTileEntity(TileEntityElectrolysisTable.class, "TileEntityElectrolysisTable"); + + // GUIを追加します + NetworkRegistry.instance().registerGuiHandler(instance, proxy); + + // 描画関係の読み込み + proxy.registerRenderInformation(); + + //化学作業台類のレシピを追加します + GameRegistry.addRecipe(new ItemStack(this.blockDecompositionTable), + new Object[]{ + "XYX", "ZAZ", "ZZZ", + Character.valueOf('X'), new ItemStack(Item.ingotIron), + Character.valueOf('Y'), new ItemStack(Block.workbench), + Character.valueOf('Z'), new ItemStack(Block.stone), + Character.valueOf('A'), new ItemStack(Block.tnt), + }); + GameRegistry.addRecipe(new ItemStack(this.blockChemicalCombinationTable), + new Object[]{ + "XYX", "ZAZ", "ZZZ", + Character.valueOf('X'), new ItemStack(Item.ingotIron), + Character.valueOf('Y'), new ItemStack(Block.workbench), + Character.valueOf('Z'), new ItemStack(Block.stone), + Character.valueOf('A'), new ItemStack(Block.obsidian), + }); + GameRegistry.addRecipe(new ItemStack(this.blockToolAndWeaponCraftingTable), + new Object[]{ + "XYX", "ZAZ", "ZZZ", + Character.valueOf('X'), new ItemStack(Item.ingotIron), + Character.valueOf('Y'), new ItemStack(Block.workbench), + Character.valueOf('Z'), new ItemStack(Block.stone), + Character.valueOf('A'), new ItemStack(Item.pickaxeSteel), + }); + GameRegistry.addRecipe(new ItemStack(this.blockChemicalCraftingTable), + new Object[]{ + "XYX", "ZAZ", "ZZZ", + Character.valueOf('X'), new ItemStack(Item.ingotIron), + Character.valueOf('Y'), new ItemStack(Block.workbench), + Character.valueOf('Z'), new ItemStack(Block.stone), + Character.valueOf('A'), new ItemStack(this.itemAtoms, 1, 0), + }); + + // 化合物を追加します + api.addLangCompound("ja_JP", "CarbonMonoxide", "一酸化炭素"); + api.addLangCompound("ja_JP", "CarbonDioxide", "二酸化炭素"); + api.addLangCompound("ja_JP", "Water", "水"); + api.addCompound("Test"); + + + //化合物のHandlerを設定します + api.settingCompoundHandler("Water", new CompoundWater()); + + //化合物のレシピを追加します + api.addChemicalCombinationRecipe(new String[]{"C", "O"}, new Integer[]{1, 2}, new ItemStack(this.itemCompounds, 1, api.getCompound("CarbonDioxide"))); + api.addChemicalCombinationRecipe(new String[]{"H", "O"}, new Integer[]{2, 1}, new ItemStack(this.itemCompounds, 1, api.getCompound("Water"))); + + //手榴弾の追加 + 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.itemAtomGrenade, 16, 0), + new NBTRecipeGrenade() + ); + } + + private void apiProcessing(final FMLPostInitializationEvent event) { + // API用の処理 + this.nameAuxiliary.addName(itemCompounds, api.getInstance().getCompoundsName().toArray()); + for (int i = 0; i < api.getCompoundsLang().size(); i++) { + this.nameAuxiliary.addName(itemCompounds, api.getCompoundsLang().get(i), api.getInstance().getCompoundsLangName().toArray()); + } + } + + private void debug(final FMLPostInitializationEvent event) { + } + +} \ No newline at end of file diff --git a/common/chemicraft/ChemiCraftAPI.java b/src/chemicraft/ChemiCraftAPI.java similarity index 100% rename from common/chemicraft/ChemiCraftAPI.java rename to src/chemicraft/ChemiCraftAPI.java diff --git a/common/chemicraft/ChemiCraftData.java b/src/chemicraft/ChemiCraftData.java similarity index 100% rename from common/chemicraft/ChemiCraftData.java rename to src/chemicraft/ChemiCraftData.java diff --git a/common/chemicraft/block/BlockChemicalCombinationTable.java b/src/chemicraft/block/BlockChemicalCombinationTable.java similarity index 100% rename from common/chemicraft/block/BlockChemicalCombinationTable.java rename to src/chemicraft/block/BlockChemicalCombinationTable.java diff --git a/common/chemicraft/block/BlockChemicalCraftingTable.java b/src/chemicraft/block/BlockChemicalCraftingTable.java similarity index 100% rename from common/chemicraft/block/BlockChemicalCraftingTable.java rename to src/chemicraft/block/BlockChemicalCraftingTable.java diff --git a/common/chemicraft/block/BlockPyrolysisTable.java b/src/chemicraft/block/BlockDecompositionTable.java similarity index 76% rename from common/chemicraft/block/BlockPyrolysisTable.java rename to src/chemicraft/block/BlockDecompositionTable.java index 686d29f..d04afa8 100644 --- a/common/chemicraft/block/BlockPyrolysisTable.java +++ b/src/chemicraft/block/BlockDecompositionTable.java @@ -6,18 +6,18 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.tileentity.TileEntity; import net.minecraft.world.World; import chemicraft.ChemiCraft; -import chemicraft.tileentity.TileEntityPyrolysisTable; +import chemicraft.tileentity.TileEntityDecompositionTable; -public class BlockPyrolysisTable extends BlockContainer { +public class BlockDecompositionTable extends BlockContainer { - public BlockPyrolysisTable(int par1, int par2, Material par3Material) { + public BlockDecompositionTable(int par1, int par2, Material par3Material) { super(par1, par2, par3Material); this.setCreativeTab(ChemiCraft.creativeTab); } @Override public boolean onBlockActivated(World par1World, int par2, int par3, int par4, EntityPlayer par5EntityPlayer, int par6, float par7, float par8, float par9){ - par5EntityPlayer.openGui(ChemiCraft.instance, ChemiCraft.instance.guiPyrolysisTableID, par1World, par2, par3, par4); + par5EntityPlayer.openGui(ChemiCraft.instance, ChemiCraft.instance.guiDecompositionTableID, par1World, par2, par3, par4); return true; } @@ -44,7 +44,7 @@ public class BlockPyrolysisTable extends BlockContainer { @Override public TileEntity createNewTileEntity(World var1) { - return new TileEntityPyrolysisTable(); + return new TileEntityDecompositionTable(); } } diff --git a/src/chemicraft/block/BlockElectrolysisTable.java b/src/chemicraft/block/BlockElectrolysisTable.java new file mode 100644 index 0000000..f6d63f6 --- /dev/null +++ b/src/chemicraft/block/BlockElectrolysisTable.java @@ -0,0 +1,31 @@ +package chemicraft.block; + +import chemicraft.ChemiCraft; +import chemicraft.tileentity.TileEntityElectrolysisTable; +import net.minecraft.block.BlockContainer; +import net.minecraft.block.material.Material; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.world.World; + +public class BlockElectrolysisTable extends BlockContainer +{ + + public BlockElectrolysisTable(int par1, int par2, Material par3Material) { + super(par1, par2, par3Material); + this.setCreativeTab(ChemiCraft.creativeTab); + } + + @Override + public boolean onBlockActivated(World par1World, int par2, int par3, int par4, EntityPlayer par5EntityPlayer, int par6, float par7, float par8, float par9){ + par5EntityPlayer.openGui(ChemiCraft.instance, ChemiCraft.instance.guiElectrolysisTableID, par1World, par2, par3, par4); + return true; + } + + @Override + public TileEntity createNewTileEntity(World var1) + { + return new TileEntityElectrolysisTable(); + } + +} diff --git a/common/chemicraft/block/BlockToolAndWeaponCraftingTable.java b/src/chemicraft/block/BlockToolAndWeaponCraftingTable.java similarity index 100% rename from common/chemicraft/block/BlockToolAndWeaponCraftingTable.java rename to src/chemicraft/block/BlockToolAndWeaponCraftingTable.java diff --git a/src/chemicraft/client/ClientProxy.java b/src/chemicraft/client/ClientProxy.java index 89c93ea..85fb428 100644 --- a/src/chemicraft/client/ClientProxy.java +++ b/src/chemicraft/client/ClientProxy.java @@ -8,13 +8,15 @@ import chemicraft.ChemiCraft; import chemicraft.entity.EntityAtomsGrenade; import chemicraft.gui.GuiChemicalCombinationTable; import chemicraft.gui.GuiChemicalCraftingTable; -import chemicraft.gui.GuiPyrolysisTable; +import chemicraft.gui.GuiDecompositionTable; +import chemicraft.gui.GuiElectrolysisTable; import chemicraft.gui.GuiToolAndWeaponCraftingTable; import chemicraft.render.RenderAtomsGrenade; import chemicraft.system.CommonProxy; import chemicraft.tileentity.TileEntityChemicalCombinationTable; import chemicraft.tileentity.TileEntityChemicalCraftingTable; -import chemicraft.tileentity.TileEntityPyrolysisTable; +import chemicraft.tileentity.TileEntityDecompositionTable; +import chemicraft.tileentity.TileEntityElectrolysisTable; import chemicraft.tileentity.TileEntityToolAndWeaponCraftingTable; import cpw.mods.fml.client.FMLClientHandler; import cpw.mods.fml.client.registry.RenderingRegistry; @@ -28,9 +30,10 @@ public class ClientProxy extends CommonProxy { MinecraftForgeClient.preloadTexture(ChemiCraft.instance.itemCompoundsTexture); MinecraftForgeClient.preloadTexture(ChemiCraft.instance.itemTexture); MinecraftForgeClient.preloadTexture(ChemiCraft.instance.guiChemicalCombinationTexture); - MinecraftForgeClient.preloadTexture(ChemiCraft.instance.guiPyrolysisTexture); + MinecraftForgeClient.preloadTexture(ChemiCraft.instance.guiDecompositionTexture); MinecraftForgeClient.preloadTexture(ChemiCraft.instance.guiChemicalCraftingTexture); MinecraftForgeClient.preloadTexture(ChemiCraft.instance.guiToolAndWeaponCraftingTexture); + MinecraftForgeClient.preloadTexture(ChemiCraft.instance.guiElectrolysisTableTexture); RenderingRegistry.registerEntityRenderingHandler(EntityAtomsGrenade.class, new RenderAtomsGrenade(0.5F)); } @@ -41,14 +44,16 @@ public class ClientProxy extends CommonProxy { return null; TileEntity tileEntity = world.getBlockTileEntity(x, y, z); - if (tileEntity instanceof TileEntityPyrolysisTable) { - return new GuiPyrolysisTable(player, (TileEntityPyrolysisTable) tileEntity); + if (tileEntity instanceof TileEntityDecompositionTable) { + return new GuiDecompositionTable(player, (TileEntityDecompositionTable) tileEntity); }else if(tileEntity instanceof TileEntityChemicalCombinationTable){ return new GuiChemicalCombinationTable(player, (TileEntityChemicalCombinationTable) tileEntity); }else if(tileEntity instanceof TileEntityToolAndWeaponCraftingTable){ return new GuiToolAndWeaponCraftingTable(player, (TileEntityToolAndWeaponCraftingTable) tileEntity); }else if(tileEntity instanceof TileEntityChemicalCraftingTable){ return new GuiChemicalCraftingTable(player, (TileEntityChemicalCraftingTable) tileEntity); + }else if(tileEntity instanceof TileEntityElectrolysisTable){ + return new GuiElectrolysisTable(player, (TileEntityElectrolysisTable) tileEntity); } return null; } diff --git a/common/chemicraft/compounds/CompoundWater.java b/src/chemicraft/compounds/CompoundWater.java similarity index 100% rename from common/chemicraft/compounds/CompoundWater.java rename to src/chemicraft/compounds/CompoundWater.java diff --git a/common/chemicraft/container/ContainerChemicalCombinationTable.java b/src/chemicraft/container/ContainerChemicalCombinationTable.java similarity index 100% rename from common/chemicraft/container/ContainerChemicalCombinationTable.java rename to src/chemicraft/container/ContainerChemicalCombinationTable.java diff --git a/common/chemicraft/container/ContainerChemicalCraftingTable.java b/src/chemicraft/container/ContainerChemicalCraftingTable.java similarity index 100% rename from common/chemicraft/container/ContainerChemicalCraftingTable.java rename to src/chemicraft/container/ContainerChemicalCraftingTable.java diff --git a/common/chemicraft/container/ContainerPyrolysisTable.java b/src/chemicraft/container/ContainerDecompositionTable.java similarity index 57% rename from common/chemicraft/container/ContainerPyrolysisTable.java rename to src/chemicraft/container/ContainerDecompositionTable.java index 15b55d2..b46340d 100644 --- a/common/chemicraft/container/ContainerPyrolysisTable.java +++ b/src/chemicraft/container/ContainerDecompositionTable.java @@ -4,9 +4,9 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.Container; import net.minecraft.world.World; import chemicraft.ChemiCraft; -import chemicraft.tileentity.TileEntityPyrolysisTable; +import chemicraft.tileentity.TileEntityDecompositionTable; -public class ContainerPyrolysisTable extends Container { +public class ContainerDecompositionTable extends Container { private World worldObj; @@ -14,7 +14,7 @@ public class ContainerPyrolysisTable extends Container { private int posY; private int posZ; - public ContainerPyrolysisTable(EntityPlayer par1EntityPlayer, TileEntityPyrolysisTable par2){ + public ContainerDecompositionTable(EntityPlayer par1EntityPlayer, TileEntityDecompositionTable par2){ super(); this.worldObj = par2.worldObj; this.posX = par2.xCoord; @@ -24,7 +24,7 @@ public class ContainerPyrolysisTable extends Container { @Override public boolean canInteractWith(EntityPlayer par1EntityPlayer) { - return this.worldObj.getBlockId(this.posX, this.posY, this.posZ) != ChemiCraft.instance.pyrolysisTableID ? false : par1EntityPlayer.getDistanceSq((double)this.posX + 0.5D, (double)this.posY + 0.5D, (double)this.posZ + 0.5D) <= 64.0D; + return this.worldObj.getBlockId(this.posX, this.posY, this.posZ) != ChemiCraft.instance.decompositionTableID ? false : par1EntityPlayer.getDistanceSq((double)this.posX + 0.5D, (double)this.posY + 0.5D, (double)this.posZ + 0.5D) <= 64.0D; } } diff --git a/src/chemicraft/container/ContainerElectrolysisTable.java b/src/chemicraft/container/ContainerElectrolysisTable.java new file mode 100644 index 0000000..b0ee4c4 --- /dev/null +++ b/src/chemicraft/container/ContainerElectrolysisTable.java @@ -0,0 +1,68 @@ +package chemicraft.container; + +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.inventory.Container; +import net.minecraft.inventory.Slot; +import net.minecraft.world.World; +import chemicraft.ChemiCraft; +import chemicraft.inventory.InventoryElectrolysisFuel; +import chemicraft.inventory.InventoryElectrolysisMaterial; +import chemicraft.inventory.InventoryElectrolysisResult; +import chemicraft.slot.SlotElectrolysisMaterial; +import chemicraft.slot.SlotElectrolysisResult; +import chemicraft.tileentity.TileEntityElectrolysisTable; + +public class ContainerElectrolysisTable extends Container +{ + + private World worldObj; + + private int posX; + private int posY; + private int posZ; + + private TileEntityElectrolysisTable tileEntity; + + private InventoryElectrolysisMaterial invm; + private InventoryElectrolysisResult invr; + private InventoryElectrolysisFuel invf; + + public ContainerElectrolysisTable(EntityPlayer par1EntityPlayer, TileEntityElectrolysisTable par2) { + super(); + this.worldObj = par2.worldObj; + this.posX = par2.xCoord; + this.posY = par2.yCoord; + this.posZ = par2.zCoord; + this.invm = (InventoryElectrolysisMaterial) this.tileEntity.getInvMaterial(); + this.invr = (InventoryElectrolysisResult) this.tileEntity.getInvResult(); + this.invf = (InventoryElectrolysisFuel) this.tileEntity.getInvFuel(); + + this.addSlotToContainer(new SlotElectrolysisMaterial(invm, 0, 123, 34)); + for (int i = 0; i < 16; i++) { + this.addSlotToContainer(new SlotElectrolysisResult(invr, i, 123, 34)); + } + this.addSlotToContainer(new SlotElectrolysisResult(invf, 0, 123, 34)); + + int var3; + for (var3 = 0; var3 < 3; ++var3) + { + for (int var4 = 0; var4 < 9; ++var4) + { + this.addSlotToContainer(new Slot(par1EntityPlayer.inventory, var4 + var3 * 9 + 9, 8 + var4 * 18, 85 + var3 * 18)); + } + } + + for (var3 = 0; var3 < 9; ++var3) + { + this.addSlotToContainer(new Slot(par1EntityPlayer.inventory, var3, 8 + var3 * 18, 143)); + } + + } + + @Override + public boolean canInteractWith(EntityPlayer par1EntityPlayer) + { + return this.worldObj.getBlockId(this.posX, this.posY, this.posZ) != ChemiCraft.instance.electrolysisTableID ? false : par1EntityPlayer.getDistanceSq((double) this.posX + 0.5D, (double) this.posY + 0.5D, (double) this.posZ + 0.5D) <= 64.0D; + } + +} diff --git a/common/chemicraft/container/ContainerToolAndWeaponCraftingTable.java b/src/chemicraft/container/ContainerToolAndWeaponCraftingTable.java similarity index 100% rename from common/chemicraft/container/ContainerToolAndWeaponCraftingTable.java rename to src/chemicraft/container/ContainerToolAndWeaponCraftingTable.java diff --git a/common/chemicraft/debug/CommandDeleteItem.java b/src/chemicraft/debug/CommandDeleteItem.java similarity index 100% rename from common/chemicraft/debug/CommandDeleteItem.java rename to src/chemicraft/debug/CommandDeleteItem.java diff --git a/common/chemicraft/debug/CommandGenDebugRoom.java b/src/chemicraft/debug/CommandGenDebugRoom.java similarity index 100% rename from common/chemicraft/debug/CommandGenDebugRoom.java rename to src/chemicraft/debug/CommandGenDebugRoom.java diff --git a/common/chemicraft/debug/CommandSetTile.java b/src/chemicraft/debug/CommandSetTile.java similarity index 97% rename from common/chemicraft/debug/CommandSetTile.java rename to src/chemicraft/debug/CommandSetTile.java index d7b4bfa..6f649fa 100644 --- a/common/chemicraft/debug/CommandSetTile.java +++ b/src/chemicraft/debug/CommandSetTile.java @@ -1,45 +1,45 @@ -package chemicraft.debug; - -import net.minecraft.block.Block; -import net.minecraft.command.CommandBase; -import net.minecraft.command.ICommandSender; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.world.World; - -public class CommandSetTile extends CommandBase { - - @Override - public String getCommandName() { - return "setTile"; - } - - @Override - public void processCommand(ICommandSender var1, String[] var2) { - try{ - EntityPlayer player = (EntityPlayer)var1; - World wolrd = player.worldObj; - if(var2.length > 0){ - try{ - if(Integer.parseInt(var2[0]) < 4096 && Block.blocksList[Integer.parseInt(var2[0])] != null || Integer.parseInt(var2[0]) == 0){ - if(var2.length == 1){ - SetBlockSupport.square(wolrd, (int)player.posX, (int)player.posY, (int)player.posZ, Integer.parseInt(var2[0]), Integer.parseInt(var2[1]), 12, 12); - }else if(var2.length > 2){ - SetBlockSupport.square(wolrd, (int)player.posX, (int)player.posY, (int)player.posZ, Integer.parseInt(var2[0]), Integer.parseInt(var2[1]), Integer.parseInt(var2[2]), Integer.parseInt(var2[2])); - }else{ - SetBlockSupport.square(wolrd, (int)player.posX, (int)player.posY, (int)player.posZ, Integer.parseInt(var2[0]), 0, 12, 12); - } - }else{ - var1.sendChatToPlayer("\u00a7cBlockが存在しないか指定された数が4096を超えています。"); - } - }catch(NumberFormatException e){ - var1.sendChatToPlayer("\u00a7c指定された文字は数値ではありません。"); - } - }else{ - var1.sendChatToPlayer("\u00a7cBlockIDを指定してください。(Metadata, Sizeも可能)"); - } - }catch(ClassCastException e){ - - } - } - -} +package chemicraft.debug; + +import net.minecraft.block.Block; +import net.minecraft.command.CommandBase; +import net.minecraft.command.ICommandSender; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.world.World; + +public class CommandSetTile extends CommandBase { + + @Override + public String getCommandName() { + return "setTile"; + } + + @Override + public void processCommand(ICommandSender var1, String[] var2) { + try{ + EntityPlayer player = (EntityPlayer)var1; + World wolrd = player.worldObj; + if(var2.length > 0){ + try{ + if(Integer.parseInt(var2[0]) < 4096 && Block.blocksList[Integer.parseInt(var2[0])] != null || Integer.parseInt(var2[0]) == 0){ + if(var2.length == 1){ + SetBlockSupport.square(wolrd, (int)player.posX, (int)player.posY, (int)player.posZ, Integer.parseInt(var2[0]), Integer.parseInt(var2[1]), 12, 12); + }else if(var2.length > 2){ + SetBlockSupport.square(wolrd, (int)player.posX, (int)player.posY, (int)player.posZ, Integer.parseInt(var2[0]), Integer.parseInt(var2[1]), Integer.parseInt(var2[2]), Integer.parseInt(var2[2])); + }else{ + SetBlockSupport.square(wolrd, (int)player.posX, (int)player.posY, (int)player.posZ, Integer.parseInt(var2[0]), 0, 12, 12); + } + }else{ + var1.sendChatToPlayer("\u00a7cBlockが存在しないか指定された数が4096を超えています。"); + } + }catch(NumberFormatException e){ + var1.sendChatToPlayer("\u00a7c指定された文字は数値ではありません。"); + } + }else{ + var1.sendChatToPlayer("\u00a7cBlockIDを指定してください。(Metadata, Sizeも可能)"); + } + }catch(ClassCastException e){ + + } + } + +} diff --git a/common/chemicraft/debug/CompoundHandlerTest.java b/src/chemicraft/debug/CompoundHandlerTest.java similarity index 100% rename from common/chemicraft/debug/CompoundHandlerTest.java rename to src/chemicraft/debug/CompoundHandlerTest.java diff --git a/common/chemicraft/debug/SetBlockSupport.java b/src/chemicraft/debug/SetBlockSupport.java similarity index 96% rename from common/chemicraft/debug/SetBlockSupport.java rename to src/chemicraft/debug/SetBlockSupport.java index d9aded8..2663d5d 100644 --- a/common/chemicraft/debug/SetBlockSupport.java +++ b/src/chemicraft/debug/SetBlockSupport.java @@ -1,596 +1,596 @@ -package chemicraft.debug; -import java.util.Random; - -import net.minecraft.world.World; - -public class SetBlockSupport -{ - - static Random rand = new Random(); - - /** - * X方向に線状にBlockを配置します。 - * Directionが0の場合、特殊な計算式で - * +,-方向:loop-1の長さになります。 - * @param par1World - * @param X 基準X座標 - * @param Y 基準Y座標 - * @param Z 基準Z座標 - * @param Block 配置するBlock - * @param meta 配置するMetadata - * @param Length 長さ - * @param Direction 方向(+方向:1,-方向:-1,中心から-+の方向:0) - * @return Object - */ - public static Object lineX(World par1World,int X,int Y,int Z,int Block,int meta,int Length,int Direction) - { - int loop2=0; - Object DataBox=null; - for(loop2=0;loop2 < Length;loop2++) - { - switch(Direction) - { - default: - - case -1: - DataBox = par1World.setBlockAndMetadataWithNotify(X, Y, Z, Block, meta); - break; - case 0: - DataBox = par1World.setBlockAndMetadataWithNotify(X-(Length-1)+loop2,Y,Z,Block,meta); - break; - case 1: - DataBox = par1World.setBlockAndMetadataWithNotify(X+loop2, Y, Z, Block,meta); - break; - } - } - return DataBox; - } - - /** - * Y方向に線状にBlockを配置します。 - * Directionが0の場合、特殊な計算式で - * +,-方向:loop-1の長さになります。 - * @param par1World - * @param X 基準X座標 - * @param Y 基準Y座標 - * @param Z 基準Z座標 - * @param Block 配置するBlock - * @param meta 配置するMetadata - * @param Length 長さ - * @param Direction 方向(+方向:1,-方向:-1,中心から-+の方向:0) - * @return Object - */ - public static Object lineY(World par1World,int X,int Y,int Z,int Block,int meta,int Length,int Direction) - { - int loop2=0; - Object DataBox=null; - for(loop2=0;loop2 < Length;loop2++) - { - switch(Direction) - { - default: - - case -1: - DataBox = par1World.setBlockAndMetadataWithNotify(X, Y-loop2, Z, Block,meta); - break; - case 0: - DataBox = par1World.setBlockAndMetadataWithNotify(X,Y-(Length-1)+loop2,Z,Block,meta); - break; - case 1: - DataBox = par1World.setBlockAndMetadataWithNotify(X, Y+loop2, Z, Block,meta); - break; - } - } - return DataBox; - } - - /** - * Z方向に線状にBlockを配置します。 - * Directionが0の場合、特殊な計算式で - * +,-方向:loop-1の長さになります。 - * @param par1World - * @param X 基準X座標 - * @param Y 基準Y座標 - * @param Z 基準Z座標 - * @param Block 配置するBlock - * @param meta 配置するMetadata - * @param Length 長さ - * @param Direction 方向指定(+方向:1,-方向:-1,中心から-+の方向:0) - * @return Object - */ - public static Object lineZ(World par1World,int X,int Y,int Z,int Block,int meta,int Length,int Direction) - { - int loop2=0; - Object DataBox=null; - for(loop2=0;loop2 < Length;loop2++) - { - switch(Direction) - { - default: - - case -1: - DataBox = par1World.setBlockAndMetadataWithNotify(X, Y, Z-loop2, Block,meta); - break; - case 0: - DataBox = par1World.setBlockAndMetadataWithNotify(X,Y,Z-(Length-1)+loop2,Block,meta); - break; - case 1: - DataBox = par1World.setBlockAndMetadataWithNotify(X, Y, Z+loop2, Block,meta); - break; - } - } - return DataBox; - } - - /** - * XY方向に線状にBlockを配置します。 - * Directionが0の場合、特殊な計算式で - * +,-方向:loop-1の長さになります。 - * @param par1World - * @param X 基準X座標 - * @param Y 基準Y座標 - * @param Z 基準Z座標 - * @param Block 配置するBlock - * @param meta 配置するMetadata - * @param XLength X方向の長さ - * @param YLength Y方向の長さ - * @param XDirection X方向指定(+方向:1,-方向:-1,中心から-+の方向:0) - * @param YDirection Y方向指定(+方向:1,-方向:-1,中心から-+の方向:0) - * @return Object - */ - public static Object lineXY(World par1World,int X,int Y,int Z,int Block,int meta,int XLength,int YLength,int XDirection,int YDirection) - { - Object DataBox=null; - DataBox = lineX(par1World,X,Y,Z,Block,meta,XLength,XDirection); - DataBox = lineY(par1World,X,Y,Z,Block,YLength,meta,YDirection); - return DataBox; - } - - /** - * XZ方向に線状にBlockを配置します。 - * Directionが0の場合、特殊な計算式で - * +,-方向:loop-1の長さになります。 - * @param par1World - * @param X 基準X座標 - * @param Y 基準Y座標 - * @param Z 基準Z座標 - * @param Block 配置するBlock - * @param meta 配置するMetadata - * @param XLength X方向の長さ - * @param ZLength Y方向の長さ - * @param XDirection X方向指定(+方向:1,-方向:-1,中心から-+の方向:0) - * @param ZDirection Z方向指定(+方向:1,-方向:-1,中心から-+の方向:0) - * @return Object - */ - public static Object lineXZ(World par1World,int X,int Y,int Z,int Block,int meta,int XLength,int ZLength,int XDirection,int ZDirection) - { - Object DataBox=null; - DataBox = lineX(par1World,X,Y,Z,Block,meta,XLength,XDirection); - DataBox = lineZ(par1World,X,Y,Z,Block,meta,ZLength,ZDirection); - return DataBox; - } - - /** - * YZ方向に線状にBlockを配置します。 - * Directionが0の場合、特殊な計算式で - * +,-方向:loop-1の長さになります。 - * @param par1World - * @param X 基準X座標 - * @param Y 基準Y座標 - * @param Z 基準Z座標 - * @param Block 配置するBlock - * @param meta 配置するMetadata - * @param YLength X方向の長さ - * @param ZLength Y方向の長さ - * @param YDirection Y方向指定(+方向:1,-方向:-1,中心から-+の方向:0) - * @param ZDirection Z方向指定(+方向:1,-方向:-1,中心から-+の方向:0) - * @return Object - */ - public static Object lineYZ(World par1World,int X,int Y,int Z,int Block,int meta,int YLength,int ZLength,int YDirection,int ZDirection) - { - Object DataBox=null; - DataBox = lineY(par1World,X,Y,Z,Block,meta,YLength,YDirection); - DataBox = lineZ(par1World,X,Y,Z,Block,meta,ZLength,ZDirection); - return DataBox; - } - - /** - * XYZ方向に線状にBlockを配置します。 - * Directionが0の場合、特殊な計算式で - * +,-方向:loop-1の長さになります。 - * @param par1World - * @param X 基準X座標 - * @param Y 基準Y座標 - * @param Z 基準Z座標 - * @param Block 配置するBlock - * @param meta 配置するMetadata - * @param XLength X方向の長さ - * @param YLength Y方向の長さ - * @param ZLength Z方向の長さ - * @param XDirection X方向指定(+方向:1,-方向:-1,中心から-+の方向:0) - * @param YDirection Y方向指定(+方向:1,-方向:-1,中心から-+の方向:0) - * @param ZDirection Z方向指定(+方向:1,-方向:-1,中心から-+の方向:0) - * @return Object - */ - public static Object lineXYZ(World par1World,int X,int Y,int Z,int Block,int meta,int XLength,int YLength,int ZLength,int XDirection,int YDirection,int ZDirection) - { - Object DataBox=null; - DataBox = lineX(par1World,X,Y,Z,Block,meta,XLength,XDirection); - DataBox = lineY(par1World,X,Y,Z,Block,meta,YLength,YDirection); - DataBox = lineZ(par1World,X,Y,Z,Block,meta,ZLength,ZDirection); - return DataBox; - } - - /** - * X方向の壁を作成します。 - * Directionは1で固定です。 - * @param par1World - * @param X 基準X座標 - * @param Y 基準Y座標 - * @param Z 基準Z座標 - * @param Block 配置するBlock - * @param meta 配置するMetadata - * @param Length 幅 - * @param height 高さ - * @return Object - */ - public static Object wallX(World par1World,int X,int Y,int Z,int Block,int meta,int Length,int height) - { - Object DataBox = null; - for(int loop = 0;loop < Length;loop++){ - lineY(par1World, X - (Length/2) + loop, Y, Z, Block,meta, height, 1); - } - return DataBox; - } - - /** - * Z方向の壁を作成します。 - * Directionは1で固定です。 - * @param par1World - * @param X 基準X座標 - * @param Y 基準Y座標 - * @param Z 基準Z座標 - * @param Block 配置するBlock - * @param meta 配置するMetadata - * @param Length 幅 - * @param height 高さ - * @return Object - */ - public static Object wallZ(World par1World,int X,int Y,int Z,int Block,int meta,int Length,int height) - { - Object DataBox = null; - for(int loop = 0;loop < Length;loop++){ - lineY(par1World, X, Y, Z - (Length/2) + loop, Block,meta, height, 1); - } - return DataBox; - } - - /** - * 辺だけの四角を作成します。 - * @param par1World - * @param X 基準X座標 - * @param Y 基準Y座標 - * @param Z 基準Z座標 - * @param Block 配置するBlock - * @param meta 配置するMetadata - * @param LengthX X方向の長さ - * @param LengthZ Z方向の長さ - * @return Object - */ - public static Object spuareFrame(World par1World,int X,int Y,int Z,int Block,int meta,int LengthX,int LengthZ) - { - Object DataBox = null; - DataBox = lineX(par1World, X, Y, Z + (LengthZ/2), Block,meta, LengthX/2+1, 0); - DataBox = lineX(par1World, X, Y, Z - (LengthZ/2), Block,meta, LengthX/2+1, 0); - DataBox = lineZ(par1World, X + (LengthX/2), Y, Z, Block,meta, LengthZ/2+1, 0); - DataBox = lineZ(par1World, X - (LengthX/2), Y, Z, Block,meta, LengthZ/2+1, 0); - return DataBox; - } - - /** - * 辺だけの箱を作成します。 - * @param par1World - * @param X 基準X座標 - * @param Y 基準Y座標 - * @param Z 基準Z座標 - * @param Block 配置するBlock - * @param meta 配置するMetadata - * @param LengthX X方向の長さ - * @param LengthZ Z方向の長さ - * @param height 高さ - * @return Object - */ - public static Object boxFrame(World par1World,int X,int Y,int Z,int Block,int meta,int LengthX,int LengthZ,int height) - { - Object DataBox=null; - DataBox = lineX(par1World, X, Y, Z + (LengthZ/2), Block,meta, LengthX/2, 0); - DataBox = lineX(par1World, X, Y, Z - (LengthZ/2), Block,meta, LengthX/2, 0); - DataBox = lineX(par1World, X, Y + height-1, Z + (LengthZ/2), Block,meta, LengthX/2, 0); - DataBox = lineX(par1World, X, Y + height-1, Z - (LengthZ/2), Block,meta, LengthX/2, 0); - - DataBox = lineY(par1World,X +(LengthX/2),Y,Z +(LengthZ/2),Block,meta,height,1); - DataBox = lineY(par1World,X -(LengthX/2),Y,Z +(LengthZ/2),Block,meta,height,1); - DataBox = lineY(par1World,X +(LengthX/2),Y,Z - (LengthZ/2),Block,meta,height,1); - DataBox = lineY(par1World,X -(LengthX/2),Y,Z - (LengthZ/2),Block,meta,height,1); - - DataBox = lineZ(par1World, X + (LengthX/2), Y, Z, Block,meta, LengthZ/2, 0); - DataBox = lineZ(par1World, X - (LengthX/2), Y, Z, Block,meta, LengthZ/2, 0); - DataBox = lineZ(par1World, X + (LengthX/2), Y + height-1, Z, Block,meta, LengthZ/2, 0); - DataBox = lineZ(par1World, X - (LengthX/2), Y + height-1, Z, Block,meta, LengthZ/2, 0); - return DataBox; - } - - /** - * 四角を作成します。 - * @param par1World - * @param X 基準X座標 - * @param Y 基準Y座標 - * @param Z 基準Z座標 - * @param Block 配置するBlock - * @param meta 配置するMetadata - * @param LengthX X方向の長さ - * @param LengthZ Z方向の長さ - * @return Object - */ - public static Object square(World par1World,int X,int Y,int Z,int Block,int meta,int LengthX,int LengthZ) - { - Object DataBox = null; - int loop1 = 0; - for(loop1=0; loop1 < LengthZ; loop1++){ - DataBox = lineX(par1World,X - (LengthX/2),Y,Z - (LengthZ/2) + loop1,Block,meta,LengthX,1); - } - return DataBox; - } - - /** - * 箱を生成します。 - * @param par1World - * @param X 基準X座標 - * @param Y 基準Y座標 - * @param Z 基準Z座標 - * @param Block 配置するBlock - * @param meta 配置するMetadata - * @param LengthX X方向の長さ - * @param LengthZ Z方向の長さ - * @param height 高さ - * @return Object - */ - public static Object box(World par1World,int X,int Y,int Z,int Block,int meta,int LengthX,int LengthZ,int height) - { - Object DataBox = null; - DataBox = square(par1World, X, Y, Z, Block, meta,LengthX,LengthZ); - DataBox = square(par1World,X,Y+height,Z,Block,meta,LengthX,LengthZ); - DataBox = wallX(par1World,X,Y,Z-(LengthZ/2),Block,meta,LengthX,height); - DataBox = wallZ(par1World,X-(LengthX/2),Y,Z,Block,meta,LengthZ,height); - DataBox = wallX(par1World,X,Y,Z+(LengthZ/2),Block,meta,LengthX,height); - DataBox = wallZ(par1World,X+(LengthX/2),Y,Z,Block,meta,LengthZ,height); - return DataBox; - } - - /** - * Blockで埋め尽くされた箱を生成します。 - * @param par1World - * @param X 基準X座標 - * @param Y 基準Y座標 - * @param Z 基準Z座標 - * @param Block 配置するBlock - * @param meta 配置するMetadata - * @param LengthX X方向の長さ - * @param LengthZ Z方向の長さ - * @param height 高さ - * @return Object - */ - public static Object fillBox(World par1World , int X,int Y,int Z,int Block,int meta,int LengthX,int LengthZ,int height) - { - Object DataBox = null; - DataBox = square(par1World, X, Y, Z, Block,meta, LengthX,LengthZ); - DataBox = square(par1World,X,Y+height,Z,Block,meta,LengthX,LengthZ); - DataBox = wallX(par1World,X,Y,Z-(LengthZ/2),Block,meta,LengthX,height); - DataBox = wallZ(par1World,X-(LengthX/2),Y,Z,Block,meta,LengthZ,height); - DataBox = wallX(par1World,X,Y,Z+(LengthZ/2),Block,meta,LengthX,height); - DataBox = wallZ(par1World,X+(LengthX/2),Y,Z,Block,meta,LengthZ,height); - - for(int i = 0; i < LengthX - 1; i++) - { - DataBox = wallZ(par1World,X + 1 - LengthX / 2 + i, Y , Z , Block ,meta,LengthZ, height); - } - - return DataBox; - } - - /** - * 座標ごとにデータを指定して配置します。 - * 配列になっているので、順番に指定してください。 - * @param par1World - * @param X 基準X座標 - * @param Y 基準Y座標 - * @param Z 基準Z座標 - * @param Block 配置するBlock - * @param meta 配置するMetadata - * @param XPosition 配置する相対X座標 - * @param YPosition 配置する相対Y座標 - * @param ZPosition 配置する相対Z座標 - * @param Option - * @return Object - */ - public static Object fineSetBlock(World par1World,int X,int Y,int Z,int[] Block,int[] meta,int[] XPosition,int[] YPosition,int[] ZPosition,Object[] Option){ - Object DataBox = null; - for(int i=0;i= par1){ - return true; - }else{ - return false; - } - } - - - - /** - * 引数に指定されたY軸と同等か判定します - * @param par1 - * @return 指定されたY軸と同等かどうか - */ - @SideOnly(Side.CLIENT) - public boolean isEquivalentY(int par1){ - if(this.posY == par1){ - return true; - }else{ - return false; - } - } - - - - /** - * 引数に指定されたY軸より低いか判定します - * @param par1 - * @return 指定されたY軸より低いか - */ - @SideOnly(Side.CLIENT) - public boolean isBelowY(int par1){ - if(this.posY <= par1){ - return true; - }else{ - return false; - } - } - -} +package chemicraft.util; + +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.world.World; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; + +/** + * いろいろなデータを格納しメソッドによってチェックするクラス + * 使用する場合はItemAtomInfoContainerを継承することを推奨 + * @author ponkotate + * + */ +public class AtomInfo { + + /** + * X, Y, Z座標 + */ + private int posX; + private int posY; + private int posZ; + + + /** + * biomeの名前 + */ + private String biomeName; + + + /** + * 天候 + */ + private String weather; + + + /** + * EntityPlayerのインスタンス + */ + private EntityPlayer entityPlayer; + + + /** + * Worldのインスタンス + */ + private World world; + + + + /** + * AtomInfoのデータをupdateします + * @param par1World Worldのインスタンス + * @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()){ + this.weather = "Thunder"; + }else if(par1World.isRaining()){ + this.weather = "Rain"; + }else{ + this.weather = "Sun"; + } + } + + + + /** + * 引数に指定されたBiomeと同等か比較します + * @param biomeName 比較するBiomeの名前 + * @return Biomeが一致しているか + */ + public boolean isEquivalentBiome(String biomeName){ + if(this.biomeName != null){ + if(this.biomeName.equals(biomeName)){ + return true; + }else{ + return false; + } + }else{ + System.err.println("AtonInfo:データが入っていません。updateメソッドでデータを入れてください"); + return false; + } + } + + + + /** + * 引数に指定された天候と同等か比較します + * 晴れ:Sun, 雨:Rain, 雷雨:Thunder + * @param weather 比較する天候 + * @return 天候が一致しているか + */ + public boolean isEquivalentWeather(String weather){ + if(this.weather != null){ + if(this.weather.equals(weather)){ + return true; + }else{ + return false; + } + }else{ + System.err.println("AtonInfo:データが入っていません。updateメソッドでデータを入れてください"); + return false; + } + } + + + + /** + * 引数に指定されたY軸より高いか判定します + * @param par1 + * @return 指定されたY軸より高いか + */ + @SideOnly(Side.CLIENT) + public boolean isOverY(int par1){ + if(this.posY >= par1){ + return true; + }else{ + return false; + } + } + + + + /** + * 引数に指定されたY軸と同等か判定します + * @param par1 + * @return 指定されたY軸と同等かどうか + */ + @SideOnly(Side.CLIENT) + public boolean isEquivalentY(int par1){ + if(this.posY == par1){ + return true; + }else{ + return false; + } + } + + + + /** + * 引数に指定されたY軸より低いか判定します + * @param par1 + * @return 指定されたY軸より低いか + */ + @SideOnly(Side.CLIENT) + public boolean isBelowY(int par1){ + if(this.posY <= par1){ + return true; + }else{ + return false; + } + } + +} diff --git a/common/chemicraft/util/Auxiliary.java b/src/chemicraft/util/Auxiliary.java similarity index 96% rename from common/chemicraft/util/Auxiliary.java rename to src/chemicraft/util/Auxiliary.java index 7560c60..fbd32a4 100644 --- a/common/chemicraft/util/Auxiliary.java +++ b/src/chemicraft/util/Auxiliary.java @@ -1,190 +1,190 @@ -package chemicraft.util; - -import net.minecraft.block.Block; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import cpw.mods.fml.common.registry.LanguageRegistry; - -public class Auxiliary { - - /** - * 補助クラス - * @author mozipi - * - */ - public static class NameAuxiliary { - - /** - * 名前を設定します - * @param object - * @param Name - */ - public void addName(Object object,Object name){ - LanguageRegistry.addName(object, (String) name); - } - - - - /** - * 名前を設定します(ItemStack版) - * @param object - * @param name - * @param meta - */ - public void addName(ItemStack itemstack,Object name){ - LanguageRegistry.addName(itemstack, (String) name); - } - - - - /** - * 指定言語にそって名前を追加します - * @param object - * @param lang - * @param name - */ - public void addName(Object object,String lang,Object name){ - LanguageRegistry.instance().addNameForObject(object, lang, (String) name); - } - - - - /** - * 指定言語にそって名前を追加します(ItemStack版) - * @param object - * @param lang - * @param name - */ - public void addName(ItemStack object,String lang,Object name){ - LanguageRegistry.instance().addNameForObject(object, lang, (String) name); - } - - - - /** - * メタデータごとに名前を追加します(Block版) - * @param object - * @param name - */ - public void addName(Block object,Object[] name){ - for(int i=0;i