Add shiftclickhandler for fluid interface

This commit is contained in:
Raoul Van den Berge
2016-08-15 22:01:07 +02:00
parent ecc4549177
commit 5c5212e86a
2 changed files with 37 additions and 0 deletions

View File

@@ -1,6 +1,8 @@
package refinedstorage.container;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack;
import net.minecraftforge.items.SlotItemHandler;
import refinedstorage.container.slot.SlotSpecimenFluid;
import refinedstorage.tile.TileFluidInterface;
@@ -18,4 +20,31 @@ public class ContainerFluidInterface extends ContainerBase {
addPlayerInventory(8, 122);
}
@Override
public ItemStack transferStackInSlot(EntityPlayer player, int index) {
ItemStack stack = null;
Slot slot = getSlot(index);
if (slot != null && slot.getHasStack()) {
stack = slot.getStack();
if (index < 4 + 2) {
if (!mergeItemStack(stack, 4 + 2, inventorySlots.size(), false)) {
return null;
}
} else if (!mergeItemStack(stack, 0, 4 + 2, false)) {
return null;
}
if (stack.stackSize == 0) {
slot.putStack(null);
} else {
slot.onSlotChanged();
}
}
return stack;
}
}

View File

@@ -46,5 +46,13 @@ public class GuiFluidInterface extends GuiBase {
drawString(43 + 4, 20, t("gui.refinedstorage:fluid_interface.in"));
drawString(115 + 1, 20, t("gui.refinedstorage:fluid_interface.out"));
drawString(7, 111, t("container.inventory"));
if (inBounds(46, 56, 12, 47, mouseX, mouseY) && TileFluidInterface.TANK_IN.getValue() != null) {
drawTooltip(mouseX, mouseY, TileFluidInterface.TANK_IN.getValue().getLocalizedName() + "\n" + TileFluidInterface.TANK_IN.getValue().amount + " mB");
}
if (inBounds(118, 56, 12, 47, mouseX, mouseY) && TileFluidInterface.TANK_OUT.getValue() != null) {
drawTooltip(mouseX, mouseY, TileFluidInterface.TANK_OUT.getValue().getLocalizedName() + "\n" + TileFluidInterface.TANK_OUT.getValue().amount + " mB");
}
}
}