Fix NPE
This commit is contained in:
@@ -22,17 +22,19 @@ import java.util.function.Consumer;
|
|||||||
public class KeyInputListener {
|
public class KeyInputListener {
|
||||||
@SubscribeEvent
|
@SubscribeEvent
|
||||||
public void onKeyInput(InputEvent.KeyInputEvent e) {
|
public void onKeyInput(InputEvent.KeyInputEvent e) {
|
||||||
PlayerInventory inv = Minecraft.getInstance().player.inventory;
|
if (Minecraft.getInstance().player != null) {
|
||||||
|
PlayerInventory inv = Minecraft.getInstance().player.inventory;
|
||||||
|
|
||||||
if (RSKeyBindings.OPEN_WIRELESS_GRID.isKeyDown()) {
|
if (RSKeyBindings.OPEN_WIRELESS_GRID.isKeyDown()) {
|
||||||
findAndOpen(inv, (error) -> Minecraft.getInstance().player.sendMessage(error), RSItems.WIRELESS_GRID, RSItems.CREATIVE_WIRELESS_GRID);
|
findAndOpen(inv, (error) -> Minecraft.getInstance().player.sendMessage(error), RSItems.WIRELESS_GRID, RSItems.CREATIVE_WIRELESS_GRID);
|
||||||
} else if (RSKeyBindings.OPEN_WIRELESS_FLUID_GRID.isKeyDown()) {
|
} else if (RSKeyBindings.OPEN_WIRELESS_FLUID_GRID.isKeyDown()) {
|
||||||
findAndOpen(inv, (error) -> Minecraft.getInstance().player.sendMessage(error), RSItems.WIRELESS_FLUID_GRID, RSItems.CREATIVE_WIRELESS_FLUID_GRID);
|
findAndOpen(inv, (error) -> Minecraft.getInstance().player.sendMessage(error), RSItems.WIRELESS_FLUID_GRID, RSItems.CREATIVE_WIRELESS_FLUID_GRID);
|
||||||
}/* TODO else if (RSKeyBindings.OPEN_PORTABLE_GRID.isKeyDown()) {
|
}/* TODO else if (RSKeyBindings.OPEN_PORTABLE_GRID.isKeyDown()) {
|
||||||
findAndOpen(inv, Item.getItemFromBlock(RSBlocks.PORTABLE_GRID));
|
findAndOpen(inv, Item.getItemFromBlock(RSBlocks.PORTABLE_GRID));
|
||||||
} else if (RSKeyBindings.OPEN_WIRELESS_CRAFTING_MONITOR.isKeyDown()) {
|
} else if (RSKeyBindings.OPEN_WIRELESS_CRAFTING_MONITOR.isKeyDown()) {
|
||||||
findAndOpen(inv, RSItems.WIRELESS_CRAFTING_MONITOR);
|
findAndOpen(inv, RSItems.WIRELESS_CRAFTING_MONITOR);
|
||||||
}*/
|
}*/
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void findAndOpen(IInventory inv, Consumer<ITextComponent> onError, Item... items) {
|
private void findAndOpen(IInventory inv, Consumer<ITextComponent> onError, Item... items) {
|
||||||
|
|||||||
Reference in New Issue
Block a user