mirror of
https://github.com/GTNewHorizons/CraftTweaker.git
synced 2026-11-19 03:39:17 +00:00
Only check if shift is down once a client tick.
This commit is contained in:
1 parent
69b28b3bd4
commit
4e3c2c1b79
2 files changed
+17
-3
No files matched your search
@@ -14,8 +14,11 @@ import minetweaker.mc1710.recipes.MCRecipeManager;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
|
||||
import org.lwjgl.input.Keyboard;
|
||||
|
||||
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
||||
import cpw.mods.fml.common.gameevent.PlayerEvent;
|
||||
import cpw.mods.fml.common.gameevent.TickEvent;
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -23,6 +26,19 @@ import cpw.mods.fml.common.gameevent.PlayerEvent;
|
||||
*/
|
||||
public class FMLEventHandler {
|
||||
|
||||
private static boolean shiftDown = false;
|
||||
|
||||
public static boolean isShiftDown() {
|
||||
return shiftDown;
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void onClientTick(TickEvent.ClientTickEvent ev) {
|
||||
if (ev.phase == TickEvent.Phase.START) {
|
||||
shiftDown = Keyboard.isKeyDown(Keyboard.KEY_LSHIFT) || Keyboard.isKeyDown(Keyboard.KEY_RSHIFT);
|
||||
}
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void onPlayerLoggedIn(PlayerEvent.PlayerLoggedInEvent ev) {
|
||||
if (ev.player instanceof EntityPlayerMP && MineTweakerConfig.sendLoadScripts) {
|
||||
|
||||
@@ -26,8 +26,6 @@ import net.minecraftforge.event.entity.living.*;
|
||||
import net.minecraftforge.event.entity.player.ItemTooltipEvent;
|
||||
import net.minecraftforge.event.entity.player.PlayerInteractEvent;
|
||||
|
||||
import org.lwjgl.input.Keyboard;
|
||||
|
||||
import stanhebben.zenscript.value.*;
|
||||
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
@@ -64,7 +62,7 @@ public class ForgeEventHandler {
|
||||
ev.toolTip.add(((IMCFormattedString) tooltip).getTooltipString());
|
||||
}
|
||||
|
||||
if (Keyboard.isKeyDown(Keyboard.KEY_LSHIFT) || Keyboard.isKeyDown(Keyboard.KEY_RSHIFT)) {
|
||||
if (FMLEventHandler.isShiftDown()) {
|
||||
for (IFormattedText tooltip : IngredientTooltips.getShiftTooltips(itemStack)) {
|
||||
ev.toolTip.add(((IMCFormattedString) tooltip).getTooltipString());
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user