This repository has been archived by the owner on Mar 10, 2021. It is now read-only.
forked from iguanaman/IguanaTweaksTConstruct
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add a config option to make all non-tinker tools unusable. >:)
- Loading branch information
Showing
5 changed files
with
65 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
49 changes: 49 additions & 0 deletions
49
src/main/java/iguanaman/iguanatweakstconstruct/tweaks/handler/VanillaToolNerfHandler.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
package iguanaman.iguanatweakstconstruct.tweaks.handler; | ||
|
||
import cpw.mods.fml.common.eventhandler.SubscribeEvent; | ||
import net.minecraft.item.Item; | ||
import net.minecraft.item.ItemStack; | ||
import net.minecraft.item.ItemTool; | ||
import net.minecraft.util.EnumChatFormatting; | ||
import net.minecraft.util.StatCollector; | ||
import net.minecraftforge.event.entity.player.ItemTooltipEvent; | ||
import net.minecraftforge.event.entity.player.PlayerEvent; | ||
|
||
public class VanillaToolNerfHandler { | ||
@SubscribeEvent | ||
public void breakSpeed(PlayerEvent.BreakSpeed event) | ||
{ | ||
event.newSpeed = event.originalSpeed*10; | ||
if(event.entityPlayer == null) | ||
return; | ||
|
||
ItemStack itemStack = event.entityPlayer.getCurrentEquippedItem(); | ||
if(itemStack == null) | ||
return; | ||
|
||
if(isUselessTool(itemStack.getItem())) | ||
event.newSpeed = 0; | ||
} | ||
|
||
@SubscribeEvent | ||
public void onItemToolTip(ItemTooltipEvent event) { | ||
if (event.entityPlayer == null) | ||
return; | ||
|
||
if(isUselessTool(event.itemStack.getItem())) { | ||
event.toolTip.add(EnumChatFormatting.DARK_RED + StatCollector.translateToLocal("tooltip.uselessTool")); | ||
event.toolTip.add(EnumChatFormatting.DARK_RED + StatCollector.translateToLocal("tooltip.uselessTool2")); | ||
} | ||
} | ||
|
||
public static boolean isUselessTool(Item item) | ||
{ | ||
if(item == null) | ||
return false; | ||
|
||
if(item instanceof ItemTool) | ||
return true; | ||
|
||
return false; | ||
} | ||
} |