OSDN Git Service

とりあえずコミット
authormozipi <mozipi@users.sourceforge.jp>
Thu, 6 Dec 2012 12:34:17 +0000 (21:34 +0900)
committermozipi <mozipi@users.sourceforge.jp>
Thu, 6 Dec 2012 12:34:17 +0000 (21:34 +0900)
common/chemicraft/ChemiCraftTabs.java
common/chemicraft/CommonProxy.java
common/chemicraft/ContainerScienceCraftingTable.java
common/chemicraft/GuiScienceCraftingTable.java
common/chemicraft/TileEntityScienceCraftingTable.java
src/chemicraft/client/ClientProxy.java

index 0840ee5..f3a9992 100644 (file)
@@ -3,19 +3,19 @@ package chemicraft;
 public class ChemiCraftTabs {
 
        /**
-        * tab\82ÌID
+        * tabID
         */
        private int id;
 
        /**
-        * tab\82ÉOverlay\82·\82éTextureID
+        * tabにOverlayするTextureID
         */
        private int texture;
 
 
 
        /**
-        * tab\82Ì\96¼\91O
+        * tabの名前
         */
        private String tabName;
 
@@ -28,8 +28,8 @@ public class ChemiCraftTabs {
 
 
        /**
-        * ID\82ð\95Ô\82µ\82Ü\82·
-        * @return tab\82ÌID
+        * tabのIDを返します
+        * @return tabID
         */
        public int getID(){
                return this.id;
@@ -38,8 +38,8 @@ public class ChemiCraftTabs {
 
 
        /**
-        * tab\82ÉOverlay\82·\82éTextureID\82ð\95Ô\82µ\82Ü\82·
-        * @return tab\82ÉOverlay\82·\82éTextureID
+        * tabにOverlayするTextureIDを返します
+        * @return tabにOverlayするTextureID
         */
        public int getTexture(){
                return this.texture;
@@ -48,8 +48,8 @@ public class ChemiCraftTabs {
 
 
        /**
-        * tab\82Ì\96¼\91O\82ð\95Ô\82µ\82Ü\82·
-        * @return tab\82Ì\96¼\91O
+        * tabの名前を返します
+        * @return tabの名前
         */
        public String getTabName(){
                return this.tabName;
index 3608d31..f19bfef 100644 (file)
@@ -1,6 +1,7 @@
 package chemicraft;
 
 import net.minecraft.src.EntityPlayer;
+import net.minecraft.src.TileEntity;
 import net.minecraft.src.World;
 import cpw.mods.fml.common.network.IGuiHandler;
 
@@ -15,7 +16,15 @@ public class CommonProxy implements IGuiHandler
        @Override
        public Object getServerGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z)
        {
+               if(!world.blockExists(x, y, z)) return null;
+
+               TileEntity tileEntity = world.getBlockTileEntity(x, y, z);
+
+               if(tileEntity instanceof TileEntityScienceCraftingTable){
+                       return new ContainerScienceCraftingTable(player.inventory, (TileEntityScienceCraftingTable)tileEntity);
+               }
                return null;
+
        }
 
        @Override
index 06c739e..5314e34 100644 (file)
@@ -1,16 +1,11 @@
 package chemicraft;
 
-import net.minecraft.src.Block;
 import net.minecraft.src.Container;
-import net.minecraft.src.CraftingManager;
 import net.minecraft.src.EntityPlayer;
 import net.minecraft.src.IInventory;
-import net.minecraft.src.InventoryCraftResult;
-import net.minecraft.src.InventoryCrafting;
 import net.minecraft.src.InventoryPlayer;
 import net.minecraft.src.ItemStack;
 import net.minecraft.src.Slot;
-import net.minecraft.src.SlotCrafting;
 import net.minecraft.src.World;
 
 public class ContainerScienceCraftingTable extends Container
@@ -20,15 +15,13 @@ public class ContainerScienceCraftingTable extends Container
     private int posY;
     private int posZ;
 
-    public ContainerScienceCraftingTable(InventoryPlayer par1InventoryPlayer, World par2World, int par3, int par4, int par5)
+    public ContainerScienceCraftingTable(InventoryPlayer par1InventoryPlayer, TileEntityScienceCraftingTable par2)
     {
-        this.worldObj = par2World;
-        this.posX = par3;
-        this.posY = par4;
-        this.posZ = par5;
-        int var6;
-        int var7;
-
+        this.worldObj = par2.worldObj;
+        this.posX = par2.xCoord;
+        this.posY = par2.yCoord;
+        this.posZ = par2.zCoord;
+        this.addSlotToContainer(new Slot(par2, 0, 10, 10));
     }
 
     /**
index 1e340e5..ad714f8 100644 (file)
@@ -4,8 +4,7 @@ import java.util.ArrayList;
 
 import net.minecraft.src.GuiContainer;
 import net.minecraft.src.InventoryPlayer;
-import net.minecraft.src.MinecraftException;
-import net.minecraft.src.World;
+import net.minecraft.src.Slot;
 
 import org.lwjgl.opengl.GL11;
 
@@ -18,9 +17,9 @@ public class GuiScienceCraftingTable extends GuiContainer
 
        private ArrayList<ChemiCraftTabs> tabList = new ArrayList<ChemiCraftTabs>();
 
-       public GuiScienceCraftingTable(InventoryPlayer par1InventoryPlayer, World par2World, int par3, int par4, int par5)
+       public GuiScienceCraftingTable(InventoryPlayer par1InventoryPlayer, TileEntityScienceCraftingTable par2)
        {
-               super(new ContainerScienceCraftingTable(par1InventoryPlayer, par2World, par3, par4, par5));
+               super(new ContainerScienceCraftingTable(par1InventoryPlayer, par2));
        }
 
        @Override
@@ -49,11 +48,23 @@ public class GuiScienceCraftingTable extends GuiContainer
                }
        }
 
+       @Override
+       protected void handleMouseClick(Slot par1Slot, int par2, int par3, boolean par4){
+               System.out.println(par2);
+               System.out.println(par3);
+       }
+
+       @Override
+       protected void mouseClicked(int par1, int par2, int par3)
+       {
+               super.mouseClicked(par1, par2, par3);
+       }
+
        private void addTabs(int id, int Texture, String name){
                for(int i = 0;i < tabList.size();i++){
                        if(id == tabList.get(i).getID()){
                                try {
-                                       throw new Exception("ChemiCraft\93à\82Å\83G\83\89\81[:ChemiCraftTabs\82ÌID\82ª\8fd\95¡\82µ\82Ä\82¢\82Ü\82·");
+                                       throw new Exception("ChemiCraft内でエラー:ChemiCraftTabのIDが重複しています");
                                } catch (Exception e) {
                                        e.printStackTrace();
                                }
index e8ac3ca..6f5bb03 100644 (file)
@@ -7,7 +7,9 @@ import net.minecraft.src.NBTTagCompound;
 import net.minecraft.src.Packet;
 import net.minecraft.src.TileEntity;
 
-public class TileEntityScienceCraftingTable extends TileEntity {
+public class TileEntityScienceCraftingTable extends TileEntity implements IInventory{
+
+       private ItemStack[] inventory = new ItemStack[10];
 
        public TileEntityScienceCraftingTable(){
        }
@@ -24,4 +26,54 @@ public class TileEntityScienceCraftingTable extends TileEntity {
        @Override
        public void writeToNBT(NBTTagCompound par1){
        }
+
+       @Override
+       public int getSizeInventory() {
+               return inventory.length;
+       }
+
+       @Override
+       public ItemStack getStackInSlot(int var1) {
+               return inventory[var1];
+       }
+
+       @Override
+       public ItemStack decrStackSize(int var1, int var2) {
+               return null;
+       }
+
+       @Override
+       public ItemStack getStackInSlotOnClosing(int var1) {
+               return null;
+       }
+
+       @Override
+       public void setInventorySlotContents(int var1, ItemStack var2) {
+
+       }
+
+       @Override
+       public String getInvName() {
+               return null;
+       }
+
+       @Override
+       public int getInventoryStackLimit() {
+               return 64;
+       }
+
+       @Override
+       public boolean isUseableByPlayer(EntityPlayer var1) {
+               return false;
+       }
+
+       @Override
+       public void openChest() {
+
+       }
+
+       @Override
+       public void closeChest() {
+
+       }
 }
index 4bdf5e1..93ad16e 100644 (file)
@@ -1,8 +1,12 @@
 package chemicraft.client;
 
 import net.minecraft.src.EntityPlayer;
+import net.minecraft.src.TileEntity;
 import net.minecraft.src.World;
 import chemicraft.CommonProxy;
+import chemicraft.ContainerScienceCraftingTable;
+import chemicraft.GuiScienceCraftingTable;
+import chemicraft.TileEntityScienceCraftingTable;
 import cpw.mods.fml.client.FMLClientHandler;
 
 public class ClientProxy extends CommonProxy
@@ -17,6 +21,13 @@ public class ClientProxy extends CommonProxy
        @Override
        public Object getClientGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z)
        {
+               if(!world.blockExists(x, y, z)) return null;
+
+               TileEntity tileEntity = world.getBlockTileEntity(x, y, z);
+
+               if(tileEntity instanceof TileEntityScienceCraftingTable){
+                       return new GuiScienceCraftingTable(player.inventory, (TileEntityScienceCraftingTable)tileEntity);
+               }
                return null;
        }