mirror of
https://github.com/GTNewHorizons/ForestryMC.git
synced 2026-11-20 12:09:39 +00:00
Allow hotkeys to send items to hotbar, except locked slots
This commit is contained in:
1 parent
3c7856f264
commit
7e3b7acdef
4 files changed
+11
-17
No files matched your search
@@ -17,12 +17,12 @@ import net.minecraft.inventory.Slot;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import forestry.core.gui.slots.SlotForestry;
|
||||
import forestry.core.gui.slots.SlotLocked;
|
||||
import forestry.core.network.IForestryPacketClient;
|
||||
import forestry.core.proxy.Proxies;
|
||||
import forestry.core.utils.SlotUtil;
|
||||
|
||||
public abstract class ContainerForestry extends Container {
|
||||
|
||||
protected final void addPlayerInventory(InventoryPlayer playerInventory, int xInv, int yInv) {
|
||||
// Player inventory
|
||||
for (int row = 0; row < 3; row++) {
|
||||
@@ -51,7 +51,16 @@ public abstract class ContainerForestry extends Container {
|
||||
return null;
|
||||
}
|
||||
|
||||
Slot slot = (slotIndex < 0) ? null : (Slot) this.inventorySlots.get(slotIndex);
|
||||
if (modifier == 2 && button >= 0 && button < 9) {
|
||||
// hotkey used to move item from slot to hotbar
|
||||
int hotbarSlotIndex = 27 + button;
|
||||
Slot hotbarSlot = getSlot(hotbarSlotIndex);
|
||||
if (hotbarSlot instanceof SlotLocked) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
Slot slot = (slotIndex < 0) ? null : getSlot(slotIndex);
|
||||
if (slot instanceof SlotForestry) {
|
||||
SlotForestry slotForestry = (SlotForestry) slot;
|
||||
if (slotForestry.isPhantom()) {
|
||||
|
||||
@@ -248,9 +248,4 @@ public class GuiNaturalistInventory extends GuiForestry<Container, IPagedInvento
|
||||
Proxies.render.bindTexture(textureFile);
|
||||
drawTexturedModalRect(guiLeft + x, guiTop + textLayout.getLineY(), column, line, 16, 16);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean checkHotbarKeys(int key) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -206,11 +206,6 @@ public class GuiLetter extends GuiForestry<ContainerLetter, ItemInventoryLetter>
|
||||
Keyboard.enableRepeatEvents(false);
|
||||
super.onGuiClosed();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean checkHotbarKeys(int key) {
|
||||
return false;
|
||||
}
|
||||
|
||||
private void setFromSessionVars() {
|
||||
if (SessionVars.getStringVar("mail.letter.recipient") == null) {
|
||||
|
||||
@@ -24,9 +24,4 @@ public class GuiBackpack extends GuiForestry<ContainerBackpack, IInventory> {
|
||||
protected GuiBackpack(String texture, ContainerBackpack container) {
|
||||
super(texture, container, null);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean checkHotbarKeys(int key) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user