diff options
author | Draknyte1 <Draknyte1@hotmail.com> | 2017-08-24 21:37:17 +1000 |
---|---|---|
committer | Draknyte1 <Draknyte1@hotmail.com> | 2017-08-24 21:37:17 +1000 |
commit | 20a08beaa60e449d0e11583e4871205ac215f534 (patch) | |
tree | f97ae1fd0903c3545e2a07bdc59ad802dcab1075 /src/Java/gtPlusPlus/xmod/forestry/bees | |
parent | 53fae197e09ad256e7ad66331f8f82a3469b28d7 (diff) | |
download | GT5-Unofficial-20a08beaa60e449d0e11583e4871205ac215f534.tar.gz GT5-Unofficial-20a08beaa60e449d0e11583e4871205ac215f534.tar.bz2 GT5-Unofficial-20a08beaa60e449d0e11583e4871205ac215f534.zip |
- Removed the broken custom Alveary blocks.
Diffstat (limited to 'src/Java/gtPlusPlus/xmod/forestry/bees')
12 files changed, 0 insertions, 1203 deletions
diff --git a/src/Java/gtPlusPlus/xmod/forestry/bees/alveary/AlvearyBeeListener.java b/src/Java/gtPlusPlus/xmod/forestry/bees/alveary/AlvearyBeeListener.java deleted file mode 100644 index 039c80fe00..0000000000 --- a/src/Java/gtPlusPlus/xmod/forestry/bees/alveary/AlvearyBeeListener.java +++ /dev/null @@ -1,18 +0,0 @@ -package gtPlusPlus.xmod.forestry.bees.alveary; - -import forestry.api.apiculture.DefaultBeeListener; -import gtPlusPlus.xmod.forestry.bees.alveary.gui.InventoryFrameHousing; - -public class AlvearyBeeListener extends DefaultBeeListener { - private final IAlvearyFrameHousing apiary; - - public AlvearyBeeListener(final IAlvearyFrameHousing apiary) { - this.apiary = apiary; - } - - @Override - public void wearOutEquipment(final int amount) { - final InventoryFrameHousing apiaryInventory = this.apiary.getAlvearyInventory(); - apiaryInventory.wearOutFrames(this.apiary, amount); - } -} diff --git a/src/Java/gtPlusPlus/xmod/forestry/bees/alveary/AlvearyHandler.java b/src/Java/gtPlusPlus/xmod/forestry/bees/alveary/AlvearyHandler.java deleted file mode 100644 index ab093645b6..0000000000 --- a/src/Java/gtPlusPlus/xmod/forestry/bees/alveary/AlvearyHandler.java +++ /dev/null @@ -1,31 +0,0 @@ -package gtPlusPlus.xmod.forestry.bees.alveary; - -import cpw.mods.fml.common.Optional; -import cpw.mods.fml.common.registry.GameRegistry; -import forestry.core.items.ItemBlockForestry; -import forestry.core.utils.StringUtil; -import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.core.lib.LoadedMods; -import net.minecraft.block.Block; -import net.minecraft.item.ItemBlock; - -public class AlvearyHandler { - - @Optional.Method(modid = "Forestry") - public static void run(){ - if (!LoadedMods.ExtraBees){ - if (CORE.configSwitches.enableCustomAlvearyBlocks){//Alveary Stuff - FR_BlockAlveary alveary; - alveary = registerBlock(new FR_BlockAlveary(), ItemBlockForestry.class, "alveary"); - GameRegistry.registerTileEntity(TileAlvearyFrameHousing.class, "FrameHousing"); - } - } - } - - protected static <T extends Block> T registerBlock(final T block, final Class<? extends ItemBlock> itemClass, final String name, final Object... itemCtorArgs) { - block.setBlockName("for." + name); - GameRegistry.registerBlock(block, itemClass, StringUtil.cleanBlockName(block), itemCtorArgs); - return block; - } - -} diff --git a/src/Java/gtPlusPlus/xmod/forestry/bees/alveary/FR_AlvearyFrameBlock.java b/src/Java/gtPlusPlus/xmod/forestry/bees/alveary/FR_AlvearyFrameBlock.java deleted file mode 100644 index 06162f7dc1..0000000000 --- a/src/Java/gtPlusPlus/xmod/forestry/bees/alveary/FR_AlvearyFrameBlock.java +++ /dev/null @@ -1,41 +0,0 @@ -package gtPlusPlus.xmod.forestry.bees.alveary; - -import com.mojang.authlib.GameProfile; - -import forestry.api.multiblock.*; -import net.minecraft.util.ChunkCoordinates; - -public class FR_AlvearyFrameBlock implements IAlvearyComponent, IMultiblockComponent{ - - @Override - public ChunkCoordinates getCoordinates() { - // TODO Auto-generated method stub - return null; - } - - @Override - public GameProfile getOwner() { - // TODO Auto-generated method stub - return null; - } - - @Override - public void onMachineAssembled(final IMultiblockController arg0, - final ChunkCoordinates arg1, final ChunkCoordinates arg2) { - // TODO Auto-generated method stub - - } - - @Override - public void onMachineBroken() { - // TODO Auto-generated method stub - - } - - @Override - public IMultiblockLogicAlveary getMultiblockLogic() { - // TODO Auto-generated method stub - return null; - } - -} diff --git a/src/Java/gtPlusPlus/xmod/forestry/bees/alveary/FR_BlockAlveary.java b/src/Java/gtPlusPlus/xmod/forestry/bees/alveary/FR_BlockAlveary.java deleted file mode 100644 index cd74ec0e81..0000000000 --- a/src/Java/gtPlusPlus/xmod/forestry/bees/alveary/FR_BlockAlveary.java +++ /dev/null @@ -1,276 +0,0 @@ -package gtPlusPlus.xmod.forestry.bees.alveary; - -import java.util.ArrayList; -import java.util.List; - -import cpw.mods.fml.common.registry.LanguageRegistry; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -import forestry.apiculture.MaterialBeehive; -import forestry.apiculture.multiblock.TileAlvearyPlain; -import forestry.core.blocks.BlockForestry; -import forestry.core.render.TextureManager; -import gtPlusPlus.GTplusplus; -import gtPlusPlus.core.creative.AddToCreativeTab; -import net.minecraft.block.Block; -import net.minecraft.client.renderer.texture.IIconRegister; -import net.minecraft.creativetab.CreativeTabs; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.IIcon; -import net.minecraft.world.IBlockAccess; -import net.minecraft.world.World; - -public class FR_BlockAlveary extends BlockForestry -{ - - public static enum Type - { - PLAIN, - ERROR, - FRAME, - MUTATOR, - - //Placeholder Values - HEATER, HYGRO, STABILIZER, SIEVE; - - public static final Type[] VALUES = values(); - - private Type() {} - } - - public FR_BlockAlveary() - { - super(new MaterialBeehive(false)); - this.setHardness(1.0F); - this.setCreativeTab(AddToCreativeTab.tabBlock); - this.setHarvestLevel("axe", 0); - - } - - @Override - public boolean onBlockActivated(final World world, final int x, final int y, final int z, final EntityPlayer player, final int side, final float lx, final float ly, final float lz) - { - if (world.isRemote) { - return true; - } - - final TileEntity te = world.getTileEntity(x, y, z); - if ((te != null) && (te instanceof TileAlvearyFrameHousing)) - { - player.openGui(GTplusplus.instance, 0, world, x, y, z); - return true; - } - /*else if (te != null && te instanceof TileAlvearyFrameHousing) - { - player.openGui(GTplusplus.instance, 0, world, x, y, z); - return true; - }*/ - return false; - } - - @Override - @SideOnly(Side.CLIENT) - public void getSubBlocks(final Item item, final CreativeTabs tab, final List list) - { - for (int i = 0; i < 4; i++) { - if ((i != 1) && (i != 0)) { - list.add(new ItemStack(item, 1, i)); - } - } - } - - @Override - public int getRenderType() - { - return 0; - } - - @Override - public boolean renderAsNormalBlock() - { - return true; - } - - @Override - public ArrayList<ItemStack> getDrops(final World world, final int x, final int y, final int z, final int metadata, final int fortune) - { - final ArrayList<ItemStack> drop = new ArrayList<>(); - drop.add(new ItemStack(this, 1, metadata != 1 ? metadata : 0)); - return drop; - } - - @Override - public int getDamageValue(final World world, final int x, final int y, final int z) - { - final int meta = world.getBlockMetadata(x, y, z); - return meta != 1 ? meta : 0; - } - - @Override - public TileEntity createTileEntity(final World world, final int metadata) - { - if ((metadata < 0) || (metadata > Type.VALUES.length)) { - return null; - } - - - - final Type type = Type.VALUES[metadata]; - switch (type) - { - case FRAME: - LanguageRegistry.addName(this, "Alveary Frame Housing"); - case MUTATOR: - LanguageRegistry.addName(this, "Alveary Mutator Block"); - case ERROR: - LanguageRegistry.addName(this, "Invalid Alveary Block"); - default: - LanguageRegistry.addName(this, "Unnamed Alveary Block"); - } - switch (type) - { - case FRAME: - return new TileAlvearyFrameHousing(); - case MUTATOR: - return new TileAlvearyPlain(); - case ERROR: - return new TileAlvearyPlain(); - default: - return new TileAlvearyPlain(); - } - } - - @Override - public Block setBlockName(final String name) { - //int meta = this. - return super.setBlockName(name); - } - - @Override - public TileEntity createNewTileEntity(final World world, final int meta) - { - return this.createTileEntity(world, meta); - } - - /* ICONS */ - public static final int PLAIN = 0; - public static final int ENTRANCE = 1; - public static final int BOTTOM = 2; - public static final int LEFT = 3; - public static final int RIGHT = 4; - public static final int ALVEARY_FRAME_OFF = 5; - public static final int ALVEARY_FRAME_ON = 6; - public static final int ALVEARY_MUTATOR_OFF = 7; - public static final int ALVEARY_MUTATOR_ON = 8; - @SideOnly(Side.CLIENT) - private IIcon[] icons; - @SideOnly(Side.CLIENT) - @Override - public void registerBlockIcons(final IIconRegister register) { - this.icons = new IIcon[9]; - this.icons[0] = TextureManager.registerTex(register, "apiculture/alveary.plain"); - this.icons[1] = TextureManager.registerTex(register, "apiculture/alveary.entrance"); - this.icons[2] = TextureManager.registerTex(register, "apiculture/alveary.bottom"); - this.icons[3] = TextureManager.registerTex(register, "apiculture/alveary.left"); - this.icons[4] = TextureManager.registerTex(register, "apiculture/alveary.right"); - this.icons[5] = TextureManager.registerTex(register, "apiculture/alveary.framehousing.off"); - this.icons[6] = TextureManager.registerTex(register, "apiculture/alveary.framehousing.on"); - this.icons[7] = TextureManager.registerTex(register, "apiculture/alveary.mutator.off"); - this.icons[8] = TextureManager.registerTex(register, "apiculture/alveary.mutator.on"); - } - @SideOnly(Side.CLIENT) - @Override - public IIcon getIcon(final int side, final int metadata) { - if (((metadata <= 1) - || (metadata == Type.FRAME.ordinal()) || (metadata == Type.MUTATOR.ordinal())) - && ((side == 1) || (side == 0))) { - return this.icons[BOTTOM]; - } - final Type type = Type.VALUES[metadata]; - switch (type) { - case ERROR: - return this.icons[PLAIN]; - case FRAME: - return this.icons[ALVEARY_FRAME_OFF]; - case MUTATOR: - return this.icons[ALVEARY_MUTATOR_OFF]; - case HEATER: - return this.icons[ALVEARY_MUTATOR_OFF]; - case HYGRO: - return this.icons[ALVEARY_MUTATOR_OFF]; - case STABILIZER: - return this.icons[PLAIN]; - case SIEVE: - return this.icons[PLAIN]; - default: - return null; - } - } - @SideOnly(Side.CLIENT) - @Override - public IIcon getIcon(final IBlockAccess world, final int x, final int y, final int z, final int side) { - final int meta = world.getBlockMetadata(x, y, z); - if (meta == 1) { - return this.getIcon(side, meta); - } else if (meta > 1) { - return this.getBlockTextureFromSideAndTile(world, x, y, z, side); - } - final Block blockXP = world.getBlock(x + 1, y, z); - final Block blockXM = world.getBlock(x - 1, y, z); - if ((blockXP == this) && (blockXM != this)) { - if (world.getBlockMetadata(x + 1, y, z) == 1) { - if (world.getBlock(x, y, z + 1) != this) { - return this.switchForSide(42, side); - } - return this.switchForSide(41, side); - } - return this.getIcon(side, meta); - } else if ((blockXP != this) && (blockXM == this)) { - if (world.getBlockMetadata(x - 1, y, z) == 1) { - if (world.getBlock(x, y, z + 1) != this) { - return this.switchForSide(41, side); - } - return this.switchForSide(42, side); - } - return this.getIcon(side, meta); - } - return this.getIcon(side, meta); - } - @SideOnly(Side.CLIENT) - private IIcon getBlockTextureFromSideAndTile(final IBlockAccess world, final int x, final int y, final int z, final int side) { - final TileEntity tile = world.getTileEntity(x, y, z); - if (!(tile instanceof FR_TileAlveary)) { - return this.getIcon(side, 0); - } - return this.icons[((FR_TileAlveary) tile).getIcon(side)]; - } - @SideOnly(Side.CLIENT) - private IIcon switchForSide(final int textureId, final int side) { - if ((side == 4) || (side == 5)) { - if (textureId == 41) { - return this.icons[LEFT]; - } - return this.icons[RIGHT]; - } else if (textureId == 41) { - return this.icons[RIGHT]; - } else { - return this.icons[LEFT]; - } - } - @Override - public void onNeighborBlockChange(final World world, final int x, final int y, final int z, final Block block) { - super.onNeighborBlockChange(world, x, y, z, block); - final TileEntity tileEntity = world.getTileEntity(x, y, z); - if (tileEntity instanceof FR_TileAlveary) { - final FR_TileAlveary tileAlveary = (FR_TileAlveary) tileEntity; - // We must check that the slabs on top were not removed - tileAlveary.getMultiblockLogic().getController().reassemble(); - } - } - public ItemStack get(final Type type) { - return new ItemStack(this, 1, type.ordinal()); - } -}
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/xmod/forestry/bees/alveary/FR_TileAlveary.java b/src/Java/gtPlusPlus/xmod/forestry/bees/alveary/FR_TileAlveary.java deleted file mode 100644 index b5e7845dab..0000000000 --- a/src/Java/gtPlusPlus/xmod/forestry/bees/alveary/FR_TileAlveary.java +++ /dev/null @@ -1,189 +0,0 @@ -package gtPlusPlus.xmod.forestry.bees.alveary; - -import java.io.IOException; -import java.util.List; - -import forestry.api.apiculture.*; -import forestry.api.core.*; -import forestry.api.multiblock.IAlvearyComponent; -import forestry.api.multiblock.IMultiblockController; -import forestry.apiculture.multiblock.MultiblockLogicAlveary; -import forestry.core.access.*; -import forestry.core.config.Config; -import forestry.core.gui.IGuiHandlerForestry; -import forestry.core.gui.IHintSource; -import forestry.core.inventory.IInventoryAdapter; -import forestry.core.multiblock.MultiblockTileEntityForestry; -import forestry.core.network.*; -import forestry.core.tiles.IClimatised; -import forestry.core.tiles.ITitled; -import net.minecraft.util.ChunkCoordinates; -import net.minecraft.util.Vec3; -import net.minecraft.world.biome.BiomeGenBase; - -public abstract class FR_TileAlveary -extends MultiblockTileEntityForestry<MultiblockLogicAlveary> -implements IBeeHousing, IAlvearyComponent, IRestrictedAccess, IStreamableGui, ITitled, IClimatised, IHintSource, IGuiHandlerForestry -{ - private final String unlocalizedTitle; - - protected FR_TileAlveary() - { - this(FR_BlockAlveary.Type.ERROR); - } - - protected FR_TileAlveary(final FR_BlockAlveary.Type type) - { - super(new MultiblockLogicAlveary()); - this.unlocalizedTitle = ("advanced.tile.for.alveary." + type.ordinal() + ".name"); - - } - - public int getIcon(final int side) - { - return 0; - } - - @Override - public void onMachineAssembled(final IMultiblockController multiblockController, final ChunkCoordinates minCoord, final ChunkCoordinates maxCoord) - { - if (this.worldObj.isRemote) { - this.worldObj.markBlockForUpdate(this.xCoord, this.yCoord, this.zCoord); - } - this.worldObj.notifyBlocksOfNeighborChange(this.xCoord, this.yCoord, this.zCoord, this.getBlockType()); - this.markDirty(); - } - - @Override - public void onMachineBroken() - { - if (this.worldObj.isRemote) { - this.worldObj.markBlockForUpdate(this.xCoord, this.yCoord, this.zCoord); - } - this.worldObj.notifyBlocksOfNeighborChange(this.xCoord, this.yCoord, this.zCoord, this.getBlockType()); - this.markDirty(); - } - - @Override - public BiomeGenBase getBiome() - { - return this.getMultiblockLogic().getController().getBiome(); - } - - @Override - public Iterable<IBeeModifier> getBeeModifiers() - { - return this.getMultiblockLogic().getController().getBeeModifiers(); - } - - @Override - public Iterable<IBeeListener> getBeeListeners() - { - return this.getMultiblockLogic().getController().getBeeListeners(); - } - - @Override - public IBeeHousingInventory getBeeInventory() - { - return this.getMultiblockLogic().getController().getBeeInventory(); - } - - @Override - public IBeekeepingLogic getBeekeepingLogic() - { - return this.getMultiblockLogic().getController().getBeekeepingLogic(); - } - - @Override - public Vec3 getBeeFXCoordinates() - { - return this.getMultiblockLogic().getController().getBeeFXCoordinates(); - } - - @Override - public EnumTemperature getTemperature() - { - return this.getMultiblockLogic().getController().getTemperature(); - } - - @Override - public EnumHumidity getHumidity() - { - return this.getMultiblockLogic().getController().getHumidity(); - } - - @Override - public int getBlockLightValue() - { - return this.getMultiblockLogic().getController().getBlockLightValue(); - } - - @Override - public boolean canBlockSeeTheSky() - { - return this.getMultiblockLogic().getController().canBlockSeeTheSky(); - } - - @Override - public IErrorLogic getErrorLogic() - { - return this.getMultiblockLogic().getController().getErrorLogic(); - } - - @Override - public IAccessHandler getAccessHandler() - { - return this.getMultiblockLogic().getController().getAccessHandler(); - } - - @Override - public void onSwitchAccess(final EnumAccess oldAccess, final EnumAccess newAccess) - { - this.getMultiblockLogic().getController().onSwitchAccess(oldAccess, newAccess); - } - - @Override - public IInventoryAdapter getInternalInventory() - { - return this.getMultiblockLogic().getController().getInternalInventory(); - } - - @Override - public String getUnlocalizedTitle() - { - return this.unlocalizedTitle; - } - - @Override - public List<String> getHints() - { - return Config.hints.get("apiary"); - } - - @Override - public float getExactTemperature() - { - return this.getMultiblockLogic().getController().getExactTemperature(); - } - - @Override - public float getExactHumidity() - { - return this.getMultiblockLogic().getController().getExactHumidity(); - } - - @Override - public void writeGuiData(final DataOutputStreamForestry data) - throws IOException - { - this.getMultiblockLogic().getController().writeGuiData(data); - } - - @Override - public void readGuiData(final DataInputStreamForestry data) - throws IOException - { - this.getMultiblockLogic().getController().readGuiData(data); - } - -} diff --git a/src/Java/gtPlusPlus/xmod/forestry/bees/alveary/IAlvearyComponentAdvanced.java b/src/Java/gtPlusPlus/xmod/forestry/bees/alveary/IAlvearyComponentAdvanced.java deleted file mode 100644 index a214263d0b..0000000000 --- a/src/Java/gtPlusPlus/xmod/forestry/bees/alveary/IAlvearyComponentAdvanced.java +++ /dev/null @@ -1,28 +0,0 @@ -package gtPlusPlus.xmod.forestry.bees.alveary; - -import forestry.api.apiculture.IBeeModifier; -import forestry.api.core.IClimateControlled; -import forestry.api.multiblock.IMultiblockComponent; -import forestry.api.multiblock.IMultiblockLogicAlveary; - -public abstract interface IAlvearyComponentAdvanced<T extends IMultiblockLogicAlveary> -extends IMultiblockComponent -{ - @Override - public abstract T getMultiblockLogic(); - - - public static abstract interface FrameHouse - extends IAlvearyComponentAdvanced - { - public abstract void changeClimate(int paramInt, IClimateControlled paramIClimateControlled); - } - - - public static abstract interface BeeModifier - extends IAlvearyComponentAdvanced - { - public abstract IBeeModifier getBeeModifier(); - } - -} diff --git a/src/Java/gtPlusPlus/xmod/forestry/bees/alveary/IAlvearyFrameHousing.java b/src/Java/gtPlusPlus/xmod/forestry/bees/alveary/IAlvearyFrameHousing.java deleted file mode 100644 index 6eeefa2696..0000000000 --- a/src/Java/gtPlusPlus/xmod/forestry/bees/alveary/IAlvearyFrameHousing.java +++ /dev/null @@ -1,9 +0,0 @@ -package gtPlusPlus.xmod.forestry.bees.alveary; - -import forestry.api.apiculture.IBeeHousing; -import gtPlusPlus.xmod.forestry.bees.alveary.gui.InventoryFrameHousing; - -public interface IAlvearyFrameHousing extends IBeeHousing { - InventoryFrameHousing getAlvearyInventory(); - void wearOutFrames(IBeeHousing beeHousing, int amount); -} diff --git a/src/Java/gtPlusPlus/xmod/forestry/bees/alveary/ISidedFrameWearingInventory.java b/src/Java/gtPlusPlus/xmod/forestry/bees/alveary/ISidedFrameWearingInventory.java deleted file mode 100644 index 2cc5e58ef7..0000000000 --- a/src/Java/gtPlusPlus/xmod/forestry/bees/alveary/ISidedFrameWearingInventory.java +++ /dev/null @@ -1,10 +0,0 @@ -package gtPlusPlus.xmod.forestry.bees.alveary; - -import forestry.api.apiculture.IBeeHousing; -import net.minecraft.inventory.ISidedInventory; - -public abstract interface ISidedFrameWearingInventory -extends ISidedInventory -{ - public abstract void wearOutFrames(IBeeHousing paramIBeeHousing, int paramInt); -}
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/xmod/forestry/bees/alveary/TileAlvearyFrameHousing.java b/src/Java/gtPlusPlus/xmod/forestry/bees/alveary/TileAlvearyFrameHousing.java deleted file mode 100644 index ff323632f5..0000000000 --- a/src/Java/gtPlusPlus/xmod/forestry/bees/alveary/TileAlvearyFrameHousing.java +++ /dev/null @@ -1,341 +0,0 @@ -package gtPlusPlus.xmod.forestry.bees.alveary; - -import java.util.*; - -import forestry.api.apiculture.*; -import forestry.api.arboriculture.EnumGermlingType; -import forestry.api.genetics.*; -import forestry.api.multiblock.IAlvearyComponent; -import forestry.apiculture.AlvearyBeeModifier; -import forestry.apiculture.network.packets.PacketActiveUpdate; -import forestry.apiculture.worldgen.*; -import forestry.core.inventory.IInventoryAdapter; -import forestry.core.inventory.wrappers.IInvSlot; -import forestry.core.inventory.wrappers.InventoryIterator; -import forestry.core.proxy.Proxies; -import forestry.core.tiles.IActivatable; -import forestry.core.utils.ItemStackUtil; -import gtPlusPlus.core.util.Utils; -import gtPlusPlus.xmod.forestry.bees.alveary.gui.*; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.inventory.IInventory; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.nbt.NBTTagList; - -public class TileAlvearyFrameHousing -extends FR_TileAlveary -implements ISidedFrameWearingInventory, IActivatable, IAlvearyComponent.Active, IAlvearyComponent.BeeModifier, IAlvearyFrameHousing, IAlvearyComponent.BeeListener -{ - private final InventoryFrameHousing inventory; - private final IBeeListener beeListener; - private final Stack<ItemStack> pendingSpawns = new Stack<>(); - private boolean active; - - public TileAlvearyFrameHousing() - { - super(FR_BlockAlveary.Type.FRAME); - this.inventory = new InventoryFrameHousing(this); - this.beeListener = new AlvearyFrameHousingBeeListener(this.inventory); - - } - - @Override - public IInventoryAdapter getInternalInventory() - { - return this.inventory; - } - - @Override - public boolean allowsAutomation() - { - return true; - } - - @Override - public void updateServer(final int tickCount) - { - - if (this.getInternalInventory() == null) { - return; - } - - if (this.inventory.getStackInSlot(0) != null) - { - if (this.getMultiblockLogic().getController().getBeekeepingLogic().canWork()){ - this.setActive(true); - if ((tickCount % 1000) == 0) { - this.wearOutFrames(this, 1); - } - } - else { - Utils.LOG_INFO("Cannot work - Probably no queen alive."); - } - - } - else - { - this.setActive(false); - } - if ((tickCount % 500) != 0) { - return; - } - - } - - @Override - public void updateClient(final int tickCount) {} - - private ItemStack getPrincessStack() - { - final ItemStack princessStack = this.getMultiblockLogic().getController().getBeeInventory().getQueen(); - if (BeeManager.beeRoot.isMated(princessStack)) { - return princessStack; - } - return null; - } - - private int consumeInducerAndGetChance() - { - if (this.getInternalInventory() == null) { - return 0; - } - for (final Iterator<?> i$ = InventoryIterator.getIterable(this.getInternalInventory()).iterator(); i$.hasNext();) - { - final IInvSlot slot = (IInvSlot)i$.next(); - final ItemStack stack = slot.getStackInSlot(); - for (final Map.Entry<ItemStack, Integer> entry : BeeManager.inducers.entrySet()) { - if (ItemStackUtil.isIdenticalItem(entry.getKey(), stack)) - { - slot.decreaseStackInSlot(); - return entry.getValue().intValue(); - } - } - } - final IInvSlot slot; - final ItemStack stack; - return 0; - } - - private void trySpawnSwarm() - { - final ItemStack toSpawn = this.pendingSpawns.peek(); - final HiveDescriptionSwarmer hiveDescription = new HiveDescriptionSwarmer(new ItemStack[] { toSpawn }); - final Hive hive = new Hive(hiveDescription); - - final int chunkX = ((this.xCoord + this.worldObj.rand.nextInt(80)) - 40) / 16; - final int chunkZ = ((this.zCoord + this.worldObj.rand.nextInt(80)) - 40) / 16; - if (HiveDecorator.genHive(this.worldObj, this.worldObj.rand, chunkX, chunkZ, hive)) { - this.pendingSpawns.pop(); - } - } - - @Override - protected void encodeDescriptionPacket(final NBTTagCompound packetData) - { - super.encodeDescriptionPacket(packetData); - packetData.setBoolean("Active", this.active); - } - - @Override - protected void decodeDescriptionPacket(final NBTTagCompound packetData) - { - super.decodeDescriptionPacket(packetData); - this.setActive(packetData.getBoolean("Active")); - } - - @Override - public int getIcon(final int side) - { - if ((side == 0) || (side == 1)) { - return 2; - } - if (this.active) { - return 6; - } - return 5; - } - - @Override - public void readFromNBT(final NBTTagCompound nbttagcompound) - { - super.readFromNBT(nbttagcompound); - this.setActive(nbttagcompound.getBoolean("Active")); - - final NBTTagList nbttaglist = nbttagcompound.getTagList("PendingSpawns", 10); - for (int i = 0; i < nbttaglist.tagCount(); i++) - { - final NBTTagCompound nbttagcompound1 = nbttaglist.getCompoundTagAt(i); - this.pendingSpawns.add(ItemStack.loadItemStackFromNBT(nbttagcompound1)); - } - } - - @Override - public void writeToNBT(final NBTTagCompound nbttagcompound) - { - super.writeToNBT(nbttagcompound); - nbttagcompound.setBoolean("Active", this.active); - - final NBTTagList nbttaglist = new NBTTagList(); - final ItemStack[] offspring = this.pendingSpawns.toArray(new ItemStack[this.pendingSpawns.size()]); - for (int i = 0; i < offspring.length; i++) { - if (offspring[i] != null) - { - final NBTTagCompound nbttagcompound1 = new NBTTagCompound(); - nbttagcompound1.setByte("Slot", (byte)i); - offspring[i].writeToNBT(nbttagcompound1); - nbttaglist.appendTag(nbttagcompound1); - } - } - nbttagcompound.setTag("PendingSpawns", nbttaglist); - } - - @Override - public boolean isActive() - { - return this.active; - } - - @Override - public void setActive(final boolean active) - { - if (this.active == active) { - return; - } - this.active = active; - if (!this.worldObj.isRemote) { - Proxies.net.sendNetworkPacket(new PacketActiveUpdate(this), this.worldObj); - } - } - - @Override - public Object getGui(final EntityPlayer player, final int data) - { - return new GUI_FrameHousing(this, player); - } - - @Override - public Object getContainer(final EntityPlayer player, final int data) - { - return new CONTAINER_FrameHousing(this, player); - } - - private final IBeeModifier beeModifier = new AlvearyBeeModifier(); - //private final IBeeListener beeListener = new AlvearyBeeListener(this); - private final Iterable<IBeeListener> beeListenerList = this.getMultiblockLogic().getController().getBeeListeners(); - - @Override - public Collection<IBeeModifier> getBeeModifiers() - { - final List<IBeeModifier> beeModifiers = new ArrayList<>(); - - beeModifiers.add(this.beeModifier); - for (final IHiveFrame frame : this.getFrames(this.inventory)) { - beeModifiers.add(frame.getBeeModifier()); - } - return beeModifiers; - } - - public Collection<IHiveFrame> getFrames(final IInventory inventory) - { - final Collection<IHiveFrame> hiveFrames = new ArrayList<>(inventory.getSizeInventory()); - for (int i = 0; i < inventory.getSizeInventory(); i++) - { - final ItemStack stackInSlot = this.getStackInSlot(i); - if (stackInSlot != null) - { - final Item itemInSlot = stackInSlot.getItem(); - if ((itemInSlot instanceof IHiveFrame)) { - hiveFrames.add((IHiveFrame)itemInSlot); - } - } - } - return hiveFrames; - } - - @Override - public IBeeModifier getBeeModifier() { - final List<IBeeModifier> beeModifiers = new ArrayList<>(); - - //beeModifiers.add(this.beeModifier); - for (final IHiveFrame frame : this.getFrames(this.inventory)) { - beeModifiers.add(frame.getBeeModifier()); - } - return beeModifiers.get(0); - } - - private ItemStack getQueenStack() - { - final ItemStack queenStack = this.getMultiblockLogic().getController().getBeeInventory().getQueen(); - return queenStack; - } - - @Override - public void wearOutFrames(final IBeeHousing beeHousing, final int amount) - { - final IBeekeepingMode beekeepingMode = BeeManager.beeRoot.getBeekeepingMode(beeHousing.getWorld()); - final int wear = Math.round(amount * beekeepingMode.getWearModifier()); - for (int i = 0; i < this.inventory.getSizeInventory(); i++) - { - final ItemStack hiveFrameStack = this.getStackInSlot(i); - if (hiveFrameStack != null) - { - final Item hiveFrameItem = hiveFrameStack.getItem(); - if ((hiveFrameItem instanceof IHiveFrame)) - { - final IHiveFrame hiveFrame = (IHiveFrame)hiveFrameItem; - Utils.LOG_INFO("Wearing out frame by "+amount); - final ItemStack queenStack = this.getQueenStack(); - final IBee queen = BeeManager.beeRoot.getMember(queenStack); - final ItemStack usedFrame = hiveFrame.frameUsed(beeHousing, hiveFrameStack, queen, wear); - - //((MultiblockLogicAlveary)getMultiblockLogic()).getController().getBeeListeners(). - - this.setInventorySlotContents(i, usedFrame); - } - } - } - } - - @Override - public InventoryFrameHousing getAlvearyInventory() { - return this.inventory; - } - - @Override - public IBeeListener getBeeListener() { - return this.beeListener; - } - - static class AlvearyFrameHousingBeeListener - extends DefaultBeeListener - { - private final InventoryFrameHousing inventory; - - public AlvearyFrameHousingBeeListener(final InventoryFrameHousing inventory) - { - this.inventory = inventory; - } - - @Override - public boolean onPollenRetrieved(final IIndividual pollen) - { - /*if (!((Object) this.inventory).canStorePollen()) { - return false; - }*/ - final ISpeciesRoot speciesRoot = AlleleManager.alleleRegistry.getSpeciesRoot(pollen.getClass()); - - final ItemStack pollenStack = speciesRoot.getMemberStack(pollen, EnumGermlingType.POLLEN.ordinal()); - if (pollenStack != null) - { - // ((Object) this.inventory).storePollenStack(pollenStack); - return true; - } - return false; - } - } - - - -} diff --git a/src/Java/gtPlusPlus/xmod/forestry/bees/alveary/gui/CONTAINER_FrameHousing.java b/src/Java/gtPlusPlus/xmod/forestry/bees/alveary/gui/CONTAINER_FrameHousing.java deleted file mode 100644 index b1c94ddc47..0000000000 --- a/src/Java/gtPlusPlus/xmod/forestry/bees/alveary/gui/CONTAINER_FrameHousing.java +++ /dev/null @@ -1,98 +0,0 @@ -package gtPlusPlus.xmod.forestry.bees.alveary.gui; - -import forestry.api.apiculture.IHiveFrame; -import forestry.core.gui.tooltips.ToolTip; -import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.core.slots.SlotFrame; -import gtPlusPlus.xmod.forestry.bees.alveary.TileAlvearyFrameHousing; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.inventory.Container; -import net.minecraft.inventory.Slot; -import net.minecraft.item.ItemStack; -import net.minecraft.util.ResourceLocation; - -public class CONTAINER_FrameHousing extends Container -{ - private final TileAlvearyFrameHousing te; - - public static final int INPUT_1 = 0; - private final ResourceLocation beeFrameIcon = new ResourceLocation(CORE.MODID, "textures/items/machine_Charger.png"); - public ToolTip newTip = new ToolTip(); - private final SlotFrame beeFrameSlot; - - private int slotID = 0; - - public CONTAINER_FrameHousing(final TileAlvearyFrameHousing te, final EntityPlayer player) - { - this.te = te; - this.beeFrameSlot = new SlotFrame(te, this.slotID++, 80, 35); - - //Fuel Slot A - this.beeFrameSlot.setBackgroundIconTexture(this.beeFrameIcon); - - this.addSlotToContainer(this.beeFrameSlot); - - //Inventory - for (int i = 0; i < 3; i++) - { - for (int j = 0; j < 9; j++) - { - this.addSlotToContainer(new Slot(player.inventory, j + (i * 9) + 9, 8 + (j * 18), 84 + (i * 18))); - } - } - // Hotbar - for (int i = 0; i < 9; i++) - { - this.addSlotToContainer(new Slot(player.inventory, i, 8 + (i * 18), 142)); - } - } - - @Override - public ItemStack transferStackInSlot(final EntityPlayer player, final int slotRaw) - { - ItemStack stack = null; - final Slot slot = (Slot)this.inventorySlots.get(slotRaw); - - if ((slot != null) && slot.getHasStack()) - { - final ItemStack stackInSlot = slot.getStack(); - stack = stackInSlot.copy(); - - - //If your inventory only stores certain instances of Items, - //you can implement shift-clicking to your inventory like this: - // Check that the item is the right type - if (!(stack.getItem() instanceof IHiveFrame)){ - return null; - } - - if (slotRaw < 1) - { - if (!this.mergeItemStack(stackInSlot, 3 * 9, this.inventorySlots.size(), true)) - { - return null; - } - } - else if (!this.mergeItemStack(stackInSlot, 0, 3 * 9, false)) - { - return null; - } - - if (stackInSlot.stackSize == 0) - { - slot.putStack((ItemStack)null); - } - else - { - slot.onSlotChanged(); - } - } - return stack; - } - - @Override - public boolean canInteractWith(final EntityPlayer player) - { - return this.te.isUseableByPlayer(player); - } -}
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/xmod/forestry/bees/alveary/gui/GUI_FrameHousing.java b/src/Java/gtPlusPlus/xmod/forestry/bees/alveary/gui/GUI_FrameHousing.java deleted file mode 100644 index 869a77f92d..0000000000 --- a/src/Java/gtPlusPlus/xmod/forestry/bees/alveary/gui/GUI_FrameHousing.java +++ /dev/null @@ -1,49 +0,0 @@ -package gtPlusPlus.xmod.forestry.bees.alveary.gui; - -import org.lwjgl.opengl.GL11; - -import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.xmod.forestry.bees.alveary.TileAlvearyFrameHousing; -import net.minecraft.client.Minecraft; -import net.minecraft.client.gui.inventory.GuiContainer; -import net.minecraft.client.resources.I18n; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.entity.player.InventoryPlayer; -import net.minecraft.util.ResourceLocation; - -public class GUI_FrameHousing extends GuiContainer -{ - private final ResourceLocation texture = new ResourceLocation(CORE.MODID, "textures/gui/machine_Charger.png"); - - private final InventoryPlayer inventory; - private final TileAlvearyFrameHousing te; - - public GUI_FrameHousing(final TileAlvearyFrameHousing te, final EntityPlayer player) - { - super(new CONTAINER_FrameHousing(te, player)); - this.inventory = player.inventory; - this.te = te; - } - - @Override - protected void drawGuiContainerBackgroundLayer(final float par1, final int par2, final int par3) - { - Minecraft.getMinecraft().renderEngine.bindTexture(this.texture); - - GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); - - final int x = (this.width - this.xSize) / 2; - final int y = (this.height - this.ySize) / 2; - - this.drawTexturedModalRect(x, y, 0, 0, this.xSize, this.ySize); - } - - @Override - protected void drawGuiContainerForegroundLayer(final int par1, final int par2) - { - this.fontRendererObj.drawString(I18n.format("Alveary Frame Housing"), (this.xSize / 2) - (this.fontRendererObj.getStringWidth(I18n.format("Alveary Frame Housing")) / 2), 6, 4210752, false); - this.fontRendererObj.drawString(I18n.format(this.inventory.getInventoryName()), 8, (this.ySize - 96) + 2, 4210752); - //fontRendererObj.drawString(I18n.format("Charge:"+te.getCharge()+"~"), 8, ySize - 96 + 2, 4210752); - //fontRendererObj.drawString(I18n.format("Progress:"+te.getProgress()+"ticks"), 80, ySize - 96 + 2, 4210752); - } -}
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/xmod/forestry/bees/alveary/gui/InventoryFrameHousing.java b/src/Java/gtPlusPlus/xmod/forestry/bees/alveary/gui/InventoryFrameHousing.java deleted file mode 100644 index cde673e952..0000000000 --- a/src/Java/gtPlusPlus/xmod/forestry/bees/alveary/gui/InventoryFrameHousing.java +++ /dev/null @@ -1,113 +0,0 @@ -package gtPlusPlus.xmod.forestry.bees.alveary.gui; - -import com.mojang.authlib.GameProfile; - -import forestry.api.apiculture.*; -import forestry.api.core.*; -import forestry.core.inventory.InventoryAdapterTile; -import forestry.core.utils.ItemStackUtil; -import gtPlusPlus.xmod.forestry.bees.alveary.IAlvearyFrameHousing; -import gtPlusPlus.xmod.forestry.bees.alveary.TileAlvearyFrameHousing; -import net.minecraft.item.ItemStack; -import net.minecraft.util.ChunkCoordinates; -import net.minecraft.util.Vec3; -import net.minecraft.world.World; -import net.minecraft.world.biome.BiomeGenBase; - -public class InventoryFrameHousing extends InventoryAdapterTile<TileAlvearyFrameHousing> implements IAlvearyFrameHousing -{ - - TileAlvearyFrameHousing alvearyFrame; - - public InventoryFrameHousing(final TileAlvearyFrameHousing alvearyFrame) - { - super(alvearyFrame, 1, "FrameHousingInv"); - this.alvearyFrame = alvearyFrame; - } - - @Override - public boolean canSlotAccept(final int slotIndex, final ItemStack itemStack) - { - return ItemStackUtil.containsItemStack(BeeManager.inducers.keySet(), itemStack); - } - - @Override - public boolean canBlockSeeTheSky() { - return this.alvearyFrame.canBlockSeeTheSky(); - } - - @Override - public Vec3 getBeeFXCoordinates() { - return this.alvearyFrame.getBeeFXCoordinates(); - } - - @Override - public IBeeHousingInventory getBeeInventory() { - return this.alvearyFrame.getBeeInventory(); - } - - @Override - public Iterable<IBeeListener> getBeeListeners() { - return this.alvearyFrame.getBeeListeners(); - } - - @Override - public Iterable<IBeeModifier> getBeeModifiers() { - return this.alvearyFrame.getBeeModifiers(); - } - - @Override - public IBeekeepingLogic getBeekeepingLogic() { - return this.alvearyFrame.getBeekeepingLogic(); - } - - @Override - public BiomeGenBase getBiome() { - return this.alvearyFrame.getBiome(); - } - - @Override - public int getBlockLightValue() { - return this.alvearyFrame.getBlockLightValue(); - } - - @Override - public EnumHumidity getHumidity() { - return this.alvearyFrame.getHumidity(); - } - - @Override - public GameProfile getOwner() { - return this.alvearyFrame.getOwner(); - } - - @Override - public EnumTemperature getTemperature() { - return this.alvearyFrame.getTemperature(); - } - - @Override - public World getWorld() { - return this.alvearyFrame.getWorld(); - } - - @Override - public ChunkCoordinates getCoordinates() { - return this.alvearyFrame.getCoordinates(); - } - - @Override - public IErrorLogic getErrorLogic() { - return this.alvearyFrame.getErrorLogic(); - } - - @Override - public InventoryFrameHousing getAlvearyInventory() { - return this; - } - - @Override - public void wearOutFrames(final IBeeHousing beeHousing, final int amount) { - this.alvearyFrame.wearOutFrames(beeHousing, amount); - } -} |