mirror of
https://github.com/GTNewHorizons/ForestryMC.git
synced 2026-11-20 03:59:45 +00:00
Refactor GUI handling code
This commit is contained in:
1 parent
31231db459
commit
408a66bb40
97 files changed
+1053
-1729
No files matched your search
@@ -1,239 +0,0 @@
|
||||
/*******************************************************************************
|
||||
* 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.apiculture;
|
||||
|
||||
import net.minecraft.client.gui.Gui;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.Container;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
import forestry.api.apiculture.BeeManager;
|
||||
import forestry.apiculture.entities.EntityMinecartApiary;
|
||||
import forestry.apiculture.entities.EntityMinecartBeehouse;
|
||||
import forestry.apiculture.gui.ContainerAlveary;
|
||||
import forestry.apiculture.gui.ContainerAlvearyHygroregulator;
|
||||
import forestry.apiculture.gui.ContainerAlvearySieve;
|
||||
import forestry.apiculture.gui.ContainerAlvearySwarmer;
|
||||
import forestry.apiculture.gui.ContainerBeeHousing;
|
||||
import forestry.apiculture.gui.ContainerHabitatLocator;
|
||||
import forestry.apiculture.gui.ContainerImprinter;
|
||||
import forestry.apiculture.gui.ContainerMinecartBeehouse;
|
||||
import forestry.apiculture.gui.GuiAlveary;
|
||||
import forestry.apiculture.gui.GuiAlvearyHygroregulator;
|
||||
import forestry.apiculture.gui.GuiAlvearySieve;
|
||||
import forestry.apiculture.gui.GuiAlvearySwarmer;
|
||||
import forestry.apiculture.gui.GuiBeeHousing;
|
||||
import forestry.apiculture.gui.GuiBeealyzer;
|
||||
import forestry.apiculture.gui.GuiHabitatLocator;
|
||||
import forestry.apiculture.gui.GuiImprinter;
|
||||
import forestry.apiculture.inventory.ItemInventoryBeealyzer;
|
||||
import forestry.apiculture.inventory.ItemInventoryHabitatLocator;
|
||||
import forestry.apiculture.inventory.ItemInventoryImprinter;
|
||||
import forestry.apiculture.multiblock.TileAlvearyHygroregulator;
|
||||
import forestry.apiculture.multiblock.TileAlvearyPlain;
|
||||
import forestry.apiculture.multiblock.TileAlvearySieve;
|
||||
import forestry.apiculture.multiblock.TileAlvearySwarmer;
|
||||
import forestry.apiculture.tiles.TileApiary;
|
||||
import forestry.apiculture.tiles.TileBeehouse;
|
||||
import forestry.core.GuiHandlerBase;
|
||||
import forestry.core.gui.ContainerAlyzer;
|
||||
import forestry.core.network.GuiId;
|
||||
import forestry.core.tiles.TileUtil;
|
||||
|
||||
public class GuiHandlerApiculture extends GuiHandlerBase {
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public Gui getClientGuiElement(int id, EntityPlayer player, World world, int x, int y, int z) {
|
||||
int cleanId = decodeGuiID(id);
|
||||
int guiData = decodeGuiData(id);
|
||||
|
||||
if (cleanId >= GuiId.values().length) {
|
||||
return null;
|
||||
}
|
||||
|
||||
ItemStack equipped;
|
||||
switch (GuiId.values()[cleanId]) {
|
||||
|
||||
case AlvearyGUI:
|
||||
return new GuiAlveary(player.inventory, TileUtil.getTile(world, x, y, z, TileAlvearyPlain.class));
|
||||
|
||||
case AlvearySieveGUI:
|
||||
return new GuiAlvearySieve(player.inventory, TileUtil.getTile(world, x, y, z, TileAlvearySieve.class));
|
||||
|
||||
case AlvearySwarmerGUI:
|
||||
return new GuiAlvearySwarmer(player.inventory, TileUtil.getTile(world, x, y, z, TileAlvearySwarmer.class));
|
||||
|
||||
case ApiaristChestGUI:
|
||||
return getNaturalistChestGui(BeeManager.beeRoot, player, world, x, y, z, guiData);
|
||||
|
||||
case ApiaryGUI: {
|
||||
TileApiary tileApiary = TileUtil.getTile(world, x, y, z, TileApiary.class);
|
||||
ContainerBeeHousing container = new ContainerBeeHousing(player.inventory, tileApiary, true);
|
||||
return new GuiBeeHousing<>(tileApiary, container, GuiBeeHousing.Icon.APIARY);
|
||||
}
|
||||
|
||||
case BeealyzerGUI:
|
||||
equipped = player.getCurrentEquippedItem();
|
||||
if (equipped == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return new GuiBeealyzer(player, new ItemInventoryBeealyzer(player, equipped));
|
||||
|
||||
case BeehouseGUI: {
|
||||
TileBeehouse tileBeehouse = TileUtil.getTile(world, x, y, z, TileBeehouse.class);
|
||||
ContainerBeeHousing container = new ContainerBeeHousing(player.inventory, tileBeehouse, false);
|
||||
return new GuiBeeHousing<>(tileBeehouse, container, GuiBeeHousing.Icon.BEE_HOUSE);
|
||||
}
|
||||
|
||||
case MinecartBeehouseGUI: {
|
||||
Entity entity = world.getEntityByID(x);
|
||||
if (!(entity instanceof EntityMinecartBeehouse)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
EntityMinecartBeehouse beeCart = (EntityMinecartBeehouse) entity;
|
||||
ContainerMinecartBeehouse container = new ContainerMinecartBeehouse(player.inventory, beeCart, false);
|
||||
return new GuiBeeHousing<>(beeCart, container, GuiBeeHousing.Icon.BEE_HOUSE);
|
||||
}
|
||||
|
||||
case MinecartApiaryGUI: {
|
||||
Entity entity = world.getEntityByID(x);
|
||||
if (!(entity instanceof EntityMinecartApiary)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
EntityMinecartApiary beeCart = (EntityMinecartApiary) entity;
|
||||
ContainerMinecartBeehouse container = new ContainerMinecartBeehouse(player.inventory, beeCart, true);
|
||||
return new GuiBeeHousing<>(beeCart, container, GuiBeeHousing.Icon.APIARY);
|
||||
}
|
||||
|
||||
case HabitatLocatorGUI:
|
||||
equipped = player.getCurrentEquippedItem();
|
||||
if (equipped == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return new GuiHabitatLocator(player, new ItemInventoryHabitatLocator(player, equipped));
|
||||
|
||||
case HygroregulatorGUI:
|
||||
return new GuiAlvearyHygroregulator(player.inventory, TileUtil.getTile(world, x, y, z, TileAlvearyHygroregulator.class));
|
||||
|
||||
case ImprinterGUI:
|
||||
equipped = player.getCurrentEquippedItem();
|
||||
if (equipped == null) {
|
||||
return null;
|
||||
}
|
||||
return new GuiImprinter(player.inventory, new ItemInventoryImprinter(player, equipped));
|
||||
|
||||
default:
|
||||
return null;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Container getServerGuiElement(int id, EntityPlayer player, World world, int x, int y, int z) {
|
||||
int cleanId = decodeGuiID(id);
|
||||
int guiData = decodeGuiData(id);
|
||||
|
||||
if (cleanId >= GuiId.values().length) {
|
||||
return null;
|
||||
}
|
||||
|
||||
ItemStack equipped;
|
||||
switch (GuiId.values()[cleanId]) {
|
||||
|
||||
case AlvearyGUI:
|
||||
synchApiaristTracker(world, player);
|
||||
return new ContainerAlveary(player.inventory, TileUtil.getTile(world, x, y, z, TileAlvearyPlain.class));
|
||||
|
||||
case AlvearySieveGUI:
|
||||
return new ContainerAlvearySieve(player.inventory, TileUtil.getTile(world, x, y, z, TileAlvearySieve.class));
|
||||
|
||||
case AlvearySwarmerGUI:
|
||||
return new ContainerAlvearySwarmer(player.inventory, TileUtil.getTile(world, x, y, z, TileAlvearySwarmer.class));
|
||||
|
||||
case ApiaristChestGUI:
|
||||
return getNaturalistChestContainer(BeeManager.beeRoot, player, world, x, y, z, guiData);
|
||||
|
||||
case ApiaryGUI:
|
||||
synchApiaristTracker(world, player);
|
||||
return new ContainerBeeHousing(player.inventory, TileUtil.getTile(world, x, y, z, TileApiary.class), true);
|
||||
|
||||
case BeealyzerGUI:
|
||||
equipped = player.getCurrentEquippedItem();
|
||||
if (equipped == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
synchApiaristTracker(world, player);
|
||||
return new ContainerAlyzer(new ItemInventoryBeealyzer(player, equipped), player);
|
||||
|
||||
case BeehouseGUI:
|
||||
synchApiaristTracker(world, player);
|
||||
return new ContainerBeeHousing(player.inventory, TileUtil.getTile(world, x, y, z, TileBeehouse.class), false);
|
||||
|
||||
case MinecartBeehouseGUI: {
|
||||
Entity entity = world.getEntityByID(x);
|
||||
if (!(entity instanceof EntityMinecartBeehouse)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
synchApiaristTracker(world, player);
|
||||
return new ContainerMinecartBeehouse(player.inventory, (EntityMinecartBeehouse) entity, false);
|
||||
}
|
||||
|
||||
case MinecartApiaryGUI: {
|
||||
Entity entity = world.getEntityByID(x);
|
||||
if (!(entity instanceof EntityMinecartApiary)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
synchApiaristTracker(world, player);
|
||||
return new ContainerMinecartBeehouse(player.inventory, (EntityMinecartApiary) entity, true);
|
||||
}
|
||||
|
||||
case HabitatLocatorGUI:
|
||||
equipped = player.getCurrentEquippedItem();
|
||||
if (equipped == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return new ContainerHabitatLocator(player, new ItemInventoryHabitatLocator(player, equipped));
|
||||
|
||||
case HygroregulatorGUI:
|
||||
return new ContainerAlvearyHygroregulator(player.inventory, TileUtil.getTile(world, x, y, z, TileAlvearyHygroregulator.class));
|
||||
|
||||
case ImprinterGUI:
|
||||
synchApiaristTracker(world, player);
|
||||
equipped = player.getCurrentEquippedItem();
|
||||
if (equipped == null) {
|
||||
return null;
|
||||
}
|
||||
return new ContainerImprinter(player.inventory, new ItemInventoryImprinter(player, equipped));
|
||||
|
||||
default:
|
||||
return null;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
private static void synchApiaristTracker(World world, EntityPlayer player) {
|
||||
BeeManager.beeRoot.getBreedingTracker(world, player.getGameProfile()).synchToPlayer(player);
|
||||
}
|
||||
}
|
||||
@@ -16,9 +16,11 @@ import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import forestry.api.apiculture.BeeManager;
|
||||
import forestry.api.apiculture.IBeeHousingInventory;
|
||||
import forestry.api.apiculture.IBeeListener;
|
||||
import forestry.api.apiculture.IBeeModifier;
|
||||
@@ -27,11 +29,12 @@ import forestry.apiculture.ApiaryBeeListener;
|
||||
import forestry.apiculture.ApiaryBeeModifier;
|
||||
import forestry.apiculture.IApiary;
|
||||
import forestry.apiculture.blocks.BlockApicultureType;
|
||||
import forestry.apiculture.gui.ContainerMinecartBeehouse;
|
||||
import forestry.apiculture.gui.GuiBeeHousing;
|
||||
import forestry.apiculture.inventory.IApiaryInventory;
|
||||
import forestry.apiculture.inventory.InventoryApiary;
|
||||
import forestry.core.config.Config;
|
||||
import forestry.core.inventory.IInventoryAdapter;
|
||||
import forestry.core.network.GuiId;
|
||||
import forestry.plugins.PluginApiculture;
|
||||
|
||||
public class EntityMinecartApiary extends EntityMinecartBeeHousingBase implements IApiary {
|
||||
@@ -48,11 +51,6 @@ public class EntityMinecartApiary extends EntityMinecartBeeHousingBase implement
|
||||
super(world, posX, posY, posZ);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected GuiId getGuiId() {
|
||||
return GuiId.MinecartApiaryGUI;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getHints() {
|
||||
return Config.hints.get("apiary");
|
||||
@@ -105,4 +103,16 @@ public class EntityMinecartApiary extends EntityMinecartBeeHousingBase implement
|
||||
public Iterable<IBeeListener> getBeeListeners() {
|
||||
return Collections.singleton(beeListener);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getGui(EntityPlayer player, int data) {
|
||||
ContainerMinecartBeehouse container = new ContainerMinecartBeehouse(player.inventory, this, true);
|
||||
return new GuiBeeHousing<>(this, container, GuiBeeHousing.Icon.APIARY);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getContainer(EntityPlayer player, int data) {
|
||||
BeeManager.beeRoot.syncBreedingTrackerToPlayer(player);
|
||||
return new ContainerMinecartBeehouse(player.inventory, this, true);
|
||||
}
|
||||
}
|
||||
@@ -35,11 +35,12 @@ import forestry.core.entities.EntityMinecartContainerForestry;
|
||||
import forestry.core.network.DataInputStreamForestry;
|
||||
import forestry.core.network.DataOutputStreamForestry;
|
||||
import forestry.core.network.IForestryPacketServer;
|
||||
import forestry.core.network.IGuiHandlerEntity;
|
||||
import forestry.core.network.IStreamableGui;
|
||||
import forestry.core.proxy.Proxies;
|
||||
import forestry.core.tiles.IClimatised;
|
||||
|
||||
public abstract class EntityMinecartBeeHousingBase extends EntityMinecartContainerForestry implements IBeeHousing, IGuiBeeHousingInventory, IClimatised, IStreamableGui {
|
||||
public abstract class EntityMinecartBeeHousingBase extends EntityMinecartContainerForestry implements IBeeHousing, IGuiBeeHousingInventory, IClimatised, IStreamableGui, IGuiHandlerEntity {
|
||||
private static final Random random = new Random();
|
||||
private static final int beeFXInterval = 4;
|
||||
private static final int pollenFXInterval = 50;
|
||||
|
||||
@@ -14,9 +14,11 @@ import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import forestry.api.apiculture.BeeManager;
|
||||
import forestry.api.apiculture.DefaultBeeListener;
|
||||
import forestry.api.apiculture.IBeeHousingInventory;
|
||||
import forestry.api.apiculture.IBeeListener;
|
||||
@@ -24,9 +26,10 @@ import forestry.api.apiculture.IBeeModifier;
|
||||
import forestry.apiculture.BeehouseBeeModifier;
|
||||
import forestry.apiculture.InventoryBeeHousing;
|
||||
import forestry.apiculture.blocks.BlockApicultureType;
|
||||
import forestry.apiculture.gui.ContainerMinecartBeehouse;
|
||||
import forestry.apiculture.gui.GuiBeeHousing;
|
||||
import forestry.core.config.Config;
|
||||
import forestry.core.inventory.IInventoryAdapter;
|
||||
import forestry.core.network.GuiId;
|
||||
import forestry.plugins.PluginApiculture;
|
||||
|
||||
public class EntityMinecartBeehouse extends EntityMinecartBeeHousingBase {
|
||||
@@ -45,11 +48,6 @@ public class EntityMinecartBeehouse extends EntityMinecartBeeHousingBase {
|
||||
beeInventory.disableAutomation();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected GuiId getGuiId() {
|
||||
return GuiId.MinecartBeehouseGUI;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getHints() {
|
||||
return Config.hints.get("bee.house");
|
||||
@@ -90,4 +88,16 @@ public class EntityMinecartBeehouse extends EntityMinecartBeeHousingBase {
|
||||
protected IInventoryAdapter getInternalInventory() {
|
||||
return beeInventory;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getGui(EntityPlayer player, int data) {
|
||||
ContainerMinecartBeehouse container = new ContainerMinecartBeehouse(player.inventory, this, false);
|
||||
return new GuiBeeHousing<>(this, container, GuiBeeHousing.Icon.BEE_HOUSE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getContainer(EntityPlayer player, int data) {
|
||||
BeeManager.beeRoot.syncBreedingTrackerToPlayer(player);
|
||||
return new ContainerMinecartBeehouse(player.inventory, this, false);
|
||||
}
|
||||
}
|
||||
@@ -12,13 +12,13 @@ package forestry.apiculture.gui;
|
||||
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
|
||||
import forestry.apiculture.multiblock.TileAlvearyPlain;
|
||||
import forestry.apiculture.multiblock.TileAlveary;
|
||||
import forestry.core.gui.ContainerTile;
|
||||
import forestry.core.network.packets.PacketGuiUpdate;
|
||||
|
||||
public class ContainerAlveary extends ContainerTile<TileAlvearyPlain> {
|
||||
public class ContainerAlveary extends ContainerTile<TileAlveary> {
|
||||
|
||||
public ContainerAlveary(InventoryPlayer player, TileAlvearyPlain tile) {
|
||||
public ContainerAlveary(InventoryPlayer player, TileAlveary tile) {
|
||||
super(tile, player, 8, 108);
|
||||
ContainerBeeHelper.addSlots(this, tile, false);
|
||||
}
|
||||
|
||||
@@ -13,14 +13,14 @@ package forestry.apiculture.gui;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
|
||||
import forestry.apiculture.multiblock.IAlvearyControllerInternal;
|
||||
import forestry.apiculture.multiblock.TileAlvearyPlain;
|
||||
import forestry.apiculture.multiblock.TileAlveary;
|
||||
import forestry.core.config.Constants;
|
||||
import forestry.core.gui.GuiForestryTitled;
|
||||
import forestry.core.render.EnumTankLevel;
|
||||
|
||||
public class GuiAlveary extends GuiForestryTitled<ContainerAlveary, TileAlvearyPlain> {
|
||||
public class GuiAlveary extends GuiForestryTitled<ContainerAlveary, TileAlveary> {
|
||||
|
||||
public GuiAlveary(InventoryPlayer inventory, TileAlvearyPlain tile) {
|
||||
public GuiAlveary(InventoryPlayer inventory, TileAlveary tile) {
|
||||
super(Constants.TEXTURE_PATH_GUI + "/alveary.png", new ContainerAlveary(inventory, tile), tile);
|
||||
|
||||
ySize = 190;
|
||||
|
||||
@@ -0,0 +1,40 @@
|
||||
/*******************************************************************************
|
||||
* 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.apiculture.items;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import forestry.api.apiculture.BeeManager;
|
||||
import forestry.api.core.Tabs;
|
||||
import forestry.apiculture.gui.GuiBeealyzer;
|
||||
import forestry.apiculture.inventory.ItemInventoryBeealyzer;
|
||||
import forestry.core.gui.ContainerAlyzer;
|
||||
import forestry.core.items.ItemWithGui;
|
||||
|
||||
public class ItemBeealyzer extends ItemWithGui {
|
||||
public ItemBeealyzer() {
|
||||
super(Tabs.tabApiculture);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getGui(EntityPlayer player, ItemStack heldItem, int data) {
|
||||
ItemInventoryBeealyzer inventory = new ItemInventoryBeealyzer(player, heldItem);
|
||||
return new GuiBeealyzer(player, inventory);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getContainer(EntityPlayer player, ItemStack heldItem, int data) {
|
||||
BeeManager.beeRoot.syncBreedingTrackerToPlayer(player);
|
||||
ItemInventoryBeealyzer inventory = new ItemInventoryBeealyzer(player, heldItem);
|
||||
return new ContainerAlyzer(inventory, player);
|
||||
}
|
||||
}
|
||||
@@ -28,9 +28,11 @@ import forestry.api.core.EnumHumidity;
|
||||
import forestry.api.core.EnumTemperature;
|
||||
import forestry.api.core.Tabs;
|
||||
import forestry.api.genetics.AlleleManager;
|
||||
import forestry.apiculture.gui.ContainerHabitatLocator;
|
||||
import forestry.apiculture.gui.GuiHabitatLocator;
|
||||
import forestry.apiculture.inventory.ItemInventoryHabitatLocator;
|
||||
import forestry.apiculture.render.TextureHabitatLocator;
|
||||
import forestry.core.items.ItemWithGui;
|
||||
import forestry.core.network.GuiId;
|
||||
import forestry.core.utils.StringUtil;
|
||||
|
||||
public class ItemHabitatLocator extends ItemWithGui {
|
||||
@@ -39,9 +41,8 @@ public class ItemHabitatLocator extends ItemWithGui {
|
||||
private final HabitatLocatorLogic locatorLogic;
|
||||
|
||||
public ItemHabitatLocator() {
|
||||
super(GuiId.HabitatLocatorGUI);
|
||||
super(Tabs.tabApiculture);
|
||||
setMaxStackSize(1);
|
||||
setCreativeTab(Tabs.tabApiculture);
|
||||
locatorLogic = new HabitatLocatorLogic();
|
||||
}
|
||||
|
||||
@@ -80,4 +81,14 @@ public class ItemHabitatLocator extends ItemWithGui {
|
||||
list.add(StringUtil.localize("gui.temperature") + ": " + AlleleManager.climateHelper.toDisplay(temperature));
|
||||
list.add(StringUtil.localize("gui.humidity") + ": " + AlleleManager.climateHelper.toDisplay(humidity));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getGui(EntityPlayer player, ItemStack heldItem, int data) {
|
||||
return new GuiHabitatLocator(player, new ItemInventoryHabitatLocator(player, heldItem));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getContainer(EntityPlayer player, ItemStack heldItem, int data) {
|
||||
return new ContainerHabitatLocator(player, new ItemInventoryHabitatLocator(player, heldItem));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
/*******************************************************************************
|
||||
* 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.apiculture.items;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import forestry.api.apiculture.BeeManager;
|
||||
import forestry.api.core.Tabs;
|
||||
import forestry.apiculture.gui.ContainerImprinter;
|
||||
import forestry.apiculture.gui.GuiImprinter;
|
||||
import forestry.apiculture.inventory.ItemInventoryImprinter;
|
||||
import forestry.core.items.ItemWithGui;
|
||||
|
||||
public class ItemImprinter extends ItemWithGui {
|
||||
public ItemImprinter() {
|
||||
super(Tabs.tabApiculture);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getGui(EntityPlayer player, ItemStack heldItem, int data) {
|
||||
return new GuiImprinter(player.inventory, new ItemInventoryImprinter(player, heldItem));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getContainer(EntityPlayer player, ItemStack heldItem, int data) {
|
||||
BeeManager.beeRoot.syncBreedingTrackerToPlayer(player);
|
||||
return new ContainerImprinter(player.inventory, new ItemInventoryImprinter(player, heldItem));
|
||||
}
|
||||
}
|
||||
@@ -18,8 +18,6 @@ import forestry.core.items.ItemForestry;
|
||||
import forestry.core.items.ItemOverlay;
|
||||
import forestry.core.items.ItemRegistry;
|
||||
import forestry.core.items.ItemScoop;
|
||||
import forestry.core.items.ItemWithGui;
|
||||
import forestry.core.network.GuiId;
|
||||
|
||||
public class ItemRegistryApiculture extends ItemRegistry {
|
||||
public final ItemBeeGE beeQueenGE;
|
||||
@@ -28,8 +26,8 @@ public class ItemRegistryApiculture extends ItemRegistry {
|
||||
public final ItemBeeGE beeLarvaeGE;
|
||||
|
||||
public final ItemHabitatLocator habitatLocator;
|
||||
public final ItemWithGui beealyzer;
|
||||
public final ItemWithGui imprinter;
|
||||
public final ItemBeealyzer beealyzer;
|
||||
public final ItemImprinter imprinter;
|
||||
|
||||
public final ItemMinecartBeehouse minecartBeehouse;
|
||||
|
||||
@@ -59,9 +57,9 @@ public class ItemRegistryApiculture extends ItemRegistry {
|
||||
beePrincessGE = registerItem(new ItemBeeGE(EnumBeeType.PRINCESS), "beePrincessGE");
|
||||
beeLarvaeGE = registerItem(new ItemBeeGE(EnumBeeType.LARVAE), "beeLarvaeGE");
|
||||
|
||||
beealyzer = registerItem(new ItemWithGui(GuiId.BeealyzerGUI, Tabs.tabApiculture), "beealyzer");
|
||||
beealyzer = registerItem(new ItemBeealyzer(), "beealyzer");
|
||||
habitatLocator = registerItem(new ItemHabitatLocator(), "habitatLocator");
|
||||
imprinter = registerItem(new ItemWithGui(GuiId.ImprinterGUI, Tabs.tabApiculture), "imprinter");
|
||||
imprinter = registerItem(new ItemImprinter(), "imprinter");
|
||||
|
||||
minecartBeehouse = registerItem(new ItemMinecartBeehouse(), "cart.beehouse");
|
||||
|
||||
|
||||
@@ -10,10 +10,15 @@
|
||||
******************************************************************************/
|
||||
package forestry.apiculture.multiblock;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.util.ChunkCoordinates;
|
||||
import net.minecraft.util.Vec3;
|
||||
import net.minecraft.world.biome.BiomeGenBase;
|
||||
|
||||
import forestry.api.apiculture.BeeManager;
|
||||
import forestry.api.apiculture.IBeeHousing;
|
||||
import forestry.api.apiculture.IBeeHousingInventory;
|
||||
import forestry.api.apiculture.IBeeListener;
|
||||
@@ -25,14 +30,31 @@ import forestry.api.core.IErrorLogic;
|
||||
import forestry.api.multiblock.IAlvearyComponent;
|
||||
import forestry.api.multiblock.IMultiblockController;
|
||||
import forestry.apiculture.blocks.BlockAlveary;
|
||||
import forestry.apiculture.gui.ContainerAlveary;
|
||||
import forestry.apiculture.gui.GuiAlveary;
|
||||
import forestry.core.access.EnumAccess;
|
||||
import forestry.core.access.IAccessHandler;
|
||||
import forestry.core.access.IRestrictedAccess;
|
||||
import forestry.core.config.Config;
|
||||
import forestry.core.gui.IHintSource;
|
||||
import forestry.core.inventory.IInventoryAdapter;
|
||||
import forestry.core.multiblock.MultiblockTileEntityForestry;
|
||||
import forestry.core.network.DataInputStreamForestry;
|
||||
import forestry.core.network.DataOutputStreamForestry;
|
||||
import forestry.core.network.IStreamableGui;
|
||||
import forestry.core.tiles.IClimatised;
|
||||
import forestry.core.tiles.ITitled;
|
||||
|
||||
public abstract class TileAlveary extends MultiblockTileEntityForestry<MultiblockLogicAlveary> implements IBeeHousing, IAlvearyComponent, IRestrictedAccess, IStreamableGui, ITitled, IClimatised, IHintSource {
|
||||
private final String unlocalizedTitle;
|
||||
|
||||
public abstract class TileAlveary extends MultiblockTileEntityForestry<MultiblockLogicAlveary> implements IBeeHousing, IRestrictedAccess, IAlvearyComponent {
|
||||
protected TileAlveary() {
|
||||
this(BlockAlveary.Type.PLAIN);
|
||||
}
|
||||
|
||||
protected TileAlveary(BlockAlveary.Type type) {
|
||||
super(new MultiblockLogicAlveary());
|
||||
this.unlocalizedTitle = "tile.for.alveary." + type.ordinal() + ".name";
|
||||
}
|
||||
|
||||
/* TEXTURES */
|
||||
@@ -127,4 +149,53 @@ public abstract class TileAlveary extends MultiblockTileEntityForestry<Multibloc
|
||||
public void onSwitchAccess(EnumAccess oldAccess, EnumAccess newAccess) {
|
||||
getMultiblockLogic().getController().onSwitchAccess(oldAccess, newAccess);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IInventoryAdapter getInternalInventory() {
|
||||
return getMultiblockLogic().getController().getInternalInventory();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUnlocalizedTitle() {
|
||||
return unlocalizedTitle;
|
||||
}
|
||||
|
||||
/* IHintSource */
|
||||
@Override
|
||||
public List<String> getHints() {
|
||||
return Config.hints.get("apiary");
|
||||
}
|
||||
|
||||
/* IClimatised */
|
||||
@Override
|
||||
public float getExactTemperature() {
|
||||
return getMultiblockLogic().getController().getExactTemperature();
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getExactHumidity() {
|
||||
return getMultiblockLogic().getController().getExactHumidity();
|
||||
}
|
||||
|
||||
/* IStreamableGui */
|
||||
@Override
|
||||
public void writeGuiData(DataOutputStreamForestry data) throws IOException {
|
||||
getMultiblockLogic().getController().writeGuiData(data);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readGuiData(DataInputStreamForestry data) throws IOException {
|
||||
getMultiblockLogic().getController().readGuiData(data);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getGui(EntityPlayer player, int data) {
|
||||
return new GuiAlveary(player.inventory, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getContainer(EntityPlayer player, int data) {
|
||||
BeeManager.beeRoot.syncBreedingTrackerToPlayer(player);
|
||||
return new ContainerAlveary(player.inventory, this);
|
||||
}
|
||||
}
|
||||
@@ -10,6 +10,7 @@
|
||||
******************************************************************************/
|
||||
package forestry.apiculture.multiblock;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
||||
@@ -22,6 +23,8 @@ import net.minecraftforge.fluids.IFluidHandler;
|
||||
import forestry.api.core.IClimateControlled;
|
||||
import forestry.api.multiblock.IAlvearyComponent;
|
||||
import forestry.apiculture.blocks.BlockAlveary;
|
||||
import forestry.apiculture.gui.ContainerAlvearyHygroregulator;
|
||||
import forestry.apiculture.gui.GuiAlvearyHygroregulator;
|
||||
import forestry.apiculture.inventory.InventoryHygroregulator;
|
||||
import forestry.core.config.Constants;
|
||||
import forestry.core.fluids.FluidHelper;
|
||||
@@ -29,10 +32,9 @@ import forestry.core.fluids.Fluids;
|
||||
import forestry.core.fluids.TankManager;
|
||||
import forestry.core.fluids.tanks.FilteredTank;
|
||||
import forestry.core.inventory.IInventoryAdapter;
|
||||
import forestry.core.network.GuiId;
|
||||
import forestry.core.tiles.ILiquidTankTile;
|
||||
|
||||
public class TileAlvearyHygroregulator extends TileAlvearyWithGui implements IInventory, ILiquidTankTile, IFluidHandler, IAlvearyComponent.Climatiser {
|
||||
public class TileAlvearyHygroregulator extends TileAlveary implements IInventory, ILiquidTankTile, IFluidHandler, IAlvearyComponent.Climatiser {
|
||||
private final HygroregulatorRecipe[] recipes;
|
||||
|
||||
private final TankManager tankManager;
|
||||
@@ -43,7 +45,7 @@ public class TileAlvearyHygroregulator extends TileAlvearyWithGui implements IIn
|
||||
private int transferTime;
|
||||
|
||||
public TileAlvearyHygroregulator() {
|
||||
super(BlockAlveary.Type.HYGRO, GuiId.HygroregulatorGUI);
|
||||
super(BlockAlveary.Type.HYGRO);
|
||||
|
||||
this.inventory = new InventoryHygroregulator(this);
|
||||
|
||||
@@ -178,6 +180,16 @@ public class TileAlvearyHygroregulator extends TileAlvearyWithGui implements IIn
|
||||
return tankManager.getTankInfo(from);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getGui(EntityPlayer player, int data) {
|
||||
return new GuiAlvearyHygroregulator(player.inventory, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getContainer(EntityPlayer player, int data) {
|
||||
return new ContainerAlvearyHygroregulator(player.inventory, this);
|
||||
}
|
||||
|
||||
private static class HygroregulatorRecipe {
|
||||
public final FluidStack liquid;
|
||||
public final int transferTime;
|
||||
|
||||
@@ -10,12 +10,9 @@
|
||||
******************************************************************************/
|
||||
package forestry.apiculture.multiblock;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.ChunkCoordinates;
|
||||
|
||||
@@ -23,19 +20,9 @@ import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import cpw.mods.fml.common.Optional;
|
||||
|
||||
import forestry.api.core.ForestryAPI;
|
||||
import forestry.api.multiblock.IMultiblockController;
|
||||
import forestry.apiculture.blocks.BlockAlveary;
|
||||
import forestry.apiculture.trigger.ApicultureTriggers;
|
||||
import forestry.core.config.Config;
|
||||
import forestry.core.gui.IHintSource;
|
||||
import forestry.core.inventory.IInventoryAdapter;
|
||||
import forestry.core.network.DataInputStreamForestry;
|
||||
import forestry.core.network.DataOutputStreamForestry;
|
||||
import forestry.core.network.GuiId;
|
||||
import forestry.core.network.IStreamableGui;
|
||||
import forestry.core.tiles.IClimatised;
|
||||
import forestry.core.tiles.ITitled;
|
||||
|
||||
import buildcraft.api.statements.IStatementContainer;
|
||||
import buildcraft.api.statements.ITriggerExternal;
|
||||
@@ -43,7 +30,7 @@ import buildcraft.api.statements.ITriggerInternal;
|
||||
import buildcraft.api.statements.ITriggerProvider;
|
||||
|
||||
@Optional.Interface(iface = "buildcraft.api.statements.ITriggerProvider", modid = "BuildCraftAPI|statements")
|
||||
public class TileAlvearyPlain extends TileAlveary implements IClimatised, IHintSource, ITitled, ITriggerProvider, IStreamableGui {
|
||||
public class TileAlvearyPlain extends TileAlveary implements ITriggerProvider {
|
||||
|
||||
@Override
|
||||
public void onMachineAssembled(IMultiblockController multiblockController, ChunkCoordinates minCoord, ChunkCoordinates maxCoord) {
|
||||
@@ -69,44 +56,11 @@ public class TileAlvearyPlain extends TileAlveary implements IClimatised, IHintS
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public IInventoryAdapter getInternalInventory() {
|
||||
return getMultiblockLogic().getController().getInternalInventory();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean allowsAutomation() {
|
||||
return true;
|
||||
}
|
||||
|
||||
/* GUI */
|
||||
@Override
|
||||
public void openGui(EntityPlayer player) {
|
||||
player.openGui(ForestryAPI.instance, GuiId.AlvearyGUI.ordinal(), worldObj, xCoord, yCoord, zCoord);
|
||||
}
|
||||
|
||||
/* IStreamableGui */
|
||||
@Override
|
||||
public void writeGuiData(DataOutputStreamForestry data) throws IOException {
|
||||
getMultiblockLogic().getController().writeGuiData(data);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readGuiData(DataInputStreamForestry data) throws IOException {
|
||||
getMultiblockLogic().getController().readGuiData(data);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUnlocalizedTitle() {
|
||||
return "tile.for.alveary.0.name";
|
||||
}
|
||||
|
||||
/* IHintSource */
|
||||
@Override
|
||||
public List<String> getHints() {
|
||||
return Config.hints.get("apiary");
|
||||
}
|
||||
|
||||
/* ITRIGGERPROVIDER */
|
||||
@Optional.Method(modid = "BuildCraftAPI|statements")
|
||||
@Override
|
||||
@@ -122,15 +76,4 @@ public class TileAlvearyPlain extends TileAlveary implements IClimatised, IHintS
|
||||
res.add(ApicultureTriggers.missingDrone);
|
||||
return res;
|
||||
}
|
||||
|
||||
/* IClimatised */
|
||||
@Override
|
||||
public float getExactTemperature() {
|
||||
return getMultiblockLogic().getController().getExactTemperature();
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getExactHumidity() {
|
||||
return getMultiblockLogic().getController().getExactHumidity();
|
||||
}
|
||||
}
|
||||
@@ -10,6 +10,7 @@
|
||||
******************************************************************************/
|
||||
package forestry.apiculture.multiblock;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import forestry.api.apiculture.DefaultBeeListener;
|
||||
@@ -20,18 +21,19 @@ import forestry.api.genetics.IIndividual;
|
||||
import forestry.api.genetics.ISpeciesRoot;
|
||||
import forestry.api.multiblock.IAlvearyComponent;
|
||||
import forestry.apiculture.blocks.BlockAlveary;
|
||||
import forestry.apiculture.gui.ContainerAlvearySieve;
|
||||
import forestry.apiculture.gui.GuiAlvearySieve;
|
||||
import forestry.apiculture.inventory.InventoryAlvearySieve;
|
||||
import forestry.core.inventory.IInventoryAdapter;
|
||||
import forestry.core.inventory.watchers.ISlotPickupWatcher;
|
||||
import forestry.core.network.GuiId;
|
||||
|
||||
public class TileAlvearySieve extends TileAlvearyWithGui implements IAlvearyComponent.BeeListener {
|
||||
public class TileAlvearySieve extends TileAlveary implements IAlvearyComponent.BeeListener {
|
||||
|
||||
private final IBeeListener beeListener;
|
||||
private final InventoryAlvearySieve inventory;
|
||||
|
||||
public TileAlvearySieve() {
|
||||
super(BlockAlveary.Type.SIEVE, GuiId.AlvearySieveGUI);
|
||||
super(BlockAlveary.Type.SIEVE);
|
||||
this.inventory = new InventoryAlvearySieve(this);
|
||||
this.beeListener = new AlvearySieveBeeListener(inventory);
|
||||
}
|
||||
@@ -58,6 +60,16 @@ public class TileAlvearySieve extends TileAlvearyWithGui implements IAlvearyComp
|
||||
return BlockAlveary.SIEVE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getGui(EntityPlayer player, int data) {
|
||||
return new GuiAlvearySieve(player.inventory, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getContainer(EntityPlayer player, int data) {
|
||||
return new ContainerAlvearySieve(player.inventory, this);
|
||||
}
|
||||
|
||||
static class AlvearySieveBeeListener extends DefaultBeeListener {
|
||||
private final InventoryAlvearySieve inventory;
|
||||
|
||||
|
||||
@@ -13,6 +13,7 @@ package forestry.apiculture.multiblock;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.Stack;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.ISidedInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
@@ -23,28 +24,28 @@ import forestry.api.apiculture.EnumBeeType;
|
||||
import forestry.api.apiculture.IBee;
|
||||
import forestry.api.multiblock.IAlvearyComponent;
|
||||
import forestry.apiculture.blocks.BlockAlveary;
|
||||
import forestry.apiculture.gui.ContainerAlvearySwarmer;
|
||||
import forestry.apiculture.gui.GuiAlvearySwarmer;
|
||||
import forestry.apiculture.inventory.InventorySwarmer;
|
||||
import forestry.apiculture.network.packets.PacketActiveUpdate;
|
||||
import forestry.apiculture.worldgen.Hive;
|
||||
import forestry.apiculture.worldgen.HiveDecorator;
|
||||
import forestry.apiculture.worldgen.HiveDescriptionSwarmer;
|
||||
import forestry.core.access.EnumAccess;
|
||||
import forestry.core.inventory.IInventoryAdapter;
|
||||
import forestry.core.inventory.wrappers.IInvSlot;
|
||||
import forestry.core.inventory.wrappers.InventoryIterator;
|
||||
import forestry.core.network.GuiId;
|
||||
import forestry.core.proxy.Proxies;
|
||||
import forestry.core.tiles.IActivatable;
|
||||
import forestry.core.utils.ItemStackUtil;
|
||||
|
||||
public class TileAlvearySwarmer extends TileAlvearyWithGui implements ISidedInventory, IActivatable, IAlvearyComponent.Active {
|
||||
public class TileAlvearySwarmer extends TileAlveary implements ISidedInventory, IActivatable, IAlvearyComponent.Active {
|
||||
|
||||
private final InventorySwarmer inventory;
|
||||
private final Stack<ItemStack> pendingSpawns = new Stack<>();
|
||||
private boolean active;
|
||||
|
||||
public TileAlvearySwarmer() {
|
||||
super(BlockAlveary.Type.SWARMER, GuiId.AlvearySwarmerGUI);
|
||||
super(BlockAlveary.Type.SWARMER);
|
||||
this.inventory = new InventorySwarmer(this);
|
||||
}
|
||||
|
||||
@@ -201,15 +202,6 @@ public class TileAlvearySwarmer extends TileAlvearyWithGui implements ISidedInve
|
||||
nbttagcompound.setTag("PendingSpawns", nbttaglist);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSwitchAccess(EnumAccess oldAccess, EnumAccess newAccess) {
|
||||
if (oldAccess == EnumAccess.SHARED || newAccess == EnumAccess.SHARED) {
|
||||
// pipes connected to this need to update
|
||||
worldObj.notifyBlocksOfNeighborChange(xCoord, yCoord, zCoord, blockType);
|
||||
markDirty();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isActive() {
|
||||
return active;
|
||||
@@ -227,4 +219,14 @@ public class TileAlvearySwarmer extends TileAlvearyWithGui implements ISidedInve
|
||||
Proxies.net.sendNetworkPacket(new PacketActiveUpdate(this), worldObj);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getGui(EntityPlayer player, int data) {
|
||||
return new GuiAlvearySwarmer(player.inventory, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getContainer(EntityPlayer player, int data) {
|
||||
return new ContainerAlvearySwarmer(player.inventory, this);
|
||||
}
|
||||
}
|
||||
@@ -1,72 +0,0 @@
|
||||
/*******************************************************************************
|
||||
* 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.apiculture.multiblock;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
||||
import forestry.api.core.ForestryAPI;
|
||||
import forestry.apiculture.blocks.BlockAlveary;
|
||||
import forestry.core.access.AccessHandler;
|
||||
import forestry.core.access.EnumAccess;
|
||||
import forestry.core.access.IAccessHandler;
|
||||
import forestry.core.access.IRestrictedAccess;
|
||||
import forestry.core.network.GuiId;
|
||||
import forestry.core.tiles.ITitled;
|
||||
|
||||
public abstract class TileAlvearyWithGui extends TileAlveary implements ITitled, IRestrictedAccess {
|
||||
|
||||
private final AccessHandler accessHandler;
|
||||
private final String unlocalizedTitle;
|
||||
private final GuiId guiId;
|
||||
|
||||
protected TileAlvearyWithGui(BlockAlveary.Type type, GuiId guiId) {
|
||||
this.accessHandler = new AccessHandler(this);
|
||||
this.unlocalizedTitle = "tile.for.alveary." + type.ordinal() + ".name";
|
||||
this.guiId = guiId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public final IAccessHandler getAccessHandler() {
|
||||
return accessHandler;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSwitchAccess(EnumAccess oldAccess, EnumAccess newAccess) {
|
||||
if (oldAccess == EnumAccess.SHARED || newAccess == EnumAccess.SHARED) {
|
||||
// pipes connected to this need to update
|
||||
worldObj.notifyBlocksOfNeighborChange(xCoord, yCoord, zCoord, blockType);
|
||||
markDirty();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound data) {
|
||||
super.writeToNBT(data);
|
||||
accessHandler.writeToNBT(data);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound data) {
|
||||
super.readFromNBT(data);
|
||||
accessHandler.readFromNBT(data);
|
||||
}
|
||||
|
||||
@Override
|
||||
public final String getUnlocalizedTitle() {
|
||||
return unlocalizedTitle;
|
||||
}
|
||||
|
||||
@Override
|
||||
public final void openGui(EntityPlayer player) {
|
||||
player.openGui(ForestryAPI.instance, guiId.ordinal(), worldObj, xCoord, yCoord, zCoord);
|
||||
}
|
||||
}
|
||||
@@ -17,7 +17,6 @@ import net.minecraft.item.ItemStack;
|
||||
import forestry.api.apiculture.BeeManager;
|
||||
import forestry.core.config.Constants;
|
||||
import forestry.core.inventory.InventoryPlain;
|
||||
import forestry.core.network.GuiId;
|
||||
import forestry.core.tiles.TileNaturalistChest;
|
||||
import forestry.core.tiles.TileUtil;
|
||||
import forestry.plugins.PluginApiculture;
|
||||
@@ -27,7 +26,7 @@ public class TileApiaristChest extends TileNaturalistChest {
|
||||
private boolean checkedForLegacyBlock = false;
|
||||
|
||||
public TileApiaristChest() {
|
||||
super(BeeManager.beeRoot, GuiId.ApiaristChestGUI);
|
||||
super(BeeManager.beeRoot);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -16,12 +16,14 @@ import java.util.Collections;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import cpw.mods.fml.common.Optional;
|
||||
|
||||
import forestry.api.apiculture.BeeManager;
|
||||
import forestry.api.apiculture.IBeeHousingInventory;
|
||||
import forestry.api.apiculture.IBeeListener;
|
||||
import forestry.api.apiculture.IBeeModifier;
|
||||
@@ -29,10 +31,11 @@ import forestry.api.apiculture.IHiveFrame;
|
||||
import forestry.apiculture.ApiaryBeeListener;
|
||||
import forestry.apiculture.ApiaryBeeModifier;
|
||||
import forestry.apiculture.IApiary;
|
||||
import forestry.apiculture.gui.ContainerBeeHousing;
|
||||
import forestry.apiculture.gui.GuiBeeHousing;
|
||||
import forestry.apiculture.inventory.IApiaryInventory;
|
||||
import forestry.apiculture.inventory.InventoryApiary;
|
||||
import forestry.apiculture.trigger.ApicultureTriggers;
|
||||
import forestry.core.network.GuiId;
|
||||
|
||||
import buildcraft.api.statements.ITriggerExternal;
|
||||
|
||||
@@ -42,7 +45,7 @@ public class TileApiary extends TileBeeHousingBase implements IApiary {
|
||||
private final InventoryApiary inventory = new InventoryApiary(getAccessHandler());
|
||||
|
||||
public TileApiary() {
|
||||
super(GuiId.ApiaryGUI, "apiary");
|
||||
super("apiary");
|
||||
setInternalInventory(inventory);
|
||||
}
|
||||
|
||||
@@ -84,4 +87,16 @@ public class TileApiary extends TileBeeHousingBase implements IApiary {
|
||||
res.add(ApicultureTriggers.noFrames);
|
||||
return res;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getGui(EntityPlayer player, int data) {
|
||||
ContainerBeeHousing container = new ContainerBeeHousing(player.inventory, this, true);
|
||||
return new GuiBeeHousing<>(this, container, GuiBeeHousing.Icon.APIARY);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getContainer(EntityPlayer player, int data) {
|
||||
BeeManager.beeRoot.syncBreedingTrackerToPlayer(player);
|
||||
return new ContainerBeeHousing(player.inventory, this, true);
|
||||
}
|
||||
}
|
||||
@@ -28,7 +28,6 @@ import forestry.api.core.EnumTemperature;
|
||||
import forestry.apiculture.gui.IGuiBeeHousingInventory;
|
||||
import forestry.core.network.DataInputStreamForestry;
|
||||
import forestry.core.network.DataOutputStreamForestry;
|
||||
import forestry.core.network.GuiId;
|
||||
import forestry.core.network.IStreamableGui;
|
||||
import forestry.core.proxy.Proxies;
|
||||
import forestry.core.tiles.IClimatised;
|
||||
@@ -41,8 +40,8 @@ public abstract class TileBeeHousingBase extends TileBase implements IBeeHousing
|
||||
// CLIENT
|
||||
private int breedingProgressPercent = 0;
|
||||
|
||||
protected TileBeeHousingBase(GuiId guiId, String hintKey) {
|
||||
super(guiId, hintKey);
|
||||
protected TileBeeHousingBase(String hintKey) {
|
||||
super(hintKey);
|
||||
this.beeLogic = BeeManager.beeRoot.createBeekeepingLogic(this);
|
||||
}
|
||||
|
||||
|
||||
@@ -12,13 +12,17 @@ package forestry.apiculture.tiles;
|
||||
|
||||
import java.util.Collections;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
|
||||
import forestry.api.apiculture.BeeManager;
|
||||
import forestry.api.apiculture.DefaultBeeListener;
|
||||
import forestry.api.apiculture.IBeeHousingInventory;
|
||||
import forestry.api.apiculture.IBeeListener;
|
||||
import forestry.api.apiculture.IBeeModifier;
|
||||
import forestry.apiculture.BeehouseBeeModifier;
|
||||
import forestry.apiculture.InventoryBeeHousing;
|
||||
import forestry.core.network.GuiId;
|
||||
import forestry.apiculture.gui.ContainerBeeHousing;
|
||||
import forestry.apiculture.gui.GuiBeeHousing;
|
||||
|
||||
public class TileBeehouse extends TileBeeHousingBase {
|
||||
private static final IBeeModifier beeModifier = new BeehouseBeeModifier();
|
||||
@@ -27,7 +31,7 @@ public class TileBeehouse extends TileBeeHousingBase {
|
||||
private final InventoryBeeHousing beeInventory;
|
||||
|
||||
public TileBeehouse() {
|
||||
super(GuiId.BeehouseGUI, "bee.house");
|
||||
super("bee.house");
|
||||
this.beeListener = new DefaultBeeListener();
|
||||
|
||||
beeInventory = new InventoryBeeHousing(12, "Items", getAccessHandler());
|
||||
@@ -49,4 +53,16 @@ public class TileBeehouse extends TileBeeHousingBase {
|
||||
public Iterable<IBeeListener> getBeeListeners() {
|
||||
return Collections.singleton(beeListener);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getGui(EntityPlayer player, int data) {
|
||||
ContainerBeeHousing container = new ContainerBeeHousing(player.inventory, this, false);
|
||||
return new GuiBeeHousing<>(this, container, GuiBeeHousing.Icon.BEE_HOUSE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getContainer(EntityPlayer player, int data) {
|
||||
BeeManager.beeRoot.syncBreedingTrackerToPlayer(player);
|
||||
return new ContainerBeeHousing(player.inventory, this, false);
|
||||
}
|
||||
}
|
||||
@@ -1,87 +0,0 @@
|
||||
/*******************************************************************************
|
||||
* 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.arboriculture;
|
||||
|
||||
import net.minecraft.client.gui.Gui;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.Container;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
import forestry.api.arboriculture.TreeManager;
|
||||
import forestry.arboriculture.gui.GuiTreealyzer;
|
||||
import forestry.arboriculture.inventory.ItemInventoryTreealyzer;
|
||||
import forestry.core.GuiHandlerBase;
|
||||
import forestry.core.gui.ContainerAlyzer;
|
||||
import forestry.core.network.GuiId;
|
||||
|
||||
public class GuiHandlerArboriculture extends GuiHandlerBase {
|
||||
|
||||
@Override
|
||||
public Container getServerGuiElement(int id, EntityPlayer player, World world, int x, int y, int z) {
|
||||
int cleanId = decodeGuiID(id);
|
||||
|
||||
if (cleanId >= GuiId.values().length) {
|
||||
return null;
|
||||
}
|
||||
|
||||
switch (GuiId.values()[cleanId]) {
|
||||
|
||||
case ArboristChestGUI:
|
||||
return this.getNaturalistChestContainer(TreeManager.treeRoot, player, world, x, y, z, decodeGuiData(id));
|
||||
|
||||
case TreealyzerGUI:
|
||||
ItemStack equipped = player.getCurrentEquippedItem();
|
||||
if (equipped == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return new ContainerAlyzer(new ItemInventoryTreealyzer(player, equipped), player);
|
||||
|
||||
default:
|
||||
return null;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public Gui getClientGuiElement(int id, EntityPlayer player, World world, int x, int y, int z) {
|
||||
int cleanId = decodeGuiID(id);
|
||||
|
||||
if (cleanId >= GuiId.values().length) {
|
||||
return null;
|
||||
}
|
||||
|
||||
switch (GuiId.values()[cleanId]) {
|
||||
|
||||
case ArboristChestGUI:
|
||||
return this.getNaturalistChestGui(TreeManager.treeRoot, player, world, x, y, z, decodeGuiData(id));
|
||||
|
||||
case TreealyzerGUI:
|
||||
ItemStack equipped = player.getCurrentEquippedItem();
|
||||
if (equipped == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return new GuiTreealyzer(player, new ItemInventoryTreealyzer(player, equipped));
|
||||
|
||||
default:
|
||||
return null;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -13,15 +13,12 @@ package forestry.arboriculture.items;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
|
||||
import forestry.api.arboriculture.EnumGermlingType;
|
||||
import forestry.api.core.Tabs;
|
||||
import forestry.core.items.ItemRegistry;
|
||||
import forestry.core.items.ItemWithGui;
|
||||
import forestry.core.network.GuiId;
|
||||
|
||||
public class ItemRegistryArboriculture extends ItemRegistry {
|
||||
public final ItemGermlingGE sapling;
|
||||
public final ItemGermlingGE pollenFertile;
|
||||
public final ItemWithGui treealyzer;
|
||||
public final ItemTreealyzer treealyzer;
|
||||
public final ItemGrafter grafter;
|
||||
public final ItemGrafter grafterProven;
|
||||
|
||||
@@ -30,7 +27,7 @@ public class ItemRegistryArboriculture extends ItemRegistry {
|
||||
OreDictionary.registerOre("treeSapling", sapling.getWildcard());
|
||||
|
||||
pollenFertile = registerItem(new ItemGermlingGE(EnumGermlingType.POLLEN), "pollenFertile");
|
||||
treealyzer = registerItem(new ItemWithGui(GuiId.TreealyzerGUI, Tabs.tabArboriculture), "treealyzer");
|
||||
treealyzer = registerItem(new ItemTreealyzer(), "treealyzer");
|
||||
grafter = registerItem(new ItemGrafter(4), "grafter");
|
||||
grafterProven = registerItem(new ItemGrafter(149), "grafterProven");
|
||||
}
|
||||
|
||||
@@ -0,0 +1,36 @@
|
||||
/*******************************************************************************
|
||||
* 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.arboriculture.items;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import forestry.api.core.Tabs;
|
||||
import forestry.arboriculture.gui.GuiTreealyzer;
|
||||
import forestry.arboriculture.inventory.ItemInventoryTreealyzer;
|
||||
import forestry.core.gui.ContainerAlyzer;
|
||||
import forestry.core.items.ItemWithGui;
|
||||
|
||||
public class ItemTreealyzer extends ItemWithGui {
|
||||
public ItemTreealyzer() {
|
||||
super(Tabs.tabArboriculture);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getGui(EntityPlayer player, ItemStack heldItem, int data) {
|
||||
return new GuiTreealyzer(player, new ItemInventoryTreealyzer(player, heldItem));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getContainer(EntityPlayer player, ItemStack heldItem, int data) {
|
||||
return new ContainerAlyzer(new ItemInventoryTreealyzer(player, heldItem), player);
|
||||
}
|
||||
}
|
||||
@@ -11,11 +11,10 @@
|
||||
package forestry.arboriculture.tiles;
|
||||
|
||||
import forestry.api.arboriculture.TreeManager;
|
||||
import forestry.core.network.GuiId;
|
||||
import forestry.core.tiles.TileNaturalistChest;
|
||||
|
||||
public class TileArboristChest extends TileNaturalistChest {
|
||||
public TileArboristChest() {
|
||||
super(TreeManager.treeRoot, GuiId.ArboristChestGUI);
|
||||
super(TreeManager.treeRoot);
|
||||
}
|
||||
}
|
||||
@@ -10,99 +10,105 @@
|
||||
******************************************************************************/
|
||||
package forestry.core;
|
||||
|
||||
import net.minecraft.client.gui.Gui;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.Container;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import cpw.mods.fml.common.network.IGuiHandler;
|
||||
|
||||
import forestry.core.circuits.ContainerSolderingIron;
|
||||
import forestry.core.circuits.GuiSolderingIron;
|
||||
import forestry.core.gui.ContainerAnalyzer;
|
||||
import forestry.core.gui.ContainerEscritoire;
|
||||
import forestry.core.gui.GuiAnalyzer;
|
||||
import forestry.core.gui.GuiEscritoire;
|
||||
import forestry.core.inventory.ItemInventorySolderingIron;
|
||||
import forestry.core.network.GuiId;
|
||||
import forestry.core.tiles.TileAnalyzer;
|
||||
import forestry.core.tiles.TileEscritoire;
|
||||
import forestry.core.tiles.TileUtil;
|
||||
import forestry.plugins.PluginManager;
|
||||
import forestry.core.network.IGuiHandlerEntity;
|
||||
import forestry.core.network.IGuiHandlerItem;
|
||||
import forestry.core.network.IGuiHandlerTile;
|
||||
|
||||
public class GuiHandler extends GuiHandlerBase {
|
||||
public class GuiHandler implements IGuiHandler {
|
||||
|
||||
public static int encodeGuiData(GuiId guiId, int data) {
|
||||
return data << 8 | guiId.ordinal();
|
||||
}
|
||||
|
||||
public static int decodeGuiID(int guiId) {
|
||||
return guiId & 0xFF;
|
||||
}
|
||||
|
||||
public static int decodeGuiData(int guiId) {
|
||||
return guiId >> 8;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public Gui getClientGuiElement(int id, EntityPlayer player, World world, int x, int y, int z) {
|
||||
public Object getClientGuiElement(int id, EntityPlayer player, World world, int x, int y, int z) {
|
||||
int cleanId = decodeGuiID(id);
|
||||
int data = decodeGuiData(id);
|
||||
|
||||
if (cleanId < GuiId.values().length) {
|
||||
switch (GuiId.values()[cleanId]) {
|
||||
|
||||
case AnalyzerGUI:
|
||||
return new GuiAnalyzer(player.inventory, TileUtil.getTile(world, x, y, z, TileAnalyzer.class));
|
||||
|
||||
case NaturalistBenchGUI:
|
||||
return new GuiEscritoire(player, TileUtil.getTile(world, x, y, z, TileEscritoire.class));
|
||||
|
||||
case SolderingIronGUI:
|
||||
ItemStack equipped = player.getCurrentEquippedItem();
|
||||
if (equipped == null) {
|
||||
return null;
|
||||
}
|
||||
return new GuiSolderingIron(player, new ItemInventorySolderingIron(player, equipped));
|
||||
|
||||
default:
|
||||
for (GuiHandlerBase handler : PluginManager.guiHandlers) {
|
||||
Gui element = handler.getClientGuiElement(id, player, world, x, y, z);
|
||||
if (element != null) {
|
||||
return element;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
if (cleanId >= GuiId.values().length) {
|
||||
return null;
|
||||
}
|
||||
|
||||
switch (GuiId.values()[cleanId]) {
|
||||
case ItemGui: {
|
||||
ItemStack heldItem = player.getCurrentEquippedItem();
|
||||
if (heldItem != null) {
|
||||
Item item = heldItem.getItem();
|
||||
if (item instanceof IGuiHandlerItem) {
|
||||
return ((IGuiHandlerItem) item).getGui(player, heldItem, data);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case TileGui: {
|
||||
TileEntity tileEntity = world.getTileEntity(x, y, z);
|
||||
if (tileEntity instanceof IGuiHandlerTile) {
|
||||
return ((IGuiHandlerTile) tileEntity).getGui(player, data);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case EntityGui: {
|
||||
Entity entity = world.getEntityByID(x);
|
||||
if (entity instanceof IGuiHandlerEntity) {
|
||||
return ((IGuiHandlerEntity) entity).getGui(player, data);
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Container getServerGuiElement(int id, EntityPlayer player, World world, int x, int y, int z) {
|
||||
public Object getServerGuiElement(int id, EntityPlayer player, World world, int x, int y, int z) {
|
||||
int cleanId = decodeGuiID(id);
|
||||
int data = decodeGuiData(id);
|
||||
|
||||
if (cleanId < GuiId.values().length) {
|
||||
switch (GuiId.values()[cleanId]) {
|
||||
|
||||
case AnalyzerGUI:
|
||||
return new ContainerAnalyzer(player.inventory, TileUtil.getTile(world, x, y, z, TileAnalyzer.class));
|
||||
|
||||
case NaturalistBenchGUI:
|
||||
return new ContainerEscritoire(player, TileUtil.getTile(world, x, y, z, TileEscritoire.class));
|
||||
|
||||
case SolderingIronGUI:
|
||||
ItemStack equipped = player.getCurrentEquippedItem();
|
||||
if (equipped == null) {
|
||||
return null;
|
||||
}
|
||||
return new ContainerSolderingIron(player, new ItemInventorySolderingIron(player, equipped));
|
||||
|
||||
default:
|
||||
for (GuiHandlerBase handler : PluginManager.guiHandlers) {
|
||||
Container element = handler.getServerGuiElement(id, player, world, x, y, z);
|
||||
if (element != null) {
|
||||
return element;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
|
||||
}
|
||||
if (cleanId >= GuiId.values().length) {
|
||||
return null;
|
||||
}
|
||||
|
||||
switch (GuiId.values()[cleanId]) {
|
||||
case ItemGui: {
|
||||
ItemStack heldItem = player.getCurrentEquippedItem();
|
||||
if (heldItem != null) {
|
||||
Item item = heldItem.getItem();
|
||||
if (item instanceof IGuiHandlerItem) {
|
||||
return ((IGuiHandlerItem) item).getContainer(player, heldItem, data);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case TileGui: {
|
||||
TileEntity tileEntity = world.getTileEntity(x, y, z);
|
||||
if (tileEntity instanceof IGuiHandlerTile) {
|
||||
return ((IGuiHandlerTile) tileEntity).getContainer(player, data);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case EntityGui: {
|
||||
Entity entity = world.getEntityByID(x);
|
||||
if (entity instanceof IGuiHandlerEntity) {
|
||||
return ((IGuiHandlerEntity) entity).getContainer(player, data);
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -1,59 +0,0 @@
|
||||
/*******************************************************************************
|
||||
* 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.core;
|
||||
|
||||
import net.minecraft.client.gui.Gui;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.Container;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import cpw.mods.fml.common.network.IGuiHandler;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
import forestry.api.genetics.ISpeciesRoot;
|
||||
import forestry.core.gui.ContainerNaturalistInventory;
|
||||
import forestry.core.gui.GuiNaturalistInventory;
|
||||
import forestry.core.network.GuiId;
|
||||
import forestry.core.tiles.TileNaturalistChest;
|
||||
import forestry.core.tiles.TileUtil;
|
||||
|
||||
public abstract class GuiHandlerBase implements IGuiHandler {
|
||||
|
||||
@Override
|
||||
public abstract Container getServerGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z);
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public abstract Gui getClientGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z);
|
||||
|
||||
protected GuiNaturalistInventory getNaturalistChestGui(ISpeciesRoot speciesRoot, EntityPlayer player, World world, int x, int y, int z, int page) {
|
||||
TileNaturalistChest tile = TileUtil.getTile(world, x, y, z, TileNaturalistChest.class);
|
||||
return new GuiNaturalistInventory(speciesRoot, player, new ContainerNaturalistInventory(player.inventory, tile, page), tile, page, 5);
|
||||
}
|
||||
|
||||
protected ContainerNaturalistInventory getNaturalistChestContainer(ISpeciesRoot speciesRoot, EntityPlayer player, World world, int x, int y, int z, int page) {
|
||||
speciesRoot.getBreedingTracker(world, player.getGameProfile()).synchToPlayer(player);
|
||||
return new ContainerNaturalistInventory(player.inventory, TileUtil.getTile(world, x, y, z, TileNaturalistChest.class), page);
|
||||
}
|
||||
|
||||
public static int encodeGuiData(GuiId guiId, int data) {
|
||||
return data << 8 | guiId.ordinal();
|
||||
}
|
||||
|
||||
protected static int decodeGuiID(int guiId) {
|
||||
return guiId & 0xFF;
|
||||
}
|
||||
|
||||
protected static int decodeGuiData(int guiId) {
|
||||
return guiId >> 8;
|
||||
}
|
||||
}
|
||||
@@ -54,13 +54,11 @@ public abstract class EntityMinecartForestry extends EntityMinecart implements I
|
||||
}
|
||||
|
||||
if (!worldObj.isRemote) {
|
||||
player.openGui(ForestryAPI.instance, getGuiId().ordinal(), worldObj, getEntityId(), -1, 0);
|
||||
player.openGui(ForestryAPI.instance, GuiId.EntityGui.ordinal(), worldObj, getEntityId(), -1, 0);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
protected abstract GuiId getGuiId();
|
||||
|
||||
public void setOwner(GameProfile owner) {
|
||||
accessHandler.setOwner(owner);
|
||||
}
|
||||
|
||||
@@ -20,6 +20,7 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import forestry.api.genetics.IAllele;
|
||||
@@ -147,4 +148,9 @@ public abstract class SpeciesRoot implements ISpeciesRoot {
|
||||
return chromosomes;
|
||||
}
|
||||
|
||||
/* BREEDING TRACKER */
|
||||
@Override
|
||||
public void syncBreedingTrackerToPlayer(EntityPlayer player) {
|
||||
getBreedingTracker(player.worldObj, player.getGameProfile()).synchToPlayer(player);
|
||||
}
|
||||
}
|
||||
@@ -17,7 +17,6 @@ import net.minecraftforge.oredict.OreDictionary;
|
||||
import forestry.api.core.Tabs;
|
||||
import forestry.core.circuits.ItemCircuitBoard;
|
||||
import forestry.core.genetics.ItemResearchNote;
|
||||
import forestry.core.network.GuiId;
|
||||
|
||||
public class ItemRegistryCore extends ItemRegistry {
|
||||
/* Fertilizer */
|
||||
@@ -132,7 +131,7 @@ public class ItemRegistryCore extends ItemRegistry {
|
||||
|
||||
circuitboards = registerItem(new ItemCircuitBoard(), "chipsets");
|
||||
|
||||
solderingIron = new ItemSolderingIron(GuiId.SolderingIronGUI);
|
||||
solderingIron = new ItemSolderingIron();
|
||||
solderingIron.setMaxDamage(5).setFull3D();
|
||||
registerItem(solderingIron, "solderingIron");
|
||||
|
||||
|
||||
@@ -10,11 +10,22 @@
|
||||
******************************************************************************/
|
||||
package forestry.core.items;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import forestry.core.circuits.ContainerSolderingIron;
|
||||
import forestry.core.circuits.GuiSolderingIron;
|
||||
import forestry.core.circuits.ISolderingIron;
|
||||
import forestry.core.network.GuiId;
|
||||
import forestry.core.inventory.ItemInventorySolderingIron;
|
||||
|
||||
public class ItemSolderingIron extends ItemWithGui implements ISolderingIron {
|
||||
public ItemSolderingIron(GuiId guiId) {
|
||||
super(guiId);
|
||||
@Override
|
||||
public Object getGui(EntityPlayer player, ItemStack heldItem, int data) {
|
||||
return new GuiSolderingIron(player, new ItemInventorySolderingIron(player, heldItem));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getContainer(EntityPlayer player, ItemStack heldItem, int data) {
|
||||
return new ContainerSolderingIron(player, new ItemInventorySolderingIron(player, heldItem));
|
||||
}
|
||||
}
|
||||
@@ -19,18 +19,15 @@ import net.minecraft.world.World;
|
||||
import forestry.api.core.ForestryAPI;
|
||||
import forestry.core.gui.ContainerItemInventory;
|
||||
import forestry.core.network.GuiId;
|
||||
import forestry.core.network.IGuiHandlerItem;
|
||||
|
||||
public class ItemWithGui extends ItemForestry {
|
||||
private final GuiId guiId;
|
||||
public abstract class ItemWithGui extends ItemForestry implements IGuiHandlerItem {
|
||||
public ItemWithGui() {
|
||||
|
||||
public ItemWithGui(GuiId guiId) {
|
||||
this.guiId = guiId;
|
||||
setMaxStackSize(1);
|
||||
}
|
||||
|
||||
public ItemWithGui(GuiId guiId, CreativeTabs creativeTabs) {
|
||||
this(guiId);
|
||||
setCreativeTab(creativeTabs);
|
||||
public ItemWithGui(CreativeTabs creativeTabs) {
|
||||
super(creativeTabs);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -42,8 +39,8 @@ public class ItemWithGui extends ItemForestry {
|
||||
return itemstack;
|
||||
}
|
||||
|
||||
protected final void openGui(World world, EntityPlayer entityplayer) {
|
||||
entityplayer.openGui(ForestryAPI.instance, guiId.ordinal(), world, (int) entityplayer.posX, (int) entityplayer.posY, (int) entityplayer.posZ);
|
||||
protected void openGui(World world, EntityPlayer entityplayer) {
|
||||
entityplayer.openGui(ForestryAPI.instance, GuiId.ItemGui.ordinal(), world, (int) entityplayer.posX, (int) entityplayer.posY, (int) entityplayer.posZ);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -19,15 +19,18 @@ import net.minecraft.world.World;
|
||||
|
||||
import com.mojang.authlib.GameProfile;
|
||||
|
||||
import forestry.api.core.ForestryAPI;
|
||||
import forestry.api.multiblock.IMultiblockLogic;
|
||||
import forestry.api.multiblock.MultiblockTileEntityBase;
|
||||
import forestry.core.config.Constants;
|
||||
import forestry.core.inventory.FakeInventoryAdapter;
|
||||
import forestry.core.inventory.IInventoryAdapter;
|
||||
import forestry.core.network.GuiId;
|
||||
import forestry.core.network.IGuiHandlerTile;
|
||||
import forestry.core.tiles.IFilterSlotDelegate;
|
||||
import forestry.core.tiles.ILocatable;
|
||||
|
||||
public abstract class MultiblockTileEntityForestry<T extends IMultiblockLogic> extends MultiblockTileEntityBase<T> implements ISidedInventory, IFilterSlotDelegate, ILocatable {
|
||||
public abstract class MultiblockTileEntityForestry<T extends IMultiblockLogic> extends MultiblockTileEntityBase<T> implements ISidedInventory, IFilterSlotDelegate, ILocatable, IGuiHandlerTile {
|
||||
private GameProfile owner;
|
||||
|
||||
public MultiblockTileEntityForestry(T multiblockLogic) {
|
||||
@@ -38,7 +41,7 @@ public abstract class MultiblockTileEntityForestry<T extends IMultiblockLogic> e
|
||||
* Called by a structure block when it is right clicked by a player.
|
||||
*/
|
||||
public void openGui(EntityPlayer player) {
|
||||
|
||||
player.openGui(ForestryAPI.instance, GuiId.TileGui.ordinal(), worldObj, xCoord, yCoord, zCoord);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -11,113 +11,7 @@
|
||||
package forestry.core.network;
|
||||
|
||||
public enum GuiId {
|
||||
AlvearyGUI,
|
||||
|
||||
AlvearySwarmerGUI,
|
||||
|
||||
AlvearySieveGUI,
|
||||
|
||||
AnalyzerGUI,
|
||||
|
||||
ApiaristBackpackGUI,
|
||||
|
||||
ApiaristChestGUI,
|
||||
|
||||
ArboristChestGUI,
|
||||
|
||||
ApiaryGUI,
|
||||
|
||||
ArboretumGUI,
|
||||
|
||||
BackpackGUI,
|
||||
|
||||
BackpackT2GUI,
|
||||
|
||||
BeealyzerGUI,
|
||||
|
||||
BeehouseGUI,
|
||||
|
||||
BottlerGUI,
|
||||
|
||||
CatalogueGUI,
|
||||
|
||||
CarpenterGUI,
|
||||
|
||||
CentrifugeGUI,
|
||||
|
||||
EngineBiogasGUI,
|
||||
|
||||
EnginePeatGUI,
|
||||
|
||||
EngineElectricGUI,
|
||||
|
||||
FabricatorGUI,
|
||||
|
||||
FarmGUI,
|
||||
|
||||
FermenterGUI,
|
||||
|
||||
FlutterlyzerGUI,
|
||||
|
||||
ForesterGUI,
|
||||
|
||||
GeneratorGUI,
|
||||
|
||||
HabitatLocatorGUI,
|
||||
|
||||
HygroregulatorGUI,
|
||||
|
||||
ImprinterGUI,
|
||||
|
||||
InfuserGUI,
|
||||
|
||||
LetterGUI,
|
||||
|
||||
LepidopteristBackpackGUI,
|
||||
|
||||
LepidopteristChestGUI,
|
||||
|
||||
MailboxGUI,
|
||||
|
||||
MinecartBeehouseGUI,
|
||||
|
||||
MinecartApiaryGUI,
|
||||
|
||||
MoistenerGUI,
|
||||
|
||||
MushroomFarmGUI,
|
||||
|
||||
MultiFarmGUI,
|
||||
|
||||
NaturalistBenchGUI,
|
||||
|
||||
NetherFarmGUI,
|
||||
|
||||
PeatBogGUI,
|
||||
|
||||
StampCollectorGUI,
|
||||
|
||||
PlantationGUI,
|
||||
|
||||
PropolisPipeGUI,
|
||||
|
||||
PumpkinFarmGUI,
|
||||
|
||||
RaintankGUI,
|
||||
|
||||
SolderingIronGUI,
|
||||
|
||||
SqueezerGUI,
|
||||
|
||||
StillGUI,
|
||||
|
||||
TraderGUI,
|
||||
|
||||
TraderNameGUI,
|
||||
|
||||
TreealyzerGUI,
|
||||
|
||||
WorktableGUI,
|
||||
|
||||
Unknown
|
||||
ItemGui,
|
||||
TileGui,
|
||||
EntityGui;
|
||||
}
|
||||
@@ -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.core.network;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
|
||||
public interface IGuiHandlerEntity {
|
||||
Object getGui(EntityPlayer player, int data);
|
||||
|
||||
Object getContainer(EntityPlayer player, int data);
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
/*******************************************************************************
|
||||
* 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.core.network;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public interface IGuiHandlerItem {
|
||||
Object getGui(EntityPlayer player, ItemStack heldItem, int data);
|
||||
|
||||
Object getContainer(EntityPlayer player, ItemStack heldItem, int data);
|
||||
}
|
||||
@@ -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.core.network;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
|
||||
public interface IGuiHandlerTile {
|
||||
Object getGui(EntityPlayer player, int data);
|
||||
|
||||
Object getContainer(EntityPlayer player, int data);
|
||||
}
|
||||
@@ -12,6 +12,7 @@ package forestry.core.tiles;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.inventory.ISidedInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
@@ -32,13 +33,14 @@ import forestry.core.fluids.FluidHelper;
|
||||
import forestry.core.fluids.Fluids;
|
||||
import forestry.core.fluids.TankManager;
|
||||
import forestry.core.fluids.tanks.FilteredTank;
|
||||
import forestry.core.gui.ContainerAnalyzer;
|
||||
import forestry.core.gui.GuiAnalyzer;
|
||||
import forestry.core.inventory.InventoryAnalyzer;
|
||||
import forestry.core.inventory.wrappers.IInvSlot;
|
||||
import forestry.core.inventory.wrappers.InventoryIterator;
|
||||
import forestry.core.inventory.wrappers.InventoryMapper;
|
||||
import forestry.core.network.DataInputStreamForestry;
|
||||
import forestry.core.network.DataOutputStreamForestry;
|
||||
import forestry.core.network.GuiId;
|
||||
import forestry.core.network.packets.PacketItemStackDisplay;
|
||||
import forestry.core.proxy.Proxies;
|
||||
import forestry.core.utils.GeneticsUtil;
|
||||
@@ -60,7 +62,7 @@ public class TileAnalyzer extends TilePowered implements ISidedInventory, ILiqui
|
||||
|
||||
/* CONSTRUCTOR */
|
||||
public TileAnalyzer() {
|
||||
super(GuiId.AnalyzerGUI, "analyzer", 800, Constants.MACHINE_MAX_ENERGY);
|
||||
super("analyzer", 800, Constants.MACHINE_MAX_ENERGY);
|
||||
setInternalInventory(new InventoryAnalyzer(this));
|
||||
resourceTank = new FilteredTank(Constants.PROCESSOR_TANK_CAPACITY, Fluids.HONEY.getFluid());
|
||||
tankManager = new TankManager(this, resourceTank);
|
||||
@@ -275,4 +277,13 @@ public class TileAnalyzer extends TilePowered implements ISidedInventory, ILiqui
|
||||
return tankManager.getTankInfo(from);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getGui(EntityPlayer player, int data) {
|
||||
return new GuiAnalyzer(player.inventory, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getContainer(EntityPlayer player, int data) {
|
||||
return new ContainerAnalyzer(player.inventory, this);
|
||||
}
|
||||
}
|
||||
@@ -21,19 +21,14 @@ import forestry.core.gui.IHintSource;
|
||||
import forestry.core.network.GuiId;
|
||||
|
||||
public abstract class TileBase extends TileForestry implements IHintSource {
|
||||
|
||||
protected final GuiId guiId;
|
||||
protected final List<String> hints;
|
||||
|
||||
protected TileBase(GuiId guiId, String hintKey) {
|
||||
this.guiId = guiId;
|
||||
protected TileBase(String hintKey) {
|
||||
this.hints = new ArrayList<>(Config.hints.get(hintKey));
|
||||
}
|
||||
|
||||
public void openGui(EntityPlayer player) {
|
||||
if (guiId != null) {
|
||||
player.openGui(ForestryAPI.instance, guiId.ordinal(), worldObj, xCoord, yCoord, zCoord);
|
||||
}
|
||||
player.openGui(ForestryAPI.instance, GuiId.TileGui.ordinal(), worldObj, xCoord, yCoord, zCoord);
|
||||
}
|
||||
|
||||
public boolean canDrainWithBucket() {
|
||||
|
||||
@@ -27,7 +27,6 @@ import forestry.core.config.Constants;
|
||||
import forestry.core.errors.EnumErrorCode;
|
||||
import forestry.core.network.DataInputStreamForestry;
|
||||
import forestry.core.network.DataOutputStreamForestry;
|
||||
import forestry.core.network.GuiId;
|
||||
import forestry.core.proxy.Proxies;
|
||||
import forestry.core.utils.BlockUtil;
|
||||
import forestry.energy.EnergyManager;
|
||||
@@ -54,8 +53,8 @@ public abstract class TileEngine extends TileBase implements IEnergyConnection,
|
||||
public float progress;
|
||||
protected final EnergyManager energyManager;
|
||||
|
||||
protected TileEngine(GuiId guiId, String hintKey, int maxHeat, int maxEnergy) {
|
||||
super(guiId, hintKey);
|
||||
protected TileEngine(String hintKey, int maxHeat, int maxEnergy) {
|
||||
super(hintKey);
|
||||
this.maxHeat = maxHeat;
|
||||
energyManager = new EnergyManager(2000, maxEnergy);
|
||||
|
||||
|
||||
@@ -22,11 +22,12 @@ import com.mojang.authlib.GameProfile;
|
||||
import forestry.api.genetics.AlleleManager;
|
||||
import forestry.api.genetics.IAlleleSpecies;
|
||||
import forestry.api.genetics.IIndividual;
|
||||
import forestry.core.gui.ContainerEscritoire;
|
||||
import forestry.core.gui.GuiEscritoire;
|
||||
import forestry.core.inventory.InventoryEscritoire;
|
||||
import forestry.core.inventory.watchers.ISlotPickupWatcher;
|
||||
import forestry.core.network.DataInputStreamForestry;
|
||||
import forestry.core.network.DataOutputStreamForestry;
|
||||
import forestry.core.network.GuiId;
|
||||
import forestry.core.network.IStreamableGui;
|
||||
import forestry.core.utils.InventoryUtil;
|
||||
|
||||
@@ -35,7 +36,7 @@ public class TileEscritoire extends TileBase implements ISidedInventory, ISlotPi
|
||||
private final EscritoireGame game = new EscritoireGame();
|
||||
|
||||
public TileEscritoire() {
|
||||
super(GuiId.NaturalistBenchGUI, "escritoire");
|
||||
super("escritoire");
|
||||
setInternalInventory(new InventoryEscritoire(this));
|
||||
}
|
||||
|
||||
@@ -120,4 +121,14 @@ public class TileEscritoire extends TileBase implements ISidedInventory, ISlotPi
|
||||
game.reset();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getGui(EntityPlayer player, int data) {
|
||||
return new GuiEscritoire(player, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getContainer(EntityPlayer player, int data) {
|
||||
return new ContainerEscritoire(player, this);
|
||||
}
|
||||
}
|
||||
@@ -40,6 +40,7 @@ import forestry.core.inventory.FakeInventoryAdapter;
|
||||
import forestry.core.inventory.IInventoryAdapter;
|
||||
import forestry.core.network.DataInputStreamForestry;
|
||||
import forestry.core.network.DataOutputStreamForestry;
|
||||
import forestry.core.network.IGuiHandlerTile;
|
||||
import forestry.core.network.IStreamable;
|
||||
import forestry.core.network.packets.PacketTileStream;
|
||||
import forestry.core.proxy.Proxies;
|
||||
@@ -50,7 +51,7 @@ import buildcraft.api.statements.ITriggerInternal;
|
||||
import buildcraft.api.statements.ITriggerProvider;
|
||||
|
||||
@Optional.Interface(iface = "buildcraft.api.statements.ITriggerProvider", modid = "BuildCraftAPI|statements")
|
||||
public abstract class TileForestry extends TileEntity implements IStreamable, IErrorLogicSource, ITriggerProvider, ISidedInventory, IFilterSlotDelegate, IRestrictedAccess, ITitled, ILocatable {
|
||||
public abstract class TileForestry extends TileEntity implements IStreamable, IErrorLogicSource, ITriggerProvider, ISidedInventory, IFilterSlotDelegate, IRestrictedAccess, ITitled, ILocatable, IGuiHandlerTile {
|
||||
private static final ForgeDirection[] forgeDirections = ForgeDirection.values();
|
||||
private static final Random rand = new Random();
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@ public abstract class TileMill extends TileBase {
|
||||
public float progress;
|
||||
|
||||
protected TileMill(GuiId guiId, String hintKey) {
|
||||
super(guiId, hintKey);
|
||||
super(hintKey);
|
||||
speed = 0.01F;
|
||||
}
|
||||
|
||||
|
||||
@@ -17,6 +17,8 @@ import net.minecraft.entity.player.EntityPlayer;
|
||||
import forestry.api.core.ForestryAPI;
|
||||
import forestry.api.genetics.ISpeciesRoot;
|
||||
import forestry.core.GuiHandler;
|
||||
import forestry.core.gui.ContainerNaturalistInventory;
|
||||
import forestry.core.gui.GuiNaturalistInventory;
|
||||
import forestry.core.gui.IPagedInventory;
|
||||
import forestry.core.inventory.InventoryNaturalistChest;
|
||||
import forestry.core.network.DataInputStreamForestry;
|
||||
@@ -26,12 +28,14 @@ import forestry.core.network.GuiId;
|
||||
public abstract class TileNaturalistChest extends TileBase implements IPagedInventory {
|
||||
private static final float lidAngleVariationPerTick = 0.1F;
|
||||
|
||||
private final ISpeciesRoot speciesRoot;
|
||||
public float lidAngle;
|
||||
public float prevLidAngle;
|
||||
private int numPlayersUsing;
|
||||
|
||||
public TileNaturalistChest(ISpeciesRoot speciesRoot, GuiId guiId) {
|
||||
super(guiId, "naturalist.chest");
|
||||
public TileNaturalistChest(ISpeciesRoot speciesRoot) {
|
||||
super("naturalist.chest");
|
||||
this.speciesRoot = speciesRoot;
|
||||
setInternalInventory(new InventoryNaturalistChest(this, speciesRoot));
|
||||
}
|
||||
|
||||
@@ -88,7 +92,7 @@ public abstract class TileNaturalistChest extends TileBase implements IPagedInve
|
||||
|
||||
@Override
|
||||
public void flipPage(EntityPlayer player, int page) {
|
||||
player.openGui(ForestryAPI.instance, GuiHandler.encodeGuiData(guiId, page), player.worldObj, xCoord, yCoord, zCoord);
|
||||
player.openGui(ForestryAPI.instance, GuiHandler.encodeGuiData(GuiId.TileGui, page), player.worldObj, xCoord, yCoord, zCoord);
|
||||
}
|
||||
|
||||
/* IStreamable */
|
||||
@@ -103,4 +107,16 @@ public abstract class TileNaturalistChest extends TileBase implements IPagedInve
|
||||
super.readData(data);
|
||||
numPlayersUsing = data.readInt();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getGui(EntityPlayer player, int page) {
|
||||
ContainerNaturalistInventory container = new ContainerNaturalistInventory(player.inventory, this, page);
|
||||
return new GuiNaturalistInventory(speciesRoot, player, container, this, page, 5);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getContainer(EntityPlayer player, int page) {
|
||||
speciesRoot.syncBreedingTrackerToPlayer(player);
|
||||
return new ContainerNaturalistInventory(player.inventory, this, page);
|
||||
}
|
||||
}
|
||||
@@ -24,7 +24,6 @@ import forestry.core.config.Config;
|
||||
import forestry.core.errors.EnumErrorCode;
|
||||
import forestry.core.network.DataInputStreamForestry;
|
||||
import forestry.core.network.DataOutputStreamForestry;
|
||||
import forestry.core.network.GuiId;
|
||||
import forestry.core.network.IStreamableGui;
|
||||
import forestry.core.render.TankRenderInfo;
|
||||
import forestry.energy.EnergyManager;
|
||||
@@ -47,8 +46,8 @@ public abstract class TilePowered extends TileBase implements IRenderableTile, I
|
||||
// the number of work ticks that this tile has had no power
|
||||
private int noPowerTime = 0;
|
||||
|
||||
protected TilePowered(GuiId guiId, String hintKey, int maxTransfer, int capacity) {
|
||||
super(guiId, hintKey);
|
||||
protected TilePowered(String hintKey, int maxTransfer, int capacity) {
|
||||
super(hintKey);
|
||||
this.energyManager = new EnergyManager(maxTransfer, capacity);
|
||||
this.energyManager.setReceiveOnly();
|
||||
|
||||
|
||||
@@ -1,95 +0,0 @@
|
||||
/*******************************************************************************
|
||||
* 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.energy;
|
||||
|
||||
import net.minecraft.client.gui.Gui;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.Container;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
import forestry.core.GuiHandlerBase;
|
||||
import forestry.core.network.GuiId;
|
||||
import forestry.core.network.packets.PacketSocketUpdate;
|
||||
import forestry.core.proxy.Proxies;
|
||||
import forestry.core.tiles.TileUtil;
|
||||
import forestry.energy.gui.ContainerEngineBiogas;
|
||||
import forestry.energy.gui.ContainerEngineElectric;
|
||||
import forestry.energy.gui.ContainerEnginePeat;
|
||||
import forestry.energy.gui.ContainerGenerator;
|
||||
import forestry.energy.gui.GuiEngineBiogas;
|
||||
import forestry.energy.gui.GuiEngineElectric;
|
||||
import forestry.energy.gui.GuiEnginePeat;
|
||||
import forestry.energy.gui.GuiGenerator;
|
||||
import forestry.energy.tiles.TileEngineBiogas;
|
||||
import forestry.energy.tiles.TileEngineElectric;
|
||||
import forestry.energy.tiles.TileEnginePeat;
|
||||
import forestry.energy.tiles.TileGenerator;
|
||||
|
||||
public class GuiHandlerEnergy extends GuiHandlerBase {
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public Gui getClientGuiElement(int id, EntityPlayer player, World world, int x, int y, int z) {
|
||||
|
||||
if (id >= GuiId.values().length) {
|
||||
return null;
|
||||
}
|
||||
|
||||
switch (GuiId.values()[id]) {
|
||||
|
||||
case EngineBiogasGUI:
|
||||
return new GuiEngineBiogas(player.inventory, TileUtil.getTile(world, x, y, z, TileEngineBiogas.class));
|
||||
|
||||
case EnginePeatGUI:
|
||||
return new GuiEnginePeat(player.inventory, TileUtil.getTile(world, x, y, z, TileEnginePeat.class));
|
||||
|
||||
case EngineElectricGUI:
|
||||
return new GuiEngineElectric(player.inventory, TileUtil.getTile(world, x, y, z, TileEngineElectric.class));
|
||||
|
||||
case GeneratorGUI:
|
||||
return new GuiGenerator(player.inventory, TileUtil.getTile(world, x, y, z, TileGenerator.class));
|
||||
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Container getServerGuiElement(int id, EntityPlayer player, World world, int x, int y, int z) {
|
||||
|
||||
if (id >= GuiId.values().length) {
|
||||
return null;
|
||||
}
|
||||
|
||||
switch (GuiId.values()[id]) {
|
||||
|
||||
case EngineBiogasGUI:
|
||||
return new ContainerEngineBiogas(player.inventory, TileUtil.getTile(world, x, y, z, TileEngineBiogas.class));
|
||||
|
||||
case EnginePeatGUI:
|
||||
return new ContainerEnginePeat(player.inventory, TileUtil.getTile(world, x, y, z, TileEnginePeat.class));
|
||||
|
||||
case EngineElectricGUI:
|
||||
return new ContainerEngineElectric(player.inventory, TileUtil.getTile(world, x, y, z, TileEngineElectric.class));
|
||||
|
||||
case GeneratorGUI:
|
||||
return new ContainerGenerator(player.inventory, TileUtil.getTile(world, x, y, z, TileGenerator.class));
|
||||
|
||||
default:
|
||||
return null;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -12,6 +12,7 @@ package forestry.energy.tiles;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.Container;
|
||||
import net.minecraft.inventory.ICrafting;
|
||||
import net.minecraft.inventory.ISidedInventory;
|
||||
@@ -36,9 +37,10 @@ import forestry.core.fluids.tanks.FilteredTank;
|
||||
import forestry.core.fluids.tanks.StandardTank;
|
||||
import forestry.core.network.DataInputStreamForestry;
|
||||
import forestry.core.network.DataOutputStreamForestry;
|
||||
import forestry.core.network.GuiId;
|
||||
import forestry.core.tiles.ILiquidTankTile;
|
||||
import forestry.core.tiles.TileEngine;
|
||||
import forestry.energy.gui.ContainerEngineBiogas;
|
||||
import forestry.energy.gui.GuiEngineBiogas;
|
||||
import forestry.energy.inventory.InventoryEngineBiogas;
|
||||
|
||||
public class TileEngineBiogas extends TileEngine implements ISidedInventory, ILiquidTankTile, IFluidHandler {
|
||||
@@ -50,7 +52,7 @@ public class TileEngineBiogas extends TileEngine implements ISidedInventory, ILi
|
||||
private boolean shutdown; // true if the engine is too cold and needs to warm itself up.
|
||||
|
||||
public TileEngineBiogas() {
|
||||
super(GuiId.EngineBiogasGUI, "engine.bronze", Constants.ENGINE_BRONZE_HEAT_MAX, 300000);
|
||||
super("engine.bronze", Constants.ENGINE_BRONZE_HEAT_MAX, 300000);
|
||||
|
||||
setInternalInventory(new InventoryEngineBiogas(this));
|
||||
|
||||
@@ -332,4 +334,14 @@ public class TileEngineBiogas extends TileEngine implements ISidedInventory, ILi
|
||||
public FluidTankInfo[] getTankInfo(ForgeDirection from) {
|
||||
return tankManager.getTankInfo(from);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getGui(EntityPlayer player, int data) {
|
||||
return new GuiEngineBiogas(player.inventory, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getContainer(EntityPlayer player, int data) {
|
||||
return new ContainerEngineBiogas(player.inventory, this);
|
||||
}
|
||||
}
|
||||
@@ -39,7 +39,7 @@ public class TileEngineClockwork extends TileEngine {
|
||||
private short delay = 0;
|
||||
|
||||
public TileEngineClockwork() {
|
||||
super(null, null, ENGINE_CLOCKWORK_HEAT_MAX, 10000);
|
||||
super(null, ENGINE_CLOCKWORK_HEAT_MAX, 10000);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -160,4 +160,13 @@ public class TileEngineClockwork extends TileEngine {
|
||||
public void sendGUINetworkData(Container containerEngine, ICrafting iCrafting) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getGui(EntityPlayer player, int data) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getContainer(EntityPlayer player, int data) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -10,6 +10,7 @@
|
||||
******************************************************************************/
|
||||
package forestry.energy.tiles;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.Container;
|
||||
import net.minecraft.inventory.ICrafting;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
@@ -25,15 +26,15 @@ import forestry.core.circuits.ISocketable;
|
||||
import forestry.core.config.Constants;
|
||||
import forestry.core.errors.EnumErrorCode;
|
||||
import forestry.core.inventory.InventoryAdapter;
|
||||
import forestry.core.network.GuiId;
|
||||
import forestry.core.tiles.TemperatureState;
|
||||
import forestry.core.tiles.TileEngine;
|
||||
import forestry.energy.gui.ContainerEngineElectric;
|
||||
import forestry.energy.gui.GuiEngineElectric;
|
||||
import forestry.plugins.compat.PluginIC2;
|
||||
|
||||
import ic2.api.energy.prefab.BasicSink;
|
||||
|
||||
public class TileEngineElectric extends TileEngine implements ISocketable, IInventory {
|
||||
|
||||
protected static class EuConfig {
|
||||
|
||||
public int euForCycle;
|
||||
@@ -53,7 +54,7 @@ public class TileEngineElectric extends TileEngine implements ISocketable, IInve
|
||||
private BasicSink ic2EnergySink;
|
||||
|
||||
public TileEngineElectric() {
|
||||
super(GuiId.EngineElectricGUI, "engine.tin", Constants.ENGINE_ELECTRIC_HEAT_MAX, 100000);
|
||||
super("engine.tin", Constants.ENGINE_ELECTRIC_HEAT_MAX, 100000);
|
||||
|
||||
setInternalInventory(new InventoryEngineElectric(this));
|
||||
|
||||
@@ -303,4 +304,14 @@ public class TileEngineElectric extends TileEngine implements ISocketable, IInve
|
||||
public ICircuitSocketType getSocketType() {
|
||||
return CircuitSocketType.ELECTRIC_ENGINE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getGui(EntityPlayer player, int data) {
|
||||
return new GuiEngineElectric(player.inventory, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getContainer(EntityPlayer player, int data) {
|
||||
return new ContainerEngineElectric(player.inventory, this);
|
||||
}
|
||||
}
|
||||
@@ -13,6 +13,7 @@ package forestry.energy.tiles;
|
||||
import java.util.Collection;
|
||||
import java.util.LinkedList;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.Container;
|
||||
import net.minecraft.inventory.ICrafting;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
@@ -33,10 +34,11 @@ import forestry.core.errors.EnumErrorCode;
|
||||
import forestry.core.inventory.AdjacentInventoryCache;
|
||||
import forestry.core.inventory.IInventoryAdapter;
|
||||
import forestry.core.inventory.wrappers.InventoryMapper;
|
||||
import forestry.core.network.GuiId;
|
||||
import forestry.core.tiles.TemperatureState;
|
||||
import forestry.core.tiles.TileEngine;
|
||||
import forestry.core.utils.InventoryUtil;
|
||||
import forestry.energy.gui.ContainerEnginePeat;
|
||||
import forestry.energy.gui.GuiEnginePeat;
|
||||
import forestry.energy.inventory.InventoryEnginePeat;
|
||||
import forestry.factory.triggers.FactoryTriggers;
|
||||
import forestry.plugins.PluginCore;
|
||||
@@ -53,7 +55,7 @@ public class TileEnginePeat extends TileEngine implements ISidedInventory {
|
||||
private final AdjacentInventoryCache inventoryCache = new AdjacentInventoryCache(this, getTileCache());
|
||||
|
||||
public TileEnginePeat() {
|
||||
super(GuiId.EnginePeatGUI, "engine.copper", Constants.ENGINE_COPPER_HEAT_MAX, 200000);
|
||||
super("engine.copper", Constants.ENGINE_COPPER_HEAT_MAX, 200000);
|
||||
|
||||
ashForItem = Constants.ENGINE_COPPER_ASH_FOR_ITEM;
|
||||
setInternalInventory(new InventoryEnginePeat(this));
|
||||
@@ -338,4 +340,14 @@ public class TileEnginePeat extends TileEngine implements ISidedInventory {
|
||||
res.add(FactoryTriggers.lowFuel10);
|
||||
return res;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getGui(EntityPlayer player, int data) {
|
||||
return new GuiEnginePeat(player.inventory, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getContainer(EntityPlayer player, int data) {
|
||||
return new ContainerEnginePeat(player.inventory, this);
|
||||
}
|
||||
}
|
||||
@@ -12,6 +12,7 @@ package forestry.energy.tiles;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.Container;
|
||||
import net.minecraft.inventory.ICrafting;
|
||||
import net.minecraft.inventory.ISidedInventory;
|
||||
@@ -33,11 +34,12 @@ import forestry.core.fluids.TankManager;
|
||||
import forestry.core.fluids.tanks.FilteredTank;
|
||||
import forestry.core.network.DataInputStreamForestry;
|
||||
import forestry.core.network.DataOutputStreamForestry;
|
||||
import forestry.core.network.GuiId;
|
||||
import forestry.core.render.TankRenderInfo;
|
||||
import forestry.core.tiles.ILiquidTankTile;
|
||||
import forestry.core.tiles.IRenderableTile;
|
||||
import forestry.core.tiles.TileBase;
|
||||
import forestry.energy.gui.ContainerGenerator;
|
||||
import forestry.energy.gui.GuiGenerator;
|
||||
import forestry.energy.inventory.InventoryGenerator;
|
||||
import forestry.plugins.compat.PluginIC2;
|
||||
|
||||
@@ -54,7 +56,7 @@ public class TileGenerator extends TileBase implements ISidedInventory, ILiquidT
|
||||
private BasicSource ic2EnergySource;
|
||||
|
||||
public TileGenerator() {
|
||||
super(GuiId.GeneratorGUI, "generator");
|
||||
super("generator");
|
||||
|
||||
setInternalInventory(new InventoryGenerator(this));
|
||||
|
||||
@@ -227,4 +229,14 @@ public class TileGenerator extends TileBase implements ISidedInventory, ILiquidT
|
||||
public FluidTankInfo[] getTankInfo(ForgeDirection from) {
|
||||
return tankManager.getTankInfo(from);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getGui(EntityPlayer player, int data) {
|
||||
return new GuiGenerator(player.inventory, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getContainer(EntityPlayer player, int data) {
|
||||
return new ContainerGenerator(player.inventory, this);
|
||||
}
|
||||
}
|
||||
@@ -1,148 +0,0 @@
|
||||
/*******************************************************************************
|
||||
* 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.factory;
|
||||
|
||||
import net.minecraft.client.gui.Gui;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.Container;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
import forestry.core.GuiHandlerBase;
|
||||
import forestry.core.network.GuiId;
|
||||
import forestry.core.tiles.TileUtil;
|
||||
import forestry.factory.gui.ContainerBottler;
|
||||
import forestry.factory.gui.ContainerCarpenter;
|
||||
import forestry.factory.gui.ContainerCentrifuge;
|
||||
import forestry.factory.gui.ContainerFabricator;
|
||||
import forestry.factory.gui.ContainerFermenter;
|
||||
import forestry.factory.gui.ContainerMoistener;
|
||||
import forestry.factory.gui.ContainerRaintank;
|
||||
import forestry.factory.gui.ContainerSqueezer;
|
||||
import forestry.factory.gui.ContainerStill;
|
||||
import forestry.factory.gui.ContainerWorktable;
|
||||
import forestry.factory.gui.GuiBottler;
|
||||
import forestry.factory.gui.GuiCarpenter;
|
||||
import forestry.factory.gui.GuiCentrifuge;
|
||||
import forestry.factory.gui.GuiFabricator;
|
||||
import forestry.factory.gui.GuiFermenter;
|
||||
import forestry.factory.gui.GuiMoistener;
|
||||
import forestry.factory.gui.GuiRaintank;
|
||||
import forestry.factory.gui.GuiSqueezer;
|
||||
import forestry.factory.gui.GuiStill;
|
||||
import forestry.factory.gui.GuiWorktable;
|
||||
import forestry.factory.tiles.TileBottler;
|
||||
import forestry.factory.tiles.TileCarpenter;
|
||||
import forestry.factory.tiles.TileCentrifuge;
|
||||
import forestry.factory.tiles.TileFabricator;
|
||||
import forestry.factory.tiles.TileFermenter;
|
||||
import forestry.factory.tiles.TileMoistener;
|
||||
import forestry.factory.tiles.TileRaintank;
|
||||
import forestry.factory.tiles.TileSqueezer;
|
||||
import forestry.factory.tiles.TileStill;
|
||||
import forestry.factory.tiles.TileWorktable;
|
||||
|
||||
public class GuiHandlerFactory extends GuiHandlerBase {
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public Gui getClientGuiElement(int id, EntityPlayer player, World world, int x, int y, int z) {
|
||||
|
||||
if (id >= GuiId.values().length) {
|
||||
return null;
|
||||
}
|
||||
|
||||
switch (GuiId.values()[id]) {
|
||||
|
||||
case BottlerGUI:
|
||||
return new GuiBottler(player.inventory, TileUtil.getTile(world, x, y, z, TileBottler.class));
|
||||
|
||||
case CarpenterGUI:
|
||||
return new GuiCarpenter(player.inventory, TileUtil.getTile(world, x, y, z, TileCarpenter.class));
|
||||
|
||||
case CentrifugeGUI:
|
||||
return new GuiCentrifuge(player.inventory, TileUtil.getTile(world, x, y, z, TileCentrifuge.class));
|
||||
|
||||
case FabricatorGUI:
|
||||
return new GuiFabricator(player.inventory, TileUtil.getTile(world, x, y, z, TileFabricator.class));
|
||||
|
||||
case FermenterGUI:
|
||||
return new GuiFermenter(player.inventory, TileUtil.getTile(world, x, y, z, TileFermenter.class));
|
||||
|
||||
case MoistenerGUI:
|
||||
return new GuiMoistener(player.inventory, TileUtil.getTile(world, x, y, z, TileMoistener.class));
|
||||
|
||||
case RaintankGUI:
|
||||
return new GuiRaintank(player.inventory, TileUtil.getTile(world, x, y, z, TileRaintank.class));
|
||||
|
||||
case SqueezerGUI:
|
||||
return new GuiSqueezer(player.inventory, TileUtil.getTile(world, x, y, z, TileSqueezer.class));
|
||||
|
||||
case StillGUI:
|
||||
return new GuiStill(player.inventory, TileUtil.getTile(world, x, y, z, TileStill.class));
|
||||
|
||||
case WorktableGUI:
|
||||
return new GuiWorktable(player, TileUtil.getTile(world, x, y, z, TileWorktable.class));
|
||||
|
||||
default:
|
||||
return null;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Container getServerGuiElement(int id, EntityPlayer player, World world, int x, int y, int z) {
|
||||
|
||||
if (id >= GuiId.values().length) {
|
||||
return null;
|
||||
}
|
||||
|
||||
switch (GuiId.values()[id]) {
|
||||
|
||||
case BottlerGUI:
|
||||
return new ContainerBottler(player.inventory, TileUtil.getTile(world, x, y, z, TileBottler.class));
|
||||
|
||||
case CarpenterGUI:
|
||||
return new ContainerCarpenter(player.inventory, TileUtil.getTile(world, x, y, z, TileCarpenter.class));
|
||||
|
||||
case CentrifugeGUI:
|
||||
return new ContainerCentrifuge(player.inventory, TileUtil.getTile(world, x, y, z, TileCentrifuge.class));
|
||||
|
||||
case FabricatorGUI:
|
||||
return new ContainerFabricator(player.inventory, TileUtil.getTile(world, x, y, z, TileFabricator.class));
|
||||
|
||||
case FermenterGUI:
|
||||
return new ContainerFermenter(player.inventory, TileUtil.getTile(world, x, y, z, TileFermenter.class));
|
||||
|
||||
case MoistenerGUI:
|
||||
return new ContainerMoistener(player.inventory, TileUtil.getTile(world, x, y, z, TileMoistener.class));
|
||||
|
||||
case RaintankGUI:
|
||||
return new ContainerRaintank(player.inventory, TileUtil.getTile(world, x, y, z, TileRaintank.class));
|
||||
|
||||
case SqueezerGUI:
|
||||
return new ContainerSqueezer(player.inventory, TileUtil.getTile(world, x, y, z, TileSqueezer.class));
|
||||
|
||||
case StillGUI:
|
||||
return new ContainerStill(player.inventory, TileUtil.getTile(world, x, y, z, TileStill.class));
|
||||
|
||||
case WorktableGUI:
|
||||
return new ContainerWorktable(player, TileUtil.getTile(world, x, y, z, TileWorktable.class));
|
||||
|
||||
default:
|
||||
return null;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -14,6 +14,7 @@ import java.io.IOException;
|
||||
import java.util.Collection;
|
||||
import java.util.LinkedList;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.ISidedInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
@@ -36,10 +37,11 @@ import forestry.core.fluids.tanks.StandardTank;
|
||||
import forestry.core.inventory.IInventoryAdapter;
|
||||
import forestry.core.network.DataInputStreamForestry;
|
||||
import forestry.core.network.DataOutputStreamForestry;
|
||||
import forestry.core.network.GuiId;
|
||||
import forestry.core.render.TankRenderInfo;
|
||||
import forestry.core.tiles.ILiquidTankTile;
|
||||
import forestry.core.tiles.TilePowered;
|
||||
import forestry.factory.gui.ContainerBottler;
|
||||
import forestry.factory.gui.GuiBottler;
|
||||
import forestry.factory.inventory.InventoryBottler;
|
||||
import forestry.factory.recipes.BottlerRecipe;
|
||||
import forestry.factory.triggers.FactoryTriggers;
|
||||
@@ -56,7 +58,7 @@ public class TileBottler extends TilePowered implements ISidedInventory, ILiquid
|
||||
private BottlerRecipe currentRecipe;
|
||||
|
||||
public TileBottler() {
|
||||
super(GuiId.BottlerGUI, "bottler", 1100, 4000);
|
||||
super("bottler", 1100, 4000);
|
||||
|
||||
setInternalInventory(new InventoryBottler(this));
|
||||
|
||||
@@ -205,4 +207,13 @@ public class TileBottler extends TilePowered implements ISidedInventory, ILiquid
|
||||
return res;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getGui(EntityPlayer player, int data) {
|
||||
return new GuiBottler(player.inventory, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getContainer(EntityPlayer player, int data) {
|
||||
return new ContainerBottler(player.inventory, this);
|
||||
}
|
||||
}
|
||||
@@ -37,13 +37,14 @@ import forestry.core.inventory.InventoryAdapterTile;
|
||||
import forestry.core.inventory.wrappers.InventoryMapper;
|
||||
import forestry.core.network.DataInputStreamForestry;
|
||||
import forestry.core.network.DataOutputStreamForestry;
|
||||
import forestry.core.network.GuiId;
|
||||
import forestry.core.render.TankRenderInfo;
|
||||
import forestry.core.tiles.IItemStackDisplay;
|
||||
import forestry.core.tiles.ILiquidTankTile;
|
||||
import forestry.core.tiles.TilePowered;
|
||||
import forestry.core.utils.InventoryUtil;
|
||||
import forestry.core.utils.PlayerUtil;
|
||||
import forestry.factory.gui.ContainerCarpenter;
|
||||
import forestry.factory.gui.GuiCarpenter;
|
||||
import forestry.factory.inventory.InventoryCarpenter;
|
||||
import forestry.factory.inventory.InventoryGhostCrafting;
|
||||
import forestry.factory.recipes.CarpenterRecipeManager;
|
||||
@@ -66,7 +67,7 @@ public class TileCarpenter extends TilePowered implements ISidedInventory, ILiqu
|
||||
}
|
||||
|
||||
public TileCarpenter() {
|
||||
super(GuiId.CarpenterGUI, "carpenter", 1100, 4000);
|
||||
super("carpenter", 1100, 4000);
|
||||
setEnergyPerWorkCycle(ENERGY_PER_WORK_CYCLE);
|
||||
resourceTank = new FilteredTank(Constants.PROCESSOR_TANK_CAPACITY, CarpenterRecipeManager.getRecipeFluids());
|
||||
|
||||
@@ -274,4 +275,14 @@ public class TileCarpenter extends TilePowered implements ISidedInventory, ILiqu
|
||||
public FluidTankInfo[] getTankInfo(ForgeDirection from) {
|
||||
return tankManager.getTankInfo(from);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getGui(EntityPlayer player, int data) {
|
||||
return new GuiCarpenter(player.inventory, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getContainer(EntityPlayer player, int data) {
|
||||
return new ContainerCarpenter(player.inventory, this);
|
||||
}
|
||||
}
|
||||
@@ -15,6 +15,7 @@ import java.util.Collection;
|
||||
import java.util.LinkedList;
|
||||
import java.util.Stack;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.ISidedInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
@@ -38,9 +39,10 @@ import forestry.core.inventory.IInventoryAdapter;
|
||||
import forestry.core.inventory.InventoryAdapter;
|
||||
import forestry.core.network.DataInputStreamForestry;
|
||||
import forestry.core.network.DataOutputStreamForestry;
|
||||
import forestry.core.network.GuiId;
|
||||
import forestry.core.tiles.TilePowered;
|
||||
import forestry.core.utils.InventoryUtil;
|
||||
import forestry.factory.gui.ContainerCentrifuge;
|
||||
import forestry.factory.gui.GuiCentrifuge;
|
||||
import forestry.factory.inventory.InventoryCentrifuge;
|
||||
import forestry.factory.recipes.CentrifugeRecipeManager;
|
||||
import forestry.factory.triggers.FactoryTriggers;
|
||||
@@ -59,7 +61,7 @@ public class TileCentrifuge extends TilePowered implements ISocketable, ISidedIn
|
||||
private final Stack<ItemStack> pendingProducts = new Stack<>();
|
||||
|
||||
public TileCentrifuge() {
|
||||
super(GuiId.CentrifugeGUI, "centrifuge", 800, Constants.MACHINE_MAX_ENERGY);
|
||||
super("centrifuge", 800, Constants.MACHINE_MAX_ENERGY);
|
||||
setInternalInventory(new InventoryCentrifuge(this));
|
||||
}
|
||||
|
||||
@@ -248,4 +250,13 @@ public class TileCentrifuge extends TilePowered implements ISocketable, ISidedIn
|
||||
return CircuitSocketType.MACHINE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getGui(EntityPlayer player, int data) {
|
||||
return new GuiCentrifuge(player.inventory, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getContainer(EntityPlayer player, int data) {
|
||||
return new ContainerCentrifuge(player.inventory, this);
|
||||
}
|
||||
}
|
||||
@@ -44,10 +44,11 @@ import forestry.core.inventory.wrappers.InventoryMapper;
|
||||
import forestry.core.items.ICraftingPlan;
|
||||
import forestry.core.network.DataInputStreamForestry;
|
||||
import forestry.core.network.DataOutputStreamForestry;
|
||||
import forestry.core.network.GuiId;
|
||||
import forestry.core.tiles.ILiquidTankTile;
|
||||
import forestry.core.tiles.TilePowered;
|
||||
import forestry.core.utils.InventoryUtil;
|
||||
import forestry.factory.gui.ContainerFabricator;
|
||||
import forestry.factory.gui.GuiFabricator;
|
||||
import forestry.factory.inventory.InventoryFabricator;
|
||||
import forestry.factory.inventory.InventoryGhostCrafting;
|
||||
import forestry.factory.recipes.FabricatorRecipeManager;
|
||||
@@ -63,7 +64,7 @@ public class TileFabricator extends TilePowered implements ISlotPickupWatcher, I
|
||||
private int meltingPoint = 0;
|
||||
|
||||
public TileFabricator() {
|
||||
super(GuiId.FabricatorGUI, "fabricator", 1100, 3300);
|
||||
super("fabricator", 1100, 3300);
|
||||
setEnergyPerWorkCycle(200);
|
||||
craftingInventory = new InventoryGhostCrafting<>(this, InventoryGhostCrafting.SLOT_CRAFTING_COUNT);
|
||||
setInternalInventory(new InventoryFabricator(this));
|
||||
@@ -354,4 +355,14 @@ public class TileFabricator extends TilePowered implements ISlotPickupWatcher, I
|
||||
public FluidTankInfo[] getTankInfo(ForgeDirection from) {
|
||||
return tankManager.getTankInfo(from);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getGui(EntityPlayer player, int data) {
|
||||
return new GuiFabricator(player.inventory, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getContainer(EntityPlayer player, int data) {
|
||||
return new ContainerFabricator(player.inventory, this);
|
||||
}
|
||||
}
|
||||
@@ -14,6 +14,7 @@ import java.io.IOException;
|
||||
import java.util.Collection;
|
||||
import java.util.LinkedList;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.Container;
|
||||
import net.minecraft.inventory.ICrafting;
|
||||
import net.minecraft.inventory.ISidedInventory;
|
||||
@@ -42,10 +43,11 @@ import forestry.core.fluids.tanks.FilteredTank;
|
||||
import forestry.core.fluids.tanks.StandardTank;
|
||||
import forestry.core.network.DataInputStreamForestry;
|
||||
import forestry.core.network.DataOutputStreamForestry;
|
||||
import forestry.core.network.GuiId;
|
||||
import forestry.core.render.TankRenderInfo;
|
||||
import forestry.core.tiles.ILiquidTankTile;
|
||||
import forestry.core.tiles.TilePowered;
|
||||
import forestry.factory.gui.ContainerFermenter;
|
||||
import forestry.factory.gui.GuiFermenter;
|
||||
import forestry.factory.inventory.InventoryFermenter;
|
||||
import forestry.factory.recipes.FermenterRecipeManager;
|
||||
import forestry.factory.triggers.FactoryTriggers;
|
||||
@@ -66,7 +68,7 @@ public class TileFermenter extends TilePowered implements ISidedInventory, ILiqu
|
||||
private int fuelCurrentFerment = 0;
|
||||
|
||||
public TileFermenter() {
|
||||
super(GuiId.FermenterGUI, "fermenter", 2000, 8000);
|
||||
super("fermenter", 2000, 8000);
|
||||
setEnergyPerWorkCycle(4200);
|
||||
setInternalInventory(new InventoryFermenter(this));
|
||||
resourceTank = new FilteredTank(Constants.PROCESSOR_TANK_CAPACITY, FermenterRecipeManager.recipeFluidInputs);
|
||||
@@ -338,4 +340,14 @@ public class TileFermenter extends TilePowered implements ISidedInventory, ILiqu
|
||||
res.add(FactoryTriggers.lowResource10);
|
||||
return res;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getGui(EntityPlayer player, int data) {
|
||||
return new GuiFermenter(player.inventory, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getContainer(EntityPlayer player, int data) {
|
||||
return new ContainerFermenter(player.inventory, this);
|
||||
}
|
||||
}
|
||||
@@ -112,4 +112,13 @@ public class TileMillRainmaker extends TileMill {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getGui(EntityPlayer player, int data) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getContainer(EntityPlayer player, int data) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -13,6 +13,7 @@ package forestry.factory.tiles;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.Container;
|
||||
import net.minecraft.inventory.ICrafting;
|
||||
import net.minecraft.inventory.ISidedInventory;
|
||||
@@ -38,13 +39,14 @@ import forestry.core.fluids.tanks.FilteredTank;
|
||||
import forestry.core.inventory.IInventoryAdapter;
|
||||
import forestry.core.network.DataInputStreamForestry;
|
||||
import forestry.core.network.DataOutputStreamForestry;
|
||||
import forestry.core.network.GuiId;
|
||||
import forestry.core.render.TankRenderInfo;
|
||||
import forestry.core.tiles.ILiquidTankTile;
|
||||
import forestry.core.tiles.IRenderableTile;
|
||||
import forestry.core.tiles.TileBase;
|
||||
import forestry.core.utils.InventoryUtil;
|
||||
import forestry.core.utils.ItemStackUtil;
|
||||
import forestry.factory.gui.ContainerMoistener;
|
||||
import forestry.factory.gui.GuiMoistener;
|
||||
import forestry.factory.inventory.InventoryMoistener;
|
||||
import forestry.factory.recipes.MoistenerRecipeManager;
|
||||
|
||||
@@ -61,7 +63,7 @@ public class TileMoistener extends TileBase implements ISidedInventory, ILiquidT
|
||||
private ItemStack pendingProduct;
|
||||
|
||||
public TileMoistener() {
|
||||
super(GuiId.MoistenerGUI, "moistener");
|
||||
super("moistener");
|
||||
setInternalInventory(new InventoryMoistener(this));
|
||||
resourceTank = new FilteredTank(Constants.PROCESSOR_TANK_CAPACITY, FluidRegistry.WATER);
|
||||
tankManager = new TankManager(this, resourceTank);
|
||||
@@ -535,4 +537,14 @@ public class TileMoistener extends TileBase implements ISidedInventory, ILiquidT
|
||||
iCrafting.sendProgressBarUpdate(container, 2, productionTime);
|
||||
iCrafting.sendProgressBarUpdate(container, 3, timePerItem);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getGui(EntityPlayer player, int data) {
|
||||
return new GuiMoistener(player.inventory, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getContainer(EntityPlayer player, int data) {
|
||||
return new ContainerMoistener(player.inventory, this);
|
||||
}
|
||||
}
|
||||
@@ -12,6 +12,7 @@ package forestry.factory.tiles;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.Container;
|
||||
import net.minecraft.inventory.ICrafting;
|
||||
import net.minecraft.inventory.ISidedInventory;
|
||||
@@ -36,10 +37,11 @@ import forestry.core.fluids.TankManager;
|
||||
import forestry.core.fluids.tanks.FilteredTank;
|
||||
import forestry.core.network.DataInputStreamForestry;
|
||||
import forestry.core.network.DataOutputStreamForestry;
|
||||
import forestry.core.network.GuiId;
|
||||
import forestry.core.tiles.ILiquidTankTile;
|
||||
import forestry.core.tiles.TileBase;
|
||||
import forestry.core.utils.ItemStackUtil;
|
||||
import forestry.factory.gui.ContainerRaintank;
|
||||
import forestry.factory.gui.GuiRaintank;
|
||||
import forestry.factory.inventory.InventoryRaintank;
|
||||
|
||||
public class TileRaintank extends TileBase implements ISidedInventory, ILiquidTankTile, IFluidHandler {
|
||||
@@ -52,7 +54,7 @@ public class TileRaintank extends TileBase implements ISidedInventory, ILiquidTa
|
||||
private ItemStack usedEmpty;
|
||||
|
||||
public TileRaintank() {
|
||||
super(GuiId.RaintankGUI, "raintank");
|
||||
super("raintank");
|
||||
setInternalInventory(new InventoryRaintank(this));
|
||||
|
||||
resourceTank = new FilteredTank(Constants.RAINTANK_TANK_CAPACITY, FluidRegistry.WATER);
|
||||
@@ -202,4 +204,14 @@ public class TileRaintank extends TileBase implements ISidedInventory, ILiquidTa
|
||||
public FluidTankInfo[] getTankInfo(ForgeDirection from) {
|
||||
return tankManager.getTankInfo(from);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getGui(EntityPlayer player, int data) {
|
||||
return new GuiRaintank(player.inventory, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getContainer(EntityPlayer player, int data) {
|
||||
return new ContainerRaintank(player.inventory, this);
|
||||
}
|
||||
}
|
||||
@@ -38,12 +38,13 @@ import forestry.core.fluids.tanks.StandardTank;
|
||||
import forestry.core.inventory.InventoryAdapter;
|
||||
import forestry.core.network.DataInputStreamForestry;
|
||||
import forestry.core.network.DataOutputStreamForestry;
|
||||
import forestry.core.network.GuiId;
|
||||
import forestry.core.render.TankRenderInfo;
|
||||
import forestry.core.tiles.ILiquidTankTile;
|
||||
import forestry.core.tiles.TilePowered;
|
||||
import forestry.core.utils.ItemStackUtil;
|
||||
import forestry.core.utils.PlayerUtil;
|
||||
import forestry.factory.gui.ContainerSqueezer;
|
||||
import forestry.factory.gui.GuiSqueezer;
|
||||
import forestry.factory.inventory.InventorySqueezer;
|
||||
import forestry.factory.recipes.SqueezerRecipeManager;
|
||||
|
||||
@@ -61,7 +62,7 @@ public class TileSqueezer extends TilePowered implements ISocketable, ISidedInve
|
||||
private ISqueezerRecipe currentRecipe;
|
||||
|
||||
public TileSqueezer() {
|
||||
super(GuiId.SqueezerGUI, "squeezer", 1100, Constants.MACHINE_MAX_ENERGY);
|
||||
super("squeezer", 1100, Constants.MACHINE_MAX_ENERGY);
|
||||
this.inventory = new InventorySqueezer(this);
|
||||
setInternalInventory(this.inventory);
|
||||
this.productTank = new StandardTank(Constants.PROCESSOR_TANK_CAPACITY);
|
||||
@@ -283,4 +284,14 @@ public class TileSqueezer extends TilePowered implements ISocketable, ISidedInve
|
||||
public ICircuitSocketType getSocketType() {
|
||||
return CircuitSocketType.MACHINE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getGui(EntityPlayer player, int data) {
|
||||
return new GuiSqueezer(player.inventory, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getContainer(EntityPlayer player, int data) {
|
||||
return new ContainerSqueezer(player.inventory, this);
|
||||
}
|
||||
}
|
||||
@@ -12,6 +12,7 @@ package forestry.factory.tiles;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.ISidedInventory;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
||||
@@ -31,10 +32,11 @@ import forestry.core.fluids.tanks.FilteredTank;
|
||||
import forestry.core.fluids.tanks.StandardTank;
|
||||
import forestry.core.network.DataInputStreamForestry;
|
||||
import forestry.core.network.DataOutputStreamForestry;
|
||||
import forestry.core.network.GuiId;
|
||||
import forestry.core.render.TankRenderInfo;
|
||||
import forestry.core.tiles.ILiquidTankTile;
|
||||
import forestry.core.tiles.TilePowered;
|
||||
import forestry.factory.gui.ContainerStill;
|
||||
import forestry.factory.gui.GuiStill;
|
||||
import forestry.factory.inventory.InventoryStill;
|
||||
import forestry.factory.recipes.StillRecipeManager;
|
||||
|
||||
@@ -49,7 +51,7 @@ public class TileStill extends TilePowered implements ISidedInventory, ILiquidTa
|
||||
private FluidStack bufferedLiquid;
|
||||
|
||||
public TileStill() {
|
||||
super(GuiId.StillGUI, "still", 1100, 8000);
|
||||
super("still", 1100, 8000);
|
||||
setInternalInventory(new InventoryStill(this));
|
||||
resourceTank = new FilteredTank(Constants.PROCESSOR_TANK_CAPACITY, StillRecipeManager.recipeFluidInputs);
|
||||
resourceTank.tankMode = StandardTank.TankMode.INPUT;
|
||||
@@ -209,4 +211,14 @@ public class TileStill extends TilePowered implements ISidedInventory, ILiquidTa
|
||||
public FluidTankInfo[] getTankInfo(ForgeDirection from) {
|
||||
return tankManager.getTankInfo(from);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getGui(EntityPlayer player, int data) {
|
||||
return new GuiStill(player.inventory, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getContainer(EntityPlayer player, int data) {
|
||||
return new ContainerStill(player.inventory, this);
|
||||
}
|
||||
}
|
||||
@@ -25,11 +25,12 @@ import forestry.core.inventory.InventoryAdapterTile;
|
||||
import forestry.core.inventory.wrappers.InventoryMapper;
|
||||
import forestry.core.network.DataInputStreamForestry;
|
||||
import forestry.core.network.DataOutputStreamForestry;
|
||||
import forestry.core.network.GuiId;
|
||||
import forestry.core.recipes.RecipeUtil;
|
||||
import forestry.core.tiles.TileBase;
|
||||
import forestry.core.utils.InventoryUtil;
|
||||
import forestry.core.utils.ItemStackUtil;
|
||||
import forestry.factory.gui.ContainerWorktable;
|
||||
import forestry.factory.gui.GuiWorktable;
|
||||
import forestry.factory.inventory.InventoryCraftingForestry;
|
||||
import forestry.factory.inventory.InventoryGhostCrafting;
|
||||
import forestry.factory.inventory.InventoryWorktable;
|
||||
@@ -42,7 +43,7 @@ public class TileWorktable extends TileBase implements ICrafterWorktable {
|
||||
private MemorizedRecipe currentRecipe;
|
||||
|
||||
public TileWorktable() {
|
||||
super(GuiId.WorktableGUI, "worktable");
|
||||
super("worktable");
|
||||
setInternalInventory(new InventoryWorktable(this));
|
||||
|
||||
craftingDisplay = new InventoryGhostCrafting<>(this, 10);
|
||||
@@ -262,4 +263,14 @@ public class TileWorktable extends TileBase implements ICrafterWorktable {
|
||||
setCraftingDisplay(currentRecipe.getCraftMatrix());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getGui(EntityPlayer player, int data) {
|
||||
return new GuiWorktable(player, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getContainer(EntityPlayer player, int data) {
|
||||
return new ContainerWorktable(player, this);
|
||||
}
|
||||
}
|
||||
@@ -1,64 +0,0 @@
|
||||
/*******************************************************************************
|
||||
* 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.farming;
|
||||
|
||||
import net.minecraft.client.gui.Gui;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.Container;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
import forestry.core.GuiHandlerBase;
|
||||
import forestry.core.network.GuiId;
|
||||
import forestry.core.network.packets.PacketSocketUpdate;
|
||||
import forestry.core.proxy.Proxies;
|
||||
import forestry.core.tiles.TileUtil;
|
||||
import forestry.farming.gui.ContainerFarm;
|
||||
import forestry.farming.gui.GuiFarm;
|
||||
import forestry.farming.tiles.TileFarm;
|
||||
|
||||
public class GuiHandlerFarming extends GuiHandlerBase {
|
||||
|
||||
@Override
|
||||
public Container getServerGuiElement(int id, EntityPlayer player, World world, int x, int y, int z) {
|
||||
|
||||
if (id >= GuiId.values().length) {
|
||||
return null;
|
||||
}
|
||||
|
||||
switch (GuiId.values()[id]) {
|
||||
case MultiFarmGUI:
|
||||
return new ContainerFarm(player.inventory, TileUtil.getTile(world, x, y, z, TileFarm.class));
|
||||
default:
|
||||
return null;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public Gui getClientGuiElement(int id, EntityPlayer player, World world, int x, int y, int z) {
|
||||
if (id >= GuiId.values().length) {
|
||||
return null;
|
||||
}
|
||||
|
||||
switch (GuiId.values()[id]) {
|
||||
case MultiFarmGUI:
|
||||
return new GuiFarm(player, TileUtil.getTile(world, x, y, z, TileFarm.class));
|
||||
default:
|
||||
return null;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -19,7 +19,6 @@ import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.ChunkCoordinates;
|
||||
|
||||
import forestry.api.circuits.ICircuitSocketType;
|
||||
import forestry.api.core.ForestryAPI;
|
||||
import forestry.api.core.IErrorLogic;
|
||||
import forestry.api.core.IErrorLogicSource;
|
||||
import forestry.api.multiblock.IFarmComponent;
|
||||
@@ -34,9 +33,10 @@ import forestry.core.inventory.IInventoryAdapter;
|
||||
import forestry.core.multiblock.MultiblockTileEntityForestry;
|
||||
import forestry.core.network.DataInputStreamForestry;
|
||||
import forestry.core.network.DataOutputStreamForestry;
|
||||
import forestry.core.network.GuiId;
|
||||
import forestry.core.network.IStreamableGui;
|
||||
import forestry.core.tiles.ITitled;
|
||||
import forestry.farming.gui.ContainerFarm;
|
||||
import forestry.farming.gui.GuiFarm;
|
||||
import forestry.farming.multiblock.MultiblockLogicFarm;
|
||||
import forestry.farming.render.EnumFarmBlockTexture;
|
||||
|
||||
@@ -48,11 +48,6 @@ public abstract class TileFarm extends MultiblockTileEntityForestry<MultiblockLo
|
||||
super(new MultiblockLogicFarm());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void openGui(EntityPlayer player) {
|
||||
player.openGui(ForestryAPI.instance, GuiId.MultiFarmGUI.ordinal(), worldObj, xCoord, yCoord, zCoord);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onMachineAssembled(IMultiblockController multiblockController, ChunkCoordinates minCoord, ChunkCoordinates maxCoord) {
|
||||
worldObj.notifyBlocksOfNeighborChange(xCoord, yCoord, zCoord, getBlockType());
|
||||
@@ -175,4 +170,14 @@ public abstract class TileFarm extends MultiblockTileEntityForestry<MultiblockLo
|
||||
public String getUnlocalizedTitle() {
|
||||
return "for.gui.farm.title";
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getGui(EntityPlayer player, int data) {
|
||||
return new GuiFarm(player, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getContainer(EntityPlayer player, int data) {
|
||||
return new ContainerFarm(player.inventory, this);
|
||||
}
|
||||
}
|
||||
@@ -1,72 +0,0 @@
|
||||
/*******************************************************************************
|
||||
* 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.food;
|
||||
|
||||
import net.minecraft.client.gui.Gui;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.Container;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
import forestry.core.GuiHandlerBase;
|
||||
import forestry.core.network.GuiId;
|
||||
import forestry.food.gui.ContainerInfuser;
|
||||
import forestry.food.gui.GuiInfuser;
|
||||
import forestry.food.inventory.ItemInventoryInfuser;
|
||||
|
||||
public class GuiHandlerFood extends GuiHandlerBase {
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public Gui getClientGuiElement(int id, EntityPlayer player, World world, int x, int y, int z) {
|
||||
|
||||
if (id >= GuiId.values().length) {
|
||||
return null;
|
||||
}
|
||||
|
||||
switch (GuiId.values()[id]) {
|
||||
|
||||
case InfuserGUI:
|
||||
ItemStack infuser = player.getCurrentEquippedItem();
|
||||
if (infuser == null) {
|
||||
return null;
|
||||
}
|
||||
return new GuiInfuser(player.inventory, new ItemInventoryInfuser(player, infuser));
|
||||
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Container getServerGuiElement(int id, EntityPlayer player, World world, int x, int y, int z) {
|
||||
|
||||
if (id >= GuiId.values().length) {
|
||||
return null;
|
||||
}
|
||||
|
||||
switch (GuiId.values()[id]) {
|
||||
|
||||
case InfuserGUI:
|
||||
ItemStack infuser = player.getCurrentEquippedItem();
|
||||
if (infuser == null) {
|
||||
return null;
|
||||
}
|
||||
return new ContainerInfuser(player.inventory, new ItemInventoryInfuser(player, infuser));
|
||||
|
||||
default:
|
||||
return null;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
/*******************************************************************************
|
||||
* 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.food.items;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import forestry.core.items.ItemWithGui;
|
||||
import forestry.food.gui.ContainerInfuser;
|
||||
import forestry.food.gui.GuiInfuser;
|
||||
import forestry.food.inventory.ItemInventoryInfuser;
|
||||
|
||||
public class ItemInfuser extends ItemWithGui {
|
||||
@Override
|
||||
public Object getGui(EntityPlayer player, ItemStack heldItem, int data) {
|
||||
return new GuiInfuser(player.inventory, new ItemInventoryInfuser(player, heldItem));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getContainer(EntityPlayer player, ItemStack heldItem, int data) {
|
||||
return new ContainerInfuser(player.inventory, new ItemInventoryInfuser(player, heldItem));
|
||||
}
|
||||
}
|
||||
@@ -16,8 +16,6 @@ import net.minecraft.item.ItemStack;
|
||||
|
||||
import forestry.core.items.ItemForestryFood;
|
||||
import forestry.core.items.ItemRegistry;
|
||||
import forestry.core.items.ItemWithGui;
|
||||
import forestry.core.network.GuiId;
|
||||
import forestry.food.BeverageEffect;
|
||||
|
||||
public class ItemRegistryFood extends ItemRegistry {
|
||||
@@ -25,7 +23,7 @@ public class ItemRegistryFood extends ItemRegistry {
|
||||
public final ItemBeverage beverage;
|
||||
public final ItemForestryFood ambrosia;
|
||||
public final ItemForestryFood honeyPot;
|
||||
public final ItemWithGui infuser;
|
||||
public final ItemInfuser infuser;
|
||||
|
||||
public ItemRegistryFood() {
|
||||
// / FOOD ITEMS
|
||||
@@ -35,7 +33,7 @@ public class ItemRegistryFood extends ItemRegistry {
|
||||
honeyPot = registerItem(new ItemForestryFood(2, 0.2f).setIsDrink(), "honeyPot");
|
||||
|
||||
// / SEASONER
|
||||
infuser = new ItemWithGui(GuiId.InfuserGUI);
|
||||
infuser = new ItemInfuser();
|
||||
registerItem(infuser, "infuser");
|
||||
|
||||
// Mead
|
||||
|
||||
@@ -1,85 +0,0 @@
|
||||
/*******************************************************************************
|
||||
* 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.lepidopterology;
|
||||
|
||||
import net.minecraft.client.gui.Gui;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.Container;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
import forestry.api.lepidopterology.ButterflyManager;
|
||||
import forestry.core.GuiHandlerBase;
|
||||
import forestry.core.gui.ContainerAlyzer;
|
||||
import forestry.core.network.GuiId;
|
||||
import forestry.lepidopterology.gui.GuiFlutterlyzer;
|
||||
import forestry.lepidopterology.inventory.ItemInventoryFlutterlyzer;
|
||||
|
||||
public class GuiHandlerLepidopterology extends GuiHandlerBase {
|
||||
|
||||
@Override
|
||||
public Container getServerGuiElement(int id, EntityPlayer player, World world, int x, int y, int z) {
|
||||
int cleanId = decodeGuiID(id);
|
||||
int guiData = decodeGuiData(id);
|
||||
|
||||
if (cleanId >= GuiId.values().length) {
|
||||
return null;
|
||||
}
|
||||
|
||||
switch (GuiId.values()[cleanId]) {
|
||||
case FlutterlyzerGUI:
|
||||
ItemStack equipped = player.getCurrentEquippedItem();
|
||||
if (equipped == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return new ContainerAlyzer(new ItemInventoryFlutterlyzer(player, equipped), player);
|
||||
|
||||
case LepidopteristChestGUI:
|
||||
return getNaturalistChestContainer(ButterflyManager.butterflyRoot, player, world, x, y, z, guiData);
|
||||
|
||||
default:
|
||||
return null;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public Gui getClientGuiElement(int id, EntityPlayer player, World world, int x, int y, int z) {
|
||||
int cleanId = decodeGuiID(id);
|
||||
int guiData = decodeGuiData(id);
|
||||
|
||||
if (cleanId >= GuiId.values().length) {
|
||||
return null;
|
||||
}
|
||||
|
||||
switch (GuiId.values()[cleanId]) {
|
||||
case FlutterlyzerGUI:
|
||||
ItemStack equipped = player.getCurrentEquippedItem();
|
||||
if (equipped == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return new GuiFlutterlyzer(player, new ItemInventoryFlutterlyzer(player, equipped));
|
||||
|
||||
case LepidopteristChestGUI:
|
||||
return getNaturalistChestGui(ButterflyManager.butterflyRoot, player, world, x, y, z, guiData);
|
||||
|
||||
default:
|
||||
return null;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
/*******************************************************************************
|
||||
* 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.lepidopterology.items;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import forestry.api.core.Tabs;
|
||||
import forestry.core.gui.ContainerAlyzer;
|
||||
import forestry.core.items.ItemWithGui;
|
||||
import forestry.lepidopterology.gui.GuiFlutterlyzer;
|
||||
import forestry.lepidopterology.inventory.ItemInventoryFlutterlyzer;
|
||||
|
||||
public class ItemFlutterlyzer extends ItemWithGui {
|
||||
public ItemFlutterlyzer() {
|
||||
super(Tabs.tabLepidopterology);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getGui(EntityPlayer player, ItemStack heldItem, int data) {
|
||||
return new GuiFlutterlyzer(player, new ItemInventoryFlutterlyzer(player, heldItem));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getContainer(EntityPlayer player, ItemStack heldItem, int data) {
|
||||
return new ContainerAlyzer(new ItemInventoryFlutterlyzer(player, heldItem), player);
|
||||
}
|
||||
}
|
||||
@@ -10,20 +10,17 @@
|
||||
******************************************************************************/
|
||||
package forestry.lepidopterology.items;
|
||||
|
||||
import forestry.api.core.Tabs;
|
||||
import forestry.api.lepidopterology.EnumFlutterType;
|
||||
import forestry.core.items.ItemRegistry;
|
||||
import forestry.core.items.ItemWithGui;
|
||||
import forestry.core.network.GuiId;
|
||||
|
||||
public class ItemRegistryLepidopterology extends ItemRegistry {
|
||||
public final ItemWithGui flutterlyzer;
|
||||
public final ItemFlutterlyzer flutterlyzer;
|
||||
public final ItemButterflyGE butterflyGE;
|
||||
public final ItemButterflyGE serumGE;
|
||||
public final ItemButterflyGE caterpillarGE;
|
||||
|
||||
public ItemRegistryLepidopterology() {
|
||||
flutterlyzer = registerItem(new ItemWithGui(GuiId.FlutterlyzerGUI, Tabs.tabLepidopterology), "flutterlyzer");
|
||||
flutterlyzer = registerItem(new ItemFlutterlyzer(), "flutterlyzer");
|
||||
butterflyGE = registerItem(new ItemButterflyGE(EnumFlutterType.BUTTERFLY), "butterflyGE");
|
||||
serumGE = registerItem(new ItemButterflyGE(EnumFlutterType.SERUM), "serumGE");
|
||||
caterpillarGE = registerItem(new ItemButterflyGE(EnumFlutterType.CATERPILLAR), "caterpillarGE");
|
||||
|
||||
@@ -11,11 +11,10 @@
|
||||
package forestry.lepidopterology.tiles;
|
||||
|
||||
import forestry.api.lepidopterology.ButterflyManager;
|
||||
import forestry.core.network.GuiId;
|
||||
import forestry.core.tiles.TileNaturalistChest;
|
||||
|
||||
public class TileLepidopteristChest extends TileNaturalistChest {
|
||||
public TileLepidopteristChest() {
|
||||
super(ButterflyManager.butterflyRoot, GuiId.LepidopteristChestGUI);
|
||||
super(ButterflyManager.butterflyRoot);
|
||||
}
|
||||
}
|
||||
@@ -1,141 +0,0 @@
|
||||
/*******************************************************************************
|
||||
* 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;
|
||||
|
||||
import net.minecraft.client.gui.Gui;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.Container;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
import forestry.core.GuiHandlerBase;
|
||||
import forestry.core.network.GuiId;
|
||||
import forestry.core.tiles.TileUtil;
|
||||
import forestry.mail.gui.ContainerCatalogue;
|
||||
import forestry.mail.gui.ContainerLetter;
|
||||
import forestry.mail.gui.ContainerMailbox;
|
||||
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.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.TileStampCollector;
|
||||
import forestry.mail.tiles.TileTrader;
|
||||
import forestry.plugins.PluginMail;
|
||||
|
||||
public class GuiHandlerMail extends GuiHandlerBase {
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public Gui getClientGuiElement(int id, EntityPlayer player, World world, int x, int y, int z) {
|
||||
|
||||
if (id >= GuiId.values().length) {
|
||||
return null;
|
||||
}
|
||||
|
||||
switch (GuiId.values()[id]) {
|
||||
case CatalogueGUI:
|
||||
ItemStack cata = player.getCurrentEquippedItem();
|
||||
if (cata == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
Item cataItem = cata.getItem();
|
||||
if (PluginMail.items.catalogue == cataItem) {
|
||||
return new GuiCatalogue(player);
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
|
||||
case LetterGUI:
|
||||
ItemStack equipped = player.getCurrentEquippedItem();
|
||||
if (equipped == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (equipped.getItem() == PluginMail.items.letters) {
|
||||
return new GuiLetter(player, new ItemInventoryLetter(player, equipped));
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
|
||||
case MailboxGUI:
|
||||
return new GuiMailbox(player.inventory, TileUtil.getTile(world, x, y, z, TileMailbox.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:
|
||||
return new GuiTradeName(TileUtil.getTile(world, x, y, z, TileTrader.class));
|
||||
default:
|
||||
return null;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Container getServerGuiElement(int id, EntityPlayer player, World world, int x, int y, int z) {
|
||||
|
||||
if (id >= GuiId.values().length) {
|
||||
return null;
|
||||
}
|
||||
|
||||
switch (GuiId.values()[id]) {
|
||||
case CatalogueGUI:
|
||||
ItemStack cata = player.getCurrentEquippedItem();
|
||||
if (cata == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
Item cataItem = cata.getItem();
|
||||
if (PluginMail.items.catalogue == cataItem) {
|
||||
return new ContainerCatalogue(player);
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
|
||||
case LetterGUI:
|
||||
ItemStack equipped = player.getCurrentEquippedItem();
|
||||
if (equipped == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (equipped.getItem() == PluginMail.items.letters) {
|
||||
return new ContainerLetter(player, new ItemInventoryLetter(player, equipped));
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
|
||||
case MailboxGUI:
|
||||
return new ContainerMailbox(player.inventory, TileUtil.getTile(world, x, y, z, TileMailbox.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:
|
||||
return new ContainerTradeName(TileUtil.getTile(world, x, y, z, TileTrader.class));
|
||||
default:
|
||||
return null;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
/*******************************************************************************
|
||||
* 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.items;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import forestry.core.items.ItemWithGui;
|
||||
import forestry.mail.gui.ContainerCatalogue;
|
||||
import forestry.mail.gui.GuiCatalogue;
|
||||
|
||||
public class ItemCatalogue extends ItemWithGui {
|
||||
@Override
|
||||
public Object getGui(EntityPlayer player, ItemStack heldItem, int data) {
|
||||
return new GuiCatalogue(player);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getContainer(EntityPlayer player, ItemStack heldItem, int data) {
|
||||
return new ContainerCatalogue(player);
|
||||
}
|
||||
}
|
||||
@@ -27,14 +27,15 @@ import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
import forestry.api.mail.ILetter;
|
||||
import forestry.core.items.ItemWithGui;
|
||||
import forestry.core.network.GuiId;
|
||||
import forestry.core.utils.StringUtil;
|
||||
import forestry.mail.Letter;
|
||||
import forestry.mail.LetterProperties;
|
||||
import forestry.mail.gui.ContainerLetter;
|
||||
import forestry.mail.gui.GuiLetter;
|
||||
import forestry.mail.inventory.ItemInventoryLetter;
|
||||
|
||||
public class ItemLetter extends ItemWithGui {
|
||||
public ItemLetter() {
|
||||
super(GuiId.LetterGUI);
|
||||
setMaxStackSize(64);
|
||||
}
|
||||
|
||||
@@ -86,4 +87,14 @@ public class ItemLetter extends ItemWithGui {
|
||||
public void getSubItems(Item item, CreativeTabs tab, List list) {
|
||||
LetterProperties.getSubItems(item, tab, list);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getGui(EntityPlayer player, ItemStack heldItem, int data) {
|
||||
return new GuiLetter(player, new ItemInventoryLetter(player, heldItem));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getContainer(EntityPlayer player, ItemStack heldItem, int data) {
|
||||
return new ContainerLetter(player, new ItemInventoryLetter(player, heldItem));
|
||||
}
|
||||
}
|
||||
@@ -11,17 +11,15 @@
|
||||
package forestry.mail.items;
|
||||
|
||||
import forestry.core.items.ItemRegistry;
|
||||
import forestry.core.items.ItemWithGui;
|
||||
import forestry.core.network.GuiId;
|
||||
|
||||
public class ItemRegistryMail extends ItemRegistry {
|
||||
public final ItemStamps stamps;
|
||||
public final ItemLetter letters;
|
||||
public final ItemWithGui catalogue;
|
||||
public final ItemCatalogue catalogue;
|
||||
|
||||
public ItemRegistryMail() {
|
||||
stamps = registerItem(new ItemStamps(), "stamps");
|
||||
letters = registerItem(new ItemLetter(), "letters");
|
||||
catalogue = registerItem(new ItemWithGui(GuiId.CatalogueGUI), "catalogue");
|
||||
catalogue = registerItem(new ItemCatalogue(), "catalogue");
|
||||
}
|
||||
}
|
||||
@@ -31,11 +31,12 @@ import forestry.api.mail.IMailAddress;
|
||||
import forestry.api.mail.IPostalState;
|
||||
import forestry.api.mail.PostManager;
|
||||
import forestry.core.inventory.InventoryAdapter;
|
||||
import forestry.core.network.GuiId;
|
||||
import forestry.core.tiles.TileBase;
|
||||
import forestry.mail.EnumDeliveryState;
|
||||
import forestry.mail.POBox;
|
||||
import forestry.mail.PostRegistry;
|
||||
import forestry.mail.gui.ContainerMailbox;
|
||||
import forestry.mail.gui.GuiMailbox;
|
||||
import forestry.mail.triggers.MailTriggers;
|
||||
|
||||
import buildcraft.api.statements.ITriggerExternal;
|
||||
@@ -45,7 +46,7 @@ public class TileMailbox extends TileBase implements IMailContainer {
|
||||
private boolean isLinked = false;
|
||||
|
||||
public TileMailbox() {
|
||||
super(GuiId.MailboxGUI, "mailbox");
|
||||
super("mailbox");
|
||||
setInternalInventory(new InventoryAdapter(POBox.SLOT_SIZE, "Letters").disableAutomation());
|
||||
}
|
||||
|
||||
@@ -125,4 +126,14 @@ public class TileMailbox extends TileBase implements IMailContainer {
|
||||
res.add(MailTriggers.triggerHasMail);
|
||||
return res;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getGui(EntityPlayer player, int data) {
|
||||
return new GuiMailbox(player.inventory, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getContainer(EntityPlayer player, int data) {
|
||||
return new ContainerMailbox(player.inventory, this);
|
||||
}
|
||||
}
|
||||
@@ -10,20 +10,22 @@
|
||||
******************************************************************************/
|
||||
package forestry.mail.tiles;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import forestry.api.mail.IStamps;
|
||||
import forestry.api.mail.PostManager;
|
||||
import forestry.core.inventory.IInventoryAdapter;
|
||||
import forestry.core.network.GuiId;
|
||||
import forestry.core.tiles.TileBase;
|
||||
import forestry.core.utils.InventoryUtil;
|
||||
import forestry.mail.gui.ContainerStampCollector;
|
||||
import forestry.mail.gui.GuiStampCollector;
|
||||
import forestry.mail.inventory.InventoryStampCollector;
|
||||
|
||||
public class TileStampCollector extends TileBase implements IInventory {
|
||||
public TileStampCollector() {
|
||||
super(GuiId.StampCollectorGUI, "philatelist");
|
||||
super("philatelist");
|
||||
setInternalInventory(new InventoryStampCollector(this));
|
||||
}
|
||||
|
||||
@@ -52,4 +54,14 @@ public class TileStampCollector extends TileBase implements IInventory {
|
||||
// Store it.
|
||||
InventoryUtil.stowInInventory(stamp, inventory, true, InventoryStampCollector.SLOT_BUFFER_1, InventoryStampCollector.SLOT_BUFFER_COUNT);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getGui(EntityPlayer player, int data) {
|
||||
return new GuiStampCollector(player.inventory, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getContainer(EntityPlayer player, int data) {
|
||||
return new ContainerStampCollector(player.inventory, this);
|
||||
}
|
||||
}
|
||||
@@ -30,6 +30,7 @@ import forestry.api.core.IErrorLogic;
|
||||
import forestry.api.mail.IMailAddress;
|
||||
import forestry.api.mail.IStamps;
|
||||
import forestry.api.mail.PostManager;
|
||||
import forestry.core.GuiHandler;
|
||||
import forestry.core.errors.EnumErrorCode;
|
||||
import forestry.core.inventory.IInventoryAdapter;
|
||||
import forestry.core.network.DataInputStreamForestry;
|
||||
@@ -40,6 +41,10 @@ import forestry.core.tiles.TileBase;
|
||||
import forestry.core.utils.ItemStackUtil;
|
||||
import forestry.mail.MailAddress;
|
||||
import forestry.mail.TradeStation;
|
||||
import forestry.mail.gui.ContainerTradeName;
|
||||
import forestry.mail.gui.ContainerTrader;
|
||||
import forestry.mail.gui.GuiTradeName;
|
||||
import forestry.mail.gui.GuiTrader;
|
||||
import forestry.mail.inventory.InventoryTradeStation;
|
||||
import forestry.mail.network.packets.PacketTraderAddressResponse;
|
||||
import forestry.mail.triggers.MailTriggers;
|
||||
@@ -51,18 +56,15 @@ public class TileTrader extends TileBase {
|
||||
private IMailAddress address;
|
||||
|
||||
public TileTrader() {
|
||||
super(GuiId.TraderGUI, "trade.station");
|
||||
super("trade.station");
|
||||
address = new MailAddress();
|
||||
setInternalInventory(new InventoryTradeStation());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void openGui(EntityPlayer player) {
|
||||
if (isLinked()) {
|
||||
super.openGui(player);
|
||||
} else {
|
||||
player.openGui(ForestryAPI.instance, GuiId.TraderNameGUI.ordinal(), worldObj, xCoord, yCoord, zCoord);
|
||||
}
|
||||
int data = isLinked() ? 0 : 1;
|
||||
player.openGui(ForestryAPI.instance, GuiHandler.encodeGuiData(GuiId.TileGui, data), worldObj, xCoord, yCoord, zCoord);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -328,4 +330,22 @@ public class TileTrader extends TileBase {
|
||||
res.add(MailTriggers.highBuffer75);
|
||||
return res;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getGui(EntityPlayer player, int data) {
|
||||
if (data == 0) {
|
||||
return new GuiTrader(player.inventory, this);
|
||||
} else {
|
||||
return new GuiTradeName(this);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getContainer(EntityPlayer player, int data) {
|
||||
if (data == 0) {
|
||||
return new ContainerTrader(player.inventory, this);
|
||||
} else {
|
||||
return new ContainerTradeName(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -20,7 +20,6 @@ import net.minecraft.world.chunk.IChunkProvider;
|
||||
import cpw.mods.fml.common.IFuelHandler;
|
||||
import cpw.mods.fml.common.event.FMLInterModComms.IMCMessage;
|
||||
|
||||
import forestry.core.GuiHandlerBase;
|
||||
import forestry.core.IPickupHandler;
|
||||
import forestry.core.IResupplyHandler;
|
||||
import forestry.core.ISaveEventHandler;
|
||||
@@ -96,10 +95,6 @@ public abstract class ForestryPlugin {
|
||||
Log.warning(invalidIMCMessageText);
|
||||
}
|
||||
|
||||
public GuiHandlerBase getGuiHandler() {
|
||||
return null;
|
||||
}
|
||||
|
||||
public ISaveEventHandler getSaveEventHandler() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -63,7 +63,6 @@ import forestry.api.recipes.RecipeManagers;
|
||||
import forestry.api.storage.ICrateRegistry;
|
||||
import forestry.api.storage.StorageManager;
|
||||
import forestry.apiculture.ArmorApiaristHelper;
|
||||
import forestry.apiculture.GuiHandlerApiculture;
|
||||
import forestry.apiculture.SaveEventHandlerApiculture;
|
||||
import forestry.apiculture.VillageHandlerApiculture;
|
||||
import forestry.apiculture.blocks.BlockAlveary;
|
||||
@@ -104,7 +103,6 @@ import forestry.apiculture.worldgen.HiveDecorator;
|
||||
import forestry.apiculture.worldgen.HiveDescription;
|
||||
import forestry.apiculture.worldgen.HiveGenHelper;
|
||||
import forestry.apiculture.worldgen.HiveRegistry;
|
||||
import forestry.core.GuiHandlerBase;
|
||||
import forestry.core.ISaveEventHandler;
|
||||
import forestry.core.blocks.BlockCoreType;
|
||||
import forestry.core.config.Config;
|
||||
@@ -385,11 +383,6 @@ public class PluginApiculture extends ForestryPlugin {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public GuiHandlerBase getGuiHandler() {
|
||||
return new GuiHandlerApiculture();
|
||||
}
|
||||
|
||||
@Override
|
||||
public IPacketRegistry getPacketRegistry() {
|
||||
return new PacketRegistryApiculture();
|
||||
|
||||
@@ -38,7 +38,6 @@ import forestry.api.genetics.AlleleManager;
|
||||
import forestry.api.recipes.RecipeManagers;
|
||||
import forestry.api.storage.ICrateRegistry;
|
||||
import forestry.api.storage.StorageManager;
|
||||
import forestry.arboriculture.GuiHandlerArboriculture;
|
||||
import forestry.arboriculture.VillageHandlerArboriculture;
|
||||
import forestry.arboriculture.WoodItemAccess;
|
||||
import forestry.arboriculture.blocks.BlockArboricultureType;
|
||||
@@ -61,7 +60,6 @@ import forestry.arboriculture.tiles.TileFruitPod;
|
||||
import forestry.arboriculture.tiles.TileLeaves;
|
||||
import forestry.arboriculture.tiles.TileSapling;
|
||||
import forestry.arboriculture.tiles.TileWood;
|
||||
import forestry.core.GuiHandlerBase;
|
||||
import forestry.core.blocks.BlockCoreType;
|
||||
import forestry.core.config.Config;
|
||||
import forestry.core.config.Constants;
|
||||
@@ -361,11 +359,6 @@ public class PluginArboriculture extends ForestryPlugin {
|
||||
AlleleManager.ersatzSaplings.put(new ItemStack(Blocks.sapling, 1, 5), TreeDefinition.DarkOak.getIndividual());
|
||||
}
|
||||
|
||||
@Override
|
||||
public GuiHandlerBase getGuiHandler() {
|
||||
return new GuiHandlerArboriculture();
|
||||
}
|
||||
|
||||
@Override
|
||||
public IFuelHandler getFuelHandler() {
|
||||
return new FuelHandler();
|
||||
|
||||
@@ -18,7 +18,6 @@ import net.minecraft.init.Items;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
import net.minecraftforge.oredict.RecipeSorter;
|
||||
|
||||
import cpw.mods.fml.common.IFuelHandler;
|
||||
|
||||
@@ -28,7 +27,6 @@ import forestry.api.genetics.AlleleManager;
|
||||
import forestry.api.multiblock.MultiblockManager;
|
||||
import forestry.api.storage.ICrateRegistry;
|
||||
import forestry.api.storage.StorageManager;
|
||||
import forestry.core.GuiHandlerBase;
|
||||
import forestry.core.IPickupHandler;
|
||||
import forestry.core.ISaveEventHandler;
|
||||
import forestry.core.PickupHandlerCore;
|
||||
@@ -56,7 +54,6 @@ import forestry.core.network.IPacketRegistry;
|
||||
import forestry.core.network.PacketRegistryCore;
|
||||
import forestry.core.proxy.Proxies;
|
||||
import forestry.core.recipes.RecipeUtil;
|
||||
import forestry.core.recipes.ShapedRecipeCustom;
|
||||
import forestry.core.tiles.MachineDefinition;
|
||||
import forestry.core.utils.ClimateUtil;
|
||||
import forestry.core.utils.ForestryModEnvWarningCallable;
|
||||
@@ -123,11 +120,6 @@ public class PluginCore extends ForestryPlugin {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public GuiHandlerBase getGuiHandler() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ISaveEventHandler getSaveEventHandler() {
|
||||
return new SaveEventHandlerCore();
|
||||
|
||||
@@ -16,10 +16,8 @@ import net.minecraft.init.Items;
|
||||
import cpw.mods.fml.common.SidedProxy;
|
||||
|
||||
import forestry.api.core.ForestryAPI;
|
||||
import forestry.core.GuiHandlerBase;
|
||||
import forestry.core.config.Constants;
|
||||
import forestry.core.recipes.RecipeUtil;
|
||||
import forestry.energy.GuiHandlerEnergy;
|
||||
import forestry.energy.blocks.BlockEngineType;
|
||||
import forestry.energy.blocks.BlockRegistryEnergy;
|
||||
import forestry.energy.proxy.ProxyEnergy;
|
||||
@@ -89,9 +87,4 @@ public class PluginEnergy extends ForestryPlugin {
|
||||
'V', Blocks.piston);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public GuiHandlerBase getGuiHandler() {
|
||||
return new GuiHandlerEnergy();
|
||||
}
|
||||
}
|
||||
@@ -32,7 +32,6 @@ import forestry.api.fuels.RainSubstrate;
|
||||
import forestry.api.recipes.ICraftingProvider;
|
||||
import forestry.api.recipes.RecipeManagers;
|
||||
import forestry.apiculture.items.ItemRegistryApiculture;
|
||||
import forestry.core.GuiHandlerBase;
|
||||
import forestry.core.blocks.BlockCoreType;
|
||||
import forestry.core.blocks.BlockSoil;
|
||||
import forestry.core.circuits.Circuit;
|
||||
@@ -53,7 +52,6 @@ import forestry.core.utils.ModUtil;
|
||||
import forestry.core.utils.datastructures.FluidMap;
|
||||
import forestry.core.utils.datastructures.ItemStackMap;
|
||||
import forestry.factory.DummyManagers;
|
||||
import forestry.factory.GuiHandlerFactory;
|
||||
import forestry.factory.blocks.BlockFactoryPlainType;
|
||||
import forestry.factory.blocks.BlockFactoryTesrType;
|
||||
import forestry.factory.blocks.BlockRegistryFactory;
|
||||
@@ -538,10 +536,4 @@ public class PluginFactory extends ForestryPlugin {
|
||||
'W', "craftingTableWood",
|
||||
'C', "chestWood");
|
||||
}
|
||||
|
||||
@Override
|
||||
public GuiHandlerBase getGuiHandler() {
|
||||
return new GuiHandlerFactory();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -33,15 +33,12 @@ import forestry.api.circuits.CircuitSocketType;
|
||||
import forestry.api.circuits.ICircuitLayout;
|
||||
import forestry.api.farming.Farmables;
|
||||
import forestry.api.farming.IFarmable;
|
||||
import forestry.core.GuiHandlerBase;
|
||||
import forestry.core.circuits.Circuit;
|
||||
import forestry.core.circuits.CircuitLayout;
|
||||
import forestry.core.config.Constants;
|
||||
import forestry.core.items.EnumElectronTube;
|
||||
import forestry.core.recipes.RecipeUtil;
|
||||
import forestry.core.recipes.ShapedRecipeCustom;
|
||||
import forestry.core.utils.Log;
|
||||
import forestry.farming.GuiHandlerFarming;
|
||||
import forestry.farming.blocks.BlockFarmType;
|
||||
import forestry.farming.blocks.BlockRegistryFarming;
|
||||
import forestry.farming.circuits.CircuitFarmLogic;
|
||||
@@ -270,11 +267,6 @@ public class PluginFarming extends ForestryPlugin {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public GuiHandlerBase getGuiHandler() {
|
||||
return new GuiHandlerFarming();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void registerRecipes() {
|
||||
|
||||
|
||||
@@ -16,13 +16,11 @@ import net.minecraft.item.ItemStack;
|
||||
import forestry.api.food.BeverageManager;
|
||||
import forestry.apiculture.items.EnumPollenCluster;
|
||||
import forestry.apiculture.items.ItemRegistryApiculture;
|
||||
import forestry.core.GuiHandlerBase;
|
||||
import forestry.core.config.Constants;
|
||||
import forestry.core.fluids.Fluids;
|
||||
import forestry.core.fluids.LiquidRegistryHelper;
|
||||
import forestry.core.recipes.RecipeUtil;
|
||||
import forestry.food.BeverageEffect;
|
||||
import forestry.food.GuiHandlerFood;
|
||||
import forestry.food.InfuserIngredientManager;
|
||||
import forestry.food.InfuserMixtureManager;
|
||||
import forestry.food.items.EnumBeverage;
|
||||
@@ -73,9 +71,4 @@ public class PluginFood extends ForestryPlugin {
|
||||
'#', "ingotIron",
|
||||
'X', "ingotBronze");
|
||||
}
|
||||
|
||||
@Override
|
||||
public GuiHandlerBase getGuiHandler() {
|
||||
return new GuiHandlerFood();
|
||||
}
|
||||
}
|
||||
@@ -26,7 +26,6 @@ import forestry.api.arboriculture.TreeManager;
|
||||
import forestry.api.genetics.AlleleManager;
|
||||
import forestry.api.lepidopterology.ButterflyManager;
|
||||
import forestry.api.recipes.RecipeManagers;
|
||||
import forestry.core.GuiHandlerBase;
|
||||
import forestry.core.config.Constants;
|
||||
import forestry.core.config.LocalizedConfiguration;
|
||||
import forestry.core.fluids.Fluids;
|
||||
@@ -34,7 +33,6 @@ import forestry.core.recipes.RecipeUtil;
|
||||
import forestry.core.tiles.MachineDefinition;
|
||||
import forestry.core.utils.EntityUtil;
|
||||
import forestry.lepidopterology.ButterflySpawner;
|
||||
import forestry.lepidopterology.GuiHandlerLepidopterology;
|
||||
import forestry.lepidopterology.blocks.BlockLepidopterologyType;
|
||||
import forestry.lepidopterology.blocks.BlockRegistryLepidopterology;
|
||||
import forestry.lepidopterology.commands.CommandButterfly;
|
||||
@@ -143,11 +141,6 @@ public class PluginLepidopterology extends ForestryPlugin {
|
||||
'Y', "chestWood");
|
||||
}
|
||||
|
||||
@Override
|
||||
public GuiHandlerBase getGuiHandler() {
|
||||
return new GuiHandlerLepidopterology();
|
||||
}
|
||||
|
||||
public static boolean isPollinationAllowed() {
|
||||
return allowPollination;
|
||||
}
|
||||
|
||||
@@ -19,7 +19,6 @@ import forestry.api.mail.EnumAddressee;
|
||||
import forestry.api.mail.PostManager;
|
||||
import forestry.api.recipes.RecipeManagers;
|
||||
import forestry.apiculture.items.ItemRegistryApiculture;
|
||||
import forestry.core.GuiHandlerBase;
|
||||
import forestry.core.ISaveEventHandler;
|
||||
import forestry.core.circuits.EnumCircuitBoardType;
|
||||
import forestry.core.config.Config;
|
||||
@@ -29,7 +28,6 @@ import forestry.core.items.EnumElectronTube;
|
||||
import forestry.core.network.IPacketRegistry;
|
||||
import forestry.core.recipes.RecipeUtil;
|
||||
import forestry.core.tiles.MachineDefinition;
|
||||
import forestry.mail.GuiHandlerMail;
|
||||
import forestry.mail.PostRegistry;
|
||||
import forestry.mail.PostalCarrier;
|
||||
import forestry.mail.SaveEventHandlerMail;
|
||||
@@ -91,11 +89,6 @@ public class PluginMail extends ForestryPlugin {
|
||||
blocks.mail.init();
|
||||
}
|
||||
|
||||
@Override
|
||||
public GuiHandlerBase getGuiHandler() {
|
||||
return new GuiHandlerMail();
|
||||
}
|
||||
|
||||
@Override
|
||||
public IPacketRegistry getPacketRegistry() {
|
||||
return new PacketRegistryMail();
|
||||
|
||||
@@ -38,7 +38,6 @@ import cpw.mods.fml.common.registry.GameRegistry;
|
||||
|
||||
import forestry.Forestry;
|
||||
import forestry.api.core.ForestryAPI;
|
||||
import forestry.core.GuiHandlerBase;
|
||||
import forestry.core.IPickupHandler;
|
||||
import forestry.core.IResupplyHandler;
|
||||
import forestry.core.ISaveEventHandler;
|
||||
@@ -67,7 +66,6 @@ public class PluginManager {
|
||||
private static final String MODULE_CONFIG_FILE_NAME = "modules.cfg";
|
||||
private static final String CATEGORY_MODULES = "modules";
|
||||
|
||||
public static final ArrayList<GuiHandlerBase> guiHandlers = Lists.newArrayList();
|
||||
public static final ArrayList<IPickupHandler> pickupHandlers = Lists.newArrayList();
|
||||
public static final ArrayList<ISaveEventHandler> saveEventHandlers = Lists.newArrayList();
|
||||
public static final ArrayList<IResupplyHandler> resupplyHandlers = Lists.newArrayList();
|
||||
@@ -167,11 +165,6 @@ public class PluginManager {
|
||||
private static void registerHandlers(ForestryPlugin plugin) {
|
||||
Log.fine("Registering Handlers for Plugin: {0}", plugin);
|
||||
|
||||
GuiHandlerBase guiHandler = plugin.getGuiHandler();
|
||||
if (guiHandler != null) {
|
||||
guiHandlers.add(guiHandler);
|
||||
}
|
||||
|
||||
plugin.getPacketRegistry().registerPackets();
|
||||
|
||||
IPickupHandler pickupHandler = plugin.getPickupHandler();
|
||||
|
||||
@@ -56,7 +56,6 @@ import forestry.api.storage.BackpackManager;
|
||||
import forestry.api.storage.IBackpackDefinition;
|
||||
import forestry.api.storage.StorageManager;
|
||||
import forestry.apiculture.blocks.BlockRegistryApiculture;
|
||||
import forestry.core.GuiHandlerBase;
|
||||
import forestry.core.IPickupHandler;
|
||||
import forestry.core.IResupplyHandler;
|
||||
import forestry.core.config.Constants;
|
||||
@@ -74,7 +73,6 @@ import forestry.storage.BackpackDefinition.BackpackDefinitionApiarist;
|
||||
import forestry.storage.BackpackDefinition.BackpackDefinitionLepidopterist;
|
||||
import forestry.storage.BackpackInterface;
|
||||
import forestry.storage.CrateRegistry;
|
||||
import forestry.storage.GuiHandlerStorage;
|
||||
import forestry.storage.PickupHandlerStorage;
|
||||
import forestry.storage.ResupplyHandler;
|
||||
import forestry.storage.items.ItemRegistryStorage;
|
||||
@@ -486,11 +484,6 @@ public class PluginStorage extends ForestryPlugin {
|
||||
return new PickupHandlerStorage();
|
||||
}
|
||||
|
||||
@Override
|
||||
public GuiHandlerBase getGuiHandler() {
|
||||
return new GuiHandlerStorage();
|
||||
}
|
||||
|
||||
@Override
|
||||
public IResupplyHandler getResupplyHandler() {
|
||||
return new ResupplyHandler();
|
||||
|
||||
@@ -10,30 +10,18 @@
|
||||
******************************************************************************/
|
||||
package forestry.storage;
|
||||
|
||||
import java.util.EnumMap;
|
||||
|
||||
import net.minecraft.item.Item;
|
||||
|
||||
import forestry.api.storage.BackpackManager;
|
||||
import forestry.api.storage.EnumBackpackType;
|
||||
import forestry.api.storage.IBackpackDefinition;
|
||||
import forestry.api.storage.IBackpackInterface;
|
||||
import forestry.core.network.GuiId;
|
||||
import forestry.storage.items.ItemBackpack;
|
||||
|
||||
public class BackpackInterface implements IBackpackInterface {
|
||||
|
||||
private static final EnumMap<EnumBackpackType, GuiId> guiIds = new EnumMap<>(EnumBackpackType.class);
|
||||
|
||||
static {
|
||||
guiIds.put(EnumBackpackType.T1, GuiId.BackpackGUI);
|
||||
guiIds.put(EnumBackpackType.T2, GuiId.BackpackT2GUI);
|
||||
guiIds.put(EnumBackpackType.APIARIST, GuiId.ApiaristBackpackGUI);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item addBackpack(IBackpackDefinition definition, EnumBackpackType type) {
|
||||
BackpackManager.definitions.put(definition.getKey(), definition);
|
||||
return new ItemBackpack(guiIds.get(type), definition, type);
|
||||
return new ItemBackpack(definition, type);
|
||||
}
|
||||
}
|
||||
@@ -1,142 +0,0 @@
|
||||
/*******************************************************************************
|
||||
* 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.storage;
|
||||
|
||||
import net.minecraft.client.gui.Gui;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.Container;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
import forestry.api.apiculture.BeeManager;
|
||||
import forestry.api.genetics.ISpeciesRoot;
|
||||
import forestry.api.lepidopterology.ButterflyManager;
|
||||
import forestry.core.GuiHandlerBase;
|
||||
import forestry.core.config.Constants;
|
||||
import forestry.core.gui.GuiNaturalistInventory;
|
||||
import forestry.core.network.GuiId;
|
||||
import forestry.storage.gui.ContainerBackpack;
|
||||
import forestry.storage.gui.ContainerNaturalistBackpack;
|
||||
import forestry.storage.gui.GuiBackpack;
|
||||
import forestry.storage.gui.GuiBackpackT2;
|
||||
import forestry.storage.inventory.ItemInventoryBackpackPaged;
|
||||
import forestry.storage.items.ItemBackpack;
|
||||
|
||||
public class GuiHandlerStorage extends GuiHandlerBase {
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public Gui getClientGuiElement(int id, EntityPlayer player, World world, int x, int y, int z) {
|
||||
int cleanId = decodeGuiID(id);
|
||||
int guiData = decodeGuiData(id);
|
||||
|
||||
if (cleanId >= GuiId.values().length) {
|
||||
return null;
|
||||
}
|
||||
|
||||
GuiId guiId = GuiId.values()[cleanId];
|
||||
|
||||
ItemStack equipped;
|
||||
switch (guiId) {
|
||||
case ApiaristBackpackGUI:
|
||||
return getNaturalistGui(BeeManager.beeRoot, player, guiId, guiData);
|
||||
|
||||
case LepidopteristBackpackGUI:
|
||||
return getNaturalistGui(ButterflyManager.butterflyRoot, player, guiId, guiData);
|
||||
|
||||
case BackpackGUI:
|
||||
equipped = getBackpackItem(player);
|
||||
if (equipped == null) {
|
||||
return null;
|
||||
}
|
||||
return new GuiBackpack(new ContainerBackpack(player, ContainerBackpack.Size.DEFAULT, equipped));
|
||||
|
||||
case BackpackT2GUI:
|
||||
equipped = getBackpackItem(player);
|
||||
if (equipped == null) {
|
||||
return null;
|
||||
}
|
||||
return new GuiBackpackT2(new ContainerBackpack(player, ContainerBackpack.Size.T2, equipped));
|
||||
|
||||
default:
|
||||
return null;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
private static Gui getNaturalistGui(ISpeciesRoot root, EntityPlayer player, GuiId guiId, int guiData) {
|
||||
ItemStack equipped = getBackpackItem(player);
|
||||
if (equipped == null) {
|
||||
return null;
|
||||
}
|
||||
ItemInventoryBackpackPaged inventory = new ItemInventoryBackpackPaged(player, Constants.SLOTS_BACKPACK_APIARIST, equipped, guiId);
|
||||
ContainerNaturalistBackpack container = new ContainerNaturalistBackpack(player, inventory, guiData);
|
||||
return new GuiNaturalistInventory(root, player, container, inventory, guiData, 5);
|
||||
}
|
||||
|
||||
private static ItemStack getBackpackItem(EntityPlayer player) {
|
||||
ItemStack equipped = player.getCurrentEquippedItem();
|
||||
if (equipped == null) {
|
||||
return null;
|
||||
}
|
||||
if (equipped.getItem() instanceof ItemBackpack) {
|
||||
return equipped;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Container getServerGuiElement(int id, EntityPlayer player, World world, int x, int y, int z) {
|
||||
int cleanId = decodeGuiID(id);
|
||||
int guiData = decodeGuiData(id);
|
||||
GuiId guiId = GuiId.values()[cleanId];
|
||||
|
||||
if (cleanId >= GuiId.values().length) {
|
||||
return null;
|
||||
}
|
||||
|
||||
ItemStack equipped;
|
||||
switch (guiId) {
|
||||
case ApiaristBackpackGUI:
|
||||
case LepidopteristBackpackGUI:
|
||||
equipped = getBackpackItem(player);
|
||||
if (equipped == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
ItemInventoryBackpackPaged inventory = new ItemInventoryBackpackPaged(player, Constants.SLOTS_BACKPACK_APIARIST, equipped, guiId);
|
||||
return new ContainerNaturalistBackpack(player, inventory, guiData);
|
||||
|
||||
case BackpackGUI:
|
||||
equipped = getBackpackItem(player);
|
||||
if (equipped == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return new ContainerBackpack(player, ContainerBackpack.Size.DEFAULT, equipped);
|
||||
|
||||
case BackpackT2GUI:
|
||||
equipped = getBackpackItem(player);
|
||||
if (equipped == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return new ContainerBackpack(player, ContainerBackpack.Size.T2, equipped);
|
||||
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -14,20 +14,17 @@ import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import forestry.api.core.ForestryAPI;
|
||||
import forestry.core.GuiHandlerBase;
|
||||
import forestry.core.GuiHandler;
|
||||
import forestry.core.gui.IPagedInventory;
|
||||
import forestry.core.network.GuiId;
|
||||
|
||||
public class ItemInventoryBackpackPaged extends ItemInventoryBackpack implements IPagedInventory {
|
||||
private final GuiId guiId;
|
||||
|
||||
public ItemInventoryBackpackPaged(EntityPlayer player, int size, ItemStack itemstack, GuiId guiId) {
|
||||
public ItemInventoryBackpackPaged(EntityPlayer player, int size, ItemStack itemstack) {
|
||||
super(player, size, itemstack);
|
||||
this.guiId = guiId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void flipPage(EntityPlayer player, int page) {
|
||||
player.openGui(ForestryAPI.instance, GuiHandlerBase.encodeGuiData(guiId, page), player.worldObj, (int) player.posX, (int) player.posY, (int) player.posZ);
|
||||
player.openGui(ForestryAPI.instance, GuiHandler.encodeGuiData(GuiId.ItemGui, page), player.worldObj, (int) player.posX, (int) player.posY, (int) player.posZ);
|
||||
}
|
||||
}
|
||||
@@ -28,9 +28,11 @@ import cpw.mods.fml.common.eventhandler.Event;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
import forestry.api.core.ForestryAPI;
|
||||
import forestry.api.storage.BackpackStowEvent;
|
||||
import forestry.api.storage.EnumBackpackType;
|
||||
import forestry.api.storage.IBackpackDefinition;
|
||||
import forestry.core.GuiHandler;
|
||||
import forestry.core.config.Config;
|
||||
import forestry.core.config.Constants;
|
||||
import forestry.core.inventory.ItemInventory;
|
||||
@@ -43,14 +45,16 @@ import forestry.core.tiles.TileUtil;
|
||||
import forestry.core.utils.InventoryUtil;
|
||||
import forestry.core.utils.StringUtil;
|
||||
import forestry.storage.BackpackMode;
|
||||
import forestry.storage.gui.ContainerBackpack;
|
||||
import forestry.storage.gui.GuiBackpack;
|
||||
import forestry.storage.gui.GuiBackpackT2;
|
||||
import forestry.storage.inventory.ItemInventoryBackpack;
|
||||
|
||||
public class ItemBackpack extends ItemWithGui {
|
||||
private final IBackpackDefinition definition;
|
||||
private final EnumBackpackType type;
|
||||
|
||||
public ItemBackpack(GuiId guiId, IBackpackDefinition definition, EnumBackpackType type) {
|
||||
super(guiId);
|
||||
public ItemBackpack(IBackpackDefinition definition, EnumBackpackType type) {
|
||||
this.definition = definition;
|
||||
this.type = type;
|
||||
}
|
||||
@@ -59,15 +63,16 @@ public class ItemBackpack extends ItemWithGui {
|
||||
return definition;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return true if the item's stackTagCompound needs to be synchronized over
|
||||
* SMP.
|
||||
*/
|
||||
@Override
|
||||
public boolean getShareTag() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void openGui(World world, EntityPlayer entityplayer) {
|
||||
entityplayer.openGui(ForestryAPI.instance, GuiHandler.encodeGuiData(GuiId.ItemGui, type.ordinal()), world, (int) entityplayer.posX, (int) entityplayer.posY, (int) entityplayer.posZ);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack onItemRightClick(ItemStack itemstack, World world, EntityPlayer player) {
|
||||
if (!world.isRemote) {
|
||||
@@ -313,4 +318,34 @@ public class ItemBackpack extends ItemWithGui {
|
||||
return BackpackMode.NORMAL;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getGui(EntityPlayer player, ItemStack heldItem, int data) {
|
||||
if (data > EnumBackpackType.values().length) {
|
||||
return null;
|
||||
}
|
||||
EnumBackpackType type = EnumBackpackType.values()[data];
|
||||
switch (type) {
|
||||
case T1:
|
||||
return new GuiBackpack(new ContainerBackpack(player, ContainerBackpack.Size.DEFAULT, heldItem));
|
||||
case T2:
|
||||
return new GuiBackpackT2(new ContainerBackpack(player, ContainerBackpack.Size.T2, heldItem));
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getContainer(EntityPlayer player, ItemStack heldItem, int data) {
|
||||
if (data > EnumBackpackType.values().length) {
|
||||
return null;
|
||||
}
|
||||
EnumBackpackType type = EnumBackpackType.values()[data];
|
||||
switch (type) {
|
||||
case T1:
|
||||
return new ContainerBackpack(player, ContainerBackpack.Size.DEFAULT, heldItem);
|
||||
case T2:
|
||||
return new ContainerBackpack(player, ContainerBackpack.Size.T2, heldItem);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
/*******************************************************************************
|
||||
* 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.storage.items;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import forestry.api.core.ForestryAPI;
|
||||
import forestry.api.genetics.ISpeciesRoot;
|
||||
import forestry.api.storage.EnumBackpackType;
|
||||
import forestry.api.storage.IBackpackDefinition;
|
||||
import forestry.core.config.Constants;
|
||||
import forestry.core.gui.GuiNaturalistInventory;
|
||||
import forestry.core.network.GuiId;
|
||||
import forestry.storage.gui.ContainerNaturalistBackpack;
|
||||
import forestry.storage.inventory.ItemInventoryBackpackPaged;
|
||||
|
||||
public class ItemBackpackNaturalist extends ItemBackpack {
|
||||
private final ISpeciesRoot speciesRoot;
|
||||
|
||||
public ItemBackpackNaturalist(ISpeciesRoot speciesRoot, IBackpackDefinition definition, EnumBackpackType type) {
|
||||
super(definition, type);
|
||||
this.speciesRoot = speciesRoot;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void openGui(World world, EntityPlayer entityplayer) {
|
||||
entityplayer.openGui(ForestryAPI.instance, GuiId.ItemGui.ordinal(), world, (int) entityplayer.posX, (int) entityplayer.posY, (int) entityplayer.posZ);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getGui(EntityPlayer player, ItemStack heldItem, int page) {
|
||||
ItemInventoryBackpackPaged inventory = new ItemInventoryBackpackPaged(player, Constants.SLOTS_BACKPACK_APIARIST, heldItem);
|
||||
ContainerNaturalistBackpack container = new ContainerNaturalistBackpack(player, inventory, page);
|
||||
return new GuiNaturalistInventory(speciesRoot, player, container, inventory, page, 5);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getContainer(EntityPlayer player, ItemStack heldItem, int page) {
|
||||
ItemInventoryBackpackPaged inventory = new ItemInventoryBackpackPaged(player, Constants.SLOTS_BACKPACK_APIARIST, heldItem);
|
||||
return new ContainerNaturalistBackpack(player, inventory, page);
|
||||
}
|
||||
}
|
||||
@@ -12,19 +12,20 @@ package forestry.storage.items;
|
||||
|
||||
import net.minecraft.item.Item;
|
||||
|
||||
import forestry.api.apiculture.BeeManager;
|
||||
import forestry.api.core.Tabs;
|
||||
import forestry.api.lepidopterology.ButterflyManager;
|
||||
import forestry.api.storage.BackpackManager;
|
||||
import forestry.api.storage.EnumBackpackType;
|
||||
import forestry.api.storage.IBackpackDefinition;
|
||||
import forestry.core.items.ItemCrated;
|
||||
import forestry.core.items.ItemRegistry;
|
||||
import forestry.core.network.GuiId;
|
||||
import forestry.plugins.PluginManager;
|
||||
|
||||
public class ItemRegistryStorage extends ItemRegistry {
|
||||
public final ItemCrated crate;
|
||||
public final ItemBackpack apiaristBackpack;
|
||||
public final ItemBackpack lepidopteristBackpack;
|
||||
public final ItemBackpackNaturalist apiaristBackpack;
|
||||
public final ItemBackpackNaturalist lepidopteristBackpack;
|
||||
public final Item minerBackpack;
|
||||
public final Item minerBackpackT2;
|
||||
public final Item diggerBackpack;
|
||||
@@ -47,7 +48,7 @@ public class ItemRegistryStorage extends ItemRegistry {
|
||||
|
||||
if (PluginManager.Module.APICULTURE.isEnabled()) {
|
||||
definition = BackpackManager.definitions.get("apiarist");
|
||||
apiaristBackpack = new ItemBackpack(GuiId.ApiaristBackpackGUI, definition, EnumBackpackType.APIARIST);
|
||||
apiaristBackpack = new ItemBackpackNaturalist(BeeManager.beeRoot, definition, EnumBackpackType.APIARIST);
|
||||
apiaristBackpack.setCreativeTab(Tabs.tabApiculture);
|
||||
registerItem(apiaristBackpack, "apiaristBag");
|
||||
} else {
|
||||
@@ -56,7 +57,7 @@ public class ItemRegistryStorage extends ItemRegistry {
|
||||
|
||||
if (PluginManager.Module.LEPIDOPTEROLOGY.isEnabled()) {
|
||||
definition = BackpackManager.definitions.get("lepidopterist");
|
||||
lepidopteristBackpack = new ItemBackpack(GuiId.LepidopteristBackpackGUI, definition, EnumBackpackType.APIARIST);
|
||||
lepidopteristBackpack = new ItemBackpackNaturalist(ButterflyManager.butterflyRoot, definition, EnumBackpackType.APIARIST);
|
||||
lepidopteristBackpack.setCreativeTab(Tabs.tabLepidopterology);
|
||||
registerItem(lepidopteristBackpack, "lepidopteristBag");
|
||||
} else {
|
||||
|
||||
Reference in new issue
Block a user