Removed left / right click functionality on filter slots to increase / decrease the amount, replaced that functionality with a dialog.
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
### 1.6.4
|
||||
- Rewrote autocrafting again (raoulvdberge)
|
||||
- Reworked the Crafting Monitor (raoulvdberge)
|
||||
- Removed left / right click functionality on filter slots to increase / decrease the amount, replaced that functionality with a dialog (raoulvdberge)
|
||||
|
||||
### 1.6.3
|
||||
- Fixed crash with Wireless Fluid Grid (raoulvdberge)
|
||||
|
@@ -0,0 +1,19 @@
|
||||
package com.raoulvdberge.refinedstorage.container;
|
||||
|
||||
import com.raoulvdberge.refinedstorage.container.slot.SlotDisabled;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.items.ItemHandlerHelper;
|
||||
import net.minecraftforge.items.ItemStackHandler;
|
||||
|
||||
public class ContainerAmount extends ContainerBase {
|
||||
public ContainerAmount(EntityPlayer player, ItemStack stack) {
|
||||
super(null, player);
|
||||
|
||||
ItemStackHandler inventory = new ItemStackHandler(1);
|
||||
|
||||
inventory.setStackInSlot(0, ItemHandlerHelper.copyStackWithSize(stack, 1));
|
||||
|
||||
addSlotToContainer(new SlotDisabled(inventory, 0, 89, 48));
|
||||
}
|
||||
}
|
@@ -96,10 +96,6 @@ public abstract class ContainerBase extends Container {
|
||||
slot.putStack(ItemStack.EMPTY);
|
||||
} else if (!player.inventory.getItemStack().isEmpty()) {
|
||||
slot.putStack(player.inventory.getItemStack().copy());
|
||||
} else if (slot.getHasStack()) {
|
||||
slot.getStack().setCount(((SlotFilter) slot).getModifiedAmount(dragType));
|
||||
|
||||
detectAndSendChanges();
|
||||
}
|
||||
} else if (player.inventory.getItemStack().isEmpty()) {
|
||||
slot.putStack(ItemStack.EMPTY);
|
||||
|
@@ -58,18 +58,6 @@ public class SlotFilter extends SlotBase {
|
||||
return (flags & FILTER_ALLOW_BLOCKS) == FILTER_ALLOW_BLOCKS;
|
||||
}
|
||||
|
||||
public int getModifiedAmount(int dragType) {
|
||||
int amount = getStack().getCount();
|
||||
|
||||
if (dragType == 0) {
|
||||
amount = Math.max(1, amount - 1);
|
||||
} else if (dragType == 1) {
|
||||
amount = Math.min(getStack().getMaxStackSize(), amount + 1);
|
||||
}
|
||||
|
||||
return amount;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public static IBlockState getBlockState(IBlockAccess world, BlockPos pos, @Nullable ItemStack stack) {
|
||||
if (stack != null) {
|
||||
|
@@ -0,0 +1,72 @@
|
||||
package com.raoulvdberge.refinedstorage.gui;
|
||||
|
||||
import com.google.common.primitives.Ints;
|
||||
import com.raoulvdberge.refinedstorage.RS;
|
||||
import com.raoulvdberge.refinedstorage.container.ContainerAmount;
|
||||
import com.raoulvdberge.refinedstorage.network.MessageSlotFilterSet;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.items.ItemHandlerHelper;
|
||||
|
||||
public class GuiAmount extends GuiAmountSpecifying {
|
||||
private int containerSlot;
|
||||
private ItemStack stack;
|
||||
private int maxAmount;
|
||||
|
||||
public GuiAmount(GuiBase parent, EntityPlayer player, int containerSlot, ItemStack stack, int maxAmount) {
|
||||
super(parent, new ContainerAmount(player, stack), 172, 99);
|
||||
|
||||
this.containerSlot = containerSlot;
|
||||
this.stack = stack;
|
||||
this.maxAmount = maxAmount;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getDefaultAmount() {
|
||||
return stack.getCount();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean canAmountGoNegative() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getMaxAmount() {
|
||||
return maxAmount;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getOkButtonText() {
|
||||
return t("misc.refinedstorage:set");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getTitle() {
|
||||
return t("gui.refinedstorage:item_amount");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getTexture() {
|
||||
return "gui/crafting_settings.png";
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int[] getIncrements() {
|
||||
return new int[]{
|
||||
1, 10, 64,
|
||||
-1, -10, -64
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onOkButtonPressed(boolean shiftDown) {
|
||||
Integer amount = Ints.tryParse(amountField.getText());
|
||||
|
||||
if (amount != null) {
|
||||
RS.INSTANCE.network.sendToServer(new MessageSlotFilterSet(containerSlot, ItemHandlerHelper.copyStackWithSize(stack, amount)));
|
||||
|
||||
close();
|
||||
}
|
||||
}
|
||||
}
|
@@ -4,6 +4,7 @@ import com.raoulvdberge.refinedstorage.RS;
|
||||
import com.raoulvdberge.refinedstorage.api.render.IElementDrawer;
|
||||
import com.raoulvdberge.refinedstorage.api.render.IElementDrawers;
|
||||
import com.raoulvdberge.refinedstorage.apiimpl.API;
|
||||
import com.raoulvdberge.refinedstorage.container.slot.filter.SlotFilter;
|
||||
import com.raoulvdberge.refinedstorage.container.slot.filter.SlotFilterFluid;
|
||||
import com.raoulvdberge.refinedstorage.gui.control.Scrollbar;
|
||||
import com.raoulvdberge.refinedstorage.gui.control.SideButton;
|
||||
@@ -247,7 +248,19 @@ public abstract class GuiBase extends GuiContainer {
|
||||
|
||||
@Override
|
||||
protected void handleMouseClick(Slot slot, int slotId, int mouseButton, ClickType type) {
|
||||
if (slot instanceof SlotFilterFluid && slot.isEnabled() && ((SlotFilterFluid) slot).isSizeAllowed() && type != ClickType.QUICK_MOVE && Minecraft.getMinecraft().player.inventory.getItemStack().isEmpty()) {
|
||||
boolean valid = type != ClickType.QUICK_MOVE && Minecraft.getMinecraft().player.inventory.getItemStack().isEmpty();
|
||||
|
||||
if (valid && slot instanceof SlotFilter && slot.isEnabled() && ((SlotFilter) slot).isSizeAllowed()) {
|
||||
if (!slot.getStack().isEmpty()) {
|
||||
FMLClientHandler.instance().showGuiScreen(new GuiAmount(
|
||||
(GuiBase) Minecraft.getMinecraft().currentScreen,
|
||||
Minecraft.getMinecraft().player,
|
||||
slot.slotNumber,
|
||||
slot.getStack(),
|
||||
slot.getSlotStackLimit()
|
||||
));
|
||||
}
|
||||
} else if (valid && slot instanceof SlotFilterFluid && slot.isEnabled() && ((SlotFilterFluid) slot).isSizeAllowed()) {
|
||||
FluidStack stack = ((SlotFilterFluid) slot).getFluidInventory().getFluid(slot.getSlotIndex());
|
||||
|
||||
if (stack != null) {
|
||||
|
@@ -25,6 +25,10 @@ public class MessageSlotFilterSet extends MessageHandlerPlayerToServer<MessageSl
|
||||
|
||||
@Override
|
||||
protected void handle(MessageSlotFilterSet message, EntityPlayerMP player) {
|
||||
if (message.stack.isEmpty() || message.stack.getCount() > message.stack.getMaxStackSize()) {
|
||||
return;
|
||||
}
|
||||
|
||||
Container container = player.openContainer;
|
||||
|
||||
if (container != null) {
|
||||
|
@@ -12,6 +12,7 @@ gui.refinedstorage:crafting_grid=Crafting Grid
|
||||
gui.refinedstorage:pattern_grid=Pattern Grid
|
||||
gui.refinedstorage:grid.pattern_create=Create Pattern
|
||||
gui.refinedstorage:fluid_grid=Fluid Grid
|
||||
gui.refinedstorage:item_amount=Item amount
|
||||
gui.refinedstorage:fluid_amount=Fluid amount in mB
|
||||
gui.refinedstorage:disk_drive=Drive
|
||||
gui.refinedstorage:disk_drive.disks=Disks
|
||||
|
Reference in New Issue
Block a user