Added subtypes to Alchemical Bags, played with the texture a bit to visually distinguish the different types better (omg texture artists please help me)

This commit is contained in:
pahimar 2014-02-01 21:23:47 -05:00
parent 78d876e78b
commit ab288a587d
14 changed files with 31 additions and 93 deletions

View file

@ -3,6 +3,7 @@ package com.pahimar.ee3.client.gui.inventory;
import com.pahimar.ee3.helper.ItemStackNBTHelper;
import com.pahimar.ee3.inventory.ContainerAlchemicalBag;
import com.pahimar.ee3.lib.Strings;
import com.pahimar.ee3.lib.Textures;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.client.gui.inventory.GuiContainer;
@ -21,10 +22,8 @@ import org.lwjgl.opengl.GL11;
@SideOnly(Side.CLIENT)
public class GuiAlchemicalBag extends GuiContainer
{
public GuiAlchemicalBag(InventoryPlayer inventoryPlayer)
{
super(new ContainerAlchemicalBag(inventoryPlayer));
xSize = 248;
ySize = 186;
@ -33,7 +32,6 @@ public class GuiAlchemicalBag extends GuiContainer
@Override
protected void drawGuiContainerForegroundLayer(int x, int y)
{
fontRenderer.drawString(StatCollector.translateToLocal(Strings.CONTAINER_ALCHEMICAL_BAG_NAME), 8, 6, 4210752);
fontRenderer.drawString(StatCollector.translateToLocal(Strings.CONTAINER_INVENTORY), 44, ySize - 96 + 2, 4210752);
}
@ -41,11 +39,10 @@ public class GuiAlchemicalBag extends GuiContainer
@Override
protected void drawGuiContainerBackgroundLayer(float opacity, int x, int y)
{
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
// this.mc.getTextureManager().bindTexture(...)
//this.mc.getTextureManager().bindTexture(Textures.GUI_ALCHEMICAL_STORAGE);
this.mc.getTextureManager().bindTexture(Textures.GUI_ALCHEMICAL_STORAGE_SMALL);
int xStart = (width - xSize) / 2;
int yStart = (height - ySize) / 2;
@ -55,7 +52,6 @@ public class GuiAlchemicalBag extends GuiContainer
@Override
public void onGuiClosed()
{
super.onGuiClosed();
if (mc.thePlayer != null)

View file

@ -9,12 +9,16 @@ import com.pahimar.ee3.lib.Strings;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.client.renderer.texture.IconRegister;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.Icon;
import net.minecraft.util.MathHelper;
import net.minecraft.world.World;
import java.util.List;
/**
* Equivalent-Exchange-3
* <p/>
@ -24,7 +28,7 @@ import net.minecraft.world.World;
*/
public class ItemAlchemicalBag extends ItemEE implements IDyeable
{
private static final String[] ALCHEMICAL_BAG_ICONS = {"Open", "OpenDrawString", "Closed", "ClosedDrawString"};
private static final String[] ALCHEMICAL_BAG_ICONS = {"open", "closed", "symbolTier1", "symbolTier2", "symbolTier3"};
@SideOnly(Side.CLIENT)
private Icon[] icons;
@ -32,9 +36,21 @@ public class ItemAlchemicalBag extends ItemEE implements IDyeable
public ItemAlchemicalBag(int id)
{
super(id);
this.setHasSubtypes(true);
this.setUnlocalizedName(Strings.ALCHEMICAL_BAG_NAME);
}
@Override
@SuppressWarnings({"rawtypes", "unchecked"})
@SideOnly(Side.CLIENT)
public void getSubItems(int id, CreativeTabs creativeTab, List list)
{
for (int meta = 0; meta < 3; ++meta)
{
list.add(new ItemStack(id, 1, meta));
}
}
@Override
@SideOnly(Side.CLIENT)
public void registerIcons(IconRegister iconRegister)
@ -43,7 +59,7 @@ public class ItemAlchemicalBag extends ItemEE implements IDyeable
for (int i = 0; i < ALCHEMICAL_BAG_ICONS.length; ++i)
{
icons[i] = iconRegister.registerIcon(Strings.RESOURCE_PREFIX + Strings.ALCHEMICAL_BAG_NAME + ALCHEMICAL_BAG_ICONS[i]);
icons[i] = iconRegister.registerIcon(Strings.RESOURCE_PREFIX + Strings.ALCHEMICAL_BAG_NAME + "." + ALCHEMICAL_BAG_ICONS[i]);
}
}
@ -75,10 +91,9 @@ public class ItemAlchemicalBag extends ItemEE implements IDyeable
@Override
public Icon getIcon(ItemStack itemStack, int renderPass)
{
// If the bag is open
if (ItemStackNBTHelper.hasTag(itemStack, Strings.NBT_ITEM_ALCHEMICAL_BAG_GUI_OPEN))
if (renderPass == 0)
{
if (renderPass != 1)
if (ItemStackNBTHelper.hasTag(itemStack, Strings.NBT_ITEM_ALCHEMICAL_BAG_GUI_OPEN))
{
return icons[0];
}
@ -87,17 +102,9 @@ public class ItemAlchemicalBag extends ItemEE implements IDyeable
return icons[1];
}
}
// Else, the bag is closed
else
{
if (renderPass != 1)
{
return icons[2];
}
else
{
return icons[3];
}
return icons[2 + MathHelper.clamp_int(itemStack.getItemDamage(), 0, 3)];
}
}
@ -105,21 +112,14 @@ public class ItemAlchemicalBag extends ItemEE implements IDyeable
@SideOnly(Side.CLIENT)
public int getColorFromItemStack(ItemStack itemStack, int renderPass)
{
if (renderPass == 1)
{
return Integer.parseInt(Colours.PURE_WHITE, 16);
}
else
{
int bagColor = this.getColor(itemStack);
int bagColor = this.getColor(itemStack);
if (bagColor < 0)
{
bagColor = Integer.parseInt(Colours.PURE_WHITE, 16);
}
return bagColor;
if (bagColor < 0)
{
bagColor = Integer.parseInt(Colours.PURE_WHITE, 16);
}
return bagColor;
}
@Override

View file

@ -26,7 +26,6 @@ public class RecipesVanilla
GameRegistry.addRecipe(new ItemStack(ModBlocks.chalk), new Object[]{"cc", "cc", 'c', new ItemStack(ModItems.chalk)});
GameRegistry.addRecipe(new ItemStack(ModBlocks.glassBell), new Object[]{"iii", "i i", "i i", 'i', Block.glass});
GameRegistry.addRecipe(new ItemStack(ModBlocks.aludelBase), new Object[]{"iii", "sis", "iii", 'i', Item.ingotIron, 's', Block.stone});
GameRegistry.addShapelessRecipe(new ItemStack(ModBlocks.infusedPlanks, 4, 0), new ItemStack(ModBlocks.infusedWood, 1, 0));
GameRegistry.addShapelessRecipe(new ItemStack(ModBlocks.infusedPlanks, 4, 1), new ItemStack(ModBlocks.infusedWood, 1, 1));
@ -36,7 +35,8 @@ public class RecipesVanilla
GameRegistry.addRecipe(new ItemStack(ModBlocks.alchemicalChest.blockID, 1, 1), new Object[]{"ppp", "p p", "ppp", 'p', new ItemStack(ModBlocks.infusedPlanks, 1, 1)});
GameRegistry.addRecipe(new ItemStack(ModBlocks.alchemicalChest.blockID, 1, 2), new Object[]{"ppp", "p p", "ppp", 'p', new ItemStack(ModBlocks.infusedPlanks, 1, 2)});
CraftingHelper.addShapedOreRecipe(new ItemStack(ModBlocks.calcinator), new Object[]{"iii", "sis", "s s", 'i', Item.ingotIron, 's', "stone"});
CraftingHelper.addShapedOreRecipe(new ItemStack(ModBlocks.calcinator), new Object[]{"i i", "sis", "s s", 'i', Item.ingotIron, 's', "stone"});
CraftingHelper.addShapedOreRecipe(new ItemStack(ModBlocks.aludelBase), new Object[]{"iii", "sis", "iii", 'i', Item.ingotIron, 's', "stone"});
CraftingHelper.addShapedOreRecipe(new ItemStack(ModBlocks.researchStation), new Object[]{"ipi", " s ", "sss", 'p', "plankWood", 'i', Item.ingotIron, 's', "stone"});
}
@ -47,7 +47,6 @@ public class RecipesVanilla
GameRegistry.addShapelessRecipe(new ItemStack(ModItems.alchemicalFuel, 9, 2), new ItemStack(ModBlocks.alchemicalFuel, 1, 2));
GameRegistry.addRecipe(new ItemStack(ModItems.inertStone), new Object[]{"sis", "igi", "sis", 's', Block.stone, 'i', Item.ingotIron, 'g', Item.ingotGold});
GameRegistry.addRecipe(new ItemStack(ModItems.miniumStone), new Object[]{"sss", "sis", "sss", 's', ModItems.miniumShard, 'i', ModItems.inertStone});
// TODO Proper recipes for the different bag sizes
// TODO Also, decide if we want different sizes, and appropriate recipes

View file

@ -1,57 +0,0 @@
package com.pahimar.ee3.recipe;
import com.pahimar.ee3.helper.ItemHelper;
import com.pahimar.ee3.helper.LogHelper;
import com.pahimar.ee3.item.ItemAlchemicalDust;
import net.minecraft.item.ItemStack;
import net.minecraftforge.oredict.OreDictionary;
public class AludelRecipeInputPair
{
public final ItemStack inputStack;
public final ItemStack dustStack;
public AludelRecipeInputPair(ItemStack inputStack, ItemStack dustStack)
{
this.inputStack = inputStack.copy();
this.dustStack = dustStack.copy();
}
@Override
public boolean equals(Object object)
{
if (object instanceof AludelRecipeInputPair)
{
AludelRecipeInputPair recipeInputPair = (AludelRecipeInputPair) object;
LogHelper.debug(String.format("input - this.itemId: %s, object.inputStack.itemId: %s", this.inputStack.itemID, recipeInputPair.inputStack.itemID));
LogHelper.debug(String.format("input - this.meta: %s, object.inputStack.meta: %s", this.inputStack.getItemDamage(), recipeInputPair.inputStack.getItemDamage()));
LogHelper.debug(String.format("input - this.stackSize: %s, object.inputStack.stackSize: %s", this.inputStack.stackSize, recipeInputPair.inputStack.stackSize));
LogHelper.debug(String.format("dust - this.itemId: %s, object.inputStack.itemId: %s", this.dustStack.itemID, recipeInputPair.dustStack.itemID));
LogHelper.debug(String.format("dust - this.meta: %s, object.inputStack.meta: %s", this.dustStack.getItemDamage(), recipeInputPair.dustStack.getItemDamage()));
LogHelper.debug(String.format("dust - this.stackSize: %s, object.inputStack.stackSize: %s", this.dustStack.stackSize, recipeInputPair.dustStack.stackSize));
if (this.inputStack.itemID == recipeInputPair.inputStack.itemID && (this.inputStack.getItemDamage() == recipeInputPair.inputStack.getItemDamage() || this.inputStack.getItemDamage() == OreDictionary.WILDCARD_VALUE || recipeInputPair.inputStack.getItemDamage() == OreDictionary.WILDCARD_VALUE) && this.inputStack.stackSize <= recipeInputPair.inputStack.stackSize)
{
if (this.dustStack.itemID == recipeInputPair.dustStack.itemID && this.dustStack.getItemDamage() == recipeInputPair.dustStack.getItemDamage() && this.dustStack.stackSize <= recipeInputPair.dustStack.stackSize)
{
return true;
}
}
}
return false;
}
public boolean isValid()
{
return inputStack != null && dustStack != null && dustStack.getItem() instanceof ItemAlchemicalDust;
}
@Override
public String toString()
{
return String.format("Input stack: %s, Dust stack: %s", ItemHelper.toString(this.inputStack), ItemHelper.toString(this.dustStack));
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 349 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 360 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 148 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 153 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 181 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 525 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 218 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 532 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 231 B