Simple Cleanup

This commit is contained in:
mezz committed 2014-12-20 03:59:31 -08:00
1 parent 09df969bcf
commit e2fff11ea8
141 files changed
+545 -859

No files matched your search

+1 -8
View File
@@ -135,16 +135,9 @@ public class Letter implements ILetter, INBTTagable {
@Override
public boolean isMailable() {
// Can't resend an already sent letter
if (this.isProcessed)
return false;
// Requires at least one recipient
if (this.recipient != null && this.recipient.length > 0)
return true;
return false;
return !isProcessed && recipient != null && recipient.length > 0;
}
@Override
+1 -1
View File
@@ -122,7 +122,7 @@ public class PostOffice extends WorldSavedData implements IPostOffice {
for (EnumPostage postage : postages) {
int collected = 0;
int collected;
if (collectedPostage[postage.ordinal()] <= 0)
continue;
@@ -161,7 +161,7 @@ public class PostRegistry implements IPostRegistry {
}
public IMailAddress getValidMailAddress(World world, GameProfile gameProfile) {
IMailAddress address = new MailAddress(gameProfile);;
IMailAddress address = new MailAddress(gameProfile);
if (getPOBox(world, address) != null)
return address;
return null;
@@ -61,15 +61,11 @@ public class PostalCarrier implements IPostalCarrier {
}
private IPostalState handleTradeLetter(World world, IPostOffice office, IMailAddress recipient, ItemStack letterstack, boolean doLodge) {
IPostalState state = EnumDeliveryState.NOT_MAILABLE;
ITradeStation trade = PostManager.postRegistry.getTradeStation(world, recipient);
if (trade == null)
return EnumDeliveryState.NO_MAILBOX;
state = trade.handleLetter(world, recipient, letterstack, doLodge);
return state;
return trade.handleLetter(world, recipient, letterstack, doLodge);
}
private EnumDeliveryState storeInPOBox(World world, IPostOffice office, IMailAddress recipient, ItemStack letterstack, boolean doLodge) {
@@ -585,7 +585,7 @@ public class TradeStation extends WorldSavedData implements ITradeStation, ISide
int[] slotsInt = new int[slots.size()];
for (int i = 0; i < slots.size(); i++)
slotsInt[i] = slots.get(i).intValue();
slotsInt[i] = slots.get(i);
return slotsInt;
}
@@ -61,17 +61,17 @@ public class ContainerLetter extends ContainerItemInventory {
// Stamps
for (int i = 0; i < 4; i++)
addSlot(new SlotCustom(inventory, Letter.SLOT_POSTAGE_1 + i, 150, 14 + i * 19, validStamps).setStackLimit(1));
addSlotToContainer(new SlotCustom(inventory, Letter.SLOT_POSTAGE_1 + i, 150, 14 + i * 19, validStamps).setStackLimit(1));
// Attachments
if (!letterInventory.getLetter().isProcessed())
for (int i = 0; i < 2; i++)
for (int j = 0; j < 9; j++)
addSlot(new SlotCustom(inventory, Letter.SLOT_ATTACHMENT_1 + j + i * 9, 17 + j * 18, 98 + i * 18, ItemLetter.class).setExclusion(true));
addSlotToContainer(new SlotCustom(inventory, Letter.SLOT_ATTACHMENT_1 + j + i * 9, 17 + j * 18, 98 + i * 18, ItemLetter.class).setExclusion(true));
else
for (int i = 0; i < 2; i++)
for (int j = 0; j < 9; j++)
addSlot(new SlotClosed(inventory, Letter.SLOT_ATTACHMENT_1 + j + i * 9, 17 + j * 18, 98 + i * 18));
addSlotToContainer(new SlotClosed(inventory, Letter.SLOT_ATTACHMENT_1 + j + i * 9, 17 + j * 18, 98 + i * 18));
// Player inventory
for (int i = 0; i < 3; i++)
@@ -126,7 +126,7 @@ public class ContainerLetter extends ContainerItemInventory {
break;
}
IPostalCarrier postal = null;
IPostalCarrier postal;
if(it.hasNext())
postal = it.next();
else
@@ -153,7 +153,7 @@ public class ContainerLetter extends ContainerItemInventory {
String typeName = packet.payload.stringPayload[1];
EnumAddressee type = EnumAddressee.fromString(typeName);
IMailAddress recipient = null;
IMailAddress recipient;
if (type == EnumAddressee.PLAYER) {
GameProfile gameProfile = MinecraftServer.getServer().func_152358_ax().func_152655_a(recipientName);
if (gameProfile == null)
@@ -44,15 +44,15 @@ public class ContainerMailbox extends ContainerForestry {
for (int i = 0; i < 7; i++)
for (int j = 0; j < 12; j++)
addSlot(new SlotClosed(inventory, j + i * 9, 8 + j * 18, 8 + i * 18));
addSlotToContainer(new SlotClosed(inventory, j + i * 9, 8 + j * 18, 8 + i * 18));
// Player inventory
for (int i = 0; i < 3; i++)
for (int j = 0; j < 9; j++)
addSlot(new Slot(player, j + i * 9 + 9, 35 + j * 18, 145 + i * 18));
addSlotToContainer(new Slot(player, j + i * 9 + 9, 35 + j * 18, 145 + i * 18));
// Player hotbar
for (int i = 0; i < 9; i++)
addSlot(new Slot(player, i, 35 + i * 18, 203));
addSlotToContainer(new Slot(player, i, 35 + i * 18, 203));
}
@@ -24,20 +24,20 @@ public class ContainerPhilatelist extends ContainerForestry {
super(tile);
// Filter
addSlot(new SlotCustom(tile, MachinePhilatelist.SLOT_FILTER, 80, 19, ItemStamps.class));
addSlotToContainer(new SlotCustom(tile, MachinePhilatelist.SLOT_FILTER, 80, 19, ItemStamps.class));
// Collected Stamps
for (int i = 0; i < 3; i++)
for (int j = 0; j < 9; j++)
addSlot(new SlotClosed(tile, j + i * 9 + MachinePhilatelist.SLOT_BUFFER_1, 8 + j * 18, 46 + i * 18));
addSlotToContainer(new SlotClosed(tile, j + i * 9 + MachinePhilatelist.SLOT_BUFFER_1, 8 + j * 18, 46 + i * 18));
// Player inventory
for (int i = 0; i < 3; i++)
for (int j = 0; j < 9; j++)
addSlot(new Slot(player, j + i * 9 + 9, 8 + j * 18, 111 + i * 18));
addSlotToContainer(new Slot(player, j + i * 9 + 9, 8 + j * 18, 111 + i * 18));
// Player hotbar
for (int i = 0; i < 9; i++)
addSlot(new Slot(player, i, 8 + i * 18, 169));
addSlotToContainer(new Slot(player, i, 8 + i * 18, 169));
}
@@ -24,13 +24,11 @@ import org.apache.commons.lang3.StringUtils;
public class ContainerTradeName extends ContainerForestry {
boolean isLinked;
MachineTrader machine;
protected final MachineTrader machine;
public ContainerTradeName(InventoryPlayer player, MachineTrader tile) {
super(new InventoryAdapter(0, "Empty"));
machine = tile;
isLinked = machine.isLinked();
}
public IMailAddress getAddress() {
@@ -32,26 +32,26 @@ public class ContainerTrader extends ContainerForestry {
IInventory inventory = machine.getOrCreateTradeInventory();
// Trade good
this.addSlot(new Slot(inventory, TradeStation.SLOT_TRADEGOOD, 78, 109));
this.addSlotToContainer(new Slot(inventory, TradeStation.SLOT_TRADEGOOD, 78, 109));
// Exchange
for (int i = 0; i < 2; i++) {
for (int j = 0; j < 2; j++) {
addSlot(new Slot(inventory, TradeStation.SLOT_EXCHANGE_1 + j + i * 2, 69 + j * 18, 55 + i * 18));
addSlotToContainer(new Slot(inventory, TradeStation.SLOT_EXCHANGE_1 + j + i * 2, 69 + j * 18, 55 + i * 18));
}
}
// Stamps
for (int i = 0; i < 2; i++) {
for (int j = 0; j < 2; j++) {
addSlot(new SlotCustom(inventory, TradeStation.SLOT_STAMPS_1 + j + i * 2, 15 + j * 18, 37 + i * 18, ItemStamps.class));
addSlotToContainer(new SlotCustom(inventory, TradeStation.SLOT_STAMPS_1 + j + i * 2, 15 + j * 18, 37 + i * 18, ItemStamps.class));
}
}
// Letters
for (int i = 0; i < 3; i++) {
for (int j = 0; j < 2; j++) {
addSlot(new SlotCustom(inventory, TradeStation.SLOT_LETTERS_1 + j + i * 2, 15 + j * 18, 73 + i * 18, Items.paper));
addSlotToContainer(new SlotCustom(inventory, TradeStation.SLOT_LETTERS_1 + j + i * 2, 15 + j * 18, 73 + i * 18, Items.paper));
}
}
@@ -59,25 +59,25 @@ public class ContainerTrader extends ContainerForestry {
final int bufCols = 5;
for (int i = 0; i < 3; i++) {
for (int j = 0; j < bufCols; j++) {
addSlot(new Slot(inventory, TradeStation.SLOT_RECEIVE_BUFFER + j + i * bufCols, 123 + j * 18, 19 + i * 18));
addSlotToContainer(new Slot(inventory, TradeStation.SLOT_RECEIVE_BUFFER + j + i * bufCols, 123 + j * 18, 19 + i * 18));
}
}
for (int i = 0; i < 2; i++) {
for (int j = 0; j < bufCols; j++) {
addSlot(new Slot(inventory, TradeStation.SLOT_SEND_BUFFER + j + i * bufCols, 123 + j * 18, (19 + (18 * 4)) + i * 18));
addSlotToContainer(new Slot(inventory, TradeStation.SLOT_SEND_BUFFER + j + i * bufCols, 123 + j * 18, (19 + (18 * 4)) + i * 18));
}
}
// Player inventory
for (int i = 0; i < 3; i++) {
for (int j = 0; j < 9; j++) {
addSlot(new Slot(player, j + i * 9 + 9, 33 + j * 18, 138 + i * 18));
addSlotToContainer(new Slot(player, j + i * 9 + 9, 33 + j * 18, 138 + i * 18));
}
}
// Player hotbar
for (int i = 0; i < 9; i++) {
addSlot(new Slot(player, i, 33 + i * 18, 196));
addSlotToContainer(new Slot(player, i, 33 + i * 18, 196));
}
}
@@ -24,13 +24,13 @@ import org.lwjgl.opengl.GL11;
public class GuiCatalogue extends GuiForestry<TileForestry> {
GuiButton buttonTrade;
GuiButton buttonClose;
// GuiButton buttonTrade;
// GuiButton buttonClose;
GuiButton buttonFilter;
GuiButton buttonCopy;
private GuiButton buttonFilter;
private GuiButton buttonCopy;
ContainerCatalogue container;
private final ContainerCatalogue container;
public GuiCatalogue(EntityPlayer player) {
super(new ResourceLocation("textures/gui/book.png"), new ContainerCatalogue(player));
@@ -76,10 +76,7 @@ public class GuiCatalogue extends GuiForestry<TileForestry> {
drawNoTrade(guiLeft + 38, guiTop + 30);
buttonFilter.displayString = StringUtil.localize("gui.mail.filter." + container.getFilterIdent());
if(container.getTradeInfo() == null || !container.getTradeInfo().state.isOk())
buttonCopy.enabled = false;
else
buttonCopy.enabled = true;
buttonCopy.enabled = container.getTradeInfo() != null && container.getTradeInfo().state.isOk();
}
private void drawNoTrade(int x, int y) {
@@ -228,10 +228,6 @@ public class ItemLetter extends ItemInventoried {
public static int encodeMeta(int state, int size) {
int meta = size << 4;
meta |= state;
size = getSize(meta);
state = getState(meta);
return meta;
}