2015-02-20 22:57:32 +01:00
|
|
|
package modtweaker2;
|
|
|
|
|
|
|
|
import minetweaker.api.item.IItemStack;
|
|
|
|
import minetweaker.api.minecraft.MineTweakerMC;
|
|
|
|
import minetweaker.api.player.IPlayer;
|
|
|
|
import net.minecraft.client.Minecraft;
|
|
|
|
import net.minecraft.client.settings.GameSettings;
|
|
|
|
import net.minecraftforge.event.entity.player.ItemTooltipEvent;
|
2016-02-27 13:21:27 +01:00
|
|
|
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
2015-02-20 22:57:32 +01:00
|
|
|
|
2016-07-09 22:30:50 +02:00
|
|
|
import static modtweaker2.helpers.LogHelper.print;
|
|
|
|
|
2015-02-20 22:57:32 +01:00
|
|
|
public class ClientEvents {
|
|
|
|
public static int cooldown;
|
|
|
|
public static boolean active;
|
2015-06-23 16:03:10 +02:00
|
|
|
|
2015-02-20 22:57:32 +01:00
|
|
|
@SubscribeEvent
|
|
|
|
public void onDrawTooltip(ItemTooltipEvent event) {
|
2015-06-19 13:14:23 +02:00
|
|
|
|
2016-07-09 22:30:50 +02:00
|
|
|
IPlayer player = MineTweakerMC.getIPlayer(event.getEntityPlayer());
|
2015-02-20 22:57:32 +01:00
|
|
|
if (player != null) {
|
2016-07-09 22:30:50 +02:00
|
|
|
IItemStack hand = MineTweakerMC.getIItemStack(event.getItemStack());
|
2015-02-20 22:57:32 +01:00
|
|
|
if (hand != null) {
|
|
|
|
if (active) {
|
|
|
|
|
|
|
|
String print = hand.toString();
|
2016-07-09 22:30:50 +02:00
|
|
|
event.getToolTip().add(print);
|
2015-02-20 22:57:32 +01:00
|
|
|
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
|
|
|
|
2015-02-20 22:57:32 +01:00
|
|
|
}
|