\r
import net.minecraft.block.Block;\r
import net.minecraft.block.material.Material;\r
+import net.minecraft.client.audio.SoundManager;\r
import net.minecraft.creativetab.CreativeTabs;\r
import net.minecraft.item.Item;\r
import net.minecraft.item.ItemStack;\r
import chemicraft.block.BlockChemicalCraftingTable;\r
import chemicraft.block.BlockPyrolysisTable;\r
import chemicraft.block.BlockToolAndWeaponCraftingTable;\r
+import chemicraft.compounds.CompoundDebug;\r
import chemicraft.compounds.CompoundWater;\r
import chemicraft.debug.CommandDeleteItem;\r
import chemicraft.debug.CommandGenDebugRoom;\r
api.addLangCompound("ja_JP", "CarbonMonoxide", "一酸化炭素");\r
api.addLangCompound("ja_JP", "CarbonDioxide", "二酸化炭素");\r
api.addLangCompound("ja_JP", "Water", "水");\r
- api.addCompound("Test");\r
\r
//化合物のHandlerを設定します\r
api.addChemicalCombinationRecipe(new String[]{"H", "O"}, new Integer[]{2, 1}, new ItemStack(this.itemCompounds, 1, api.getCompound("Water")));\r
\r
//手榴弾の追加\r
- api.addMaterialRecipe(\r
- new ItemStack[]{\r
- null,\r
- new ItemStack(Block.stone),\r
- null,\r
- new ItemStack(Block.stone),\r
- new ItemStack(Item.gunpowder),\r
- new ItemStack(Block.stone),\r
- null,\r
- new ItemStack(Block.stone),\r
- null\r
- },\r
- new ItemStack(this.itemAtomGrenade, 16, 0),\r
- new NBTRecipeGrenade()\r
+ api.addMaterialRecipe(new ItemStack[] {\r
+ null,\r
+ new ItemStack(Block.stone),\r
+ null,\r
+ new ItemStack(Block.stone),\r
+ new ItemStack(Item.gunpowder),\r
+ new ItemStack(Block.stone),\r
+ null,\r
+ new ItemStack(Block.stone),\r
+ null\r
+ },\r
+ new ItemStack(this.itemAtomGrenade, 16, 0),\r
+ new NBTRecipeGrenade()\r
);\r
- //Tickingの追加\r
- this.proxy.registerTickHandler();\r
+\r
+ api.addDecompositionRecipe(new ItemStack(Item.potion, 1, 0),\r
+ new int[] {ChemiCraftData.HYDROGEN, ChemiCraftData.OXYGEN},\r
+ new int[] {2, 1});\r
+\r
+ api.addDecompositionRecipe(new ItemStack(this.itemCompounds, 1, api.getCompound("Water")),\r
+ new int[] {ChemiCraftData.HYDROGEN, ChemiCraftData.OXYGEN},\r
+ new int[] {2, 1});\r
+\r
+ api.addDecompositionFuel(new ItemStack(Item.coal), 2000*8);\r
}\r
\r
private void apiProcessing(final FMLPostInitializationEvent event) {\r
}\r
\r
private void debug(final FMLPostInitializationEvent event) {\r
+ //DebugTickingの追加\r
+ this.proxy.registerTickHandler();\r
+ api.addCompound("Debug");\r
+ this.api.settingCompoundHandler("Debug", new CompoundDebug());\r
}\r
\r
}\r
/**
- * 分解台の素材のリスト
- */
- private ArrayList<ItemStack> decompositionMaterial = new ArrayList<ItemStack>();
-
-
- /**
- * 分解台の結果のリスト
- */
- private ArrayList<ItemStack[]> decompositionResults = new ArrayList<ItemStack[]>();
-
-
- /**
* 化合台の原子の種類のリスト
*/
private ArrayList<String[]> chemicalCombinationAtoms = new ArrayList<String[]>();
/**
- * 分解レシピを追加します。resultの要素数は0<= n <= 16にしてください。
- * @param material 素材
- * @param result 結果
- */
- public void addDecompositionRecipe(ItemStack material, ItemStack[] result){
- if(result.length <= 16){
- decompositionMaterial.add(material);
- decompositionResults.add(result);
- }else{
- System.err.println("ChemiCraft内でエラー:addDecompositionRecipeの引数resultの要素数が16を超えています。" + "Material:" + material + " Result:" + result);
- }
- }
-
-
-
- /**
* 化合レシピを追加します。materialの要素数は0<= n <= 16にしてください。
* @param material 素材
* @param result 結果
public void addDecompositionRecipe(ItemStack material, int[] results, int[] stacks) {
ItemStack[] itemstacks = new ItemStack[results.length];
for (int i = 0; i < itemstacks.length; i++) {
- itemstacks[i] = new ItemStack(ChemiCraft.instance.atomsID,stacks[i], results[i]);
+ itemstacks[i] = new ItemStack(ChemiCraft.instance.itemAtoms,stacks[i], results[i]);
}
TileEntityPyrolysisTable.addRecipe(material, itemstacks);
}
- public void addDecompositionRecipe(ItemStack itemstack, int burnTime) {
+ public void addDecompositionFuel(ItemStack itemstack, int burnTime) {
TileEntityPyrolysisTable.addFuel(itemstack, burnTime);
}
- public ArrayList<ItemStack> getDecompositionMaterial(){
- return decompositionMaterial;
- }
-
-
-
- public ArrayList<ItemStack[]> getDecompositionResult(){
- return decompositionResults;
- }
-
-
-
public ArrayList<String[]> getChemicalCombinationAtoms(){
return chemicalCombinationAtoms;
}
--- /dev/null
+package chemicraft.compounds;
+
+import net.minecraft.entity.Entity;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.entity.projectile.EntityLargeFireball;
+import net.minecraft.item.ItemStack;
+import net.minecraft.world.World;
+import chemicraft.util.ICompoundHandler;
+
+public class CompoundDebug implements ICompoundHandler {
+
+ @Override
+ public ItemStack onItemRightClickHandler(ItemStack par1ItemStack,
+ World par2World, EntityPlayer par3EntityPlayer) {
+ if (!par2World.isRemote) {
+ double var1 = par3EntityPlayer.posX;
+ double var2 = par3EntityPlayer.posY + 10;
+ double var3 = par3EntityPlayer.posZ;
+ double var4 = par3EntityPlayer.posX;
+ double var5 = par3EntityPlayer.posY;
+ double var6 = par3EntityPlayer.posZ;
+ par2World.spawnEntityInWorld(new EntityLargeFireball(par2World, var1, var2, var3, var4, var5, var6));
+ }
+ return par1ItemStack;
+ }
+
+ @Override
+ public boolean onItemUseHandler(ItemStack par1ItemStack,
+ EntityPlayer par2EntityPlayer, World par3World, int par4, int par5,
+ int par6, int par7, float par8, float par9, float par10) {
+ return false;
+ }
+
+ @Override
+ public void onUpdateHandler(ItemStack par1ItemStack, World par2World,
+ Entity par3Entity, int par4, boolean par5) {
+
+ }
+
+ @Override
+ public int getIconIndexHandler() {
+ return 0;
+ }
+
+}
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.Container;
+import net.minecraft.inventory.Slot;
+import net.minecraft.world.World;
+import chemicraft.slot.SlotToolAndWeaponCraftingTableResult;
import chemicraft.tileentity.TileEntityToolAndWeaponCraftingTable;
public class ContainerToolAndWeaponCraftingTable extends Container {
+ private World worldobj;
+
+ private int posX;
+ private int posY;
+ private int posZ;
+
+ private TileEntityToolAndWeaponCraftingTable tileentity;
+
public ContainerToolAndWeaponCraftingTable(EntityPlayer par1EntityPlayer, TileEntityToolAndWeaponCraftingTable par2){
super();
+ this.tileentity = par2;
+ this.worldobj = this.tileentity.worldObj;
+ this.posX = this.tileentity.xCoord;
+ this.posY = this.tileentity.yCoord;
+ this.posZ = this.tileentity.zCoord;
+
+ for (int i = 0; i < 3; i++) {
+ for (int j = 0; j < 3; j++) {
+ this.addSlotToContainer(new Slot(this.tileentity.invm, i * 3 + i, 30 + i * 18, 17 + j * 18));
+ }
+ }
+
+ this.addSlotToContainer(new SlotToolAndWeaponCraftingTableResult(this.tileentity.invr, 0, 125, 36));
+
+ 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 var1) {
- return false;
+ return true;
}
}
} else if (this.worldObj.isThundering() && var1) {
this.heat += 0.25F;
} else {
- this.heat += 3F;
+ this.heat += 0.5F;
}
} else {
this.heat = 1700;
//var2 = true;
if (itemstackMaterial.itemID == materialItem.itemID && itemstackMaterial.getItemDamage() == materialItem.getItemDamage()) {
this.inItem(itemstackMaterial);
- if (materialItem.stackSize >= 1) {
+ if (materialItem.stackSize > 1) {
this.invm.setInventorySlotContents(0, new ItemStack(materialItem.itemID, --materialItem.stackSize, materialItem.getItemDamage()));
} else {
this.invm.setInventorySlotContents(0, null);
if (fuelItem != null) {
if (itemstackFuel.itemID == fuelItem.itemID && itemstackFuel.getItemDamage() == fuelItem.getItemDamage()) {
this.fuelRestTime = fuelList.get(itemstackFuel);
- if (fuelItem.stackSize >= 1) {
+ if (fuelItem.stackSize > 1) {
this.invf.setInventorySlotContents(0, new ItemStack(fuelItem.itemID, --fuelItem.stackSize, fuelItem.getItemDamage()));
break;
} else {
public boolean isInItemCheck(ItemStack key) {
ItemStack[] results = recipeList.get(key).clone();
ItemStack[] containerResults = new ItemStack[this.invr.getSizeInventory()];
- for (int i = 0; i < this.invr.getSizeInventory(); i++) {
- containerResults[i] = this.invr.getStackInSlot(i);
+ for (int j = 0; j < this.invr.getSizeInventory(); j++) {
+ containerResults[j] = this.invr.getStackInSlot(j);
}
for (int i = 0; i < results.length; i++) {
int var5 = results[i].stackSize;
for (int j = 0; j < containerResults.length; j++) {
if (containerResults[j] == null) {
+ containerResults[j] = results[i];
results[i] = null;
break;
} else {
int var7 = containerResults[j].getMaxStackSize();
if (var1 == var2 && var3 == var4) {
if (var5 + var6 <= var7) {
+ containerResults[j] = results[i];
results[i] = null;
break;
} else {
public void inItem(ItemStack key) {
ItemStack[] results = recipeList.get(key);
- ItemStack[] containerResults = new ItemStack[this.invr.getSizeInventory()];
- for (int i = 0; i < this.invr.getSizeInventory(); i++) {
- containerResults[i] = this.invr.getStackInSlot(i);
- }
for (int i = 0; i < results.length; i++) {
+ ItemStack[] containerResults = new ItemStack[this.invr.getSizeInventory()];
+ for (int j = 0; j < this.invr.getSizeInventory(); j++) {
+ containerResults[j] = this.invr.getStackInSlot(j);
+ }
int var1 = results[i].itemID;
int var3 = results[i].getItemDamage();
int var5 = results[i].stackSize;
int var7 = containerResults[j].getMaxStackSize();
if (var1 == var2 && var3 == var4) {
if (var5 + var6 <= var7) {
- System.out.println(var5);
- System.out.println(var6);
- System.out.println(var5 + var6);
- System.out.println(i);
- System.out.println(j);
this.invr.setInventorySlotContents(j, new ItemStack(results[i].itemID, var5 + var6, results[i].getItemDamage()));
break;
} else {
import java.io.DataOutputStream;
import net.minecraft.tileentity.TileEntity;
+import chemicraft.inventory.InventoryToolAndWeaponCraftingTableMaterial;
+import chemicraft.inventory.InventoryToolAndWeaponCraftingTableResult;
import com.google.common.io.ByteArrayDataInput;
public class TileEntityToolAndWeaponCraftingTable extends TileEntity {
+ public InventoryToolAndWeaponCraftingTableMaterial invm = new InventoryToolAndWeaponCraftingTableMaterial();
+ public InventoryToolAndWeaponCraftingTableResult invr = new InventoryToolAndWeaponCraftingTableResult();
+
public void readPacket(ByteArrayDataInput data) {
try {
} catch (Exception e) {