Fix various keybinding bugs
This commit is contained in:
@@ -95,6 +95,7 @@ public class Config
|
|||||||
if(configValue != null && value != null && (!value.equals(configValue.get()) || configValue.get() instanceof List<?>))
|
if(configValue != null && value != null && (!value.equals(configValue.get()) || configValue.get() instanceof List<?>))
|
||||||
{
|
{
|
||||||
Config.CONFIG_DATA.set(configValue.getPath(), value);
|
Config.CONFIG_DATA.set(configValue.getPath(), value);
|
||||||
|
configValue.clearCache();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
package exopandora.worldhandler.config;
|
package exopandora.worldhandler.config;
|
||||||
|
|
||||||
import exopandora.worldhandler.builder.impl.BuilderSetBlock.EnumMode;
|
import exopandora.worldhandler.builder.impl.BuilderSetBlock.EnumMode;
|
||||||
|
import exopandora.worldhandler.event.KeyHandler;
|
||||||
import net.minecraftforge.api.distmarker.Dist;
|
import net.minecraftforge.api.distmarker.Dist;
|
||||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||||
import net.minecraftforge.common.ForgeConfigSpec;
|
import net.minecraftforge.common.ForgeConfigSpec;
|
||||||
@@ -124,7 +125,14 @@ public class ConfigCategorySettings
|
|||||||
|
|
||||||
public void setShortcutKeys(boolean enabled)
|
public void setShortcutKeys(boolean enabled)
|
||||||
{
|
{
|
||||||
|
boolean previous = this.shortcutKeys();
|
||||||
|
|
||||||
Config.set(this.shortcutKeys, enabled);
|
Config.set(this.shortcutKeys, enabled);
|
||||||
|
|
||||||
|
if(previous != enabled)
|
||||||
|
{
|
||||||
|
KeyHandler.updatePosKeys();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean tooltips()
|
public boolean tooltips()
|
||||||
|
|||||||
@@ -19,22 +19,22 @@ public class KeyHandler
|
|||||||
{
|
{
|
||||||
public static final KeyBinding KEY_WORLD_HANDLER = new KeyBinding("key.worldhandler", GLFW.GLFW_KEY_V, "key.categories.worldhandler");
|
public static final KeyBinding KEY_WORLD_HANDLER = new KeyBinding("key.worldhandler", GLFW.GLFW_KEY_V, "key.categories.worldhandler");
|
||||||
public static final KeyBinding KEY_WORLD_HANDLER_POS1 = new KeyBinding("key.worldhandler.pos1", GLFW.GLFW_KEY_O, "key.categories.worldhandler");
|
public static final KeyBinding KEY_WORLD_HANDLER_POS1 = new KeyBinding("key.worldhandler.pos1", GLFW.GLFW_KEY_O, "key.categories.worldhandler");
|
||||||
public static final KeyBinding KEY_WORLD_HANDLER_POS2 = new KeyBinding("key.worldhandler.pos1", GLFW.GLFW_KEY_P, "key.categories.worldhandler");
|
public static final KeyBinding KEY_WORLD_HANDLER_POS2 = new KeyBinding("key.worldhandler.pos2", GLFW.GLFW_KEY_P, "key.categories.worldhandler");
|
||||||
|
|
||||||
@SubscribeEvent
|
@SubscribeEvent
|
||||||
public static void keyInputEvent(KeyInputEvent event)
|
public static void keyInputEvent(KeyInputEvent event)
|
||||||
{
|
{
|
||||||
if(Minecraft.getInstance() != null && Minecraft.getInstance().screen == null)
|
if(Minecraft.getInstance() != null && Minecraft.getInstance().screen == null)
|
||||||
{
|
{
|
||||||
if(KEY_WORLD_HANDLER.isDown())
|
if(KEY_WORLD_HANDLER.consumeClick())
|
||||||
{
|
{
|
||||||
ActionHelper.displayGui();
|
ActionHelper.displayGui();
|
||||||
}
|
}
|
||||||
else if(KEY_WORLD_HANDLER_POS1.isDown() && Config.getSettings().shortcutKeys())
|
else if(Config.getSettings().shortcutKeys() && KEY_WORLD_HANDLER_POS1.consumeClick())
|
||||||
{
|
{
|
||||||
BlockHelper.setPos1(BlockHelper.getFocusedBlockPos());
|
BlockHelper.setPos1(BlockHelper.getFocusedBlockPos());
|
||||||
}
|
}
|
||||||
else if(KEY_WORLD_HANDLER_POS2.isDown() && Config.getSettings().shortcutKeys())
|
else if(Config.getSettings().shortcutKeys() && KEY_WORLD_HANDLER_POS2.consumeClick())
|
||||||
{
|
{
|
||||||
BlockHelper.setPos2(BlockHelper.getFocusedBlockPos());
|
BlockHelper.setPos2(BlockHelper.getFocusedBlockPos());
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user