Probably fixed that GUI freeze that WarGreg reported
This commit is contained in:
parent
1bba20504d
commit
e467d00877
@ -151,7 +151,7 @@ public class TestContent {
|
|||||||
KeyEvent.class,
|
KeyEvent.class,
|
||||||
TestContent::onBlockBreakTrigger,
|
TestContent::onBlockBreakTrigger,
|
||||||
KeyMatcher.of(GLFW.GLFW_MOUSE_BUTTON_LEFT).matcher(),
|
KeyMatcher.of(GLFW.GLFW_MOUSE_BUTTON_LEFT).matcher(),
|
||||||
i -> getSelection().exists()
|
i -> isAnythingSelected()
|
||||||
));
|
));
|
||||||
logic.register(ControlLogic.of("Test:BreakBlock", TestContent::onBlockBreakReceived));
|
logic.register(ControlLogic.of("Test:BreakBlock", TestContent::onBlockBreakReceived));
|
||||||
|
|
||||||
@ -161,7 +161,7 @@ public class TestContent {
|
|||||||
KeyEvent.class,
|
KeyEvent.class,
|
||||||
TestContent::onBlockPlaceTrigger,
|
TestContent::onBlockPlaceTrigger,
|
||||||
KeyMatcher.of(GLFW.GLFW_MOUSE_BUTTON_RIGHT).matcher(),
|
KeyMatcher.of(GLFW.GLFW_MOUSE_BUTTON_RIGHT).matcher(),
|
||||||
i -> getSelection().exists() && TestPlayerControls.getInstance().isBlockSelected()
|
i -> isAnythingSelected() && TestPlayerControls.getInstance().isBlockSelected()
|
||||||
));
|
));
|
||||||
logic.register(ControlLogic.of("Test:PlaceBlock", TestContent::onBlockPlaceReceived));
|
logic.register(ControlLogic.of("Test:PlaceBlock", TestContent::onBlockPlaceReceived));
|
||||||
|
|
||||||
@ -171,7 +171,7 @@ public class TestContent {
|
|||||||
KeyEvent.class,
|
KeyEvent.class,
|
||||||
TestContent::onTilePlaceTrigger,
|
TestContent::onTilePlaceTrigger,
|
||||||
KeyMatcher.of(GLFW.GLFW_MOUSE_BUTTON_RIGHT).matcher(),
|
KeyMatcher.of(GLFW.GLFW_MOUSE_BUTTON_RIGHT).matcher(),
|
||||||
i -> getSelection().exists() && !TestPlayerControls.getInstance().isBlockSelected()
|
i -> isAnythingSelected() && !TestPlayerControls.getInstance().isBlockSelected()
|
||||||
));
|
));
|
||||||
logic.register(ControlLogic.of("Test:PlaceTile", TestContent::onTilePlaceReceived));
|
logic.register(ControlLogic.of("Test:PlaceTile", TestContent::onTilePlaceReceived));
|
||||||
}
|
}
|
||||||
@ -236,6 +236,13 @@ public class TestContent {
|
|||||||
return client.getLocalPlayer().getSelection();
|
return client.getLocalPlayer().getSelection();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static boolean isAnythingSelected() {
|
||||||
|
ru.windcorp.progressia.client.Client client = ClientState.getInstance();
|
||||||
|
if (client == null || !client.isReady()) return false;
|
||||||
|
|
||||||
|
return client.getLocalPlayer().getSelection().exists();
|
||||||
|
}
|
||||||
|
|
||||||
private static void onBlockBreakTrigger(ControlData control) {
|
private static void onBlockBreakTrigger(ControlData control) {
|
||||||
((ControlBreakBlockData) control).setBlockInWorld(getSelection().getBlock());
|
((ControlBreakBlockData) control).setBlockInWorld(getSelection().getBlock());
|
||||||
SoundEffect sfx = new SoundEffect("Progressia:BlockDestroy");
|
SoundEffect sfx = new SoundEffect("Progressia:BlockDestroy");
|
||||||
|
Reference in New Issue
Block a user