Skip to content
This repository has been archived by the owner on Mar 10, 2021. It is now read-only.

Commit

Permalink
Fix shurikens thrown when holding a tool giving xp to the tool instea…
Browse files Browse the repository at this point in the history
…d of the shurikens.
  • Loading branch information
bonii-xx committed Apr 3, 2015
1 parent c7d1eaf commit 1018760
Showing 1 changed file with 17 additions and 0 deletions.
Expand Up @@ -14,17 +14,22 @@
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.EntityDamageSourceIndirect;
import net.minecraftforge.client.event.RenderGameOverlayEvent;
import net.minecraftforge.common.util.FakePlayer;
import net.minecraftforge.event.entity.living.LivingHurtEvent;
import net.minecraftforge.event.entity.player.UseHoeEvent;
import tconstruct.items.tools.*;
import tconstruct.library.TConstructRegistry;
import tconstruct.library.entity.ProjectileBase;
import tconstruct.library.event.ToolCraftEvent;
import tconstruct.library.tools.ToolCore;
import tconstruct.library.tools.Weapon;
import tconstruct.library.weaponry.AmmoItem;
import tconstruct.library.weaponry.ProjectileWeapon;
import tconstruct.tools.TinkerTools;
import tconstruct.weaponry.entity.ShurikenEntity;
import tconstruct.weaponry.weapons.Shuriken;

import java.util.Arrays;

Expand All @@ -45,6 +50,18 @@ public void onHurt (LivingHurtEvent event)
return;

ItemStack stack = player.getCurrentEquippedItem();
if(event.source.getSourceOfDamage() instanceof ShurikenEntity) {
if(stack == null || !(stack.getItem() instanceof Shuriken)) {
if (player.inventory.currentItem == 0)
stack = player.inventory.getStackInSlot(8);
else
stack = player.inventory.getStackInSlot(player.inventory.currentItem + 1);
}

if(stack != null && !(stack.getItem() instanceof Shuriken))
stack = null;
}

if (stack == null || !stack.hasTagCompound())
return;

Expand Down

0 comments on commit 1018760

Please sign in to comment.