mirror of
https://github.com/GTNewHorizons/TinkersConstruct.git
synced 2026-11-13 08:54:12 +00:00
Replace the hardcoded stick/bone handle with an oredicted variant using the ToolBuildEvent
This commit is contained in:
1 parent
e786518807
commit
0b7a8f6b22
2 files changed
+25
-10
No files matched your search
@@ -19,14 +19,12 @@ import net.minecraft.util.EntityDamageSourceIndirect;
|
||||
import net.minecraft.util.Vec3;
|
||||
import net.minecraftforge.event.entity.living.LivingAttackEvent;
|
||||
import net.minecraftforge.event.entity.living.LivingDropsEvent;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
import net.minecraftforge.oredict.OreDictionary.OreRegisterEvent;
|
||||
import tconstruct.TConstruct;
|
||||
import tconstruct.armor.player.TPlayerStats;
|
||||
import tconstruct.library.TConstructRegistry;
|
||||
import tconstruct.library.event.PartBuilderEvent;
|
||||
import tconstruct.library.event.SmelteryCastEvent;
|
||||
import tconstruct.library.event.SmelteryCastedEvent;
|
||||
import tconstruct.library.event.ToolCraftEvent;
|
||||
import tconstruct.library.event.*;
|
||||
import tconstruct.library.tools.AbilityHelper;
|
||||
import tconstruct.library.tools.ArrowMaterial;
|
||||
import tconstruct.library.tools.BowMaterial;
|
||||
@@ -39,6 +37,8 @@ import cpw.mods.fml.common.eventhandler.Event.Result;
|
||||
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
||||
import cpw.mods.fml.common.gameevent.PlayerEvent.ItemCraftedEvent;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class TinkerToolEvents
|
||||
{
|
||||
@SubscribeEvent
|
||||
@@ -58,7 +58,25 @@ public class TinkerToolEvents
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@SubscribeEvent
|
||||
public void buildTool(ToolBuildEvent event)
|
||||
{
|
||||
// check if the handle is a bone
|
||||
if(event.handleStack.getItem() == Items.bone) {
|
||||
event.handleStack = new ItemStack(TinkerTools.toolRod, 1, 5); // bone tool rod
|
||||
return;
|
||||
}
|
||||
|
||||
// check if the handle is a stick
|
||||
List<ItemStack> sticks = OreDictionary.getOres("stickWood");
|
||||
for(ItemStack stick : sticks)
|
||||
if (OreDictionary.itemMatches(stick, event.handleStack, false)) {
|
||||
event.handleStack = new ItemStack(TinkerTools.toolRod, 1, 0); // wooden tool rod
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void craftTool (ToolCraftEvent.NormalTool event)
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user