Better specimen slot with size
This commit is contained in:
@@ -7,6 +7,7 @@ import net.minecraft.inventory.ClickType;
|
|||||||
import net.minecraft.inventory.Container;
|
import net.minecraft.inventory.Container;
|
||||||
import net.minecraft.inventory.Slot;
|
import net.minecraft.inventory.Slot;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
|
import org.lwjgl.input.Keyboard;
|
||||||
import refinedstorage.container.slot.SlotDisabled;
|
import refinedstorage.container.slot.SlotDisabled;
|
||||||
import refinedstorage.container.slot.SlotSpecimen;
|
import refinedstorage.container.slot.SlotSpecimen;
|
||||||
|
|
||||||
@@ -63,7 +64,56 @@ public abstract class ContainerBase extends Container
|
|||||||
|
|
||||||
if (slot instanceof SlotSpecimen)
|
if (slot instanceof SlotSpecimen)
|
||||||
{
|
{
|
||||||
if (clickedButton == 2 || player.inventory.getItemStack() == null)
|
if (((SlotSpecimen) slot).isSizeAllowed())
|
||||||
|
{
|
||||||
|
if (player.inventory.getItemStack() != null)
|
||||||
|
{
|
||||||
|
int amount = player.inventory.getItemStack().stackSize;
|
||||||
|
|
||||||
|
if (clickedButton == 1)
|
||||||
|
{
|
||||||
|
amount = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
ItemStack toPut = player.inventory.getItemStack().copy();
|
||||||
|
toPut.stackSize = amount;
|
||||||
|
|
||||||
|
slot.putStack(toPut);
|
||||||
|
}
|
||||||
|
else if (slot.getStack() != null)
|
||||||
|
{
|
||||||
|
if (Keyboard.isKeyDown(Keyboard.KEY_LSHIFT))
|
||||||
|
{
|
||||||
|
slot.putStack(null);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
int amount = slot.getStack().stackSize;
|
||||||
|
|
||||||
|
if (clickedButton == 0)
|
||||||
|
{
|
||||||
|
amount++;
|
||||||
|
|
||||||
|
if (amount > 64)
|
||||||
|
{
|
||||||
|
amount = 64;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (clickedButton == 1)
|
||||||
|
{
|
||||||
|
amount--;
|
||||||
|
|
||||||
|
if (amount < 1)
|
||||||
|
{
|
||||||
|
amount = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
slot.getStack().stackSize = amount;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (player.inventory.getItemStack() == null)
|
||||||
{
|
{
|
||||||
slot.putStack(null);
|
slot.putStack(null);
|
||||||
}
|
}
|
||||||
|
@@ -7,13 +7,13 @@ import net.minecraft.item.ItemStack;
|
|||||||
|
|
||||||
public class SlotSpecimen extends Slot
|
public class SlotSpecimen extends Slot
|
||||||
{
|
{
|
||||||
private boolean allowSize;
|
private boolean sizeAllowed;
|
||||||
|
|
||||||
public SlotSpecimen(IInventory inventory, int id, int x, int y, boolean allowSize)
|
public SlotSpecimen(IInventory inventory, int id, int x, int y, boolean allowSize)
|
||||||
{
|
{
|
||||||
super(inventory, id, x, y);
|
super(inventory, id, x, y);
|
||||||
|
|
||||||
this.allowSize = allowSize;
|
this.sizeAllowed = allowSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -31,11 +31,16 @@ public class SlotSpecimen extends Slot
|
|||||||
@Override
|
@Override
|
||||||
public void putStack(ItemStack stack)
|
public void putStack(ItemStack stack)
|
||||||
{
|
{
|
||||||
if (stack != null && !allowSize)
|
if (stack != null && !sizeAllowed)
|
||||||
{
|
{
|
||||||
stack.stackSize = 1;
|
stack.stackSize = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
super.putStack(stack);
|
super.putStack(stack);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isSizeAllowed()
|
||||||
|
{
|
||||||
|
return sizeAllowed;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@@ -45,5 +45,14 @@ public class GuiInterface extends GuiBase
|
|||||||
drawString(7, 7, t("gui.refinedstorage:interface.import"));
|
drawString(7, 7, t("gui.refinedstorage:interface.import"));
|
||||||
drawString(7, 42, t("gui.refinedstorage:interface.export"));
|
drawString(7, 42, t("gui.refinedstorage:interface.export"));
|
||||||
drawString(7, 123, t("container.inventory"));
|
drawString(7, 123, t("container.inventory"));
|
||||||
|
|
||||||
|
if (inBounds(162, 42, 7, 7, mouseX, mouseY))
|
||||||
|
{
|
||||||
|
String message = t("gui.refinedstorage:interface.export.explanation.0");
|
||||||
|
message += "\n" + t("gui.refinedstorage:interface.export.explanation.1");
|
||||||
|
message += "\n" + t("gui.refinedstorage:interface.export.explanation.2");
|
||||||
|
|
||||||
|
drawTooltip(mouseX, mouseY, message);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -15,6 +15,9 @@ gui.refinedstorage:constructor=Constructor
|
|||||||
gui.refinedstorage:relay=Relay
|
gui.refinedstorage:relay=Relay
|
||||||
gui.refinedstorage:interface.import=Interface Import
|
gui.refinedstorage:interface.import=Interface Import
|
||||||
gui.refinedstorage:interface.export=Interface Export
|
gui.refinedstorage:interface.export=Interface Export
|
||||||
|
gui.refinedstorage:interface.export.explanation.0=Top slots: items you want exported
|
||||||
|
gui.refinedstorage:interface.export.explanation.1=Clear a slot: mouse click + SHIFT
|
||||||
|
gui.refinedstorage:interface.export.explanation.2=Incr. or decr. a slot: left/ right mouse click
|
||||||
|
|
||||||
misc.refinedstorage:energy_stored=%d / %d RF
|
misc.refinedstorage:energy_stored=%d / %d RF
|
||||||
misc.refinedstorage:energy_usage=Usage: %d RF/t
|
misc.refinedstorage:energy_usage=Usage: %d RF/t
|
||||||
|
@@ -15,6 +15,9 @@ gui.refinedstorage:constructor=Constructor
|
|||||||
gui.refinedstorage:relay=Relais
|
gui.refinedstorage:relay=Relais
|
||||||
gui.refinedstorage:interface.import=Interface Import
|
gui.refinedstorage:interface.import=Interface Import
|
||||||
gui.refinedstorage:interface.export=Interface Export
|
gui.refinedstorage:interface.export=Interface Export
|
||||||
|
gui.refinedstorage:interface.export.explanation.0=Bovenste slots: items die je wilt exporten
|
||||||
|
gui.refinedstorage:interface.export.explanation.1=Slot leegmaken: muisklik + SHIFT
|
||||||
|
gui.refinedstorage:interface.export.explanation.2=Verhoog of verklein aantal: links/ rechts muisklik
|
||||||
|
|
||||||
misc.refinedstorage:energy_stored=%d / %d RF
|
misc.refinedstorage:energy_stored=%d / %d RF
|
||||||
misc.refinedstorage:energy_usage=Vebruik: %d RF/t
|
misc.refinedstorage:energy_usage=Vebruik: %d RF/t
|
||||||
|
Binary file not shown.
Before Width: | Height: | Size: 1.9 KiB After Width: | Height: | Size: 1.9 KiB |
Reference in New Issue
Block a user