Skip to content

Commit

Permalink
Push my latest fixes to creative.
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexander committed Feb 7, 2014
1 parent 2b8c5e7 commit f287176
Show file tree
Hide file tree
Showing 10 changed files with 66 additions and 24 deletions.
2 changes: 1 addition & 1 deletion src/main/java/tconstruct/common/TContent.java
Expand Up @@ -649,7 +649,7 @@ void registerItems ()
GameRegistry.registerItem(TRepo.strangeFood, "strangeFood");
GameRegistry.registerItem(TRepo.oreBerries, "oreBerries");

boolean foodOverhaul;
boolean foodOverhaul = false;
if (Loader.isModLoaded("HungerOverhaul") || Loader.isModLoaded("fc_food")) {
foodOverhaul = true;
}
Expand Down
3 changes: 2 additions & 1 deletion src/main/java/tconstruct/items/ArmorPattern.java
Expand Up @@ -6,6 +6,7 @@
import net.minecraft.block.Block;
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 tconstruct.library.ItemBlocklike;
Expand Down Expand Up @@ -50,7 +51,7 @@ public void registerIcons (IIconRegister iconRegister)

private static final String[] patternName = new String[] { "helmet", "chestplate", "leggings", "boots" };

public void getSubItems (Block block, CreativeTabs tab, List list)
public void getSubItems (Item block, CreativeTabs tab, List list)
{
for (int i = 0; i < patternName.length; i++)
{
Expand Down
3 changes: 2 additions & 1 deletion src/main/java/tconstruct/items/Bowstring.java
Expand Up @@ -5,6 +5,7 @@
import mantle.items.abstracts.CraftingItem;
import net.minecraft.block.Block;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import tconstruct.common.TRepo;
import tconstruct.library.TConstructRegistry;
Expand Down Expand Up @@ -43,7 +44,7 @@ public int getMaterialID (ItemStack stack)
return stack.getItemDamage();
}

public void getSubItems (Block b, CreativeTabs tab, List list)
public void getSubItems (Item b, CreativeTabs tab, List list)
{
list.add(new ItemStack(b, 1, 0));
if (TRepo.thaumcraftAvailable)
Expand Down
3 changes: 2 additions & 1 deletion src/main/java/tconstruct/items/GoldenHead.java
Expand Up @@ -7,6 +7,7 @@
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.EnumRarity;
import net.minecraft.item.Item;
import net.minecraft.item.ItemFood;
import net.minecraft.item.ItemStack;
import net.minecraft.potion.Potion;
Expand Down Expand Up @@ -60,7 +61,7 @@ protected void onFoodEaten (ItemStack par1ItemStack, World par2World, EntityPlay
/**
* returns a list of items with the same ID, but different meta (eg: dye returns 16 items)
*/
public void getSubItems (Block b, CreativeTabs par2CreativeTabs, List par3List)
public void getSubItems (Item b, CreativeTabs par2CreativeTabs, List par3List)
{
par3List.add(new ItemStack(b, 1, 0));
}
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/tconstruct/items/Pattern.java
Expand Up @@ -43,7 +43,7 @@ protected static String[] getPatternNames (String partType)
"knifeblade", "chisel", "largerod", "toughbinding", "largeplate", "broadaxe", "scythe", "excavator", "largeblade", "hammerhead", "fullguard", "bowstring", "fletching", "arrowhead" };

@Override
public void getSubItems (Block b, CreativeTabs tab, List list)
public void getSubItems (Item b, CreativeTabs tab, List list)
{
for (int i = 1; i < patternName.length; i++)
{
Expand Down
3 changes: 2 additions & 1 deletion src/main/java/tconstruct/items/SpecialFood.java
Expand Up @@ -6,6 +6,7 @@
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemFood;
import net.minecraft.item.ItemStack;
import net.minecraft.util.IIcon;
Expand Down Expand Up @@ -66,7 +67,7 @@ public String getUnlocalizedName (ItemStack stack)
return getUnlocalizedName() + "." + unlocalizedNames[arr];
}

public void getSubItems (Block b, CreativeTabs tab, List list)
public void getSubItems (Item b, CreativeTabs tab, List list)
{
for (int i = 0; i < unlocalizedNames.length; i++)
list.add(new ItemStack(b, 1, i));
Expand Down
3 changes: 2 additions & 1 deletion src/main/java/tconstruct/items/ToolPart.java
Expand Up @@ -5,6 +5,7 @@
import mantle.items.abstracts.CraftingItem;
import net.minecraft.block.Block;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.StatCollector;
import tconstruct.common.TRepo;
Expand Down Expand Up @@ -67,7 +68,7 @@ private static String[] buildTextureNames (String textureType)
"copper", "bronze", "alumite", "steel", "blueslime", "pigiron", "", "", "", "", "", "", "", "", "", "", "", "", "thaumium" };

@Override
public void getSubItems (Block b, CreativeTabs tab, List list)
public void getSubItems (Item b, CreativeTabs tab, List list)
{
for (int i = 0; i < 19; i++)
list.add(new ItemStack(b, 1, i));
Expand Down
4 changes: 3 additions & 1 deletion src/main/java/tconstruct/items/ToolShard.java
Expand Up @@ -5,6 +5,7 @@
import net.minecraft.block.Block;
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 tconstruct.common.TRepo;
Expand Down Expand Up @@ -54,7 +55,8 @@ public void registerIcons (IIconRegister iconRegister)
}
}

public void getSubItems (Block b, CreativeTabs tab, List list)
@Override
public void getSubItems (Item b, CreativeTabs tab, List list)
{
for (int i = 1; i < 5; i++)
list.add(new ItemStack(b, 1, i));
Expand Down
3 changes: 2 additions & 1 deletion src/main/java/tconstruct/items/armor/ExoArmor.java
Expand Up @@ -8,6 +8,7 @@
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
Expand Down Expand Up @@ -49,7 +50,7 @@ public void damageArmor (EntityLivingBase entity, ItemStack stack, DamageSource
}

@SideOnly(Side.CLIENT)
public void getSubItems (Block b, CreativeTabs par2CreativeTabs, List par3List)
public void getSubItems (Item b, CreativeTabs par2CreativeTabs, List par3List)
{
ItemStack armor = new ItemStack(b, 1, 0);
NBTTagCompound baseTag = new NBTTagCompound();
Expand Down
64 changes: 49 additions & 15 deletions src/main/java/tconstruct/library/tools/ToolCore.java
Expand Up @@ -58,7 +58,7 @@

public abstract class ToolCore extends Item implements IEnergyContainerItem, IBattlegearWeapon
{
//TE power constants -- TODO grab these from the items added
//TE power constants -- TODO grab these from the
protected int capacity = 400000;
protected int maxReceive = 75;
protected int maxExtract = 75;
Expand Down Expand Up @@ -337,6 +337,25 @@ public void addInformation (ItemStack stack, EntityPlayer player, List list, boo
return;

NBTTagCompound tags = stack.getTagCompound();
if (tags.hasKey("charge"))
{
String color = "";
//double joules = this.getJoules(stack);
int power = tags.getInteger("charge");

if (power != 0)
{
if (power <= this.getMaxEnergyStored(stack) / 3)
color = "\u00a74";
else if (power > this.getMaxEnergyStored(stack) * 2 / 3)
color = "\u00a72";
else
color = "\u00a76";
}

String charge = new StringBuilder().append(color).append(tags.getInteger("charge")).append("/").append(getMaxEnergyStored(stack)).append(" EU").toString();
list.add(charge);
}
if (tags.hasKey("Energy"))
{
String color = "";
Expand Down Expand Up @@ -546,7 +565,7 @@ public void buildTool (int id, String name, List list)
boolean supress = false;
try
{
clazz = Class.forName("tconstruct.common.TRepo"); //TODO: Make sure this is still working in 1.7.
clazz = Class.forName("tconstruct.common.TContent"); //TODO: Make sure this is still working in 1.7.
fld = clazz.getField("supressMissingToolLogs");
supress = fld.getBoolean(fld);
}
Expand Down Expand Up @@ -821,6 +840,7 @@ public int getItemMaxDamageFromStack (ItemStack stack)
{
return 0;
}

if (tags.hasKey("Energy"))
{
int energy = tags.getInteger("Energy");
Expand All @@ -837,6 +857,7 @@ public int getItemDamageFromStackForDisplay (ItemStack stack)
{
return 0;
}

if (tags.hasKey("Energy"))
{
int energy = tags.getInteger("Energy");
Expand All @@ -847,30 +868,44 @@ public int getItemDamageFromStackForDisplay (ItemStack stack)
}

/* Battlegear support, IBattlegearWeapon */

@Override
public boolean willAllowOffhandWeapon ()
// 1.6.4 start
public boolean allowOffhand(ItemStack mainhand, ItemStack offhand)
{
return true;
}

@Override
public boolean willAllowShield ()
public boolean isOffhandHandDual(ItemStack off)
{
return true;
}

@Override
public boolean isOffhandHandDualWeapon ()
public boolean sheatheOnBack(ItemStack item)
{
return true;
return false;
}
//1.6.4 end

//1.6.2 start
public boolean willAllowOffhandWeapon()
{
return true;
}

@Override
public boolean sheatheOnBack ()
public boolean willAllowShield()
{
return false;
return true;
}

public boolean isOffhandHandDualWeapon()
{
return true;
}

public boolean sheatheOnBack()
{
return false;
}
//1.6.2 end

@Override
public boolean offhandAttackEntity (OffhandAttackEvent event, ItemStack mainhandItem, ItemStack offhandItem)
Expand All @@ -884,7 +919,7 @@ public boolean offhandClickAir (PlayerInteractEvent event, ItemStack mainhandIte
return true;
}

@Override
@Override
public boolean offhandClickBlock (PlayerInteractEvent event, ItemStack mainhandItem, ItemStack offhandItem)
{
return true;
Expand Down Expand Up @@ -961,7 +996,6 @@ public int getEnergyStored (ItemStack container)
}
return tags.getInteger("Energy");
}

@Override
public int getMaxEnergyStored (ItemStack container)
{
Expand Down

0 comments on commit f287176

Please sign in to comment.