Change naming
This commit is contained in:
@@ -59,14 +59,14 @@ public final class RSUtils {
|
||||
QUANTITY_FORMATTER.setRoundingMode(RoundingMode.DOWN);
|
||||
}
|
||||
|
||||
public static void writeItemStack(ByteBuf buf, INetworkMaster network, ItemStack stack, boolean outputFromPattern) {
|
||||
public static void writeItemStack(ByteBuf buf, INetworkMaster network, ItemStack stack, boolean displayCraftText) {
|
||||
buf.writeInt(Item.getIdFromItem(stack.getItem()));
|
||||
buf.writeInt(stack.getCount());
|
||||
buf.writeInt(stack.getItemDamage());
|
||||
ByteBufUtils.writeTag(buf, stack.getItem().getNBTShareTag(stack));
|
||||
buf.writeInt(API.instance().getItemStackHashCode(stack));
|
||||
buf.writeBoolean(network.hasPattern(stack));
|
||||
buf.writeBoolean(outputFromPattern);
|
||||
buf.writeBoolean(displayCraftText);
|
||||
}
|
||||
|
||||
public static void writeFluidStack(ByteBuf buf, FluidStack stack) {
|
||||
|
||||
@@ -369,7 +369,7 @@ public class GuiGrid extends GuiBase {
|
||||
if (grid.getType() != EnumGridType.FLUID && (held.isEmpty() || (!held.isEmpty() && clickedButton == 2))) {
|
||||
ClientStackItem stack = (ClientStackItem) STACKS.get(slotNumber);
|
||||
|
||||
if (stack.isCraftable() && (stack.isOutputFromPattern() || (GuiScreen.isShiftKeyDown() && GuiScreen.isCtrlKeyDown()))) {
|
||||
if (stack.isCraftable() && (stack.doesDisplayCraftText() || (GuiScreen.isShiftKeyDown() && GuiScreen.isCtrlKeyDown()))) {
|
||||
FMLCommonHandler.instance().showGuiScreen(new GuiCraftingStart(this, container.getPlayer(), stack));
|
||||
} else {
|
||||
int flags = 0;
|
||||
|
||||
@@ -17,14 +17,15 @@ public class ClientStackItem implements IClientStack {
|
||||
private int hash;
|
||||
private ItemStack stack;
|
||||
private boolean craftable;
|
||||
private boolean outputFromPattern;
|
||||
private boolean displayCraftText;
|
||||
|
||||
public ClientStackItem(ByteBuf buf) {
|
||||
stack = new ItemStack(Item.getItemById(buf.readInt()), buf.readInt(), buf.readInt());
|
||||
stack.setTagCompound(ByteBufUtils.readTag(buf));
|
||||
hash = buf.readInt();
|
||||
craftable = buf.readBoolean();
|
||||
setOutputFromPattern(buf.readBoolean());
|
||||
|
||||
setDisplayCraftText(buf.readBoolean());
|
||||
}
|
||||
|
||||
public ItemStack getStack() {
|
||||
@@ -35,15 +36,15 @@ public class ClientStackItem implements IClientStack {
|
||||
return craftable;
|
||||
}
|
||||
|
||||
public boolean isOutputFromPattern() {
|
||||
return outputFromPattern;
|
||||
public boolean doesDisplayCraftText() {
|
||||
return displayCraftText;
|
||||
}
|
||||
|
||||
public void setOutputFromPattern(boolean outputFromPattern) {
|
||||
this.outputFromPattern = outputFromPattern;
|
||||
public void setDisplayCraftText(boolean displayCraftText) {
|
||||
this.displayCraftText = displayCraftText;
|
||||
|
||||
if (outputFromPattern) {
|
||||
stack.setCount(1);
|
||||
if (displayCraftText) {
|
||||
this.stack.setCount(1);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -86,7 +87,7 @@ public class ClientStackItem implements IClientStack {
|
||||
private String getQuantityForDisplay(boolean advanced) {
|
||||
int qty = stack.getCount();
|
||||
|
||||
if (outputFromPattern) {
|
||||
if (displayCraftText) {
|
||||
return I18n.format("gui.refinedstorage:grid.craft");
|
||||
} else if (advanced && qty > 1) {
|
||||
return String.valueOf(qty);
|
||||
|
||||
@@ -47,13 +47,18 @@ public class MessageGridItemDelta implements IMessage, IMessageHandler<MessageGr
|
||||
if (stack.equals(message.clientStack)) {
|
||||
if (stack.getStack().getCount() + message.delta == 0) {
|
||||
if (message.clientStack.isCraftable()) {
|
||||
stack.setOutputFromPattern(true);
|
||||
stack.setDisplayCraftText(true);
|
||||
} else {
|
||||
GuiGrid.ITEMS.remove(item, stack);
|
||||
}
|
||||
} else {
|
||||
stack.getStack().grow(message.delta - (stack.isOutputFromPattern() ? 1 : 0));
|
||||
stack.setOutputFromPattern(false);
|
||||
if (stack.doesDisplayCraftText()) {
|
||||
stack.setDisplayCraftText(false);
|
||||
|
||||
stack.getStack().setCount(message.delta);
|
||||
} else {
|
||||
stack.getStack().grow(message.delta);
|
||||
}
|
||||
}
|
||||
|
||||
GuiGrid.markForSorting();
|
||||
|
||||
@@ -65,7 +65,7 @@ public class MessageGridItemUpdate implements IMessage, IMessageHandler<MessageG
|
||||
for (ClientStackItem item : message.stacks) {
|
||||
boolean canAdd = true;
|
||||
|
||||
if (item.isOutputFromPattern()) {
|
||||
if (item.doesDisplayCraftText()) {
|
||||
// This is an output from a pattern being sent. Only add it if it hasn't been added before.
|
||||
for (ClientStackItem otherItem : GuiGrid.ITEMS.get(item.getStack().getItem())) {
|
||||
if (API.instance().getComparer().isEqualNoQuantity(item.getStack(), otherItem.getStack())) {
|
||||
|
||||
Reference in New Issue
Block a user