Change naming

This commit is contained in:
Raoul Van den Berge
2016-11-27 13:03:48 +01:00
parent d89861be4a
commit 261f63c796
5 changed files with 22 additions and 16 deletions

View File

@@ -59,14 +59,14 @@ public final class RSUtils {
QUANTITY_FORMATTER.setRoundingMode(RoundingMode.DOWN); 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(Item.getIdFromItem(stack.getItem()));
buf.writeInt(stack.getCount()); buf.writeInt(stack.getCount());
buf.writeInt(stack.getItemDamage()); buf.writeInt(stack.getItemDamage());
ByteBufUtils.writeTag(buf, stack.getItem().getNBTShareTag(stack)); ByteBufUtils.writeTag(buf, stack.getItem().getNBTShareTag(stack));
buf.writeInt(API.instance().getItemStackHashCode(stack)); buf.writeInt(API.instance().getItemStackHashCode(stack));
buf.writeBoolean(network.hasPattern(stack)); buf.writeBoolean(network.hasPattern(stack));
buf.writeBoolean(outputFromPattern); buf.writeBoolean(displayCraftText);
} }
public static void writeFluidStack(ByteBuf buf, FluidStack stack) { public static void writeFluidStack(ByteBuf buf, FluidStack stack) {

View File

@@ -369,7 +369,7 @@ public class GuiGrid extends GuiBase {
if (grid.getType() != EnumGridType.FLUID && (held.isEmpty() || (!held.isEmpty() && clickedButton == 2))) { if (grid.getType() != EnumGridType.FLUID && (held.isEmpty() || (!held.isEmpty() && clickedButton == 2))) {
ClientStackItem stack = (ClientStackItem) STACKS.get(slotNumber); 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)); FMLCommonHandler.instance().showGuiScreen(new GuiCraftingStart(this, container.getPlayer(), stack));
} else { } else {
int flags = 0; int flags = 0;

View File

@@ -17,14 +17,15 @@ public class ClientStackItem implements IClientStack {
private int hash; private int hash;
private ItemStack stack; private ItemStack stack;
private boolean craftable; private boolean craftable;
private boolean outputFromPattern; private boolean displayCraftText;
public ClientStackItem(ByteBuf buf) { public ClientStackItem(ByteBuf buf) {
stack = new ItemStack(Item.getItemById(buf.readInt()), buf.readInt(), buf.readInt()); stack = new ItemStack(Item.getItemById(buf.readInt()), buf.readInt(), buf.readInt());
stack.setTagCompound(ByteBufUtils.readTag(buf)); stack.setTagCompound(ByteBufUtils.readTag(buf));
hash = buf.readInt(); hash = buf.readInt();
craftable = buf.readBoolean(); craftable = buf.readBoolean();
setOutputFromPattern(buf.readBoolean());
setDisplayCraftText(buf.readBoolean());
} }
public ItemStack getStack() { public ItemStack getStack() {
@@ -35,15 +36,15 @@ public class ClientStackItem implements IClientStack {
return craftable; return craftable;
} }
public boolean isOutputFromPattern() { public boolean doesDisplayCraftText() {
return outputFromPattern; return displayCraftText;
} }
public void setOutputFromPattern(boolean outputFromPattern) { public void setDisplayCraftText(boolean displayCraftText) {
this.outputFromPattern = outputFromPattern; this.displayCraftText = displayCraftText;
if (outputFromPattern) { if (displayCraftText) {
stack.setCount(1); this.stack.setCount(1);
} }
} }
@@ -86,7 +87,7 @@ public class ClientStackItem implements IClientStack {
private String getQuantityForDisplay(boolean advanced) { private String getQuantityForDisplay(boolean advanced) {
int qty = stack.getCount(); int qty = stack.getCount();
if (outputFromPattern) { if (displayCraftText) {
return I18n.format("gui.refinedstorage:grid.craft"); return I18n.format("gui.refinedstorage:grid.craft");
} else if (advanced && qty > 1) { } else if (advanced && qty > 1) {
return String.valueOf(qty); return String.valueOf(qty);

View File

@@ -47,13 +47,18 @@ public class MessageGridItemDelta implements IMessage, IMessageHandler<MessageGr
if (stack.equals(message.clientStack)) { if (stack.equals(message.clientStack)) {
if (stack.getStack().getCount() + message.delta == 0) { if (stack.getStack().getCount() + message.delta == 0) {
if (message.clientStack.isCraftable()) { if (message.clientStack.isCraftable()) {
stack.setOutputFromPattern(true); stack.setDisplayCraftText(true);
} else { } else {
GuiGrid.ITEMS.remove(item, stack); GuiGrid.ITEMS.remove(item, stack);
} }
} else { } else {
stack.getStack().grow(message.delta - (stack.isOutputFromPattern() ? 1 : 0)); if (stack.doesDisplayCraftText()) {
stack.setOutputFromPattern(false); stack.setDisplayCraftText(false);
stack.getStack().setCount(message.delta);
} else {
stack.getStack().grow(message.delta);
}
} }
GuiGrid.markForSorting(); GuiGrid.markForSorting();

View File

@@ -65,7 +65,7 @@ public class MessageGridItemUpdate implements IMessage, IMessageHandler<MessageG
for (ClientStackItem item : message.stacks) { for (ClientStackItem item : message.stacks) {
boolean canAdd = true; 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. // 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())) { for (ClientStackItem otherItem : GuiGrid.ITEMS.get(item.getStack().getItem())) {
if (API.instance().getComparer().isEqualNoQuantity(item.getStack(), otherItem.getStack())) { if (API.instance().getComparer().isEqualNoQuantity(item.getStack(), otherItem.getStack())) {