From 4bcf341fe8ea61e5555d6c9f60d11289d5a18694 Mon Sep 17 00:00:00 2001 From: Draknyte1 Date: Fri, 1 Jul 2016 10:41:19 +1000 Subject: %Changed the way the Foresty xmod stuff runs in a non-dev situation. %Improved Growthcraft Booze handling --- src/Java/miscutil/core/lib/CORE.java | 2 +- .../core/xmod/forestry/HANDLER_Forestry.java | 10 +- .../apiculture/blocks/FR_BlockAlveary.java | 219 ----------------- .../blocks/FR_BlockRegistryApiculture.java | 41 ---- .../apiculture/items/FR_ItemHiveFrame.java | 67 ----- .../forestry/apiculture/items/FR_ItemRegistry.java | 58 +++++ .../items/FR_ItemRegistryApiculture.java | 58 ----- .../items/magicbees/FR_StringManager.java | 30 --- .../apiculture/items/magicbees/FR_StringUtil.java | 24 ++ .../apiculture/items/magicbees/MB_FrameType.java | 107 ++++++++ .../items/magicbees/MB_HiveFrameType.java | 107 -------- .../apiculture/items/magicbees/MB_ItemFrame.java | 103 ++++++++ .../items/magicbees/MB_ItemMagicHiveFrame.java | 62 ----- .../apiculture/multiblock/FR_TileAlveary.java | 199 --------------- .../apiculture/multiblock/TileAlvearyMutatron.java | 232 ------------------ .../inventory/FR_ContainerAlvearyMutatron.java | 28 --- .../inventory/FR_GuiAlvearyMutatron.java | 26 -- .../multiblock/inventory/FR_InventoryMutatron.java | 29 --- .../multiblock/inventory/MutatronHandler.java | 22 -- .../forestry/apiculture/tiles/FR_TileHandler.java | 14 -- .../xmod/forestry/core/gui/FR_FontRenderer.java | 111 --------- .../xmod/forestry/core/gui/FR_GuiForestry.java | 272 --------------------- .../forestry/core/gui/FR_GuiForestryTitled.java | 33 --- .../core/xmod/forestry/core/gui/FR_GuiUtil.java | 145 ----------- .../xmod/forestry/core/gui/FR_WidgetManager.java | 90 ------- .../core/xmod/gregtech/HANDLER_Gregtech.java | 3 +- .../core/xmod/growthcraft/HANDLER_Growthcraft.java | 55 +---- .../xmod/growthcraft/booze/Register_Booze.java | 64 +++++ src/Java/miscutil/deprecated/ResourceHandler.java | 83 ------- 29 files changed, 366 insertions(+), 1928 deletions(-) delete mode 100644 src/Java/miscutil/core/xmod/forestry/apiculture/blocks/FR_BlockAlveary.java delete mode 100644 src/Java/miscutil/core/xmod/forestry/apiculture/blocks/FR_BlockRegistryApiculture.java delete mode 100644 src/Java/miscutil/core/xmod/forestry/apiculture/items/FR_ItemHiveFrame.java create mode 100644 src/Java/miscutil/core/xmod/forestry/apiculture/items/FR_ItemRegistry.java delete mode 100644 src/Java/miscutil/core/xmod/forestry/apiculture/items/FR_ItemRegistryApiculture.java delete mode 100644 src/Java/miscutil/core/xmod/forestry/apiculture/items/magicbees/FR_StringManager.java create mode 100644 src/Java/miscutil/core/xmod/forestry/apiculture/items/magicbees/FR_StringUtil.java create mode 100644 src/Java/miscutil/core/xmod/forestry/apiculture/items/magicbees/MB_FrameType.java delete mode 100644 src/Java/miscutil/core/xmod/forestry/apiculture/items/magicbees/MB_HiveFrameType.java create mode 100644 src/Java/miscutil/core/xmod/forestry/apiculture/items/magicbees/MB_ItemFrame.java delete mode 100644 src/Java/miscutil/core/xmod/forestry/apiculture/items/magicbees/MB_ItemMagicHiveFrame.java delete mode 100644 src/Java/miscutil/core/xmod/forestry/apiculture/multiblock/FR_TileAlveary.java delete mode 100644 src/Java/miscutil/core/xmod/forestry/apiculture/multiblock/TileAlvearyMutatron.java delete mode 100644 src/Java/miscutil/core/xmod/forestry/apiculture/multiblock/inventory/FR_ContainerAlvearyMutatron.java delete mode 100644 src/Java/miscutil/core/xmod/forestry/apiculture/multiblock/inventory/FR_GuiAlvearyMutatron.java delete mode 100644 src/Java/miscutil/core/xmod/forestry/apiculture/multiblock/inventory/FR_InventoryMutatron.java delete mode 100644 src/Java/miscutil/core/xmod/forestry/apiculture/multiblock/inventory/MutatronHandler.java delete mode 100644 src/Java/miscutil/core/xmod/forestry/apiculture/tiles/FR_TileHandler.java delete mode 100644 src/Java/miscutil/core/xmod/forestry/core/gui/FR_FontRenderer.java delete mode 100644 src/Java/miscutil/core/xmod/forestry/core/gui/FR_GuiForestry.java delete mode 100644 src/Java/miscutil/core/xmod/forestry/core/gui/FR_GuiForestryTitled.java delete mode 100644 src/Java/miscutil/core/xmod/forestry/core/gui/FR_GuiUtil.java delete mode 100644 src/Java/miscutil/core/xmod/forestry/core/gui/FR_WidgetManager.java create mode 100644 src/Java/miscutil/core/xmod/growthcraft/booze/Register_Booze.java delete mode 100644 src/Java/miscutil/deprecated/ResourceHandler.java (limited to 'src/Java') diff --git a/src/Java/miscutil/core/lib/CORE.java b/src/Java/miscutil/core/lib/CORE.java index e8315a2446..570059b00c 100644 --- a/src/Java/miscutil/core/lib/CORE.java +++ b/src/Java/miscutil/core/lib/CORE.java @@ -15,7 +15,7 @@ public class CORE { public static final String name = "Misc. Utils"; public static final String MODID = "miscutils"; - public static final String VERSION = "1.2.2"; + public static final String VERSION = "1.2.5"; public static final boolean DEBUG = false; public static final boolean LOAD_ALL_CONTENT = false; public static final int GREG_FIRST_ID = 760; diff --git a/src/Java/miscutil/core/xmod/forestry/HANDLER_Forestry.java b/src/Java/miscutil/core/xmod/forestry/HANDLER_Forestry.java index 94beb5618e..50b07e7535 100644 --- a/src/Java/miscutil/core/xmod/forestry/HANDLER_Forestry.java +++ b/src/Java/miscutil/core/xmod/forestry/HANDLER_Forestry.java @@ -1,22 +1,20 @@ package miscutil.core.xmod.forestry; import miscutil.core.lib.LoadedMods; -import miscutil.core.xmod.forestry.apiculture.blocks.FR_BlockRegistryApiculture; -import miscutil.core.xmod.forestry.apiculture.items.FR_ItemRegistryApiculture; -import miscutil.core.xmod.forestry.apiculture.tiles.FR_TileHandler; +import miscutil.core.xmod.forestry.apiculture.items.FR_ItemRegistry; public class HANDLER_Forestry { public static void preInit(){ if (LoadedMods.Forestry){ - FR_ItemRegistryApiculture.RegisterApiculture(); - FR_BlockRegistryApiculture.RegistryApiculture(); + FR_ItemRegistry.Register(); + //FR_BlockRegistryApiculture.RegistryApiculture(); } } public static void Init(){ if (LoadedMods.Forestry){ - FR_TileHandler.init(); + //FR_TileHandler.init(); } } diff --git a/src/Java/miscutil/core/xmod/forestry/apiculture/blocks/FR_BlockAlveary.java b/src/Java/miscutil/core/xmod/forestry/apiculture/blocks/FR_BlockAlveary.java deleted file mode 100644 index 62669ef8d0..0000000000 --- a/src/Java/miscutil/core/xmod/forestry/apiculture/blocks/FR_BlockAlveary.java +++ /dev/null @@ -1,219 +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 miscutil.core.xmod.forestry.apiculture.blocks; - -import java.util.ArrayList; -import java.util.List; - -import miscutil.core.creative.AddToCreativeTab; -import miscutil.core.xmod.forestry.apiculture.multiblock.TileAlvearyMutatron; -import net.minecraft.block.Block; -import net.minecraft.client.renderer.texture.IIconRegister; -import net.minecraft.creativetab.CreativeTabs; -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; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -import forestry.apiculture.MaterialBeehive; -import forestry.apiculture.multiblock.TileAlveary; -import forestry.core.blocks.BlockStructure; -import forestry.core.render.TextureManager; - -public class FR_BlockAlveary extends BlockStructure { - public enum Type { - PLAIN, - MUTATRON; - public static final Type[] VALUES = values(); - } - - public FR_BlockAlveary() { - super(new MaterialBeehive(false)); - setHardness(1.0f); - setCreativeTab(AddToCreativeTab.tabMisc); - setHarvestLevel("axe", 0); - } - - @SuppressWarnings({"rawtypes", "unchecked"}) - @Override - @SideOnly(Side.CLIENT) - public void getSubBlocks(Item item, CreativeTabs tab, List list) { - for (int i = 0; i < 8; i++) { - if (i == 1) { - continue; - } - list.add(new ItemStack(item, 1, i)); - } - } - - @Override - public int getRenderType() { - return 0; - } - - @Override - public boolean renderAsNormalBlock() { - return true; - } - - @Override - public ArrayList getDrops(World world, int x, int y, int z, int metadata, int fortune) { - ArrayList drop = new ArrayList<>(); - drop.add(new ItemStack(this, 1, metadata != 1 ? metadata : 0)); - return drop; - } - - @Override - public int getDamageValue(World world, int x, int y, int z) { - int meta = world.getBlockMetadata(x, y, z); - return meta != 1 ? meta : 0; - } - - /* TILE ENTITY CREATION */ - @Override - public TileEntity createTileEntity(World world, int metadata) { - if (metadata < 0 || metadata > Type.VALUES.length) { - return null; - } - return new TileAlvearyMutatron(); - } - - @Override - public TileEntity createNewTileEntity(World world, int meta) { - return 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 MUTATRON_OFF = 5; - public static final int MUTATRON_ON = 6; - - @SideOnly(Side.CLIENT) - private IIcon[] icons; - - @SideOnly(Side.CLIENT) - @Override - public void registerBlockIcons(IIconRegister register) { - icons = new IIcon[7]; - icons[0] = TextureManager.registerTex(register, "apiculture/alveary.plain"); - icons[1] = TextureManager.registerTex(register, "apiculture/alveary.entrance"); - icons[2] = TextureManager.registerTex(register, "apiculture/alveary.bottom"); - icons[3] = TextureManager.registerTex(register, "apiculture/alveary.left"); - icons[4] = TextureManager.registerTex(register, "apiculture/alveary.right"); - icons[5] = TextureManager.registerTex(register, "apiculture/alveary.mutatron.off"); - icons[6] = TextureManager.registerTex(register, "apiculture/alveary.mutatron.on"); - } - - @SideOnly(Side.CLIENT) - @Override - public IIcon getIcon(int side, int metadata) { - if ((metadata <= 1 /*|| metadata == Type.MUTATRON.ordinal()*/) && (side == 1 || side == 0)) { - return icons[BOTTOM]; - } - return icons[MUTATRON_OFF]; - } - - @SideOnly(Side.CLIENT) - @Override - public IIcon getIcon(IBlockAccess world, int x, int y, int z, int side) { - int meta = world.getBlockMetadata(x, y, z); - - if (meta == 1) { - return this.getIcon(side, meta); - } else if (meta > 1) { - return getBlockTextureFromSideAndTile(world, x, y, z, side); - } - - Block blockXP = world.getBlock(x + 1, y, z); - 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 switchForSide(42, side); - } else { - return switchForSide(41, side); - } - - } else { - 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 switchForSide(41, side); - } else { - return switchForSide(42, side); - } - - } else { - return this.getIcon(side, meta); - } - } - - return this.getIcon(side, meta); - } - - @SideOnly(Side.CLIENT) - private IIcon getBlockTextureFromSideAndTile(IBlockAccess world, int x, int y, int z, int side) { - TileEntity tile = world.getTileEntity(x, y, z); - if (!(tile instanceof TileAlveary)) { - return getIcon(side, 0); - } - - return icons[((TileAlveary) tile).getIcon(side)]; - } - - @SideOnly(Side.CLIENT) - private IIcon switchForSide(int textureId, int side) { - - if (side == 4 || side == 5) { - if (textureId == 41) { - return icons[LEFT]; - } else { - return icons[RIGHT]; - } - } else if (textureId == 41) { - return icons[RIGHT]; - } else { - return icons[LEFT]; - } - - } - - @Override - public void onNeighborBlockChange(World world, int x, int y, int z, Block block) { - super.onNeighborBlockChange(world, x, y, z, block); - - TileEntity tileEntity = world.getTileEntity(x, y, z); - if (tileEntity instanceof TileAlveary) { - TileAlveary tileAlveary = (TileAlveary) tileEntity; - - // We must check that the slabs on top were not removed - tileAlveary.getMultiblockLogic().getController().reassemble(); - } - } - - public ItemStack get(Type type) { - return new ItemStack(this, 1, type.ordinal()); - } -} diff --git a/src/Java/miscutil/core/xmod/forestry/apiculture/blocks/FR_BlockRegistryApiculture.java b/src/Java/miscutil/core/xmod/forestry/apiculture/blocks/FR_BlockRegistryApiculture.java deleted file mode 100644 index ebde18655f..0000000000 --- a/src/Java/miscutil/core/xmod/forestry/apiculture/blocks/FR_BlockRegistryApiculture.java +++ /dev/null @@ -1,41 +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 miscutil.core.xmod.forestry.apiculture.blocks; - -import miscutil.core.lib.CORE; -import net.minecraft.block.Block; -import net.minecraft.item.ItemBlock; -import net.minecraft.item.ItemStack; -import net.minecraftforge.oredict.OreDictionary; -import cpw.mods.fml.common.registry.GameRegistry; -import forestry.core.blocks.BlockRegistry; -import forestry.core.items.ItemBlockForestry; -import forestry.core.utils.StringUtil; -public class FR_BlockRegistryApiculture extends BlockRegistry { - - public static FR_BlockAlveary alveary; - - public static void RegistryApiculture() { - if (CORE.DEBUG){ - alveary = registerBlock2(new FR_BlockAlveary(), ItemBlockForestry.class, "alveary"); - } - } - - protected static T registerBlock2(T block, Class itemClass, String name, Object... itemCtorArgs) { - block.setBlockName(name); - GameRegistry.registerBlock(block, itemClass, StringUtil.cleanBlockName(block), itemCtorArgs); - return block; - } - - protected static void registerOreDictWildcard(String oreDictName, Block block) { - OreDictionary.registerOre(oreDictName, new ItemStack(block, 1, OreDictionary.WILDCARD_VALUE)); - } -} \ No newline at end of file diff --git a/src/Java/miscutil/core/xmod/forestry/apiculture/items/FR_ItemHiveFrame.java b/src/Java/miscutil/core/xmod/forestry/apiculture/items/FR_ItemHiveFrame.java deleted file mode 100644 index cd517fd1ad..0000000000 --- a/src/Java/miscutil/core/xmod/forestry/apiculture/items/FR_ItemHiveFrame.java +++ /dev/null @@ -1,67 +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 miscutil.core.xmod.forestry.apiculture.items; - -import miscutil.core.creative.AddToCreativeTab; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import forestry.api.apiculture.DefaultBeeModifier; -import forestry.api.apiculture.IBee; -import forestry.api.apiculture.IBeeGenome; -import forestry.api.apiculture.IBeeHousing; -import forestry.api.apiculture.IBeeModifier; -import forestry.api.apiculture.IHiveFrame; - -public class FR_ItemHiveFrame extends Item implements IHiveFrame { - - private final IBeeModifier beeModifier; - - public FR_ItemHiveFrame(int maxDamage, float geneticDecay) { - setMaxStackSize(1); - setMaxDamage(maxDamage); - setCreativeTab(AddToCreativeTab.tabMisc); - - this.beeModifier = new HiveFrameBeeModifier(geneticDecay); - } - - @Override - public ItemStack frameUsed(IBeeHousing housing, ItemStack frame, IBee queen, int wear) { - frame.setItemDamage(frame.getItemDamage() + wear); - if (frame.getItemDamage() >= frame.getMaxDamage()) { - return null; - } else { - return frame; - } - } - - @Override - public IBeeModifier getBeeModifier() { - return beeModifier; - } - - private static class HiveFrameBeeModifier extends DefaultBeeModifier { - private final float geneticDecay; - - public HiveFrameBeeModifier(float geneticDecay) { - this.geneticDecay = geneticDecay; - } - - @Override - public float getProductionModifier(IBeeGenome genome, float currentModifier) { - return (currentModifier < 10f) ? 2f : 1f; - } - - @Override - public float getGeneticDecay(IBeeGenome genome, float currentModifier) { - return this.geneticDecay; - } - } -} diff --git a/src/Java/miscutil/core/xmod/forestry/apiculture/items/FR_ItemRegistry.java b/src/Java/miscutil/core/xmod/forestry/apiculture/items/FR_ItemRegistry.java new file mode 100644 index 0000000000..3772d70918 --- /dev/null +++ b/src/Java/miscutil/core/xmod/forestry/apiculture/items/FR_ItemRegistry.java @@ -0,0 +1,58 @@ +/******************************************************************************* + * 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 miscutil.core.xmod.forestry.apiculture.items; +import miscutil.core.xmod.forestry.apiculture.items.magicbees.MB_FrameType; +import miscutil.core.xmod.forestry.apiculture.items.magicbees.MB_ItemFrame; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.util.WeightedRandomChestContent; +import net.minecraftforge.common.ChestGenHooks; +import cpw.mods.fml.common.registry.GameRegistry; +import forestry.core.utils.StringUtil; + +public class FR_ItemRegistry { + + + //----- Apiary Frames ---------------------- + //public static FR_ItemHiveFrame frameUntreated; + //public static FR_ItemHiveFrame frameImpregnated; + //public static FR_ItemHiveFrame frameProven; + + //Magic Bee Frame Items + public static MB_ItemFrame hiveFrameAccelerated; + public static MB_ItemFrame hiveFrameVoid; + + public static void Register() { + + //Forestry Frames + //frameUntreated = registerItem(new FR_ItemHiveFrame(80, 0.9f), "frameUntreated"); + //frameImpregnated = registerItem(new FR_ItemHiveFrame(240, 0.4f), "frameImpregnated"); + //frameProven = registerItem(new FR_ItemHiveFrame(720, 0.3f), "frameProven"); + + //Magic Bee like Frames + hiveFrameAccelerated = new MB_ItemFrame(MB_FrameType.ACCELERATED); + hiveFrameVoid = new MB_ItemFrame(MB_FrameType.VOID); + ChestGenHooks.addItem(ChestGenHooks.STRONGHOLD_CORRIDOR, new WeightedRandomChestContent(new ItemStack(hiveFrameVoid), 1, 1, 18)); + ChestGenHooks.addItem(ChestGenHooks.STRONGHOLD_LIBRARY, new WeightedRandomChestContent(new ItemStack(hiveFrameVoid), 1, 3, 23)); + + + + + } + + protected static T registerItem(T item, String name) { + item.setUnlocalizedName(name); + GameRegistry.registerItem(item, StringUtil.cleanItemName(item)); + return item; + } +} + + diff --git a/src/Java/miscutil/core/xmod/forestry/apiculture/items/FR_ItemRegistryApiculture.java b/src/Java/miscutil/core/xmod/forestry/apiculture/items/FR_ItemRegistryApiculture.java deleted file mode 100644 index f2a64a9f90..0000000000 --- a/src/Java/miscutil/core/xmod/forestry/apiculture/items/FR_ItemRegistryApiculture.java +++ /dev/null @@ -1,58 +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 miscutil.core.xmod.forestry.apiculture.items; -import miscutil.core.xmod.forestry.apiculture.items.magicbees.MB_HiveFrameType; -import miscutil.core.xmod.forestry.apiculture.items.magicbees.MB_ItemMagicHiveFrame; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.util.WeightedRandomChestContent; -import net.minecraftforge.common.ChestGenHooks; -import cpw.mods.fml.common.registry.GameRegistry; -import forestry.core.items.ItemRegistry; -import forestry.core.utils.StringUtil; - -public class FR_ItemRegistryApiculture extends ItemRegistry { - - - //----- Apiary Frames ---------------------- - public static FR_ItemHiveFrame frameUntreated; - public static FR_ItemHiveFrame frameImpregnated; - public static FR_ItemHiveFrame frameProven; - //Magic Bee Frame Items - public static MB_ItemMagicHiveFrame hiveFrameMetabolic; - public static MB_ItemMagicHiveFrame hiveFrameOblivion; - - public static void RegisterApiculture() { - - //Forestry Frames - //frameUntreated = registerItem(new FR_ItemHiveFrame(80, 0.9f), "frameUntreated"); - //frameImpregnated = registerItem(new FR_ItemHiveFrame(240, 0.4f), "frameImpregnated"); - //frameProven = registerItem(new FR_ItemHiveFrame(720, 0.3f), "frameProven"); - - //Magic Bee like Frames - hiveFrameMetabolic = new MB_ItemMagicHiveFrame(MB_HiveFrameType.ACCELERATED); - hiveFrameOblivion = new MB_ItemMagicHiveFrame(MB_HiveFrameType.VOID); - ChestGenHooks.addItem(ChestGenHooks.STRONGHOLD_CORRIDOR, new WeightedRandomChestContent(new ItemStack(hiveFrameOblivion), 1, 1, 18)); - ChestGenHooks.addItem(ChestGenHooks.STRONGHOLD_LIBRARY, new WeightedRandomChestContent(new ItemStack(hiveFrameOblivion), 1, 3, 23)); - - - - - } - - protected static T registerItem(T item, String name) { - item.setUnlocalizedName(name); - GameRegistry.registerItem(item, StringUtil.cleanItemName(item)); - return item; - } -} - - diff --git a/src/Java/miscutil/core/xmod/forestry/apiculture/items/magicbees/FR_StringManager.java b/src/Java/miscutil/core/xmod/forestry/apiculture/items/magicbees/FR_StringManager.java deleted file mode 100644 index f08f1fd542..0000000000 --- a/src/Java/miscutil/core/xmod/forestry/apiculture/items/magicbees/FR_StringManager.java +++ /dev/null @@ -1,30 +0,0 @@ -package miscutil.core.xmod.forestry.apiculture.items.magicbees; - -import net.minecraft.util.StatCollector; - -public class FR_StringManager -{ - public static String getLocalizedString(String key) - { - if(StatCollector.canTranslate(key)) - { - return StatCollector.translateToLocal(key); - } - else - { - return StatCollector.translateToFallback(key); - } - } - - public static String getLocalizedString(String key, Object... objects) - { - if(StatCollector.canTranslate(key)) - { - return String.format(StatCollector.translateToLocal(key), objects); - } - else - { - return String.format(StatCollector.translateToFallback(key), objects); - } - } -} diff --git a/src/Java/miscutil/core/xmod/forestry/apiculture/items/magicbees/FR_StringUtil.java b/src/Java/miscutil/core/xmod/forestry/apiculture/items/magicbees/FR_StringUtil.java new file mode 100644 index 0000000000..235566f4ef --- /dev/null +++ b/src/Java/miscutil/core/xmod/forestry/apiculture/items/magicbees/FR_StringUtil.java @@ -0,0 +1,24 @@ +package miscutil.core.xmod.forestry.apiculture.items.magicbees; + +import net.minecraft.util.StatCollector; + +public class FR_StringUtil +{ + public static String getLocalizedString(String key) + { + if(StatCollector.canTranslate(key)) + { + return StatCollector.translateToLocal(key); + } + return StatCollector.translateToFallback(key); + } + + public static String getLocalizedString(String key, Object... objects) + { + if(StatCollector.canTranslate(key)) + { + return String.format(StatCollector.translateToLocal(key), objects); + } + return String.format(StatCollector.translateToFallback(key), objects); + } +} diff --git a/src/Java/miscutil/core/xmod/forestry/apiculture/items/magicbees/MB_FrameType.java b/src/Java/miscutil/core/xmod/forestry/apiculture/items/magicbees/MB_FrameType.java new file mode 100644 index 0000000000..0d322d4498 --- /dev/null +++ b/src/Java/miscutil/core/xmod/forestry/apiculture/items/magicbees/MB_FrameType.java @@ -0,0 +1,107 @@ +package miscutil.core.xmod.forestry.apiculture.items.magicbees; + +import forestry.api.apiculture.IBeeGenome; +import forestry.api.apiculture.IBeeModifier; + +public enum MB_FrameType implements IBeeModifier +{ + ACCELERATED("Accelerated", 175, 1f, 2.5f, 0.9f, 1.8f, 1f), + VOID("Void", 20, 1f, 1f, 0.0001f, 10f, 1f); + + private final String frameName; + public final int maxDamage; + + private final float territoryMod; + private final float mutationMod; + private final float lifespanMod; + private final float productionMod; + private final float floweringMod; + private final float geneticDecayMod; + private final boolean isSealed; + private final boolean isLit; + private final boolean isSunlit; + private final boolean isHellish; + + MB_FrameType(String name, int damage, float territory, float mutation, float lifespan, float production, float geneticDecay) { + this(name, damage, territory, mutation, lifespan, production, 1f, geneticDecay, false, false, false, false); + } + + MB_FrameType(String name, int damage, + float territory, float mutation, float lifespan, float production, float flowering, float geneticDecay, + boolean sealed, boolean lit, boolean sunlit, boolean hellish) + { + this.frameName = name; + this.maxDamage = damage; + + this.territoryMod = territory; + this.mutationMod = mutation; + this.lifespanMod = lifespan; + this.productionMod = production; + this.floweringMod = flowering; + this.geneticDecayMod = geneticDecay; + this.isSealed = sealed; + this.isLit = lit; + this.isSunlit = sunlit; + this.isHellish = hellish; + } + + public String getName() + { + return this.frameName; + } + + public String getLocalizedName() + { + return FR_StringUtil.getLocalizedString("frame." + this.frameName); + } + + @Override + public float getTerritoryModifier(IBeeGenome genome, float currentModifier) { + return territoryMod; + } + + @Override + public float getMutationModifier(IBeeGenome genome, IBeeGenome mate, float currentModifier) { + return mutationMod; + } + + @Override + public float getLifespanModifier(IBeeGenome genome, IBeeGenome mate, float currentModifier) { + return lifespanMod; + } + + @Override + public float getProductionModifier(IBeeGenome genome, float currentModifier) { + return productionMod; + } + + @Override + public float getFloweringModifier(IBeeGenome genome, float currentModifier) { + return floweringMod; + } + + @Override + public float getGeneticDecay(IBeeGenome genome, float currentModifier) { + return geneticDecayMod; + } + + @Override + public boolean isSealed() { + return isSealed; + } + + @Override + public boolean isSelfLighted() { + return isLit; + } + + @Override + public boolean isSunlightSimulated() { + return isSunlit; + } + + @Override + public boolean isHellish() { + return isHellish; + } +} diff --git a/src/Java/miscutil/core/xmod/forestry/apiculture/items/magicbees/MB_HiveFrameType.java b/src/Java/miscutil/core/xmod/forestry/apiculture/items/magicbees/MB_HiveFrameType.java deleted file mode 100644 index 5921867eae..0000000000 --- a/src/Java/miscutil/core/xmod/forestry/apiculture/items/magicbees/MB_HiveFrameType.java +++ /dev/null @@ -1,107 +0,0 @@ -package miscutil.core.xmod.forestry.apiculture.items.magicbees; - -import forestry.api.apiculture.IBeeGenome; -import forestry.api.apiculture.IBeeModifier; - -public enum MB_HiveFrameType implements IBeeModifier -{ - ACCELERATED("Accelerated", 175, 1f, 2.5f, 0.9f, 1.8f, 1f), - VOID("Void", 20, 1f, 1f, 0.0001f, 10f, 1f); - - private final String frameName; - public final int maxDamage; - - private final float territoryMod; - private final float mutationMod; - private final float lifespanMod; - private final float productionMod; - private final float floweringMod; - private final float geneticDecayMod; - private final boolean isSealed; - private final boolean isLit; - private final boolean isSunlit; - private final boolean isHellish; - - MB_HiveFrameType(String name, int damage, float territory, float mutation, float lifespan, float production, float geneticDecay) { - this(name, damage, territory, mutation, lifespan, production, 1f, geneticDecay, false, false, false, false); - } - - MB_HiveFrameType(String name, int damage, - float territory, float mutation, float lifespan, float production, float flowering, float geneticDecay, - boolean sealed, boolean lit, boolean sunlit, boolean hellish) - { - this.frameName = name; - this.maxDamage = damage; - - this.territoryMod = territory; - this.mutationMod = mutation; - this.lifespanMod = lifespan; - this.productionMod = production; - this.floweringMod = flowering; - this.geneticDecayMod = geneticDecay; - this.isSealed = sealed; - this.isLit = lit; - this.isSunlit = sunlit; - this.isHellish = hellish; - } - - public String getName() - { - return this.frameName; - } - - public String getLocalizedName() - { - return FR_StringManager.getLocalizedString("frame." + this.frameName); - } - - @Override - public float getTerritoryModifier(IBeeGenome genome, float currentModifier) { - return territoryMod; - } - - @Override - public float getMutationModifier(IBeeGenome genome, IBeeGenome mate, float currentModifier) { - return mutationMod; - } - - @Override - public float getLifespanModifier(IBeeGenome genome, IBeeGenome mate, float currentModifier) { - return lifespanMod; - } - - @Override - public float getProductionModifier(IBeeGenome genome, float currentModifier) { - return productionMod; - } - - @Override - public float getFloweringModifier(IBeeGenome genome, float currentModifier) { - return floweringMod; - } - - @Override - public float getGeneticDecay(IBeeGenome genome, float currentModifier) { - return geneticDecayMod; - } - - @Override - public boolean isSealed() { - return isSealed; - } - - @Override - public boolean isSelfLighted() { - return isLit; - } - - @Override - public boolean isSunlightSimulated() { - return isSunlit; - } - - @Override - public boolean isHellish() { - return isHellish; - } -} diff --git a/src/Java/miscutil/core/xmod/forestry/apiculture/items/magicbees/MB_ItemFrame.java b/src/Java/miscutil/core/xmod/forestry/apiculture/items/magicbees/MB_ItemFrame.java new file mode 100644 index 0000000000..b12f29340c --- /dev/null +++ b/src/Java/miscutil/core/xmod/forestry/apiculture/items/magicbees/MB_ItemFrame.java @@ -0,0 +1,103 @@ +package miscutil.core.xmod.forestry.apiculture.items.magicbees; + +import miscutil.core.creative.AddToCreativeTab; +import miscutil.core.lib.CORE; +import net.minecraft.client.renderer.texture.IIconRegister; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import cpw.mods.fml.common.registry.GameRegistry; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import forestry.api.apiculture.IBee; +import forestry.api.apiculture.IBeeGenome; +import forestry.api.apiculture.IBeeHousing; +import forestry.api.apiculture.IBeeModifier; +import forestry.api.apiculture.IHiveFrame; + +public class MB_ItemFrame extends Item implements IHiveFrame +{ + private MB_FrameType type; + + public MB_ItemFrame(MB_FrameType frameType) + { + super(); + this.type = frameType; + this.setMaxDamage(this.type.maxDamage); + this.setMaxStackSize(1); + this.setCreativeTab(AddToCreativeTab.tabMisc); + this.setUnlocalizedName("frame" + frameType.getName()); + GameRegistry.registerItem(this, "frame" + frameType.getName()); + } + + @Override + @SideOnly(Side.CLIENT) + public void registerIcons(IIconRegister par1IconRegister) + { + this.itemIcon = par1IconRegister.registerIcon(CORE.MODID + ":frame" + type.getName()); + } + + // --------- IHiveFrame functions ----------------------------------------- + + @Override + public ItemStack frameUsed(IBeeHousing housing, ItemStack frame, IBee queen, int wear) { + frame.setItemDamage(frame.getItemDamage() + wear); + + if (frame.getItemDamage() >= frame.getMaxDamage()) { + // Break the frame. + frame = null; + } + + return frame; + } + + public IBeeModifier getBeeModifier() { + return type; + } + + @Override + public boolean isBookEnchantable(ItemStack itemstack1, ItemStack itemstack2) + { + return false; + } + + public float getTerritoryModifier(IBeeGenome genome, float currentModifier) { + return type.getTerritoryModifier(genome, currentModifier); + } + + public float getMutationModifier(IBeeGenome genome, IBeeGenome mate, float currentModifier) { + return type.getMutationModifier(genome, mate, currentModifier); + } + + public float getLifespanModifier(IBeeGenome genome, IBeeGenome mate, float currentModifier) { + return type.getLifespanModifier(genome, mate, currentModifier); + } + + public float getProductionModifier(IBeeGenome genome, float currentModifier) { + return type.getProductionModifier(genome, currentModifier); + } + + public float getFloweringModifier(IBeeGenome genome, float currentModifier) { + return type.getFloweringModifier(genome, currentModifier); + } + + public float getGeneticDecay(IBeeGenome genome, float currentModifier) { + return type.getGeneticDecay(genome, currentModifier); + } + + public boolean isSealed() { + return type.isSealed(); + } + + public boolean isSelfLighted() { + return type.isSelfLighted(); + } + + public boolean isSunlightSimulated() { + return type.isSunlightSimulated(); + } + + public boolean isHellish(){ + return type.isHellish(); + } + +} diff --git a/src/Java/miscutil/core/xmod/forestry/apiculture/items/magicbees/MB_ItemMagicHiveFrame.java b/src/Java/miscutil/core/xmod/forestry/apiculture/items/magicbees/MB_ItemMagicHiveFrame.java deleted file mode 100644 index 78e0afb55b..0000000000 --- a/src/Java/miscutil/core/xmod/forestry/apiculture/items/magicbees/MB_ItemMagicHiveFrame.java +++ /dev/null @@ -1,62 +0,0 @@ -package miscutil.core.xmod.forestry.apiculture.items.magicbees; - -import miscutil.core.creative.AddToCreativeTab; -import miscutil.core.lib.CORE; -import net.minecraft.client.renderer.texture.IIconRegister; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import cpw.mods.fml.common.registry.GameRegistry; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -import forestry.api.apiculture.IBee; -import forestry.api.apiculture.IBeeHousing; -import forestry.api.apiculture.IBeeModifier; -import forestry.api.apiculture.IHiveFrame; - -public class MB_ItemMagicHiveFrame extends Item implements IHiveFrame -{ - private MB_HiveFrameType type; - - public MB_ItemMagicHiveFrame(MB_HiveFrameType frameType) - { - super(); - this.type = frameType; - this.setMaxDamage(this.type.maxDamage); - this.setMaxStackSize(1); - this.setCreativeTab(AddToCreativeTab.tabMisc); - this.setUnlocalizedName("frame" + frameType.getName()); - GameRegistry.registerItem(this, "frame" + frameType.getName()); - } - - @SideOnly(Side.CLIENT) - public void registerIcons(IIconRegister par1IconRegister) - { - this.itemIcon = par1IconRegister.registerIcon(CORE.MODID + ":frame" + type.getName()); - } - - // --------- IHiveFrame functions ----------------------------------------- - - @Override - public ItemStack frameUsed(IBeeHousing housing, ItemStack frame, IBee queen, int wear) { - frame.setItemDamage(frame.getItemDamage() + wear); - - if (frame.getItemDamage() >= frame.getMaxDamage()) { - // Break the frame. - frame = null; - } - - return frame; - } - - @Override - public IBeeModifier getBeeModifier() { - return type; - } - - @Override - public boolean isBookEnchantable(ItemStack itemstack1, ItemStack itemstack2) - { - return false; - } - -} diff --git a/src/Java/miscutil/core/xmod/forestry/apiculture/multiblock/FR_TileAlveary.java b/src/Java/miscutil/core/xmod/forestry/apiculture/multiblock/FR_TileAlveary.java deleted file mode 100644 index 06633a87cf..0000000000 --- a/src/Java/miscutil/core/xmod/forestry/apiculture/multiblock/FR_TileAlveary.java +++ /dev/null @@ -1,199 +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 miscutil.core.xmod.forestry.apiculture.multiblock; - -import java.io.IOException; -import java.util.List; - -import miscutil.core.xmod.forestry.apiculture.blocks.FR_BlockAlveary; -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.IBeeHousing; -import forestry.api.apiculture.IBeeHousingInventory; -import forestry.api.apiculture.IBeeListener; -import forestry.api.apiculture.IBeeModifier; -import forestry.api.apiculture.IBeekeepingLogic; -import forestry.api.core.EnumHumidity; -import forestry.api.core.EnumTemperature; -import forestry.api.core.IErrorLogic; -import forestry.api.multiblock.IAlvearyComponent; -import forestry.api.multiblock.IMultiblockController; -import forestry.apiculture.multiblock.MultiblockLogicAlveary; -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 FR_TileAlveary extends MultiblockTileEntityForestry implements IBeeHousing, IAlvearyComponent, IRestrictedAccess, IStreamableGui, ITitled, IClimatised, IHintSource { - private final String unlocalizedTitle; - - protected FR_TileAlveary() { - this(FR_BlockAlveary.Type.PLAIN); - } - - protected FR_TileAlveary(FR_BlockAlveary.Type type) { - super(new MultiblockLogicAlveary()); - this.unlocalizedTitle = "tile.alveary." + type.ordinal() + ".name"; - } - - /* TEXTURES */ - public int getIcon(int side) { - return FR_BlockAlveary.PLAIN; - } - - @Override - public void onMachineAssembled(IMultiblockController multiblockController, ChunkCoordinates minCoord, ChunkCoordinates maxCoord) { - // Re-render this block on the client - if (worldObj.isRemote) { - this.worldObj.markBlockForUpdate(xCoord, yCoord, zCoord); - } - worldObj.notifyBlocksOfNeighborChange(xCoord, yCoord, zCoord, getBlockType()); - markDirty(); - } - - @Override - public void onMachineBroken() { - // Re-render this block on the client - if (worldObj.isRemote) { - this.worldObj.markBlockForUpdate(xCoord, yCoord, zCoord); - } - worldObj.notifyBlocksOfNeighborChange(xCoord, yCoord, zCoord, getBlockType()); - markDirty(); - } - - /* IHousing */ - @Override - public BiomeGenBase getBiome() { - return getMultiblockLogic().getController().getBiome(); - } - - /* IBeeHousing */ - @Override - public Iterable getBeeModifiers() { - return getMultiblockLogic().getController().getBeeModifiers(); - } - - @Override - public Iterable getBeeListeners() { - return getMultiblockLogic().getController().getBeeListeners(); - } - - @Override - public IBeeHousingInventory getBeeInventory() { - return getMultiblockLogic().getController().getBeeInventory(); - } - - @Override - public IBeekeepingLogic getBeekeepingLogic() { - return getMultiblockLogic().getController().getBeekeepingLogic(); - } - - @Override - public Vec3 getBeeFXCoordinates() { - return getMultiblockLogic().getController().getBeeFXCoordinates(); - } - - /* IClimatised */ - @Override - public EnumTemperature getTemperature() { - return getMultiblockLogic().getController().getTemperature(); - } - - @Override - public EnumHumidity getHumidity() { - return getMultiblockLogic().getController().getHumidity(); - } - - @Override - public int getBlockLightValue() { - return getMultiblockLogic().getController().getBlockLightValue(); - } - - @Override - public boolean canBlockSeeTheSky() { - return getMultiblockLogic().getController().canBlockSeeTheSky(); - } - - @Override - public IErrorLogic getErrorLogic() { - return getMultiblockLogic().getController().getErrorLogic(); - } - - @Override - public IAccessHandler getAccessHandler() { - return getMultiblockLogic().getController().getAccessHandler(); - } - - @Override - 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 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); - return null; //TODO - } - - @Override - public Object getContainer(EntityPlayer player, int data) { - //return new ContainerAlveary(player.inventory, this); - return null; //TODO - } -} diff --git a/src/Java/miscutil/core/xmod/forestry/apiculture/multiblock/TileAlvearyMutatron.java b/src/Java/miscutil/core/xmod/forestry/apiculture/multiblock/TileAlvearyMutatron.java deleted file mode 100644 index c784f69ea7..0000000000 --- a/src/Java/miscutil/core/xmod/forestry/apiculture/multiblock/TileAlvearyMutatron.java +++ /dev/null @@ -1,232 +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 miscutil.core.xmod.forestry.apiculture.multiblock; - -import java.util.Map.Entry; -import java.util.Stack; - -import miscutil.core.xmod.forestry.apiculture.blocks.FR_BlockAlveary; -import miscutil.core.xmod.forestry.apiculture.multiblock.inventory.FR_ContainerAlvearyMutatron; -import miscutil.core.xmod.forestry.apiculture.multiblock.inventory.FR_GuiAlvearyMutatron; -import miscutil.core.xmod.forestry.apiculture.multiblock.inventory.FR_InventoryMutatron; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.inventory.ISidedInventory; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.nbt.NBTTagList; -import forestry.api.apiculture.BeeManager; -import forestry.api.apiculture.EnumBeeType; -import forestry.api.apiculture.IBee; -import forestry.api.multiblock.IAlvearyComponent; -import forestry.apiculture.blocks.BlockAlveary; -import forestry.apiculture.network.packets.PacketActiveUpdate; -import forestry.apiculture.worldgen.Hive; -import forestry.apiculture.worldgen.HiveDecorator; -import forestry.apiculture.worldgen.HiveDescriptionSwarmer; -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; - -public class TileAlvearyMutatron extends FR_TileAlveary implements ISidedInventory, IActivatable, IAlvearyComponent.Active { - - private final FR_InventoryMutatron inventory; - private final Stack pendingSpawns = new Stack<>(); - private boolean active; - - public TileAlvearyMutatron() { - super(FR_BlockAlveary.Type.MUTATRON); - this.inventory = new FR_InventoryMutatron(this); - } - - @Override - public IInventoryAdapter getInternalInventory() { - return inventory; - } - - @Override - public boolean allowsAutomation() { - return true; - } - - /* UPDATING */ - @Override - public void updateServer(int tickCount) { - if (pendingSpawns.size() > 0) { - setActive(true); - if (tickCount % 1000 == 0) { - trySpawnSwarm(); - } - } else { - setActive(false); - } - - if (tickCount % 500 != 0) { - return; - } - - ItemStack princessStack = getPrincessStack(); - if (princessStack == null) { - return; - } - - int chance = consumeInducerAndGetChance(); - if (chance == 0) { - return; - } - - // Try to spawn princess - if (worldObj.rand.nextInt(1000) >= chance) { - return; - } - - // Queue swarm spawn - IBee princess = BeeManager.beeRoot.getMember(princessStack); - princess.setIsNatural(false); - pendingSpawns.push(BeeManager.beeRoot.getMemberStack(princess, EnumBeeType.PRINCESS.ordinal())); - } - - @Override - public void updateClient(int tickCount) { - - } - - private ItemStack getPrincessStack() { - ItemStack princessStack = getMultiblockLogic().getController().getBeeInventory().getQueen(); - - if (BeeManager.beeRoot.isMated(princessStack)) { - return princessStack; - } - - return null; - } - - private int consumeInducerAndGetChance() { - if (getInternalInventory() == null) { - return 0; - } - - for (IInvSlot slot : InventoryIterator.getIterable(getInternalInventory())) { - ItemStack stack = slot.getStackInSlot(); - for (Entry entry : BeeManager.inducers.entrySet()) { - if (ItemStackUtil.isIdenticalItem(entry.getKey(), stack)) { - slot.decreaseStackInSlot(); - return entry.getValue(); - } - } - } - - return 0; - } - - private void trySpawnSwarm() { - - ItemStack toSpawn = pendingSpawns.peek(); - HiveDescriptionSwarmer hiveDescription = new HiveDescriptionSwarmer(toSpawn); - Hive hive = new Hive(hiveDescription); - - int chunkX = (xCoord + worldObj.rand.nextInt(40 * 2) - 40) / 16; - int chunkZ = (zCoord + worldObj.rand.nextInt(40 * 2) - 40) / 16; - - if (HiveDecorator.genHive(worldObj, worldObj.rand, chunkX, chunkZ, hive)) { - pendingSpawns.pop(); - } - } - - /* NETWORK */ - - @Override - protected void encodeDescriptionPacket(NBTTagCompound packetData) { - super.encodeDescriptionPacket(packetData); - packetData.setBoolean("Active", active); - } - - @Override - protected void decodeDescriptionPacket(NBTTagCompound packetData) { - super.decodeDescriptionPacket(packetData); - setActive(packetData.getBoolean("Active")); - } - - /* TEXTURES */ - @Override - public int getIcon(int side) { - if (side == 0 || side == 1) { - return BlockAlveary.BOTTOM; - } - - if (active) { - return BlockAlveary.ALVEARY_SWARMER_ON; - } else { - return BlockAlveary.ALVEARY_SWARMER_OFF; - } - } - - /* SAVING & LOADING */ - @Override - public void readFromNBT(NBTTagCompound nbttagcompound) { - super.readFromNBT(nbttagcompound); - setActive(nbttagcompound.getBoolean("Active")); - - NBTTagList nbttaglist = nbttagcompound.getTagList("PendingSpawns", 10); - for (int i = 0; i < nbttaglist.tagCount(); i++) { - NBTTagCompound nbttagcompound1 = nbttaglist.getCompoundTagAt(i); - pendingSpawns.add(ItemStack.loadItemStackFromNBT(nbttagcompound1)); - } - } - - @Override - public void writeToNBT(NBTTagCompound nbttagcompound) { - super.writeToNBT(nbttagcompound); - nbttagcompound.setBoolean("Active", active); - - NBTTagList nbttaglist = new NBTTagList(); - ItemStack[] offspring = pendingSpawns.toArray(new ItemStack[pendingSpawns.size()]); - for (int i = 0; i < offspring.length; i++) { - if (offspring[i] != null) { - 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 active; - } - - @Override - public void setActive(boolean active) { - if (this.active == active) { - return; - } - - this.active = active; - - if (!worldObj.isRemote) { - Proxies.net.sendNetworkPacket(new PacketActiveUpdate(this), worldObj); - } - } - - @Override - public Object getGui(EntityPlayer player, int data) { - return new FR_GuiAlvearyMutatron(player.inventory, this); - } - - @Override - public Object getContainer(EntityPlayer player, int data) { - return new FR_ContainerAlvearyMutatron(player.inventory, this); - } -} diff --git a/src/Java/miscutil/core/xmod/forestry/apiculture/multiblock/inventory/FR_ContainerAlvearyMutatron.java b/src/Java/miscutil/core/xmod/forestry/apiculture/multiblock/inventory/FR_ContainerAlvearyMutatron.java deleted file mode 100644 index 5af0978631..0000000000 --- a/src/Java/miscutil/core/xmod/forestry/apiculture/multiblock/inventory/FR_ContainerAlvearyMutatron.java +++ /dev/null @@ -1,28 +0,0 @@ -package miscutil.core.xmod.forestry.apiculture.multiblock.inventory; - -import miscutil.core.xmod.forestry.apiculture.multiblock.TileAlvearyMutatron; -import net.minecraft.entity.player.InventoryPlayer; -import forestry.core.gui.ContainerTile; -import forestry.core.gui.slots.SlotFiltered; - -public class FR_ContainerAlvearyMutatron extends ContainerTile { - public FR_ContainerAlvearyMutatron(InventoryPlayer player, TileAlvearyMutatron tile) { - super(tile, player, 8, 87); - this.addSlotToContainer(new SlotFiltered(tile, 0, 79, 52)); - this.addSlotToContainer(new SlotFiltered(tile, 1, 100, 39)); - this.addSlotToContainer(new SlotFiltered(tile, 2, 58, 39)); - this.addSlotToContainer(new SlotFiltered(tile, 3, 79, 26)); - } -} - - -/******************************************************************************* - * Copyright (c) 2011-2014 SirSengir. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the GNU Lesser Public License v3 - * which accompanies this distribution, and is available at - * http://www.gnu.org/licenses/lgpl-3.0.txt - * - * Various Contributors including, but not limited to: - * SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges - ******************************************************************************/ diff --git a/src/Java/miscutil/core/xmod/forestry/apiculture/multiblock/inventory/FR_GuiAlvearyMutatron.java b/src/Java/miscutil/core/xmod/forestry/apiculture/multiblock/inventory/FR_GuiAlvearyMutatron.java deleted file mode 100644 index b85d5e38a0..0000000000 --- a/src/Java/miscutil/core/xmod/forestry/apiculture/multiblock/inventory/FR_GuiAlvearyMutatron.java +++ /dev/null @@ -1,26 +0,0 @@ -package miscutil.core.xmod.forestry.apiculture.multiblock.inventory; - -import miscutil.core.lib.CORE; -import miscutil.core.xmod.forestry.apiculture.multiblock.TileAlvearyMutatron; -import miscutil.core.xmod.forestry.core.gui.FR_GuiForestryTitled; -import net.minecraft.entity.player.InventoryPlayer; - -public class FR_GuiAlvearyMutatron extends FR_GuiForestryTitled { - - public FR_GuiAlvearyMutatron(InventoryPlayer inventory, TileAlvearyMutatron tile) { - super(CORE.MODID+"/swarmer.png", new FR_ContainerAlvearyMutatron(inventory, tile), tile); - } - - } - - -/******************************************************************************* - * 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 - ******************************************************************************/ \ No newline at end of file diff --git a/src/Java/miscutil/core/xmod/forestry/apiculture/multiblock/inventory/FR_InventoryMutatron.java b/src/Java/miscutil/core/xmod/forestry/apiculture/multiblock/inventory/FR_InventoryMutatron.java deleted file mode 100644 index aa51d3ebb1..0000000000 --- a/src/Java/miscutil/core/xmod/forestry/apiculture/multiblock/inventory/FR_InventoryMutatron.java +++ /dev/null @@ -1,29 +0,0 @@ -package miscutil.core.xmod.forestry.apiculture.multiblock.inventory; - -import miscutil.core.xmod.forestry.apiculture.multiblock.TileAlvearyMutatron; -import net.minecraft.item.ItemStack; -import forestry.api.apiculture.BeeManager; -import forestry.core.inventory.InventoryAdapterTile; -import forestry.core.utils.ItemStackUtil; - -public class FR_InventoryMutatron extends InventoryAdapterTile { - public FR_InventoryMutatron(TileAlvearyMutatron alvearyMutatron) { - super(alvearyMutatron, 4, "mutatronInv"); - } - @Override - public boolean canSlotAccept(int slotIndex, ItemStack itemStack) { - return ItemStackUtil.containsItemStack(BeeManager.inducers.keySet(), itemStack); - } -} - - -/******************************************************************************* - * 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 - ******************************************************************************/ \ No newline at end of file diff --git a/src/Java/miscutil/core/xmod/forestry/apiculture/multiblock/inventory/MutatronHandler.java b/src/Java/miscutil/core/xmod/forestry/apiculture/multiblock/inventory/MutatronHandler.java deleted file mode 100644 index e629eeca51..0000000000 --- a/src/Java/miscutil/core/xmod/forestry/apiculture/multiblock/inventory/MutatronHandler.java +++ /dev/null @@ -1,22 +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 miscutil.core.xmod.forestry.apiculture.multiblock.inventory; - -public class MutatronHandler { - - - - - - - - -} \ No newline at end of file diff --git a/src/Java/miscutil/core/xmod/forestry/apiculture/tiles/FR_TileHandler.java b/src/Java/miscutil/core/xmod/forestry/apiculture/tiles/FR_TileHandler.java deleted file mode 100644 index 7ab787052b..0000000000 --- a/src/Java/miscutil/core/xmod/forestry/apiculture/tiles/FR_TileHandler.java +++ /dev/null @@ -1,14 +0,0 @@ -package miscutil.core.xmod.forestry.apiculture.tiles; - -import miscutil.core.lib.CORE; -import miscutil.core.xmod.forestry.apiculture.multiblock.TileAlvearyMutatron; -import cpw.mods.fml.common.registry.GameRegistry; - -public class FR_TileHandler { - - public static void init(){ - if (CORE.DEBUG){ - GameRegistry.registerTileEntity(TileAlvearyMutatron.class, "MiscUtils.AlvearyMutatron"); - } - } -} diff --git a/src/Java/miscutil/core/xmod/forestry/core/gui/FR_FontRenderer.java b/src/Java/miscutil/core/xmod/forestry/core/gui/FR_FontRenderer.java deleted file mode 100644 index 27de0a712c..0000000000 --- a/src/Java/miscutil/core/xmod/forestry/core/gui/FR_FontRenderer.java +++ /dev/null @@ -1,111 +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 miscutil.core.xmod.forestry.core.gui; - -import net.minecraft.client.gui.FontRenderer; - -import org.lwjgl.opengl.GL11; - -import forestry.core.render.FontColour; - -public class FR_FontRenderer { - private static final int LINE_HEIGHT = 12; - - private final FR_GuiForestry guiForestry; - private final int defaultFontColor; - private FontRenderer fontRendererObj; - - public int column0; - public int column1; - public int column2; - public int line; - - public FR_FontRenderer(FR_GuiForestry guiForestry, FontColour fontColour) { - this.guiForestry = guiForestry; - this.defaultFontColor = fontColour.get("gui.screen"); - } - - public void setFontRendererObj(FontRenderer fontRendererObj) { - this.fontRendererObj = fontRendererObj; - } - - public void startPage() { - line = LINE_HEIGHT; - GL11.glPushMatrix(); - } - - public void startPage(int column0, int column1, int column2) { - - this.column0 = column0; - this.column1 = column1; - this.column2 = column2; - - startPage(); - } - - public int getLineY() { - return line; - } - - public void newLine() { - line += LINE_HEIGHT; - } - - public void newLineCompressed() { - line += (LINE_HEIGHT - 2); - } - - public void newLine(int lineHeight) { - line += lineHeight; - } - - public void endPage() { - GL11.glPopMatrix(); - } - - public void drawRow(String text0, String text1, String text2, int colour0, int colour1, int colour2) { - drawLine(text0, column0, colour0); - drawLine(text1, column1, colour1); - drawLine(text2, column2, colour2); - } - - public void drawLine(String text, int x) { - drawLine(text, x, defaultFontColor); - } - - public void drawSplitLine(String text, int x, int maxWidth) { - drawSplitLine(text, x, maxWidth, defaultFontColor); - } - - public void drawCenteredLine(String text, int x, int color) { - drawCenteredLine(text, x, guiForestry.getSizeX(), color); - } - - public void drawCenteredLine(String text, int x, int width, int color) { - fontRendererObj.drawString(text, guiForestry.getGuiLeft() + x + getCenteredOffset(text, width), guiForestry.getGuiTop() + line, color); - } - - public void drawLine(String text, int x, int color) { - fontRendererObj.drawString(text, guiForestry.getGuiLeft() + x, guiForestry.getGuiTop() + line, color); - } - - public void drawSplitLine(String text, int x, int maxWidth, int color) { - fontRendererObj.drawSplitString(text, guiForestry.getGuiLeft() + x, guiForestry.getGuiTop() + line, maxWidth, color); - } - - public int getCenteredOffset(String string) { - return getCenteredOffset(string, guiForestry.getSizeX()); - } - - public int getCenteredOffset(String string, int xWidth) { - return (xWidth - fontRendererObj.getStringWidth(string)) / 2; - } -} diff --git a/src/Java/miscutil/core/xmod/forestry/core/gui/FR_GuiForestry.java b/src/Java/miscutil/core/xmod/forestry/core/gui/FR_GuiForestry.java deleted file mode 100644 index 1a2863a528..0000000000 --- a/src/Java/miscutil/core/xmod/forestry/core/gui/FR_GuiForestry.java +++ /dev/null @@ -1,272 +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 miscutil.core.xmod.forestry.core.gui; - -import java.util.List; - -import miscutil.core.lib.CORE; -import net.minecraft.client.Minecraft; -import net.minecraft.client.gui.FontRenderer; -import net.minecraft.client.gui.inventory.GuiContainer; -import net.minecraft.client.renderer.OpenGlHelper; -import net.minecraft.client.renderer.RenderHelper; -import net.minecraft.client.renderer.entity.RenderItem; -import net.minecraft.entity.player.InventoryPlayer; -import net.minecraft.inventory.Container; -import net.minecraft.inventory.IInventory; -import net.minecraft.inventory.Slot; -import net.minecraft.util.ResourceLocation; - -import org.lwjgl.opengl.GL11; -import org.lwjgl.opengl.GL12; - -import forestry.api.core.IErrorLogicSource; -import forestry.api.core.IErrorSource; -import forestry.core.access.IRestrictedAccess; -import forestry.core.config.Config; -import forestry.core.gui.IHintSource; -import forestry.core.gui.ledgers.ClimateLedger; -import forestry.core.gui.ledgers.HintLedger; -import forestry.core.gui.ledgers.LedgerManager; -import forestry.core.gui.ledgers.OwnerLedger; -import forestry.core.gui.ledgers.PowerLedger; -import forestry.core.proxy.Proxies; -import forestry.core.render.FontColour; -import forestry.core.tiles.IClimatised; -import forestry.core.tiles.IPowerHandler; - -public abstract class FR_GuiForestry extends GuiContainer { - protected final I inventory; - protected final C container; - - public final ResourceLocation textureFile; - protected final FR_WidgetManager widgetManager; - protected LedgerManager ledgerManager; - protected FR_FontRenderer textLayout; - protected FontColour fontColor; - - protected FR_GuiForestry(String texture, C container, I inventory) { - this(new ResourceLocation(CORE.MODID, texture), container, inventory); - } - - protected FR_GuiForestry(ResourceLocation texture, C container, I inventory) { - super(container); - - this.widgetManager = new FR_WidgetManager(this); - - this.textureFile = texture; - - this.inventory = inventory; - this.container = container; - - this.fontColor = new FontColour(Proxies.