Move mail blocks to PluginMail.blocks

This commit is contained in:
mezz committed 2015-11-19 01:04:37 -08:00
1 parent 6cfae1462f
commit ffe19807db
14 files changed
+129 -72

No files matched your search

@@ -26,18 +26,18 @@ import forestry.core.tiles.TileUtil;
import forestry.mail.gui.ContainerCatalogue;
import forestry.mail.gui.ContainerLetter;
import forestry.mail.gui.ContainerMailbox;
import forestry.mail.gui.ContainerPhilatelist;
import forestry.mail.gui.ContainerStampCollector;
import forestry.mail.gui.ContainerTradeName;
import forestry.mail.gui.ContainerTrader;
import forestry.mail.gui.GuiCatalogue;
import forestry.mail.gui.GuiLetter;
import forestry.mail.gui.GuiMailbox;
import forestry.mail.gui.GuiPhilatelist;
import forestry.mail.gui.GuiStampCollector;
import forestry.mail.gui.GuiTradeName;
import forestry.mail.gui.GuiTrader;
import forestry.mail.inventory.ItemInventoryLetter;
import forestry.mail.tiles.TileMailbox;
import forestry.mail.tiles.TilePhilatelist;
import forestry.mail.tiles.TileStampCollector;
import forestry.mail.tiles.TileTrader;
import forestry.plugins.PluginMail;
@@ -79,8 +79,8 @@ public class GuiHandlerMail extends GuiHandlerBase {
case MailboxGUI:
return new GuiMailbox(player.inventory, TileUtil.getTile(world, x, y, z, TileMailbox.class));
case PhilatelistGUI:
return new GuiPhilatelist(player.inventory, TileUtil.getTile(world, x, y, z, TilePhilatelist.class));
case StampCollectorGUI:
return new GuiStampCollector(player.inventory, TileUtil.getTile(world, x, y, z, TileStampCollector.class));
case TraderGUI:
return new GuiTrader(player.inventory, TileUtil.getTile(world, x, y, z, TileTrader.class));
case TraderNameGUI:
@@ -126,8 +126,8 @@ public class GuiHandlerMail extends GuiHandlerBase {
case MailboxGUI:
return new ContainerMailbox(player.inventory, TileUtil.getTile(world, x, y, z, TileMailbox.class));
case PhilatelistGUI:
return new ContainerPhilatelist(player.inventory, TileUtil.getTile(world, x, y, z, TilePhilatelist.class));
case StampCollectorGUI:
return new ContainerStampCollector(player.inventory, TileUtil.getTile(world, x, y, z, TileStampCollector.class));
case TraderGUI:
return new ContainerTrader(player.inventory, TileUtil.getTile(world, x, y, z, TileTrader.class));
case TraderNameGUI:
@@ -0,0 +1,26 @@
/*******************************************************************************
* Copyright (c) 2011-2014 SirSengir.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the GNU Lesser Public License v3
* which accompanies this distribution, and is available at
* http://www.gnu.org/licenses/lgpl-3.0.txt
*
* Various Contributors including, but not limited to:
* SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges
******************************************************************************/
package forestry.mail.blocks;
import net.minecraft.block.material.Material;
import net.minecraft.item.ItemStack;
import forestry.core.blocks.BlockBase;
public class BlockMail extends BlockBase {
public BlockMail() {
super(Material.iron);
}
public ItemStack get(BlockMailType type) {
return new ItemStack(this, 1, type.ordinal());
}
}
@@ -0,0 +1,19 @@
/*******************************************************************************
* Copyright (c) 2011-2014 SirSengir.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the GNU Lesser Public License v3
* which accompanies this distribution, and is available at
* http://www.gnu.org/licenses/lgpl-3.0.txt
*
* Various Contributors including, but not limited to:
* SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges
******************************************************************************/
package forestry.mail.blocks;
public enum BlockMailType {
MAILBOX,
TRADE_STATION,
STAMP_COLLECTOR;
public static final BlockMailType[] VALUES = values();
}
@@ -0,0 +1,22 @@
/*******************************************************************************
* Copyright (c) 2011-2014 SirSengir.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the GNU Lesser Public License v3
* which accompanies this distribution, and is available at
* http://www.gnu.org/licenses/lgpl-3.0.txt
*
* Various Contributors including, but not limited to:
* SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges
******************************************************************************/
package forestry.mail.blocks;
import forestry.core.blocks.BlockRegistry;
import forestry.core.items.ItemBlockForestry;
public class BlockRegistryMail extends BlockRegistry {
public final BlockMail mail;
public BlockRegistryMail() {
mail = registerBlock(new BlockMail(), ItemBlockForestry.class, "mail");
}
}
@@ -15,21 +15,21 @@ import net.minecraft.entity.player.InventoryPlayer;
import forestry.core.gui.ContainerTile;
import forestry.core.gui.slots.SlotFiltered;
import forestry.core.gui.slots.SlotOutput;
import forestry.mail.inventory.InventoryPhilatelist;
import forestry.mail.tiles.TilePhilatelist;
import forestry.mail.inventory.InventoryStampCollector;
import forestry.mail.tiles.TileStampCollector;
public class ContainerPhilatelist extends ContainerTile<TilePhilatelist> {
public class ContainerStampCollector extends ContainerTile<TileStampCollector> {
public ContainerPhilatelist(InventoryPlayer player, TilePhilatelist tile) {
public ContainerStampCollector(InventoryPlayer player, TileStampCollector tile) {
super(tile, player, 8, 111);
// Filter
addSlotToContainer(new SlotFiltered(tile, InventoryPhilatelist.SLOT_FILTER, 80, 19));
addSlotToContainer(new SlotFiltered(tile, InventoryStampCollector.SLOT_FILTER, 80, 19));
// Collected Stamps
for (int i = 0; i < 3; i++) {
for (int j = 0; j < 9; j++) {
addSlotToContainer(new SlotOutput(tile, j + i * 9 + InventoryPhilatelist.SLOT_BUFFER_1, 8 + j * 18, 46 + i * 18));
addSlotToContainer(new SlotOutput(tile, j + i * 9 + InventoryStampCollector.SLOT_BUFFER_1, 8 + j * 18, 46 + i * 18));
}
}
}
@@ -14,14 +14,12 @@ import net.minecraft.entity.player.InventoryPlayer;
import forestry.core.config.Constants;
import forestry.core.gui.GuiForestry;
import forestry.mail.tiles.TilePhilatelist;
import forestry.mail.tiles.TileStampCollector;
public class GuiPhilatelist extends GuiForestry<ContainerPhilatelist, TilePhilatelist> {
public GuiPhilatelist(InventoryPlayer player, TilePhilatelist tile) {
super(Constants.TEXTURE_PATH_GUI + "/philatelist.png", new ContainerPhilatelist(player, tile), tile);
public class GuiStampCollector extends GuiForestry<ContainerStampCollector, TileStampCollector> {
public GuiStampCollector(InventoryPlayer player, TileStampCollector tile) {
super(Constants.TEXTURE_PATH_GUI + "/philatelist.png", new ContainerStampCollector(player, tile), tile);
this.xSize = 176;
this.ySize = 193;
}
}
@@ -14,14 +14,14 @@ import net.minecraft.item.ItemStack;
import forestry.api.mail.IStamps;
import forestry.core.inventory.InventoryAdapterTile;
import forestry.mail.tiles.TilePhilatelist;
import forestry.mail.tiles.TileStampCollector;
public class InventoryPhilatelist extends InventoryAdapterTile<TilePhilatelist> {
public class InventoryStampCollector extends InventoryAdapterTile<TileStampCollector> {
public static final short SLOT_FILTER = 0;
public static final short SLOT_BUFFER_1 = 1;
public static final short SLOT_BUFFER_COUNT = 27;
public InventoryPhilatelist(TilePhilatelist tile) {
public InventoryStampCollector(TileStampCollector tile) {
super(tile, 28, "INV");
}
@@ -19,12 +19,12 @@ import forestry.core.inventory.IInventoryAdapter;
import forestry.core.network.GuiId;
import forestry.core.tiles.TileBase;
import forestry.core.utils.InventoryUtil;
import forestry.mail.inventory.InventoryPhilatelist;
import forestry.mail.inventory.InventoryStampCollector;
public class TilePhilatelist extends TileBase implements IInventory {
public TilePhilatelist() {
super(GuiId.PhilatelistGUI, "philatelist");
setInternalInventory(new InventoryPhilatelist(this));
public class TileStampCollector extends TileBase implements IInventory {
public TileStampCollector() {
super(GuiId.StampCollectorGUI, "philatelist");
setInternalInventory(new InventoryStampCollector(this));
}
@Override
@@ -36,10 +36,10 @@ public class TilePhilatelist extends TileBase implements IInventory {
ItemStack stamp = null;
IInventoryAdapter inventory = getInternalInventory();
if (inventory.getStackInSlot(InventoryPhilatelist.SLOT_FILTER) == null) {
if (inventory.getStackInSlot(InventoryStampCollector.SLOT_FILTER) == null) {
stamp = PostManager.postRegistry.getPostOffice(worldObj).getAnyStamp(1);
} else {
ItemStack filter = inventory.getStackInSlot(InventoryPhilatelist.SLOT_FILTER);
ItemStack filter = inventory.getStackInSlot(InventoryStampCollector.SLOT_FILTER);
if (filter.getItem() instanceof IStamps) {
stamp = PostManager.postRegistry.getPostOffice(worldObj).getAnyStamp(((IStamps) filter.getItem()).getPostage(filter), 1);
}
@@ -50,6 +50,6 @@ public class TilePhilatelist extends TileBase implements IInventory {
}
// Store it.
InventoryUtil.stowInInventory(stamp, inventory, true, InventoryPhilatelist.SLOT_BUFFER_1, InventoryPhilatelist.SLOT_BUFFER_COUNT);
InventoryUtil.stowInInventory(stamp, inventory, true, InventoryStampCollector.SLOT_BUFFER_1, InventoryStampCollector.SLOT_BUFFER_COUNT);
}
}