/******************************************************************************* * 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.tiles; import javax.annotation.Nonnull; import java.util.ArrayList; import java.util.Collection; import java.util.Collections; import java.util.List; import net.minecraft.entity.player.EntityPlayer; import forestry.api.apiculture.IBeeHousingInventory; import forestry.api.apiculture.IBeeListener; import forestry.api.apiculture.IBeeModifier; 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; public class TileApiary extends TileBeeHousingBase implements IApiary { @Nonnull private final IBeeModifier beeModifier = new ApiaryBeeModifier(); @Nonnull private final IBeeListener beeListener = new ApiaryBeeListener(this); @Nonnull private final InventoryApiary inventory = new InventoryApiary(); public TileApiary() { super("apiary"); setInternalInventory(inventory); } @Nonnull @Override public IBeeHousingInventory getBeeInventory() { return inventory; } @Override public IApiaryInventory getApiaryInventory() { return inventory; } @Override public Collection getBeeModifiers() { List beeModifiers = new ArrayList<>(); beeModifiers.add(beeModifier); for (IHiveFrame frame : inventory.getFrames()) { beeModifiers.add(frame.getBeeModifier()); } return beeModifiers; } @Override public Iterable getBeeListeners() { return Collections.singleton(beeListener); } /* ITRIGGERPROVIDER */ // TODO: buildcraft for 1.9 // @Optional.Method(modid = "BuildCraftAPI|statements") // @Override // public Collection getExternalTriggers(EnumFacing side, TileEntity tile) { // LinkedList res = new LinkedList<>(); // res.add(ApicultureTriggers.missingQueen); // res.add(ApicultureTriggers.missingDrone); // 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) { return new ContainerBeeHousing(player.inventory, this, true); } }