mirror of
https://github.com/GTNewHorizons/ForestryMC.git
synced 2026-11-20 03:59:45 +00:00
Fix #978 missing localization keys for mail trades and escritoire
This commit is contained in:
1 parent
2b874fb42f
commit
eff9dfcca7
3 files changed
+30
-16
No files matched your search
@@ -24,6 +24,7 @@ import forestry.core.gui.widgets.Widget;
|
||||
import forestry.core.tiles.EscritoireGame;
|
||||
import forestry.core.tiles.EscritoireTextSource;
|
||||
import forestry.core.tiles.TileEscritoire;
|
||||
import forestry.core.utils.StringUtil;
|
||||
|
||||
public class GuiEscritoire extends GuiForestry<ContainerEscritoire, TileEscritoire> {
|
||||
private final ItemStack LEVEL_ITEM = new ItemStack(Items.paper);
|
||||
@@ -93,7 +94,8 @@ public class GuiEscritoire extends GuiForestry<ContainerEscritoire, TileEscritoi
|
||||
textLayout.newLine();
|
||||
String format = EnumChatFormatting.UNDERLINE + EnumChatFormatting.ITALIC.toString();
|
||||
int attemptNo = EscritoireGame.BOUNTY_MAX - inventory.getGame().getBountyLevel();
|
||||
textLayout.drawLine(format + "Attempt No. " + attemptNo, 170, fontColor.get("gui.mail.lettertext"));
|
||||
String attemptNoString = StringUtil.localizeAndFormat("gui.escritoire.attempt.number", attemptNo);
|
||||
textLayout.drawLine(format + attemptNoString, 170, fontColor.get("gui.mail.lettertext"));
|
||||
textLayout.newLine();
|
||||
String escritoireText = textSource.getText(inventory.getGame());
|
||||
textLayout.drawSplitLine(escritoireText, 170, 90, fontColor.get("gui.mail.lettertext"));
|
||||
|
||||
@@ -34,6 +34,7 @@ import forestry.core.inventory.IInventoryAdapter;
|
||||
import forestry.core.inventory.InventoryAdapter;
|
||||
import forestry.core.utils.InventoryUtil;
|
||||
import forestry.core.utils.ItemStackUtil;
|
||||
import forestry.core.utils.StringUtil;
|
||||
import forestry.mail.inventory.InventoryTradeStation;
|
||||
import forestry.mail.items.EnumStampDefinition;
|
||||
import forestry.plugins.PluginMail;
|
||||
@@ -175,44 +176,44 @@ public class TradeStation extends WorldSavedData implements ITradeStation, IInve
|
||||
return EnumStationState.INSUFFICIENT_PAPER;
|
||||
}
|
||||
|
||||
int ordersToFill = ItemStackUtil.containsSets(InventoryUtil.getStacks(inventory, SLOT_EXCHANGE_1, SLOT_EXCHANGE_COUNT), letter.getAttachments());
|
||||
int ordersToFillCount = ItemStackUtil.containsSets(InventoryUtil.getStacks(inventory, SLOT_EXCHANGE_1, SLOT_EXCHANGE_COUNT), letter.getAttachments());
|
||||
|
||||
// Not a single match.
|
||||
if (ordersToFill <= 0) {
|
||||
if (ordersToFillCount <= 0) {
|
||||
return EnumStationState.INSUFFICIENT_OFFER;
|
||||
}
|
||||
|
||||
if (!isVirtual()) {
|
||||
int fillable = countFillableOrders(ordersToFill, inventory.getStackInSlot(SLOT_TRADEGOOD));
|
||||
int fillable = countFillableOrders(ordersToFillCount, inventory.getStackInSlot(SLOT_TRADEGOOD));
|
||||
|
||||
// Nothing can be filled.
|
||||
if (fillable <= 0) {
|
||||
return EnumStationState.INSUFFICIENT_TRADE_GOOD;
|
||||
}
|
||||
|
||||
if (fillable < ordersToFill) {
|
||||
ordersToFill = fillable;
|
||||
if (fillable < ordersToFillCount) {
|
||||
ordersToFillCount = fillable;
|
||||
}
|
||||
|
||||
// Check for sufficient output buffer
|
||||
int storable = countStorablePayment(ordersToFill, InventoryUtil.getStacks(inventory, SLOT_EXCHANGE_1, SLOT_EXCHANGE_COUNT));
|
||||
int storable = countStorablePayment(ordersToFillCount, InventoryUtil.getStacks(inventory, SLOT_EXCHANGE_1, SLOT_EXCHANGE_COUNT));
|
||||
|
||||
if (storable <= 0) {
|
||||
return EnumStationState.INSUFFICIENT_BUFFER;
|
||||
}
|
||||
|
||||
if (storable < ordersToFill) {
|
||||
ordersToFill = storable;
|
||||
if (storable < ordersToFillCount) {
|
||||
ordersToFillCount = storable;
|
||||
}
|
||||
}
|
||||
|
||||
// Prepare the letter
|
||||
ILetter mail = new Letter(this.address, letter.getSender());
|
||||
mail.setText("Please find your order attached.");
|
||||
for (int i = 0; i < ordersToFill; i++) {
|
||||
mail.setText(StringUtil.localize("gui.mail.order.attached"));
|
||||
for (int i = 0; i < ordersToFillCount; i++) {
|
||||
mail.addAttachment(inventory.getStackInSlot(SLOT_TRADEGOOD).copy());
|
||||
}
|
||||
mail.addAttachments(getSurplusAttachments(ordersToFill, letter.getAttachments()));
|
||||
mail.addAttachments(getSurplusAttachments(ordersToFillCount, letter.getAttachments()));
|
||||
|
||||
// Check for necessary postage
|
||||
int requiredPostage = mail.requiredPostage();
|
||||
@@ -247,7 +248,7 @@ public class TradeStation extends WorldSavedData implements ITradeStation, IInve
|
||||
}
|
||||
|
||||
// Store received items
|
||||
for (int i = 0; i < ordersToFill; i++) {
|
||||
for (int i = 0; i < ordersToFillCount; i++) {
|
||||
for (ItemStack stack : InventoryUtil.getStacks(inventory, SLOT_EXCHANGE_1, SLOT_EXCHANGE_COUNT)) {
|
||||
if (stack == null) {
|
||||
continue;
|
||||
@@ -260,14 +261,25 @@ public class TradeStation extends WorldSavedData implements ITradeStation, IInve
|
||||
// Remove resources
|
||||
removePaper();
|
||||
removeStamps(stampCount);
|
||||
removeTradegood(ordersToFill);
|
||||
removeTradegood(ordersToFillCount);
|
||||
|
||||
// Send confirmation message to seller
|
||||
if (sendOwnerNotice) {
|
||||
nbttagcompound = new NBTTagCompound();
|
||||
|
||||
ILetter confirm = new Letter(this.address, new MailAddress(this.owner));
|
||||
confirm.setText(ordersToFill + " order(s) from " + letter.getSender().getName() + " were filled.");
|
||||
|
||||
String orderFilledMessage;
|
||||
if (ordersToFillCount == 1) {
|
||||
orderFilledMessage = StringUtil.localize("gui.mail.order.filled.one");
|
||||
} else {
|
||||
orderFilledMessage = StringUtil.localize("gui.mail.order.filled.multiple");
|
||||
orderFilledMessage = orderFilledMessage.replace("%COUNT", Integer.toString(ordersToFillCount));
|
||||
}
|
||||
|
||||
orderFilledMessage = orderFilledMessage.replace("%SENDER", letter.getSender().getName());
|
||||
|
||||
confirm.setText(orderFilledMessage);
|
||||
confirm.addStamps(PluginMail.items.stamps.get(EnumStampDefinition.P_1, 1));
|
||||
confirm.writeToNBT(nbttagcompound);
|
||||
|
||||
|
||||
Reference in new issue
Block a user