Re-add keybinding to open Portable Grid

This commit is contained in:
raoulvdberge
2019-10-25 23:07:09 +02:00
parent 07f9f673ed
commit 5153e62562
4 changed files with 20 additions and 10 deletions

View File

@@ -177,6 +177,7 @@ public class ClientSetup {
ClientRegistry.registerKeyBinding(RSKeyBindings.OPEN_WIRELESS_FLUID_GRID);
ClientRegistry.registerKeyBinding(RSKeyBindings.FOCUS_SEARCH_BAR);
ClientRegistry.registerKeyBinding(RSKeyBindings.CLEAR_GRID_CRAFTING_MATRIX);
ClientRegistry.registerKeyBinding(RSKeyBindings.OPEN_PORTABLE_GRID);
ClientRegistry.bindTileEntitySpecialRenderer(StorageMonitorTile.class, new StorageMonitorTileRenderer());

View File

@@ -7,8 +7,7 @@ import net.minecraftforge.client.settings.KeyModifier;
import org.lwjgl.glfw.GLFW;
public final class RSKeyBindings {
/*
public static final KeyBinding OPEN_PORTABLE_GRID = new KeyBinding("key.refinedstorage.openPortableGrid", KeyConflictContext.IN_GAME, 0, "Refined Storage");
/* TODO
public static final KeyBinding OPEN_WIRELESS_CRAFTING_MONITOR = new KeyBinding("key.refinedstorage.openWirelessCraftingMonitor", KeyConflictContext.IN_GAME, 0, "Refined Storage");
public static void init() {
@@ -16,6 +15,13 @@ public final class RSKeyBindings {
ClientRegistry.registerKeyBinding(OPEN_WIRELESS_CRAFTING_MONITOR);
}*/
public static final KeyBinding OPEN_PORTABLE_GRID = new KeyBinding(
"key.refinedstorage.openPortableGrid",
KeyConflictContext.IN_GAME,
InputMappings.INPUT_INVALID,
"Refined Storage"
);
public static final KeyBinding OPEN_WIRELESS_GRID = new KeyBinding(
"key.refinedstorage.openWirelessGrid",
KeyConflictContext.IN_GAME,

View File

@@ -1,7 +1,10 @@
package com.raoulvdberge.refinedstorage.network;
import com.raoulvdberge.refinedstorage.apiimpl.API;
import com.raoulvdberge.refinedstorage.apiimpl.network.grid.factory.PortableGridGridFactory;
import com.raoulvdberge.refinedstorage.item.NetworkItem;
import net.minecraft.entity.player.PlayerEntity;
import com.raoulvdberge.refinedstorage.item.blockitem.PortableGridBlockItem;
import net.minecraft.entity.player.ServerPlayerEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.network.PacketBuffer;
import net.minecraftforge.fml.network.NetworkEvent;
@@ -24,7 +27,7 @@ public class OpenNetworkItemMessage {
}
public static void handle(OpenNetworkItemMessage message, Supplier<NetworkEvent.Context> ctx) {
PlayerEntity player = ctx.get().getSender();
ServerPlayerEntity player = ctx.get().getSender();
if (player != null) {
ctx.get().enqueueWork(() -> {
@@ -32,9 +35,9 @@ public class OpenNetworkItemMessage {
if (stack.getItem() instanceof NetworkItem) {
((NetworkItem) stack.getItem()).applyNetwork(player.getServer(), stack, n -> n.getNetworkItemManager().open(player, stack), player::sendMessage);
}/* TODO else if (stack.getItem() == Item.getItemFromBlock(RSBlocks.PORTABLE_GRID)) { // @Hack
API.instance().getGridManager().openGrid(PortableGrid.ID, player, stack);
}*/
} else if (stack.getItem() instanceof PortableGridBlockItem) {
API.instance().getGridManager().openGrid(PortableGridGridFactory.ID, player, stack);
}
});
}

View File

@@ -29,9 +29,9 @@ public class KeyInputListener {
findAndOpen(inv, (error) -> Minecraft.getInstance().player.sendMessage(error), RSItems.WIRELESS_GRID, RSItems.CREATIVE_WIRELESS_GRID);
} 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);
}/* TODO else if (RSKeyBindings.OPEN_PORTABLE_GRID.isKeyDown()) {
findAndOpen(inv, Item.getItemFromBlock(RSBlocks.PORTABLE_GRID));
} else if (RSKeyBindings.OPEN_WIRELESS_CRAFTING_MONITOR.isKeyDown()) {
} else if (RSKeyBindings.OPEN_PORTABLE_GRID.isKeyDown()) {
findAndOpen(inv, (error) -> Minecraft.getInstance().player.sendMessage(error), RSItems.PORTABLE_GRID, RSItems.CREATIVE_PORTABLE_GRID);
}/* TODO else if (RSKeyBindings.OPEN_WIRELESS_CRAFTING_MONITOR.isKeyDown()) {
findAndOpen(inv, RSItems.WIRELESS_CRAFTING_MONITOR);
}*/
}