2015-02-20 23:57:32 +02:00
|
|
|
package modtweaker2;
|
|
|
|
|
|
2015-06-19 13:14:23 +02:00
|
|
|
import static modtweaker2.helpers.LogHelper.print;
|
2015-02-20 23:57:32 +02:00
|
|
|
import minetweaker.api.item.IItemStack;
|
|
|
|
|
import minetweaker.api.minecraft.MineTweakerMC;
|
|
|
|
|
import minetweaker.api.player.IPlayer;
|
2015-06-19 13:14:23 +02:00
|
|
|
import modtweaker2.utils.TweakerPlugin;
|
2015-02-20 23:57:32 +02:00
|
|
|
import net.minecraft.client.Minecraft;
|
|
|
|
|
import net.minecraft.client.settings.GameSettings;
|
2015-06-19 13:14:23 +02:00
|
|
|
import net.minecraft.item.ItemStack;
|
|
|
|
|
import net.minecraft.util.EnumChatFormatting;
|
2015-02-20 23:57:32 +02:00
|
|
|
import net.minecraftforge.event.entity.player.ItemTooltipEvent;
|
|
|
|
|
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
|
|
|
|
|
|
|
|
|
public class ClientEvents {
|
|
|
|
|
public static int cooldown;
|
|
|
|
|
public static boolean active;
|
2015-06-19 13:14:23 +02:00
|
|
|
public static String notice = EnumChatFormatting.DARK_RED + "This item's recipe has been changed by ModTweaker.";
|
2015-02-20 23:57:32 +02:00
|
|
|
@SubscribeEvent
|
|
|
|
|
public void onDrawTooltip(ItemTooltipEvent event) {
|
2015-06-19 13:14:23 +02:00
|
|
|
|
2015-02-20 23:57:32 +02:00
|
|
|
IPlayer player = MineTweakerMC.getIPlayer(event.entityPlayer);
|
|
|
|
|
if (player != null) {
|
|
|
|
|
IItemStack hand = MineTweakerMC.getIItemStack(event.itemStack);
|
|
|
|
|
if (hand != null) {
|
|
|
|
|
|
|
|
|
|
if (active) {
|
|
|
|
|
|
|
|
|
|
String print = hand.toString();
|
|
|
|
|
event.toolTip.add(print);
|
|
|
|
|
if (GameSettings.isKeyDown(Minecraft.getMinecraft().gameSettings.keyBindSprint)) {
|
|
|
|
|
if (cooldown <= 0) {
|
|
|
|
|
cooldown = 30;
|
|
|
|
|
print(print + " -- " + hand.getDisplayName());
|
|
|
|
|
} else
|
|
|
|
|
cooldown--;
|
|
|
|
|
} else
|
|
|
|
|
cooldown--;
|
|
|
|
|
}
|
|
|
|
|
|
2015-06-19 13:14:23 +02:00
|
|
|
for (ItemStack stack : TweakerPlugin.changed) {
|
|
|
|
|
if (stack.isItemEqual(event.itemStack) && event.toolTip.contains(notice)) {
|
|
|
|
|
event.toolTip.add(notice);
|
|
|
|
|
}
|
|
|
|
|
}
|
2015-02-20 23:57:32 +02:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2015-06-19 13:14:23 +02:00
|
|
|
|
2015-02-20 23:57:32 +02:00
|
|
|
}
|