Lots of work on various things

This commit is contained in:
pahimar 2013-02-26 16:08:43 -05:00
parent 77697c78b2
commit 87c0dfea75
20 changed files with 415 additions and 134 deletions

View file

@ -10,6 +10,7 @@ import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
import net.minecraftforge.common.ForgeDirection;
import com.pahimar.ee3.EquivalentExchange3;
import com.pahimar.ee3.lib.GuiIds;
@ -71,16 +72,23 @@ public class BlockAlchemicalChest extends BlockEE {
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int par6, float par7, float par8, float par9) {
if (!world.isRemote) {
TileAlchemicalChest tileAlchemicalChest = (TileAlchemicalChest) world.getBlockTileEntity(x, y, z);
if (tileAlchemicalChest != null) {
player.openGui(EquivalentExchange3.instance, GuiIds.ALCHEMICAL_CHEST, world, x, y, z);
}
if (player.isSneaking()) {
return true;
}
else if (world.isBlockSolidOnSide(x, y + 1, z, ForgeDirection.DOWN)) {
return true;
}
else {
if (!world.isRemote) {
TileAlchemicalChest tileAlchemicalChest = (TileAlchemicalChest) world.getBlockTileEntity(x, y, z);
if (tileAlchemicalChest != null) {
player.openGui(EquivalentExchange3.instance, GuiIds.ALCHEMICAL_CHEST, world, x, y, z);
}
}
return true;
}
return true;
}
private void dropInventory(World world, int x, int y, int z) {

View file

@ -2,13 +2,6 @@ package com.pahimar.ee3.block;
import java.util.Random;
import com.pahimar.ee3.EquivalentExchange3;
import com.pahimar.ee3.lib.GuiIds;
import com.pahimar.ee3.lib.RenderIds;
import com.pahimar.ee3.lib.Strings;
import com.pahimar.ee3.tileentity.TileAludel;
import com.pahimar.ee3.tileentity.TileCalcinator;
import net.minecraft.block.material.Material;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.player.EntityPlayer;
@ -18,28 +11,34 @@ import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
import com.pahimar.ee3.EquivalentExchange3;
import com.pahimar.ee3.lib.GuiIds;
import com.pahimar.ee3.lib.RenderIds;
import com.pahimar.ee3.lib.Strings;
import com.pahimar.ee3.tileentity.TileAludel;
public class BlockAludel extends BlockEE {
/**
* Is the random generator used by aludel to drop the inventory contents in random directions.
* Is the random generator used by aludel to drop the inventory contents in
* random directions.
*/
private Random rand = new Random();
public BlockAludel(int id) {
super(id, Material.rock);
this.setBlockName(Strings.ALUDEL_NAME);
this.setCreativeTab(EquivalentExchange3.tabsEE3);
this.setHardness(5F);
}
@Override
public TileEntity createNewTileEntity(World world) {
return new TileAludel();
}
@Override
public boolean renderAsNormalBlock() {
@ -66,48 +65,53 @@ public class BlockAludel extends BlockEE {
@Override
public void breakBlock(World world, int x, int y, int z, int id, int meta) {
dropInventory(world, x, y, z);
super.breakBlock(world, x, y, z, id, meta);
}
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int par6, float par7, float par8, float par9) {
if (!world.isRemote) {
TileAludel tileAludel = (TileAludel) world.getBlockTileEntity(x, y, z);
if (tileAludel != null) {
player.openGui(EquivalentExchange3.instance, GuiIds.ALUDEL, world, x, y, z);
}
if (player.isSneaking()) {
return false;
}
return true;
}
else {
if (!world.isRemote) {
TileAludel tileAludel = (TileAludel) world.getBlockTileEntity(x, y, z);
if (tileAludel != null) {
player.openGui(EquivalentExchange3.instance, GuiIds.ALUDEL, world, x, y, z);
}
}
return true;
}
}
private void dropInventory(World world, int x, int y, int z) {
TileEntity tileEntity = world.getBlockTileEntity(x, y, z);
if (!(tileEntity instanceof IInventory)) {
return;
}
IInventory inventory = (IInventory) tileEntity;
for (int i = 0; i < inventory.getSizeInventory(); i++) {
ItemStack itemStack = inventory.getStackInSlot(i);
if ((itemStack != null) && (itemStack.stackSize > 0)) {
float dX = this.rand.nextFloat() * 0.8F + 0.1F;
float dY = this.rand.nextFloat() * 0.8F + 0.1F;
float dZ = this.rand.nextFloat() * 0.8F + 0.1F;
EntityItem entityItem = new EntityItem(world, x + dX, y + dY, z + dZ, new ItemStack(itemStack.itemID, itemStack.stackSize, itemStack.getItemDamage()));
if (itemStack.hasTagCompound()) {
entityItem.getEntityItem().setTagCompound((NBTTagCompound)itemStack.getTagCompound().copy());
entityItem.getEntityItem().setTagCompound((NBTTagCompound) itemStack.getTagCompound().copy());
}
float factor = 0.05F;

View file

@ -81,16 +81,20 @@ public class BlockCalcinator extends BlockEE {
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int par6, float par7, float par8, float par9) {
if (!world.isRemote) {
TileCalcinator tileCalcinator = (TileCalcinator) world.getBlockTileEntity(x, y, z);
if (tileCalcinator != null) {
player.openGui(EquivalentExchange3.instance, GuiIds.CALCINATOR, world, x, y, z);
}
if (player.isSneaking()) {
return false;
}
else {
if (!world.isRemote) {
TileCalcinator tileCalcinator = (TileCalcinator) world.getBlockTileEntity(x, y, z);
if (tileCalcinator != null) {
player.openGui(EquivalentExchange3.instance, GuiIds.CALCINATOR, world, x, y, z);
}
}
return true;
}
return true;
}
private void dropInventory(World world, int x, int y, int z) {

View file

@ -2,10 +2,12 @@ package com.pahimar.ee3.client.gui.inventory;
import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.util.StatCollector;
import org.lwjgl.opengl.GL11;
import com.pahimar.ee3.core.helper.NBTHelper;
import com.pahimar.ee3.inventory.ContainerAlchemicalBag;
import com.pahimar.ee3.lib.Sprites;
import com.pahimar.ee3.lib.Strings;
@ -40,4 +42,18 @@ public class GuiAlchemicalBag extends GuiContainer {
this.drawTexturedModalRect(xStart, yStart, 0, 0, this.xSize, this.ySize);
}
public void onGuiClosed() {
super.onGuiClosed();
if (this.mc.thePlayer != null) {
for (ItemStack itemStack : this.mc.thePlayer.inventory.mainInventory) {
if (itemStack != null) {
if (NBTHelper.hasTag(itemStack, Strings.NBT_ITEM_ALCHEMY_BAG_GUI_OPEN)) {
NBTHelper.removeTag(itemStack, Strings.NBT_ITEM_ALCHEMY_BAG_GUI_OPEN);
}
}
}
}
}
}

View file

@ -0,0 +1,49 @@
package com.pahimar.ee3.client.gui.inventory;
import org.lwjgl.opengl.GL11;
import com.pahimar.ee3.inventory.ContainerAludel;
import com.pahimar.ee3.lib.Sprites;
import com.pahimar.ee3.lib.Strings;
import com.pahimar.ee3.tileentity.TileAludel;
import cpw.mods.fml.common.registry.LanguageRegistry;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.Container;
import net.minecraft.util.StatCollector;
@SideOnly(Side.CLIENT)
public class GuiAludel extends GuiContainer {
private TileAludel tileAludel;
public GuiAludel(InventoryPlayer inventoryPlayer, TileAludel tileAludel) {
super(new ContainerAludel(inventoryPlayer, tileAludel));
this.tileAludel = tileAludel;
this.xSize = 176;
this.ySize = 187;
}
@Override
protected void drawGuiContainerForegroundLayer(int x, int y) {
this.fontRenderer.drawString(LanguageRegistry.instance().getStringLocalization(Strings.GUI_ALUDEL_NAME), 73, 6, 4210752);
this.fontRenderer.drawString(StatCollector.translateToLocal("container.inventory"), 8, this.ySize - 93, 4210752);
}
@Override
protected void drawGuiContainerBackgroundLayer(float var1, int var2, int var3) {
int backgroundTexture = this.mc.renderEngine.getTexture(Sprites.GUI_ALUDEL);
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
this.mc.renderEngine.bindTexture(backgroundTexture);
int xStart = (this.width - this.xSize) / 2;
int yStart = (this.height - this.ySize) / 2;
this.drawTexturedModalRect(xStart, yStart, 0, 0, this.xSize, this.ySize);
}
}

View file

@ -30,6 +30,9 @@ public class ItemEventHandler {
else if (NBTHelper.hasTag(event.item.getEntityItem(), Strings.NBT_ITEM_TRANSMUTATION_GUI_OPEN)) {
NBTHelper.removeTag(event.item.getEntityItem(), Strings.NBT_ITEM_TRANSMUTATION_GUI_OPEN);
}
else if (NBTHelper.hasTag(event.item.getEntityItem(), Strings.NBT_ITEM_ALCHEMY_BAG_GUI_OPEN)) {
NBTHelper.removeTag(event.item.getEntityItem(), Strings.NBT_ITEM_ALCHEMY_BAG_GUI_OPEN);
}
}
@ForgeSubscribe
@ -41,6 +44,9 @@ public class ItemEventHandler {
else if (NBTHelper.hasTag(event.entityItem.getEntityItem(), Strings.NBT_ITEM_TRANSMUTATION_GUI_OPEN)) {
NBTHelper.removeTag(event.entityItem.getEntityItem(), Strings.NBT_ITEM_TRANSMUTATION_GUI_OPEN);
}
else if (NBTHelper.hasTag(event.entityItem.getEntityItem(), Strings.NBT_ITEM_ALCHEMY_BAG_GUI_OPEN)) {
NBTHelper.removeTag(event.entityItem.getEntityItem(), Strings.NBT_ITEM_ALCHEMY_BAG_GUI_OPEN);
}
}
@ForgeSubscribe
@ -53,6 +59,9 @@ public class ItemEventHandler {
else if (NBTHelper.hasTag(entityItem.getEntityItem(), Strings.NBT_ITEM_TRANSMUTATION_GUI_OPEN)) {
NBTHelper.removeTag(entityItem.getEntityItem(), Strings.NBT_ITEM_TRANSMUTATION_GUI_OPEN);
}
else if (NBTHelper.hasTag(entityItem.getEntityItem(), Strings.NBT_ITEM_ALCHEMY_BAG_GUI_OPEN)) {
NBTHelper.removeTag(entityItem.getEntityItem(), Strings.NBT_ITEM_ALCHEMY_BAG_GUI_OPEN);
}
}
}
}

View file

@ -7,11 +7,13 @@ import net.minecraft.world.World;
import com.pahimar.ee3.client.gui.inventory.GuiAlchemicalBag;
import com.pahimar.ee3.client.gui.inventory.GuiAlchemicalChest;
import com.pahimar.ee3.client.gui.inventory.GuiAludel;
import com.pahimar.ee3.client.gui.inventory.GuiCalcinator;
import com.pahimar.ee3.client.gui.inventory.GuiPortableCrafting;
import com.pahimar.ee3.client.gui.inventory.GuiPortableTransmutation;
import com.pahimar.ee3.inventory.ContainerAlchemicalBag;
import com.pahimar.ee3.inventory.ContainerAlchemicalChest;
import com.pahimar.ee3.inventory.ContainerAludel;
import com.pahimar.ee3.inventory.ContainerCalcinator;
import com.pahimar.ee3.inventory.ContainerPortableCrafting;
import com.pahimar.ee3.inventory.ContainerPortableTransmutation;
@ -105,6 +107,10 @@ public class CommonProxy implements IGuiHandler {
// TODO Alchemical Bag inventory work is incomplete
return new ContainerAlchemicalBag(player.inventory);
}
else if (ID == GuiIds.ALUDEL) {
TileAludel tileAludel = (TileAludel) world.getBlockTileEntity(x, y, z);
return new ContainerAludel(player.inventory, tileAludel);
}
return null;
}
@ -130,6 +136,10 @@ public class CommonProxy implements IGuiHandler {
// TODO Alchemical Bag inventory work is incomplete
return new GuiAlchemicalBag(player.inventory);
}
else if (ID == GuiIds.ALUDEL) {
TileAludel tileAludel = (TileAludel) world.getBlockTileEntity(x, y, z);
return new GuiAludel(player.inventory, tileAludel);
}
return null;
}

View file

@ -0,0 +1,109 @@
package com.pahimar.ee3.inventory;
import java.util.UUID;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.world.WorldSavedData;
import com.pahimar.ee3.lib.Strings;
public class AlchemicalBagSavedData extends WorldSavedData implements IInventory {
public UUID uuid;
public ItemStack[] inventory;
private final int INVENTORY_SIZE = 13 * 4;
public AlchemicalBagSavedData(String filePath) {
super(filePath);
inventory = new ItemStack[INVENTORY_SIZE];
}
@Override
public void readFromNBT(NBTTagCompound var1) {
// TODO Auto-generated method stub
}
@Override
public void writeToNBT(NBTTagCompound var1) {
// TODO Auto-generated method stub
}
@Override
public int getSizeInventory() {
return this.inventory.length;
}
@Override
public ItemStack getStackInSlot(int slot) {
return this.inventory[slot];
}
@Override
public ItemStack decrStackSize(int var1, int var2) {
// TODO Auto-generated method stub
return null;
}
@Override
public ItemStack getStackInSlotOnClosing(int var1) {
// TODO Auto-generated method stub
return null;
}
@Override
public void setInventorySlotContents(int var1, ItemStack var2) {
// TODO Auto-generated method stub
}
@Override
public String getInvName() {
return "worldsaveddata" + "." + Strings.ALCHEMY_BAG_NAME;
}
@Override
public int getInventoryStackLimit() {
return 64;
}
@Override
public void onInventoryChanged() {
// TODO Auto-generated method stub
}
@Override
public boolean isUseableByPlayer(EntityPlayer var1) {
// TODO Auto-generated method stub
return false;
}
@Override
public void openChest() {
}
@Override
public void closeChest() {
}
}

View file

@ -1,15 +1,18 @@
package com.pahimar.ee3.inventory;
import com.pahimar.ee3.core.helper.NBTHelper;
import com.pahimar.ee3.lib.Strings;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.Container;
import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack;
public class ContainerAlchemicalBag extends Container {
public ContainerAlchemicalBag(InventoryPlayer inventoryPlayer) {
// Add the player's inventory slots to the container
for (int inventoryRowIndex = 0; inventoryRowIndex < 3; ++inventoryRowIndex) {
for (int inventoryColumnIndex = 0; inventoryColumnIndex < 9; ++inventoryColumnIndex) {
@ -22,11 +25,27 @@ public class ContainerAlchemicalBag extends Container {
this.addSlotToContainer(new Slot(inventoryPlayer, actionBarSlotIndex, 44 + actionBarSlotIndex * 18, 162));
}
}
@Override
public boolean canInteractWith(EntityPlayer var1) {
return true;
}
@Override
public void onCraftGuiClosed(EntityPlayer player) {
super.onCraftGuiClosed(player);
if (!player.worldObj.isRemote) {
InventoryPlayer invPlayer = player.inventory;
for (ItemStack itemStack : invPlayer.mainInventory) {
if (itemStack != null) {
if (NBTHelper.hasTag(itemStack, Strings.NBT_ITEM_ALCHEMY_BAG_GUI_OPEN)) {
NBTHelper.removeTag(itemStack, Strings.NBT_ITEM_ALCHEMY_BAG_GUI_OPEN);
}
}
}
}
}
}

View file

@ -12,11 +12,11 @@ public class ContainerAlchemicalChest extends Container {
private TileAlchemicalChest tileAlchemicalChest;
private int numChestRows = 4;
private int numChestColumns = 13;
private final int CHEST_INVENTORY_ROWS = 4;
private final int CHEST_INVENTORY_COLUMNS = 13;
private int numPlayerRows = 3;
private int numPlayerColumns = 9;
private final int PLAYER_INVENTORY_ROWS = 3;
private final int PLAYER_INVENTORY_COLUMNS = 9;
public ContainerAlchemicalChest(InventoryPlayer inventoryPlayer, TileAlchemicalChest tileAlchemicalChest) {
@ -25,21 +25,21 @@ public class ContainerAlchemicalChest extends Container {
tileAlchemicalChest.openChest();
// Add the Alchemical Chest slots to the container
for (int chestRowIndex = 0; chestRowIndex < numChestRows; ++chestRowIndex) {
for (int chestColumnIndex = 0; chestColumnIndex < numChestColumns; ++chestColumnIndex) {
for (int chestRowIndex = 0; chestRowIndex < CHEST_INVENTORY_ROWS; ++chestRowIndex) {
for (int chestColumnIndex = 0; chestColumnIndex < CHEST_INVENTORY_COLUMNS; ++chestColumnIndex) {
this.addSlotToContainer(new Slot(tileAlchemicalChest, chestColumnIndex + chestRowIndex * 13, 8 + chestColumnIndex * 18, 18 + chestRowIndex * 18));
}
}
// Add the player's inventory slots to the container
for (int inventoryRowIndex = 0; inventoryRowIndex < numPlayerRows; ++inventoryRowIndex) {
for (int inventoryColumnIndex = 0; inventoryColumnIndex < numPlayerColumns; ++inventoryColumnIndex) {
for (int inventoryRowIndex = 0; inventoryRowIndex < PLAYER_INVENTORY_ROWS; ++inventoryRowIndex) {
for (int inventoryColumnIndex = 0; inventoryColumnIndex < PLAYER_INVENTORY_COLUMNS; ++inventoryColumnIndex) {
this.addSlotToContainer(new Slot(inventoryPlayer, inventoryColumnIndex + inventoryRowIndex * 9 + 9, 44 + inventoryColumnIndex * 18, 104 + inventoryRowIndex * 18));
}
}
// Add the player's action bar slots to the container
for (int actionBarSlotIndex = 0; actionBarSlotIndex < numPlayerColumns; ++actionBarSlotIndex) {
for (int actionBarSlotIndex = 0; actionBarSlotIndex < PLAYER_INVENTORY_COLUMNS; ++actionBarSlotIndex) {
this.addSlotToContainer(new Slot(inventoryPlayer, actionBarSlotIndex, 44 + actionBarSlotIndex * 18, 162));
}
}
@ -68,12 +68,12 @@ public class ContainerAlchemicalChest extends Container {
ItemStack itemStack = slot.getStack();
newItemStack = itemStack.copy();
if (slotIndex < (numChestRows * numChestColumns)) {
if (!this.mergeItemStack(itemStack, (numChestRows * numChestColumns), this.inventorySlots.size(), true)) {
if (slotIndex < (CHEST_INVENTORY_ROWS * CHEST_INVENTORY_COLUMNS)) {
if (!this.mergeItemStack(itemStack, (CHEST_INVENTORY_ROWS * CHEST_INVENTORY_COLUMNS), this.inventorySlots.size(), true)) {
return null;
}
}
else if (!this.mergeItemStack(itemStack, 0, (numChestRows * numChestColumns), false)) {
else if (!this.mergeItemStack(itemStack, 0, (CHEST_INVENTORY_ROWS * CHEST_INVENTORY_COLUMNS), false)) {
return null;
}

View file

@ -0,0 +1,50 @@
package com.pahimar.ee3.inventory;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.Container;
import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack;
import com.pahimar.ee3.tileentity.TileAludel;
public class ContainerAludel extends Container {
private TileAludel tileAludel;
private final int PLAYER_INVENTORY_ROWS = 3;
private final int PLAYER_INVENTORY_COLUMNS = 9;
public ContainerAludel(InventoryPlayer inventoryPlayer, TileAludel tileAludel) {
this.tileAludel = tileAludel;
this.addSlotToContainer(new Slot(tileAludel, TileAludel.INPUT_INVENTORY_INDEX, 44, 18));
this.addSlotToContainer(new Slot(tileAludel, TileAludel.DUST_INVENTORY_INDEX, 44, 39));
this.addSlotToContainer(new Slot(tileAludel, TileAludel.FUEL_INVENTORY_INDEX, 44, 74));
this.addSlotToContainer(new Slot(tileAludel, TileAludel.OUTPUT_INVENTORY_INDEX, 120, 39));
// Add the player's inventory slots to the container
for (int inventoryRowIndex = 0; inventoryRowIndex < PLAYER_INVENTORY_ROWS; ++inventoryRowIndex) {
for (int inventoryColumnIndex = 0; inventoryColumnIndex < PLAYER_INVENTORY_COLUMNS; ++inventoryColumnIndex) {
this.addSlotToContainer(new Slot(inventoryPlayer, inventoryColumnIndex + inventoryRowIndex * 9 + 9, 8 + inventoryColumnIndex * 18, 106 + inventoryRowIndex * 18));
}
}
// Add the player's action bar slots to the container
for (int actionBarSlotIndex = 0; actionBarSlotIndex < PLAYER_INVENTORY_COLUMNS; ++actionBarSlotIndex) {
this.addSlotToContainer(new Slot(inventoryPlayer, actionBarSlotIndex, 8 + actionBarSlotIndex * 18, 164));
}
}
@Override
public boolean canInteractWith(EntityPlayer var1) {
return true;
}
public ItemStack transferStackInSlot(EntityPlayer entityPlayer, int slotIndex) {
return null;
}
}

View file

@ -3,11 +3,15 @@ package com.pahimar.ee3.item;
import java.util.List;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.util.MathHelper;
import net.minecraft.world.World;
import com.pahimar.ee3.EquivalentExchange3;
import com.pahimar.ee3.core.helper.NBTHelper;
import com.pahimar.ee3.lib.Colours;
import com.pahimar.ee3.lib.GuiIds;
import com.pahimar.ee3.lib.Strings;
import cpw.mods.fml.client.FMLClientHandler;
@ -16,16 +20,30 @@ import cpw.mods.fml.relauncher.SideOnly;
public class ItemAlchemyBag extends ItemEE {
public static final String[] alchemyBagNames = new String[] { "white", "orange", "magenta", "light_blue", "yellow", "lime", "pink", "gray", "light_gray", "cyan", "purple", "blue", "brown", "green", "red", "black" };
public ItemAlchemyBag(int id) {
super(id);
this.setHasSubtypes(true);
this.setIconCoord(7, 0);
this.setItemName(Strings.ALCHEMY_BAG_NAME);
this.setCreativeTab(EquivalentExchange3.tabsEE3);
}
@Override
public ItemStack onItemRightClick(ItemStack itemStack, World world, EntityPlayer entityPlayer) {
if (!world.isRemote) {
NBTHelper.setBoolean(itemStack, Strings.NBT_ITEM_ALCHEMY_BAG_GUI_OPEN, true);
entityPlayer.openGui(EquivalentExchange3.instance, GuiIds.ALCHEMICAL_BAG, entityPlayer.worldObj, (int) entityPlayer.posX, (int) entityPlayer.posY, (int) entityPlayer.posZ);
}
return itemStack;
}
@Override
public boolean getShareTag() {
return true;
}
@SideOnly(Side.CLIENT)
public boolean requiresMultipleRenderPasses() {
@ -33,34 +51,27 @@ public class ItemAlchemyBag extends ItemEE {
return true;
}
@SideOnly(Side.CLIENT)
public int getIconFromDamageForRenderPass(int meta, int renderPass) {
if (renderPass == 0) {
return this.getIconFromDamage(meta);
@Override
public int getIconIndex(ItemStack itemStack, int renderPass) {
if (NBTHelper.hasTag(itemStack, Strings.NBT_ITEM_ALCHEMY_BAG_GUI_OPEN)) {
if (renderPass == 0) {
return this.iconIndex + 2;
}
else {
return this.iconIndex + 1 + 2;
}
}
else {
return this.getIconFromDamage(meta) + 1;
if (renderPass == 0) {
return this.iconIndex;
}
else {
return this.iconIndex + 1;
}
}
}
@SideOnly(Side.CLIENT)
public int getIconFromDamage(int meta) {
if (FMLClientHandler.instance().getClient().currentScreen != null) {
return (this.iconIndex + 2);
}
return this.iconIndex;
}
@SideOnly(Side.CLIENT)
public String getItemNameIS(ItemStack stack) {
int meta = MathHelper.clamp_int(stack.getItemDamage(), 0, 15);
return super.getItemName() + "." + alchemyBagNames[meta];
}
@SideOnly(Side.CLIENT)
public int getColorFromItemStack(ItemStack itemStack, int renderPass) {
@ -120,13 +131,4 @@ public class ItemAlchemyBag extends ItemEE {
}
return returnValue;
}
@SideOnly(Side.CLIENT)
public void getSubItems(int id, CreativeTabs creativeTab, List list) {
for (int meta = 0; meta < 16; ++meta) {
list.add(new ItemStack(id, 1, meta));
}
}
}

View file

@ -25,6 +25,7 @@ public class Strings {
public static final String NBT_ITEM_MODE_KEY = "itemMode";
public static final String NBT_ITEM_CRAFTING_GUI_OPEN = "itemCraftingGuiOpen";
public static final String NBT_ITEM_TRANSMUTATION_GUI_OPEN = "itemTransmutationGuiOpen";
public static final String NBT_ITEM_ALCHEMY_BAG_GUI_OPEN = "itemAlchemyBagGuiOpen";
public static final String NBT_TE_OWNER_KEY = "teOwner";
public static final String NBT_TE_STATE_KEY = "teState";
public static final String NBT_TE_DIRECTION_KEY = "teDirection";

View file

@ -23,6 +23,8 @@ public class TileAlchemicalChest extends TileEE implements IInventory {
/** Server sync counter (once per 20 ticks) */
private int ticksSinceSync;
private final int INVENTORY_SIZE = 13 * 4;
/**
* The ItemStacks that hold the items currently being used in the Alchemical
@ -32,7 +34,7 @@ public class TileAlchemicalChest extends TileEE implements IInventory {
public TileAlchemicalChest() {
inventory = new ItemStack[13 * 4];
inventory = new ItemStack[INVENTORY_SIZE];
}
@Override
@ -69,20 +71,26 @@ public class TileAlchemicalChest extends TileEE implements IInventory {
@Override
public ItemStack getStackInSlotOnClosing(int slot) {
ItemStack itemStack = getStackInSlot(slot);
if (itemStack != null) {
setInventorySlotContents(slot, null);
if (this.inventory[slot] != null) {
ItemStack itemStack = this.inventory[slot];
this.inventory[slot] = null;
return itemStack;
}
else {
return null;
}
return itemStack;
}
@Override
public void setInventorySlotContents(int slot, ItemStack itemStack) {
inventory[slot] = itemStack;
if (itemStack != null && itemStack.stackSize > getInventoryStackLimit()) {
itemStack.stackSize = getInventoryStackLimit();
this.inventory[slot] = itemStack;
if (itemStack != null && itemStack.stackSize > this.getInventoryStackLimit()) {
itemStack.stackSize = this.getInventoryStackLimit();
}
this.onInventoryChanged();
}
@Override

View file

@ -1,12 +1,11 @@
package com.pahimar.ee3.tileentity;
import com.pahimar.ee3.lib.Strings;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
import com.pahimar.ee3.lib.Strings;
public class TileAludel extends TileEE implements IInventory {
@ -15,11 +14,18 @@ public class TileAludel extends TileEE implements IInventory {
*/
private ItemStack[] inventory;
public TileAludel() {
inventory = new ItemStack[4];
}
private final int INVENTORY_SIZE = 4;
public static final int INPUT_INVENTORY_INDEX = 0;
public static final int DUST_INVENTORY_INDEX = 1;
public static final int FUEL_INVENTORY_INDEX = 2;
public static final int OUTPUT_INVENTORY_INDEX = 3;
public TileAludel() {
inventory = new ItemStack[INVENTORY_SIZE];
}
@Override
public int getSizeInventory() {
@ -47,7 +53,7 @@ public class TileAludel extends TileEE implements IInventory {
}
}
}
return itemStack;
}
@ -84,14 +90,14 @@ public class TileAludel extends TileEE implements IInventory {
@Override
public void openChest() {
}
@Override
public void closeChest() {
}
public void readFromNBT(NBTTagCompound nbtTagCompound) {
super.readFromNBT(nbtTagCompound);

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.9 KiB

After

Width:  |  Height:  |  Size: 5.8 KiB

Binary file not shown.

View file

@ -16,22 +16,7 @@
<entry key="item.alchemyDust.azure.name">Azure Dust</entry>
<entry key="item.alchemyDust.amaranthine.name">Amaranthine Dust</entry>
<entry key="item.alchemyDust.iridescent.name">Iridescent Dust</entry>
<entry key="item.alchemyBag.white.name">White Alchemical Bag</entry>
<entry key="item.alchemyBag.orange.name">Orange Alchemical Bag</entry>
<entry key="item.alchemyBag.magenta.name">Magenta Alchemical Bag</entry>
<entry key="item.alchemyBag.light_blue.name">Light Blue Alchemical Bag</entry>
<entry key="item.alchemyBag.yellow.name">Yellow Alchemical Bag</entry>
<entry key="item.alchemyBag.lime.name">Lime Alchemical Bag</entry>
<entry key="item.alchemyBag.pink.name">Pink Alchemical Bag</entry>
<entry key="item.alchemyBag.gray.name">Gray Alchemical Bag</entry>
<entry key="item.alchemyBag.light_gray.name">Light Gray Alchemical Bag</entry>
<entry key="item.alchemyBag.cyan.name">Cyan Alchemical Bag</entry>
<entry key="item.alchemyBag.purple.name">Purple Alchemical Bag</entry>
<entry key="item.alchemyBag.blue.name">Blue Alchemical Bag</entry>
<entry key="item.alchemyBag.brown.name">Brown Alchemical Bag</entry>
<entry key="item.alchemyBag.green.name">Green Alchemical Bag</entry>
<entry key="item.alchemyBag.red.name">Red Alchemical Bag</entry>
<entry key="item.alchemyBag.black.name">Black Alchemical Bag</entry>
<entry key="item.alchemyBag.name">Alchemical Bag</entry>
<entry key="tile.redWaterStill.name">Red Water (Still)</entry>
<entry key="tile.redWaterFlowing.name">Red Water (Flowing)</entry>
<entry key="tile.calcinator.name">Calcinator</entry>
@ -40,6 +25,7 @@
<entry key="gui.calcinator.name">Calcinator</entry>
<entry key="gui.aludel.name">Aludel</entry>
<entry key="gui.alchemicalChest.name">Alchemical Chest</entry>
<entry key="gui.alchemicalBag.name">Alchemical Bag</entry>
<entry key="itemGroup.EE3">Equivalent Exchange 3</entry>
<entry key="version.init_log_message">Initializing remote version check against remote version authority, located at</entry>
<entry key="version.uninitialized">Remote version check failed to initialize properly</entry>