More Alchemical Chest/Inventory stuff
This commit is contained in:
parent
be86ee89af
commit
f8237d6c89
15 changed files with 78 additions and 36 deletions
|
@ -5,13 +5,19 @@ import com.pahimar.ee3.lib.GuiIds;
|
|||
import com.pahimar.ee3.lib.RenderIds;
|
||||
import com.pahimar.ee3.lib.Strings;
|
||||
import com.pahimar.ee3.tileentity.TileAlchemicalChest;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.block.ITileEntityProvider;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Equivalent-Exchange-3
|
||||
* <p/>
|
||||
|
@ -33,7 +39,7 @@ public class BlockAlchemicalChest extends BlockEE implements ITileEntityProvider
|
|||
@Override
|
||||
public TileEntity createNewTileEntity(World world)
|
||||
{
|
||||
return new TileAlchemicalChest();
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -42,6 +48,15 @@ public class BlockAlchemicalChest extends BlockEE implements ITileEntityProvider
|
|||
return new TileAlchemicalChest(metaData);
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void getSubBlocks(int id, CreativeTabs creativeTabs, List list)
|
||||
{
|
||||
for (int meta = 0; meta < 3; meta++)
|
||||
{
|
||||
list.add(new ItemStack(id, 1, meta));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderAsNormalBlock()
|
||||
{
|
||||
|
|
|
@ -1,9 +1,6 @@
|
|||
package com.pahimar.ee3.block;
|
||||
|
||||
import com.pahimar.ee3.item.ItemAlchemicalFuelBlock;
|
||||
import com.pahimar.ee3.item.ItemInfusedClothBlock;
|
||||
import com.pahimar.ee3.item.ItemInfusedPlanksBlock;
|
||||
import com.pahimar.ee3.item.ItemInfusedWoodBlock;
|
||||
import com.pahimar.ee3.item.*;
|
||||
import com.pahimar.ee3.lib.BlockIds;
|
||||
import com.pahimar.ee3.lib.Strings;
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
|
@ -43,16 +40,16 @@ public class ModBlocks
|
|||
infusedCloth = new BlockInfusedCloth(BlockIds.INFUSED_CLOTH);
|
||||
infusedPlanks = new BlockInfusedPlanks(BlockIds.INFUSED_PLANKS);
|
||||
|
||||
GameRegistry.registerBlock(alchemicalChest, "block." + Strings.ALCHEMICAL_CHEST_NAME);
|
||||
GameRegistry.registerBlock(alchemicalFuel, ItemAlchemicalFuelBlock.class, "block." + Strings.ALCHEMICAL_FUEL_NAME);
|
||||
GameRegistry.registerBlock(alchemicalChest, ItemBlockAlchemicalChest.class, "block." + Strings.ALCHEMICAL_CHEST_NAME);
|
||||
GameRegistry.registerBlock(alchemicalFuel, ItemBlockAlchemicalFuel.class, "block." + Strings.ALCHEMICAL_FUEL_NAME);
|
||||
GameRegistry.registerBlock(alchemySquare, "block." + Strings.ALCHEMY_SQUARE_NAME);
|
||||
GameRegistry.registerBlock(aludelBase, "block." + Strings.ALUDEL_NAME);
|
||||
GameRegistry.registerBlock(calcinator, "block." + Strings.CALCINATOR_NAME);
|
||||
GameRegistry.registerBlock(chalk, "block." + Strings.CHALK_NAME);
|
||||
GameRegistry.registerBlock(glassBell, "block." + Strings.GLASS_BELL_NAME);
|
||||
GameRegistry.registerBlock(researchStation, "block." + Strings.RESEARCH_STATION_NAME);
|
||||
GameRegistry.registerBlock(infusedCloth, ItemInfusedClothBlock.class, "block." + Strings.INFUSED_CLOTH_NAME);
|
||||
GameRegistry.registerBlock(infusedWood, ItemInfusedWoodBlock.class, "block." + Strings.INFUSED_WOOD_NAME);
|
||||
GameRegistry.registerBlock(infusedPlanks, ItemInfusedPlanksBlock.class, "block." + Strings.INFUSED_PLANKS_NAME);
|
||||
GameRegistry.registerBlock(infusedCloth, ItemBlockInfusedCloth.class, "block." + Strings.INFUSED_CLOTH_NAME);
|
||||
GameRegistry.registerBlock(infusedWood, ItemBlockInfusedWood.class, "block." + Strings.INFUSED_WOOD_NAME);
|
||||
GameRegistry.registerBlock(infusedPlanks, ItemBlockInfusedPlanks.class, "block." + Strings.INFUSED_PLANKS_NAME);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -45,22 +45,22 @@ public class ItemAlchemicalChestRenderer implements IItemRenderer
|
|||
{
|
||||
case ENTITY:
|
||||
{
|
||||
renderAlchemicalChest(0.5F, 0.5F, 0.5F);
|
||||
renderAlchemicalChest(0.5F, 0.5F, 0.5F, item.getItemDamage());
|
||||
break;
|
||||
}
|
||||
case EQUIPPED:
|
||||
{
|
||||
renderAlchemicalChest(1.0F, 1.0F, 1.0F);
|
||||
renderAlchemicalChest(1.0F, 1.0F, 1.0F, item.getItemDamage());
|
||||
break;
|
||||
}
|
||||
case EQUIPPED_FIRST_PERSON:
|
||||
{
|
||||
renderAlchemicalChest(1.0F, 1.0F, 1.0F);
|
||||
renderAlchemicalChest(1.0F, 1.0F, 1.0F, item.getItemDamage());
|
||||
break;
|
||||
}
|
||||
case INVENTORY:
|
||||
{
|
||||
renderAlchemicalChest(0.0F, 0.075F, 0.0F);
|
||||
renderAlchemicalChest(0.0F, 0.075F, 0.0F, item.getItemDamage());
|
||||
break;
|
||||
}
|
||||
default:
|
||||
|
@ -68,9 +68,21 @@ public class ItemAlchemicalChestRenderer implements IItemRenderer
|
|||
}
|
||||
}
|
||||
|
||||
private void renderAlchemicalChest(float x, float y, float z)
|
||||
private void renderAlchemicalChest(float x, float y, float z, int metaData)
|
||||
{
|
||||
FMLClientHandler.instance().getClient().renderEngine.bindTexture(Textures.MODEL_ALCHEMICAL_CHEST);
|
||||
if (metaData == 0)
|
||||
{
|
||||
FMLClientHandler.instance().getClient().renderEngine.bindTexture(Textures.MODEL_ALCHEMICAL_CHEST_SMALL);
|
||||
}
|
||||
else if (metaData == 1)
|
||||
{
|
||||
FMLClientHandler.instance().getClient().renderEngine.bindTexture(Textures.MODEL_ALCHEMICAL_CHEST_MEDIUM);
|
||||
}
|
||||
else if (metaData == 2)
|
||||
{
|
||||
FMLClientHandler.instance().getClient().renderEngine.bindTexture(Textures.MODEL_ALCHEMICAL_CHEST_LARGE);
|
||||
}
|
||||
|
||||
GL11.glPushMatrix(); //start
|
||||
GL11.glTranslatef(x, y, z); //size
|
||||
GL11.glRotatef(180, 1, 0, 0);
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package com.pahimar.ee3.handler;
|
||||
|
||||
import com.pahimar.ee3.client.gui.inventory.*;
|
||||
import com.pahimar.ee3.helper.LogHelper;
|
||||
import com.pahimar.ee3.inventory.*;
|
||||
import com.pahimar.ee3.lib.GuiIds;
|
||||
import com.pahimar.ee3.tileentity.TileAlchemicalChest;
|
||||
|
@ -29,16 +30,19 @@ public class GuiHandler implements IGuiHandler
|
|||
else if (ID == GuiIds.ALCHEMICAL_CHEST_SMALL)
|
||||
{
|
||||
TileAlchemicalChest tileAlchemicalChest = (TileAlchemicalChest) world.getBlockTileEntity(x, y, z);
|
||||
LogHelper.debug("State: " + tileAlchemicalChest.getState());
|
||||
return new ContainerAlchemicalChestSmall(player.inventory, tileAlchemicalChest);
|
||||
}
|
||||
else if (ID == GuiIds.ALCHEMICAL_CHEST_MEDIUM)
|
||||
{
|
||||
TileAlchemicalChest tileAlchemicalChest = (TileAlchemicalChest) world.getBlockTileEntity(x, y, z);
|
||||
LogHelper.debug("State: " + tileAlchemicalChest.getState());
|
||||
return new ContainerAlchemicalChestMedium(player.inventory, tileAlchemicalChest);
|
||||
}
|
||||
else if (ID == GuiIds.ALCHEMICAL_CHEST_LARGE)
|
||||
{
|
||||
TileAlchemicalChest tileAlchemicalChest = (TileAlchemicalChest) world.getBlockTileEntity(x, y, z);
|
||||
LogHelper.debug("State: " + tileAlchemicalChest.getState());
|
||||
return new ContainerAlchemicalChestLarge(player.inventory, tileAlchemicalChest);
|
||||
}
|
||||
else if (ID == GuiIds.ALCHEMICAL_BAG)
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package com.pahimar.ee3.inventory;
|
||||
|
||||
import com.pahimar.ee3.helper.LogHelper;
|
||||
import com.pahimar.ee3.tileentity.TileAlchemicalChest;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
|
@ -27,7 +28,7 @@ public class ContainerAlchemicalChestLarge extends Container
|
|||
public ContainerAlchemicalChestLarge(InventoryPlayer inventoryPlayer, TileAlchemicalChest tileAlchemicalChest)
|
||||
{
|
||||
this.tileAlchemicalChest = tileAlchemicalChest;
|
||||
|
||||
LogHelper.debug("State: " + this.tileAlchemicalChest.getState() + ", Inventory size: " + this.tileAlchemicalChest.getSizeInventory());
|
||||
tileAlchemicalChest.openChest();
|
||||
|
||||
// Add the Alchemical Chest slots to the container
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package com.pahimar.ee3.inventory;
|
||||
|
||||
import com.pahimar.ee3.helper.LogHelper;
|
||||
import com.pahimar.ee3.tileentity.TileAlchemicalChest;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
|
@ -27,7 +28,7 @@ public class ContainerAlchemicalChestMedium extends Container
|
|||
public ContainerAlchemicalChestMedium(InventoryPlayer inventoryPlayer, TileAlchemicalChest tileAlchemicalChest)
|
||||
{
|
||||
this.tileAlchemicalChest = tileAlchemicalChest;
|
||||
|
||||
LogHelper.debug("State: " + this.tileAlchemicalChest.getState() + ", Inventory size: " + this.tileAlchemicalChest.getSizeInventory());
|
||||
tileAlchemicalChest.openChest();
|
||||
|
||||
// Add the Alchemical Chest slots to the container
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package com.pahimar.ee3.inventory;
|
||||
|
||||
import com.pahimar.ee3.helper.LogHelper;
|
||||
import com.pahimar.ee3.tileentity.TileAlchemicalChest;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
|
@ -27,7 +28,7 @@ public class ContainerAlchemicalChestSmall extends Container
|
|||
public ContainerAlchemicalChestSmall(InventoryPlayer inventoryPlayer, TileAlchemicalChest tileAlchemicalChest)
|
||||
{
|
||||
this.tileAlchemicalChest = tileAlchemicalChest;
|
||||
|
||||
LogHelper.debug("State: " + this.tileAlchemicalChest.getState() + ", Inventory size: " + this.tileAlchemicalChest.getSizeInventory());
|
||||
tileAlchemicalChest.openChest();
|
||||
|
||||
// Add the Alchemical Chest slots to the container
|
||||
|
|
|
@ -0,0 +1,18 @@
|
|||
package com.pahimar.ee3.item;
|
||||
|
||||
import net.minecraft.item.ItemBlock;
|
||||
|
||||
public class ItemBlockAlchemicalChest extends ItemBlock
|
||||
{
|
||||
public ItemBlockAlchemicalChest(int id)
|
||||
{
|
||||
super(id);
|
||||
this.setHasSubtypes(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMetadata(int meta)
|
||||
{
|
||||
return meta;
|
||||
}
|
||||
}
|
|
@ -4,9 +4,9 @@ import com.pahimar.ee3.block.ModBlocks;
|
|||
import com.pahimar.ee3.lib.Strings;
|
||||
import net.minecraft.item.ItemMultiTextureTile;
|
||||
|
||||
public class ItemAlchemicalFuelBlock extends ItemMultiTextureTile
|
||||
public class ItemBlockAlchemicalFuel extends ItemMultiTextureTile
|
||||
{
|
||||
public ItemAlchemicalFuelBlock(int id)
|
||||
public ItemBlockAlchemicalFuel(int id)
|
||||
{
|
||||
super(id, ModBlocks.alchemicalFuel, Strings.ALCHEMICAL_FUEL_SUBTYPE_NAMES);
|
||||
}
|
|
@ -2,9 +2,9 @@ package com.pahimar.ee3.item;
|
|||
|
||||
import net.minecraft.item.ItemBlock;
|
||||
|
||||
public class ItemInfusedClothBlock extends ItemBlock
|
||||
public class ItemBlockInfusedCloth extends ItemBlock
|
||||
{
|
||||
public ItemInfusedClothBlock(int id)
|
||||
public ItemBlockInfusedCloth(int id)
|
||||
{
|
||||
super(id);
|
||||
this.setHasSubtypes(true);
|
|
@ -11,9 +11,9 @@ import net.minecraft.util.StatCollector;
|
|||
|
||||
import java.util.List;
|
||||
|
||||
public class ItemInfusedPlanksBlock extends ItemBlock
|
||||
public class ItemBlockInfusedPlanks extends ItemBlock
|
||||
{
|
||||
public ItemInfusedPlanksBlock(int id)
|
||||
public ItemBlockInfusedPlanks(int id)
|
||||
{
|
||||
super(id);
|
||||
this.setHasSubtypes(true);
|
|
@ -11,9 +11,9 @@ import net.minecraft.util.StatCollector;
|
|||
|
||||
import java.util.List;
|
||||
|
||||
public class ItemInfusedWoodBlock extends ItemBlock
|
||||
public class ItemBlockInfusedWood extends ItemBlock
|
||||
{
|
||||
public ItemInfusedWoodBlock(int id)
|
||||
public ItemBlockInfusedWood(int id)
|
||||
{
|
||||
super(id);
|
||||
this.setHasSubtypes(true);
|
|
@ -1,6 +1,7 @@
|
|||
package com.pahimar.ee3.tileentity;
|
||||
|
||||
import com.pahimar.ee3.block.ModBlocks;
|
||||
import com.pahimar.ee3.helper.LogHelper;
|
||||
import com.pahimar.ee3.lib.Sounds;
|
||||
import com.pahimar.ee3.lib.Strings;
|
||||
import net.minecraft.block.Block;
|
||||
|
@ -49,11 +50,6 @@ public class TileAlchemicalChest extends TileEE implements IInventory
|
|||
*/
|
||||
private ItemStack[] inventory;
|
||||
|
||||
public TileAlchemicalChest()
|
||||
{
|
||||
this(0);
|
||||
}
|
||||
|
||||
public TileAlchemicalChest(int metaData)
|
||||
{
|
||||
super();
|
||||
|
@ -71,10 +67,6 @@ public class TileAlchemicalChest extends TileEE implements IInventory
|
|||
{
|
||||
inventory = new ItemStack[LARGE_INVENTORY_SIZE];
|
||||
}
|
||||
else
|
||||
{
|
||||
inventory = new ItemStack[SMALL_INVENTORY_SIZE];
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -87,6 +79,7 @@ public class TileAlchemicalChest extends TileEE implements IInventory
|
|||
@Override
|
||||
public ItemStack getStackInSlot(int slotIndex)
|
||||
{
|
||||
LogHelper.debug(inventory.length);
|
||||
return inventory[slotIndex];
|
||||
}
|
||||
|
||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 3.9 KiB After Width: | Height: | Size: 3.4 KiB |
Before Width: | Height: | Size: 3.9 KiB After Width: | Height: | Size: 3.9 KiB |
Loading…
Reference in a new issue