Bunch more work on porting Items. More to come tonight

This commit is contained in:
pahimar 2014-04-01 16:11:52 -04:00
parent 28c7b80a66
commit 16edfe03a4
17 changed files with 299 additions and 15 deletions

View file

@ -1,10 +1,10 @@
package com.pahimar.ee3.creativetab; package com.pahimar.ee3.creativetab;
import com.pahimar.ee3.item.ModItems;
import com.pahimar.ee3.reference.Reference; import com.pahimar.ee3.reference.Reference;
import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly; import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.creativetab.CreativeTabs; import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.init.Items;
import net.minecraft.item.Item; import net.minecraft.item.Item;
public class CreativeTab public class CreativeTab
@ -14,7 +14,7 @@ public class CreativeTab
@Override @Override
public Item getTabIconItem() public Item getTabIconItem()
{ {
return Items.baked_potato; return ModItems.philosophersStone;
} }
@Override @Override

View file

@ -18,7 +18,7 @@ public class ItemAlchemicalDust extends ItemEE
public ItemAlchemicalDust() public ItemAlchemicalDust()
{ {
super(); super();
this.maxStackSize = 64; this.setMaxStackSize(64);
this.setHasSubtypes(true); this.setHasSubtypes(true);
this.setUnlocalizedName(Names.Items.ALCHEMICAL_DUST); this.setUnlocalizedName(Names.Items.ALCHEMICAL_DUST);
} }
@ -29,7 +29,7 @@ public class ItemAlchemicalDust extends ItemEE
for (int meta = 0; meta < Names.Items.ALCHEMICAL_DUST_SUBTYPES.length; meta++) for (int meta = 0; meta < Names.Items.ALCHEMICAL_DUST_SUBTYPES.length; meta++)
{ {
alchemicalDustStacks.add(new ItemStack(ModItems.itemAlchemicalDust, 1, meta)); alchemicalDustStacks.add(new ItemStack(ModItems.alchemicalDust, 1, meta));
} }
return alchemicalDustStacks; return alchemicalDustStacks;

View file

@ -1,5 +1,69 @@
package com.pahimar.ee3.item; package com.pahimar.ee3.item;
import com.pahimar.ee3.reference.Names;
import com.pahimar.ee3.reference.Textures;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.IIcon;
import net.minecraft.util.MathHelper;
import java.util.List;
public class ItemAlchemicalFuel extends ItemEE public class ItemAlchemicalFuel extends ItemEE
{ {
@SideOnly(Side.CLIENT)
private IIcon[] icons;
public ItemAlchemicalFuel()
{
super();
this.setMaxStackSize(64);
this.setHasSubtypes(true);
this.setUnlocalizedName(Names.Items.ALCHEMICAL_FUEL);
}
@Override
public String getUnlocalizedName()
{
return String.format("item.%s%s", Textures.RESOURCE_PREFIX, Names.Items.ALCHEMICAL_FUEL);
}
@Override
public String getUnlocalizedName(ItemStack itemStack)
{
return String.format("item.%s%s.%s", Textures.RESOURCE_PREFIX, Names.Items.ALCHEMICAL_FUEL, Names.Items.ALCHEMICAL_FUEL_SUBTYPES[MathHelper.clamp_int(itemStack.getItemDamage(), 0, Names.Items.ALCHEMICAL_FUEL_SUBTYPES.length - 1)]);
}
@Override
@SideOnly(Side.CLIENT)
public void getSubItems(Item item, CreativeTabs creativeTab, List list)
{
for (int meta = 0; meta < Names.Items.ALCHEMICAL_FUEL_SUBTYPES.length; ++meta)
{
list.add(new ItemStack(this, 1, meta));
}
}
@Override
@SideOnly(Side.CLIENT)
public IIcon getIconFromDamage(int meta)
{
return icons[MathHelper.clamp_int(meta, 0, Names.Items.ALCHEMICAL_FUEL_SUBTYPES.length - 1)];
}
@Override
@SideOnly(Side.CLIENT)
public void registerIcons(IIconRegister iconRegister)
{
icons = new IIcon[Names.Items.ALCHEMICAL_FUEL_SUBTYPES.length];
for (int i = 0; i < Names.Items.ALCHEMICAL_FUEL_SUBTYPES.length; i++)
{
icons[i] = iconRegister.registerIcon(Textures.RESOURCE_PREFIX + Names.Items.ALCHEMICAL_FUEL + "." + Names.Items.ALCHEMICAL_FUEL_SUBTYPES[i]);
}
}
} }

View file

@ -1,5 +1,101 @@
package com.pahimar.ee3.item; package com.pahimar.ee3.item;
import com.pahimar.ee3.reference.Colors;
import com.pahimar.ee3.reference.Messages;
import com.pahimar.ee3.reference.Names;
import com.pahimar.ee3.reference.Textures;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumChatFormatting;
import net.minecraft.util.MathHelper;
import net.minecraft.util.StatCollector;
import java.util.List;
public class ItemAlchemicalInventoryUpgrade extends ItemEE public class ItemAlchemicalInventoryUpgrade extends ItemEE
{ {
public ItemAlchemicalInventoryUpgrade()
{
super();
this.setMaxStackSize(64);
this.setUnlocalizedName(Names.Items.ALCHEMICAL_UPGRADE);
this.setHasSubtypes(true);
}
@Override
public String getUnlocalizedName()
{
return String.format("item.%s%s", Textures.RESOURCE_PREFIX, Names.Items.ALCHEMICAL_UPGRADE);
}
@Override
public String getUnlocalizedName(ItemStack itemStack)
{
return String.format("item.%s%s.%s", Textures.RESOURCE_PREFIX, Names.Items.ALCHEMICAL_UPGRADE, Names.Items.ALCHEMICAL_UPGRADE_SUBTYPES[MathHelper.clamp_int(itemStack.getItemDamage(), 0, Names.Items.ALCHEMICAL_UPGRADE_SUBTYPES.length - 1)]);
}
@Override
@SideOnly(Side.CLIENT)
public void getSubItems(Item item, CreativeTabs creativeTab, List list)
{
for (int meta = 0; meta < Names.Items.ALCHEMICAL_UPGRADE_SUBTYPES.length; ++meta)
{
list.add(new ItemStack(this, 1, meta));
}
}
@Override
@SideOnly(Side.CLIENT)
public int getColorFromItemStack(ItemStack itemStack, int renderPass)
{
if (itemStack.getItemDamage() == 0)
{
return Integer.parseInt(Colors.DUST_VERDANT, 16);
}
else if (itemStack.getItemDamage() == 1)
{
return Integer.parseInt(Colors.DUST_AZURE, 16);
}
else if (itemStack.getItemDamage() == 2)
{
return Integer.parseInt(Colors.DUST_MINIUM, 16);
}
return Integer.parseInt(Colors.PURE_WHITE, 16);
}
@Override
@SideOnly(Side.CLIENT)
public void addInformation(ItemStack itemStack, EntityPlayer entityPlayer, List list, boolean flag)
{
list.add(StatCollector.translateToLocal(Messages.UPGRADES_CHESTS));
}
@Override
public String getItemStackDisplayName(ItemStack itemStack)
{
switch (MathHelper.clamp_int(itemStack.getItemDamage(), 0, Names.Items.ALCHEMICAL_UPGRADE_SUBTYPES.length - 1))
{
case 0:
{
return EnumChatFormatting.GREEN + super.getItemStackDisplayName(itemStack);
}
case 1:
{
return EnumChatFormatting.BLUE + super.getItemStackDisplayName(itemStack);
}
case 2:
{
return EnumChatFormatting.RED + super.getItemStackDisplayName(itemStack);
}
default:
{
return EnumChatFormatting.WHITE + super.getItemStackDisplayName(itemStack);
}
}
}
} }

View file

@ -7,7 +7,7 @@ public class ItemChalk extends ItemEE
public ItemChalk() public ItemChalk()
{ {
super(); super();
this.maxStackSize = 64; this.setMaxStackSize(64);
this.setUnlocalizedName(Names.Items.CHALK); this.setUnlocalizedName(Names.Items.CHALK);
} }
} }

View file

@ -1,5 +1,12 @@
package com.pahimar.ee3.item; package com.pahimar.ee3.item;
import com.pahimar.ee3.reference.Names;
public class ItemInertStone extends ItemEE public class ItemInertStone extends ItemEE
{ {
public ItemInertStone()
{
super();
this.setUnlocalizedName(Names.Items.INERT_STONE);
}
} }

View file

@ -1,5 +1,13 @@
package com.pahimar.ee3.item; package com.pahimar.ee3.item;
import com.pahimar.ee3.reference.Names;
public class ItemMiniumShard extends ItemEE public class ItemMiniumShard extends ItemEE
{ {
public ItemMiniumShard()
{
super();
this.setMaxStackSize(64);
this.setUnlocalizedName(Names.Items.MINIUM_SHARD);
}
} }

View file

@ -1,5 +1,47 @@
package com.pahimar.ee3.item; package com.pahimar.ee3.item;
import com.pahimar.ee3.reference.Names;
import com.pahimar.ee3.util.NBTHelper;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.item.ItemStack;
public class ItemMiniumStone extends ItemEE public class ItemMiniumStone extends ItemEE
{ {
public ItemMiniumStone()
{
super();
this.setUnlocalizedName(Names.Items.MINIUM_STONE);
this.setMaxDamage(1000); // TODO Get this from configs
}
@Override
public boolean doesContainerItemLeaveCraftingGrid(ItemStack itemStack)
{
return false;
}
@Override
public boolean getShareTag()
{
return true;
}
@Override
public ItemStack getContainerItem(ItemStack itemStack)
{
ItemStack copiedStack = itemStack.copy();
copiedStack.setItemDamage(copiedStack.getItemDamage() + 1);
copiedStack.stackSize = 1;
return copiedStack;
}
@Override
@SideOnly(Side.CLIENT)
public boolean hasEffect(ItemStack itemStack, int renderPass)
{
return NBTHelper.hasTag(itemStack, Names.NBT.CRAFTING_GUI_OPEN) || NBTHelper.hasTag(itemStack, Names.NBT.TRANSMUTATION_GUI_OPEN);
}
} }

View file

@ -1,5 +1,40 @@
package com.pahimar.ee3.item; package com.pahimar.ee3.item;
import com.pahimar.ee3.reference.Names;
import net.minecraft.item.ItemStack;
public class ItemPhilosophersStone extends ItemEE public class ItemPhilosophersStone extends ItemEE
{ {
private int maxChargeLevel;
public ItemPhilosophersStone()
{
super();
this.setUnlocalizedName(Names.Items.PHILOSOPHERS_STONE);
this.setMaxDamage(1000);
this.maxChargeLevel = 3;
}
@Override
public boolean doesContainerItemLeaveCraftingGrid(ItemStack itemStack)
{
return false;
}
@Override
public boolean getShareTag()
{
return true;
}
@Override
public ItemStack getContainerItem(ItemStack itemStack)
{
ItemStack copiedStack = itemStack.copy();
copiedStack.setItemDamage(copiedStack.getItemDamage() + 1);
copiedStack.stackSize = 1;
return copiedStack;
}
} }

View file

@ -6,14 +6,26 @@ import net.minecraft.item.Item;
public class ModItems public class ModItems
{ {
public static final Item itemAlchemicalBag = new ItemAlchemicalBag(); public static final Item alchemicalBag = new ItemAlchemicalBag();
public static final Item itemAlchemicalDust = new ItemAlchemicalDust(); public static final Item alchemicalDust = new ItemAlchemicalDust();
public static final Item itemChalk = new ItemChalk(); public static final Item alchemicalFuel = new ItemAlchemicalFuel();
public static final Item inertStone = new ItemInertStone();
public static final Item miniumShard = new ItemMiniumShard();
public static final Item miniumStone = new ItemMiniumStone();
public static final Item philosophersStone = new ItemPhilosophersStone();
public static final Item alchemicalInventoryUpgrade = new ItemAlchemicalInventoryUpgrade();
public static final Item chalk = new ItemChalk();
public static void init() public static void init()
{ {
GameRegistry.registerItem(itemAlchemicalBag, "item." + Names.Items.ALCHEMICAL_BAG); GameRegistry.registerItem(alchemicalBag, "item." + Names.Items.ALCHEMICAL_BAG);
GameRegistry.registerItem(itemAlchemicalDust, "item." + Names.Items.ALCHEMICAL_DUST); GameRegistry.registerItem(alchemicalDust, "item." + Names.Items.ALCHEMICAL_DUST);
GameRegistry.registerItem(itemChalk, "item." + Names.Items.CHALK); GameRegistry.registerItem(alchemicalFuel, "item." + Names.Items.ALCHEMICAL_FUEL);
GameRegistry.registerItem(inertStone, "item." + Names.Items.INERT_STONE);
GameRegistry.registerItem(miniumShard, "item." + Names.Items.MINIUM_SHARD);
GameRegistry.registerItem(miniumStone, "item." + Names.Items.MINIUM_STONE);
GameRegistry.registerItem(philosophersStone, "item." + Names.Items.PHILOSOPHERS_STONE);
GameRegistry.registerItem(chalk, "item." + Names.Items.CHALK);
GameRegistry.registerItem(alchemicalInventoryUpgrade, "item." + Names.Items.ALCHEMICAL_UPGRADE);
} }
} }

View file

@ -0,0 +1,6 @@
package com.pahimar.ee3.reference;
public class Messages
{
public static final String UPGRADES_CHESTS = "tooltip.ee3:upgradesPrefix";
}

View file

@ -7,11 +7,18 @@ public class Names
public static final String ALCHEMICAL_BAG = "alchemicalBag"; public static final String ALCHEMICAL_BAG = "alchemicalBag";
public static final String ALCHEMICAL_DUST = "alchemicalDust"; public static final String ALCHEMICAL_DUST = "alchemicalDust";
public static final String[] ALCHEMICAL_DUST_SUBTYPES = {"ash", "verdant", "azure", "minium"}; public static final String[] ALCHEMICAL_DUST_SUBTYPES = {"ash", "verdant", "azure", "minium"};
public static final String ALCHEMICAL_COAL_NAME = "alchemicalCoal"; public static final String ALCHEMICAL_FUEL = "alchemicalFuel";
public static final String MOBIUS_FUEL_NAME = "mobiusFuel"; public static final String ALCHEMICAL_COAL = "alchemicalCoal";
public static final String AETERNALIS_FUEL_NAME = "aeternalisFuel"; public static final String MOBIUS_FUEL = "mobiusFuel";
public static final String[] ALCHEMICAL_FUEL_SUBTYPES = {ALCHEMICAL_COAL_NAME, MOBIUS_FUEL_NAME, AETERNALIS_FUEL_NAME}; public static final String AETERNALIS_FUEL = "aeternalisFuel";
public static final String[] ALCHEMICAL_FUEL_SUBTYPES = {ALCHEMICAL_COAL, MOBIUS_FUEL, AETERNALIS_FUEL};
public static final String CHALK = "chalk"; public static final String CHALK = "chalk";
public static final String INERT_STONE = "stoneInert";
public static final String MINIUM_SHARD = "shardMinium";
public static final String MINIUM_STONE = "stoneMinium";
public static final String PHILOSOPHERS_STONE = "stonePhilosophers";
public static final String ALCHEMICAL_UPGRADE = "alchemicalUpgrade";
public static final String[] ALCHEMICAL_UPGRADE_SUBTYPES = {"verdant", "azure", "minium"};
} }
public static class NBT public static class NBT

Binary file not shown.

Before

Width:  |  Height:  |  Size: 548 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 540 B

After

Width:  |  Height:  |  Size: 514 B

View file

@ -0,0 +1,7 @@
{
"animation": {
"frames": [
]
}
}