Skip to content

Commit

Permalink
Nothing to see here
Browse files Browse the repository at this point in the history
  • Loading branch information
bonii-xx committed Jan 6, 2015
1 parent 491132c commit 4a2defb
Show file tree
Hide file tree
Showing 6 changed files with 114 additions and 1 deletion.
1 change: 1 addition & 0 deletions resources/assets/tinker/lang/en_US.lang
Expand Up @@ -949,6 +949,7 @@ manual.page.tool1=Crafting Parts

tool.glassarrows=Glass Arrows
tool.glassarrows.lore=Crafted by a legendary Glassmaker
tool.boneana.lore=It sounded like a good idea back then
tool.baneofpigs=Bane of Pigs
tool.infiminer=InfiMiner

Expand Down
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
11 changes: 10 additions & 1 deletion src/main/java/tconstruct/weaponry/TinkerWeaponry.java
Expand Up @@ -44,6 +44,7 @@
import tconstruct.weaponry.ammo.BoltAmmo;
import tconstruct.library.tools.DualMaterialToolPart;
import tconstruct.weaponry.entity.*;
import tconstruct.weaponry.items.Boneana;
import tconstruct.weaponry.items.GlassArrows;
import tconstruct.weaponry.items.WeaponryPattern;
import tconstruct.library.weaponry.AmmoItem;
Expand Down Expand Up @@ -92,6 +93,10 @@ public class TinkerWeaponry {
public static Pattern woodPattern;
public static Pattern metalPattern;

// legendary weapons?
public static GlassArrows glassArrows;
public static Boneana boneana;

// other stuff
public static Random random = new Random();

Expand Down Expand Up @@ -262,7 +267,11 @@ private void addPartRecipies()

private void registerLegendaries()
{
GameRegistry.registerItem(new GlassArrows(), "GlassArrows");
glassArrows = new GlassArrows();
boneana = new Boneana();

GameRegistry.registerItem(glassArrows, "GlassArrows");
GameRegistry.registerItem(boneana, "Boneana");
}

private void registerMaterials()
Expand Down
58 changes: 58 additions & 0 deletions src/main/java/tconstruct/weaponry/WeaponryHandler.java
@@ -1,7 +1,13 @@
package tconstruct.weaponry;

import cpw.mods.fml.common.eventhandler.Event;
import cpw.mods.fml.common.eventhandler.EventPriority;
import cpw.mods.fml.common.gameevent.PlayerEvent;
import net.minecraft.init.Items;
import net.minecraft.nbt.NBTTagList;
import net.minecraft.nbt.NBTTagString;
import net.minecraft.util.EnumChatFormatting;
import net.minecraft.util.StatCollector;
import tconstruct.armor.player.TPlayerStats;
import tconstruct.library.crafting.PatternBuilder;
import tconstruct.library.event.PartBuilderEvent;
Expand Down Expand Up @@ -357,4 +363,56 @@ public void weaponryPartCast(SmelteryCastEvent.CastingTable event) {
if (TConstructRegistry.getBowMaterial(mat) == null)
event.setResult(Event.Result.DENY);
}

// high priority because we want to do these checks on unmodified stacks
@SubscribeEvent(priority = EventPriority.HIGH)
public void boneanaParts(ToolBuildEvent event) {
if(event.headStack == null || event.handleStack == null || event.accessoryStack != null || event.extraStack != null)
return;

// golden carrot + bone
if(event.headStack.getItem() == Items.golden_carrot && event.handleStack.getItem() == Items.bone)
{
// golden carrot must be named banana
if(!event.headStack.hasTagCompound() || !event.headStack.getTagCompound().hasKey("display") ||
!event.headStack.getTagCompound().getCompoundTag("display").hasKey("Name") ||
!event.headStack.getTagCompound().getCompoundTag("display").getString("Name").toLowerCase().equals("banana"))
return;
event.name = '\u2400' + "Bonæna"; // the \u2400 is a non-printable unicode character so you can't just type it
event.headStack = new ItemStack(TinkerTools.swordBlade, 1, TinkerTools.MaterialID.Bone);
event.handleStack = new ItemStack(TinkerTools.toolRod, 1, TinkerTools.MaterialID.Bone);
event.accessoryStack = new ItemStack(TinkerTools.wideGuard, 1, TinkerTools.MaterialID.Bone);
}
}

@SubscribeEvent(priority = EventPriority.HIGH)
public void boneanaBuilding(ToolCraftEvent.NormalTool event) {
// is it a boneana?
if("\u00A7f\u2400Bonæna".equals(event.toolTag.getCompoundTag("display").getString("Name")))
{
// set correct name
event.toolTag.getCompoundTag("display").setString("Name", EnumChatFormatting.YELLOW + "Bonæna");
// lore!
NBTTagList lore = new NBTTagList();
lore.appendTag(new NBTTagString(StatCollector.translateToLocal("tool.boneana.lore")));
event.toolTag.getCompoundTag("display").setTag("Lore", lore);

// let's polish it up a bit!
NBTTagCompound tag = event.toolTag.getCompoundTag("InfiTool");
tag.setBoolean("Special", true);
tag.setInteger("Attack", 4);
tag.setInteger("TotalDurability", 600);
tag.setInteger("BaseDurability", 600);
tag.setFloat("Shoddy", -2.0f);
tag.setInteger("MiningSpeed", 1);
tag.setInteger("HarvestLevel", 0);

tag.setInteger("Modifiers", 0);

ItemStack weapon = new ItemStack(TinkerWeaponry.boneana);
weapon.setTagCompound(event.toolTag);
event.overrideResult(weapon);
event.setResult(Event.Result.ALLOW);
}
}
}
45 changes: 45 additions & 0 deletions src/main/java/tconstruct/weaponry/items/Boneana.java
@@ -0,0 +1,45 @@
package tconstruct.weaponry.items;

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 tconstruct.items.tools.Broadsword;
import tconstruct.library.tools.AbilityHelper;
import tconstruct.util.Reference;

import java.util.List;

public class Boneana extends Broadsword {
private IIcon brokenIcon;

@Override
public void registerIcons(IIconRegister iconRegister) {
itemIcon = iconRegister.registerIcon(Reference.resource("broadsword/boneana"));
brokenIcon = iconRegister.registerIcon(Reference.resource("broadsword/boneana_split"));
}

@Override
@SideOnly(Side.CLIENT)
public IIcon getIcon(ItemStack stack, int renderPass) {
if(!stack.hasTagCompound() || !stack.getTagCompound().hasKey("InfiTool"))
return emptyIcon;

if(stack.getTagCompound().getCompoundTag("InfiTool").getBoolean("Broken"))
return brokenIcon;
return itemIcon;
}

@Override
public String getLocalizedToolName() {
return "Bonæna";
}

@Override
public void getSubItems(Item id, CreativeTabs tab, List list) {
// you are not welcome here >:C
}
}

1 comment on commit 4a2defb

@asiekierka
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi!

Please sign in to comment.