diff options
author | draknyte1 <draknyte1@hotmail.com> | 2016-11-04 15:23:26 +1000 |
---|---|---|
committer | draknyte1 <draknyte1@hotmail.com> | 2016-11-04 15:23:26 +1000 |
commit | 0669f5eb9d5029a8b94ec552171b0837605f7747 (patch) | |
tree | 6b40e64c04d51b7a33cf2f0b35f7232cf37c4247 /src/Java/gtPlusPlus/xmod/forestry/bees | |
parent | 3654052fb63a571c5eaca7f20714b87c17f7e966 (diff) | |
download | GT5-Unofficial-0669f5eb9d5029a8b94ec552171b0837605f7747.tar.gz GT5-Unofficial-0669f5eb9d5029a8b94ec552171b0837605f7747.tar.bz2 GT5-Unofficial-0669f5eb9d5029a8b94ec552171b0837605f7747.zip |
$ Cleaned up the entire project.
> Much neat, very nices.
Diffstat (limited to 'src/Java/gtPlusPlus/xmod/forestry/bees')
16 files changed, 821 insertions, 928 deletions
diff --git a/src/Java/gtPlusPlus/xmod/forestry/bees/alveary/AlvearyBeeListener.java b/src/Java/gtPlusPlus/xmod/forestry/bees/alveary/AlvearyBeeListener.java index 6736c54309..039c80fe00 100644 --- a/src/Java/gtPlusPlus/xmod/forestry/bees/alveary/AlvearyBeeListener.java +++ b/src/Java/gtPlusPlus/xmod/forestry/bees/alveary/AlvearyBeeListener.java @@ -6,13 +6,13 @@ import gtPlusPlus.xmod.forestry.bees.alveary.gui.InventoryFrameHousing; public class AlvearyBeeListener extends DefaultBeeListener { private final IAlvearyFrameHousing apiary; - public AlvearyBeeListener(IAlvearyFrameHousing apiary) { + public AlvearyBeeListener(final IAlvearyFrameHousing apiary) { this.apiary = apiary; } @Override - public void wearOutEquipment(int amount) { - InventoryFrameHousing apiaryInventory = apiary.getAlvearyInventory(); - apiaryInventory.wearOutFrames(apiary, amount); + 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/FR_AlvearyFrameBlock.java b/src/Java/gtPlusPlus/xmod/forestry/bees/alveary/FR_AlvearyFrameBlock.java index a304647f72..5c6956ec86 100644 --- a/src/Java/gtPlusPlus/xmod/forestry/bees/alveary/FR_AlvearyFrameBlock.java +++ b/src/Java/gtPlusPlus/xmod/forestry/bees/alveary/FR_AlvearyFrameBlock.java @@ -5,7 +5,7 @@ import com.mojang.authlib.GameProfile; import forestry.api.multiblock.*; import net.minecraft.util.ChunkCoordinates; -public class FR_AlvearyFrameBlock implements IAlvearyComponent, IMultiblockComponent{ +public class FR_AlvearyFrameBlock implements IAlvearyComponent, IMultiblockComponent { @Override public ChunkCoordinates getCoordinates() { @@ -14,28 +14,28 @@ public class FR_AlvearyFrameBlock implements IAlvearyComponent, IMultiblockCompo } @Override - public GameProfile getOwner() { + public IMultiblockLogicAlveary getMultiblockLogic() { // TODO Auto-generated method stub return null; } @Override - public void onMachineAssembled(IMultiblockController arg0, - ChunkCoordinates arg1, ChunkCoordinates arg2) { + public GameProfile getOwner() { // TODO Auto-generated method stub - + return null; } @Override - public void onMachineBroken() { + public void onMachineAssembled(final IMultiblockController arg0, final ChunkCoordinates arg1, + final ChunkCoordinates arg2) { // TODO Auto-generated method stub - + } @Override - public IMultiblockLogicAlveary getMultiblockLogic() { + public void onMachineBroken() { // 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 index b3eaa94566..d4fce6465b 100644 --- a/src/Java/gtPlusPlus/xmod/forestry/bees/alveary/FR_BlockAlveary.java +++ b/src/Java/gtPlusPlus/xmod/forestry/bees/alveary/FR_BlockAlveary.java @@ -23,252 +23,249 @@ import net.minecraft.util.IIcon; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; -public class FR_BlockAlveary extends BlockStructure -{ +public class FR_BlockAlveary extends BlockStructure { - public static enum Type - { - PLAIN, - ERROR, - FRAME, - MUTATOR, - - //Placeholder Values + public static enum Type { + PLAIN, ERROR, FRAME, MUTATOR, + + // Placeholder Values HEATER, HYGRO, STABILIZER, SIEVE; - public static final Type[] VALUES = values(); + public static final Type[] VALUES = Type.values(); - private Type() {} + private Type() { + } } - public FR_BlockAlveary() - { - super(new MaterialBeehive(false)); - setHardness(1.0F); - setCreativeTab(AddToCreativeTab.tabBlock); - setHarvestLevel("axe", 0); - - } + /* ICONS */ + public static final int PLAIN = 0; - @Override - public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float lx, float ly, float lz) - { - if (world.isRemote) return true; - - 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; - } + public static final int ENTRANCE = 1; - @Override - @SideOnly(Side.CLIENT) - public void getSubBlocks(Item item, CreativeTabs tab, List list) - { - for (int i = 0; i < 4; i++) { - if (i != 1 && i != 0) { - list.add(new ItemStack(item, 1, i)); - } - } - } + public static final int BOTTOM = 2; - @Override - public int getRenderType() - { - return 0; - } + public static final int LEFT = 3; - @Override - public boolean renderAsNormalBlock() - { - return true; - } + public static final int RIGHT = 4; - @Override - public ArrayList<ItemStack> getDrops(World world, int x, int y, int z, int metadata, int fortune) - { - ArrayList<ItemStack> drop = new ArrayList<ItemStack>(); - drop.add(new ItemStack(this, 1, metadata != 1 ? metadata : 0)); - return drop; - } + 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; + + public FR_BlockAlveary() { + super(new MaterialBeehive(false)); + this.setHardness(1.0F); + this.setCreativeTab(AddToCreativeTab.tabBlock); + this.setHarvestLevel("axe", 0); + + } @Override - public int getDamageValue(World world, int x, int y, int z) - { - int meta = world.getBlockMetadata(x, y, z); - return meta != 1 ? meta : 0; + public TileEntity createNewTileEntity(final World world, final int meta) { + return this.createTileEntity(world, meta); } - @Override - public TileEntity createTileEntity(World world, int metadata) - { - if ((metadata < 0) || (metadata > Type.VALUES.length)) { + public TileEntity createTileEntity(final World world, final int metadata) { + if (metadata < 0 || metadata > Type.VALUES.length) { return null; } - - - - 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"); + + 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(); + 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(String name) { - //int meta = this. - return super.setBlockName(name); - } - - @Override - public TileEntity createNewTileEntity(World world, int meta) - { - return createTileEntity(world, meta); + public ItemStack get(final Type type) { + return new ItemStack(this, 1, type.ordinal()); } - - /* 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) + 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)]; + } @Override - public void registerBlockIcons(IIconRegister register) { - icons = new IIcon[9]; - 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.framehousing.off"); - icons[6] = TextureManager.registerTex(register, "apiculture/alveary.framehousing.on"); - icons[7] = TextureManager.registerTex(register, "apiculture/alveary.mutator.off"); - icons[8] = TextureManager.registerTex(register, "apiculture/alveary.mutator.on"); + 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; } - @SideOnly(Side.CLIENT) @Override - public IIcon getIcon(int side, int metadata) { - if ((metadata <= 1 - || metadata == Type.FRAME.ordinal() || metadata == Type.MUTATOR.ordinal()) - && (side == 1 || side == 0)) { - return icons[BOTTOM]; - } - Type type = Type.VALUES[metadata]; - switch (type) { - case ERROR: - return icons[PLAIN]; - case FRAME: - return icons[ALVEARY_FRAME_OFF]; - case MUTATOR: - return icons[ALVEARY_MUTATOR_OFF]; - case HEATER: - return icons[ALVEARY_MUTATOR_OFF]; - case HYGRO: - return icons[ALVEARY_MUTATOR_OFF]; - case STABILIZER: - return icons[PLAIN]; - case SIEVE: - return icons[PLAIN]; - default: - return null; - } + 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<ItemStack>(); + drop.add(new ItemStack(this, 1, metadata != 1 ? metadata : 0)); + return drop; } @SideOnly(Side.CLIENT) @Override - public IIcon getIcon(IBlockAccess world, int x, int y, int z, int side) { - int meta = world.getBlockMetadata(x, y, z); + 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 getBlockTextureFromSideAndTile(world, x, y, z, side); } - Block blockXP = world.getBlock(x + 1, y, z); - Block blockXM = world.getBlock(x - 1, y, z); + 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 switchForSide(42, side); + return this.switchForSide(42, side); } - return switchForSide(41, side); + return this.switchForSide(41, side); } return this.getIcon(side, meta); - } else if (blockXP != this && blockXM == this) { + } + 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); + return this.switchForSide(41, side); } - return switchForSide(42, side); + return this.switchForSide(42, side); } 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 FR_TileAlveary)) { - return getIcon(side, 0); + @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[FR_BlockAlveary.BOTTOM]; + } + final Type type = Type.VALUES[metadata]; + switch (type) { + case ERROR: + return this.icons[FR_BlockAlveary.PLAIN]; + case FRAME: + return this.icons[FR_BlockAlveary.ALVEARY_FRAME_OFF]; + case MUTATOR: + return this.icons[FR_BlockAlveary.ALVEARY_MUTATOR_OFF]; + case HEATER: + return this.icons[FR_BlockAlveary.ALVEARY_MUTATOR_OFF]; + case HYGRO: + return this.icons[FR_BlockAlveary.ALVEARY_MUTATOR_OFF]; + case STABILIZER: + return this.icons[FR_BlockAlveary.PLAIN]; + case SIEVE: + return this.icons[FR_BlockAlveary.PLAIN]; + default: + return null; } - return icons[((FR_TileAlveary) tile).getIcon(side)]; } + @Override + public int getRenderType() { + return 0; + } + + @Override @SideOnly(Side.CLIENT) - private IIcon switchForSide(int textureId, int side) { - if (side == 4 || side == 5) { - if (textureId == 41) { - return icons[LEFT]; + 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)); } - return icons[RIGHT]; - } else if (textureId == 41) { - return icons[RIGHT]; - } else { - return icons[LEFT]; } } + + @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 - public void onNeighborBlockChange(World world, int x, int y, int z, Block block) { + 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); - TileEntity tileEntity = world.getTileEntity(x, y, z); + final TileEntity tileEntity = world.getTileEntity(x, y, z); if (tileEntity instanceof FR_TileAlveary) { - FR_TileAlveary tileAlveary = (FR_TileAlveary) tileEntity; + 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(Type type) { - return new ItemStack(this, 1, type.ordinal()); + + @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"); + } + + @Override + public boolean renderAsNormalBlock() { + return true; + } + + @Override + public Block setBlockName(final String name) { + // int meta = this. + return super.setBlockName(name); + } + + @SideOnly(Side.CLIENT) + private IIcon switchForSide(final int textureId, final int side) { + if (side == 4 || side == 5) { + if (textureId == 41) { + return this.icons[FR_BlockAlveary.LEFT]; + } + return this.icons[FR_BlockAlveary.RIGHT]; + } + else if (textureId == 41) { + return this.icons[FR_BlockAlveary.RIGHT]; + } + else { + return this.icons[FR_BlockAlveary.LEFT]; + } } }
\ 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 index 5c456916f0..2db809ae90 100644 --- a/src/Java/gtPlusPlus/xmod/forestry/bees/alveary/FR_TileAlveary.java +++ b/src/Java/gtPlusPlus/xmod/forestry/bees/alveary/FR_TileAlveary.java @@ -21,169 +21,142 @@ 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 -{ +public abstract class FR_TileAlveary extends MultiblockTileEntityForestry<MultiblockLogicAlveary> + implements IBeeHousing, IAlvearyComponent, IRestrictedAccess, IStreamableGui, ITitled, IClimatised, IHintSource, + IGuiHandlerForestry { private final String unlocalizedTitle; - protected FR_TileAlveary() - { + protected FR_TileAlveary() { this(FR_BlockAlveary.Type.ERROR); } - protected FR_TileAlveary(FR_BlockAlveary.Type type) - { + protected FR_TileAlveary(final FR_BlockAlveary.Type type) { super(new MultiblockLogicAlveary()); - this.unlocalizedTitle = ("advanced.tile.for.alveary." + type.ordinal() + ".name"); - - } + this.unlocalizedTitle = "advanced.tile.for.alveary." + type.ordinal() + ".name"; - public int getIcon(int side) - { - return 0; } @Override - public void onMachineAssembled(IMultiblockController multiblockController, ChunkCoordinates minCoord, ChunkCoordinates maxCoord) - { - if (this.worldObj.isRemote) { - this.worldObj.markBlockForUpdate(this.xCoord, this.yCoord, this.zCoord); - } - this.worldObj.notifyBlocksOfNeighborChange(this.xCoord, this.yCoord, this.zCoord, getBlockType()); - markDirty(); + public boolean canBlockSeeTheSky() { + return this.getMultiblockLogic().getController().canBlockSeeTheSky(); } @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, getBlockType()); - markDirty(); + public IAccessHandler getAccessHandler() { + return this.getMultiblockLogic().getController().getAccessHandler(); } @Override - public BiomeGenBase getBiome() - { - return ((MultiblockLogicAlveary)getMultiblockLogic()).getController().getBiome(); + public Vec3 getBeeFXCoordinates() { + return this.getMultiblockLogic().getController().getBeeFXCoordinates(); } @Override - public Iterable<IBeeModifier> getBeeModifiers() - { - return ((MultiblockLogicAlveary)getMultiblockLogic()).getController().getBeeModifiers(); + public IBeeHousingInventory getBeeInventory() { + return this.getMultiblockLogic().getController().getBeeInventory(); } @Override - public Iterable<IBeeListener> getBeeListeners() - { - return ((MultiblockLogicAlveary)getMultiblockLogic()).getController().getBeeListeners(); + public IBeekeepingLogic getBeekeepingLogic() { + return this.getMultiblockLogic().getController().getBeekeepingLogic(); } @Override - public IBeeHousingInventory getBeeInventory() - { - return ((MultiblockLogicAlveary)getMultiblockLogic()).getController().getBeeInventory(); + public Iterable<IBeeListener> getBeeListeners() { + return this.getMultiblockLogic().getController().getBeeListeners(); } @Override - public IBeekeepingLogic getBeekeepingLogic() - { - return ((MultiblockLogicAlveary)getMultiblockLogic()).getController().getBeekeepingLogic(); + public Iterable<IBeeModifier> getBeeModifiers() { + return this.getMultiblockLogic().getController().getBeeModifiers(); } @Override - public Vec3 getBeeFXCoordinates() - { - return ((MultiblockLogicAlveary)getMultiblockLogic()).getController().getBeeFXCoordinates(); + public BiomeGenBase getBiome() { + return this.getMultiblockLogic().getController().getBiome(); } @Override - public EnumTemperature getTemperature() - { - return ((MultiblockLogicAlveary)getMultiblockLogic()).getController().getTemperature(); + public int getBlockLightValue() { + return this.getMultiblockLogic().getController().getBlockLightValue(); } @Override - public EnumHumidity getHumidity() - { - return ((MultiblockLogicAlveary)getMultiblockLogic()).getController().getHumidity(); + public IErrorLogic getErrorLogic() { + return this.getMultiblockLogic().getController().getErrorLogic(); } @Override - public int getBlockLightValue() - { - return ((MultiblockLogicAlveary)getMultiblockLogic()).getController().getBlockLightValue(); + public float getExactHumidity() { + return this.getMultiblockLogic().getController().getExactHumidity(); } @Override - public boolean canBlockSeeTheSky() - { - return ((MultiblockLogicAlveary)getMultiblockLogic()).getController().canBlockSeeTheSky(); + public float getExactTemperature() { + return this.getMultiblockLogic().getController().getExactTemperature(); } @Override - public IErrorLogic getErrorLogic() - { - return ((MultiblockLogicAlveary)getMultiblockLogic()).getController().getErrorLogic(); + public List<String> getHints() { + return Config.hints.get("apiary"); } @Override - public IAccessHandler getAccessHandler() - { - return ((MultiblockLogicAlveary)getMultiblockLogic()).getController().getAccessHandler(); + public EnumHumidity getHumidity() { + return this.getMultiblockLogic().getController().getHumidity(); + } + + public int getIcon(final int side) { + return 0; } @Override - public void onSwitchAccess(EnumAccess oldAccess, EnumAccess newAccess) - { - ((MultiblockLogicAlveary)getMultiblockLogic()).getController().onSwitchAccess(oldAccess, newAccess); + public IInventoryAdapter getInternalInventory() { + return this.getMultiblockLogic().getController().getInternalInventory(); } @Override - public IInventoryAdapter getInternalInventory() - { - return ((MultiblockLogicAlveary)getMultiblockLogic()).getController().getInternalInventory(); + public EnumTemperature getTemperature() { + return this.getMultiblockLogic().getController().getTemperature(); } @Override - public String getUnlocalizedTitle() - { + public String getUnlocalizedTitle() { return this.unlocalizedTitle; } @Override - public List<String> getHints() - { - return Config.hints.get("apiary"); + 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 float getExactTemperature() - { - return ((MultiblockLogicAlveary)getMultiblockLogic()).getController().getExactTemperature(); + 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 float getExactHumidity() - { - return ((MultiblockLogicAlveary)getMultiblockLogic()).getController().getExactHumidity(); + public void onSwitchAccess(final EnumAccess oldAccess, final EnumAccess newAccess) { + this.getMultiblockLogic().getController().onSwitchAccess(oldAccess, newAccess); } @Override - public void writeGuiData(DataOutputStreamForestry data) - throws IOException - { - ((MultiblockLogicAlveary)getMultiblockLogic()).getController().writeGuiData(data); + public void readGuiData(final DataInputStreamForestry data) throws IOException { + this.getMultiblockLogic().getController().readGuiData(data); } @Override - public void readGuiData(DataInputStreamForestry data) - throws IOException - { - ((MultiblockLogicAlveary)getMultiblockLogic()).getController().readGuiData(data); + public void writeGuiData(final DataOutputStreamForestry data) throws IOException { + this.getMultiblockLogic().getController().writeGuiData(data); } } diff --git a/src/Java/gtPlusPlus/xmod/forestry/bees/alveary/IAlvearyComponentAdvanced.java b/src/Java/gtPlusPlus/xmod/forestry/bees/alveary/IAlvearyComponentAdvanced.java index b55d2d37a6..c5c2e0c8f4 100644 --- a/src/Java/gtPlusPlus/xmod/forestry/bees/alveary/IAlvearyComponentAdvanced.java +++ b/src/Java/gtPlusPlus/xmod/forestry/bees/alveary/IAlvearyComponentAdvanced.java @@ -5,24 +5,16 @@ 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 abstract interface IAlvearyComponentAdvanced<T extends IMultiblockLogicAlveary> extends IMultiblockComponent { + public static abstract interface BeeModifier extends IAlvearyComponentAdvanced { + public abstract IBeeModifier getBeeModifier(); + } - - public static abstract interface FrameHouse - extends IAlvearyComponentAdvanced - { + 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(); - } + @Override + public abstract T getMultiblockLogic(); } diff --git a/src/Java/gtPlusPlus/xmod/forestry/bees/alveary/IAlvearyFrameHousing.java b/src/Java/gtPlusPlus/xmod/forestry/bees/alveary/IAlvearyFrameHousing.java index 6eeefa2696..d4166b00c9 100644 --- a/src/Java/gtPlusPlus/xmod/forestry/bees/alveary/IAlvearyFrameHousing.java +++ b/src/Java/gtPlusPlus/xmod/forestry/bees/alveary/IAlvearyFrameHousing.java @@ -5,5 +5,6 @@ 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 index 5c485a9618..f8724fc840 100644 --- a/src/Java/gtPlusPlus/xmod/forestry/bees/alveary/ISidedFrameWearingInventory.java +++ b/src/Java/gtPlusPlus/xmod/forestry/bees/alveary/ISidedFrameWearingInventory.java @@ -3,8 +3,6 @@ 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); +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 index 1e6507208c..af1e0b95b3 100644 --- a/src/Java/gtPlusPlus/xmod/forestry/bees/alveary/TileAlvearyFrameHousing.java +++ b/src/Java/gtPlusPlus/xmod/forestry/bees/alveary/TileAlvearyFrameHousing.java @@ -7,7 +7,6 @@ import forestry.api.arboriculture.EnumGermlingType; import forestry.api.genetics.*; import forestry.api.multiblock.IAlvearyComponent; import forestry.apiculture.AlvearyBeeModifier; -import forestry.apiculture.multiblock.MultiblockLogicAlveary; import forestry.apiculture.network.packets.PacketActiveUpdate; import forestry.apiculture.worldgen.*; import forestry.core.inventory.IInventoryAdapter; @@ -25,17 +24,44 @@ 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<ItemStack>(); - private boolean active; - - public TileAlvearyFrameHousing() - { +public class TileAlvearyFrameHousing extends FR_TileAlveary implements ISidedFrameWearingInventory, IActivatable, + IAlvearyComponent.Active, IAlvearyComponent.BeeModifier, IAlvearyFrameHousing, IAlvearyComponent.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; + } + } + private final InventoryFrameHousing inventory; + private final IBeeListener beeListener; + private final Stack<ItemStack> pendingSpawns = new Stack<ItemStack>(); + + private boolean active; + + private final IBeeModifier beeModifier = new AlvearyBeeModifier(); + + // private final IBeeListener beeListener = new AlvearyBeeListener(this); + private final Iterable<IBeeListener> beeListenerList = this.getMultiblockLogic().getController() + .getBeeListeners(); + + public TileAlvearyFrameHousing() { super(FR_BlockAlveary.Type.FRAME); this.inventory = new InventoryFrameHousing(this); this.beeListener = new AlvearyFrameHousingBeeListener(this.inventory); @@ -43,113 +69,101 @@ implements ISidedFrameWearingInventory, IActivatable, IAlvearyComponent.Active, } @Override - public IInventoryAdapter getInternalInventory() - { - return this.inventory; - } - - @Override - public boolean allowsAutomation() - { + public boolean allowsAutomation() { return true; } - @Override - public void updateServer(int tickCount) - { - - if (getInternalInventory() == null) { - return; + private int consumeInducerAndGetChance() { + if (this.getInternalInventory() == null) { + return 0; } - - if (this.inventory.getStackInSlot(0) != null) - { - if (((MultiblockLogicAlveary)getMultiblockLogic()).getController().getBeekeepingLogic().canWork()){ - setActive(true); - if (tickCount % 1000 == 0) { - wearOutFrames(this, 1); + 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(); } } - else { - Utils.LOG_INFO("Cannot work - Probably no queen alive."); - } - - } - else - { - setActive(false); - } - if (tickCount % 500 != 0) { - return; } + final IInvSlot slot; + final ItemStack stack; + return 0; + } + @Override + protected void decodeDescriptionPacket(final NBTTagCompound packetData) { + super.decodeDescriptionPacket(packetData); + this.setActive(packetData.getBoolean("Active")); + } + + @Override + protected void encodeDescriptionPacket(final NBTTagCompound packetData) { + super.encodeDescriptionPacket(packetData); + packetData.setBoolean("Active", this.active); } @Override - public void updateClient(int tickCount) {} + public InventoryFrameHousing getAlvearyInventory() { + return this.inventory; + } - private ItemStack getPrincessStack() - { - ItemStack princessStack = ((MultiblockLogicAlveary)getMultiblockLogic()).getController().getBeeInventory().getQueen(); - if (BeeManager.beeRoot.isMated(princessStack)) { - return princessStack; - } - return null; + @Override + public IBeeListener getBeeListener() { + return this.beeListener; } - private int consumeInducerAndGetChance() - { - if (getInternalInventory() == null) { - return 0; - } - for (Iterator<?> i$ = InventoryIterator.getIterable(getInternalInventory()).iterator(); i$.hasNext();) - { - IInvSlot slot = (IInvSlot)i$.next(); - ItemStack stack = slot.getStackInSlot(); - for (Map.Entry<ItemStack, Integer> entry : BeeManager.inducers.entrySet()) { - if (ItemStackUtil.isIdenticalItem((ItemStack)entry.getKey(), stack)) - { - slot.decreaseStackInSlot(); - return ((Integer)entry.getValue()).intValue(); - } - } + @Override + public IBeeModifier getBeeModifier() { + final List<IBeeModifier> beeModifiers = new ArrayList<IBeeModifier>(); + + // beeModifiers.add(this.beeModifier); + for (final IHiveFrame frame : this.getFrames(this.inventory)) { + beeModifiers.add(frame.getBeeModifier()); } - IInvSlot slot; - ItemStack stack; - return 0; + return beeModifiers.get(0); } - private void trySpawnSwarm() - { - ItemStack toSpawn = (ItemStack)this.pendingSpawns.peek(); - HiveDescriptionSwarmer hiveDescription = new HiveDescriptionSwarmer(new ItemStack[] { toSpawn }); - Hive hive = new Hive(hiveDescription); + @Override + public Collection<IBeeModifier> getBeeModifiers() { + final List<IBeeModifier> beeModifiers = new ArrayList<IBeeModifier>(); - int chunkX = (this.xCoord + this.worldObj.rand.nextInt(80) - 40) / 16; - 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(); + beeModifiers.add(this.beeModifier); + for (final IHiveFrame frame : this.getFrames(this.inventory)) { + beeModifiers.add(frame.getBeeModifier()); } + return beeModifiers; } @Override - protected void encodeDescriptionPacket(NBTTagCompound packetData) - { - super.encodeDescriptionPacket(packetData); - packetData.setBoolean("Active", this.active); + public Object getContainer(final EntityPlayer player, final int data) { + return new CONTAINER_FrameHousing(this, player); + } + + public Collection<IHiveFrame> getFrames(final IInventory inventory) { + final Collection<IHiveFrame> hiveFrames = new ArrayList<IHiveFrame>(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 - protected void decodeDescriptionPacket(NBTTagCompound packetData) - { - super.decodeDescriptionPacket(packetData); - setActive(packetData.getBoolean("Active")); + public Object getGui(final EntityPlayer player, final int data) { + return new GUI_FrameHousing(this, player); } @Override - public int getIcon(int side) - { - if ((side == 0) || (side == 1)) { + public int getIcon(final int side) { + if (side == 0 || side == 1) { return 2; } if (this.active) { @@ -159,48 +173,41 @@ implements ISidedFrameWearingInventory, IActivatable, IAlvearyComponent.Active, } @Override - public void readFromNBT(NBTTagCompound nbttagcompound) - { - super.readFromNBT(nbttagcompound); - setActive(nbttagcompound.getBoolean("Active")); + public IInventoryAdapter getInternalInventory() { + return this.inventory; + } - NBTTagList nbttaglist = nbttagcompound.getTagList("PendingSpawns", 10); - for (int i = 0; i < nbttaglist.tagCount(); i++) - { - NBTTagCompound nbttagcompound1 = nbttaglist.getCompoundTagAt(i); - this.pendingSpawns.add(ItemStack.loadItemStackFromNBT(nbttagcompound1)); + private ItemStack getPrincessStack() { + final ItemStack princessStack = this.getMultiblockLogic().getController().getBeeInventory().getQueen(); + if (BeeManager.beeRoot.isMated(princessStack)) { + return princessStack; } + return null; + } + private ItemStack getQueenStack() { + final ItemStack queenStack = this.getMultiblockLogic().getController().getBeeInventory().getQueen(); + return queenStack; } @Override - public void writeToNBT(NBTTagCompound nbttagcompound) - { - super.writeToNBT(nbttagcompound); - nbttagcompound.setBoolean("Active", this.active); - - NBTTagList nbttaglist = new NBTTagList(); - ItemStack[] offspring = (ItemStack[])this.pendingSpawns.toArray(new ItemStack[this.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); + public boolean isActive() { + return this.active; } @Override - public boolean isActive() - { - return this.active; + 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 setActive(boolean active) - { + public void setActive(final boolean active) { if (this.active == active) { return; } @@ -210,133 +217,91 @@ implements ISidedFrameWearingInventory, IActivatable, IAlvearyComponent.Active, } } - @Override - public Object getGui(EntityPlayer player, int data) - { - return new GUI_FrameHousing(this, player); + 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 - public Object getContainer(EntityPlayer player, int data) - { - return new CONTAINER_FrameHousing(this, player); + public void updateClient(final int tickCount) { } - private final IBeeModifier beeModifier = new AlvearyBeeModifier(); - //private final IBeeListener beeListener = new AlvearyBeeListener(this); - private final Iterable<IBeeListener> beeListenerList = ((MultiblockLogicAlveary)getMultiblockLogic()).getController().getBeeListeners(); - @Override - public Collection<IBeeModifier> getBeeModifiers() - { - List<IBeeModifier> beeModifiers = new ArrayList<IBeeModifier>(); + public void updateServer(final int tickCount) { - beeModifiers.add(this.beeModifier); - for (IHiveFrame frame : getFrames(this.inventory)) { - beeModifiers.add(frame.getBeeModifier()); + if (this.getInternalInventory() == null) { + return; } - return beeModifiers; - } - public Collection<IHiveFrame> getFrames(IInventory inventory) - { - Collection<IHiveFrame> hiveFrames = new ArrayList<IHiveFrame>(inventory.getSizeInventory()); - for (int i = 0; i < inventory.getSizeInventory(); i++) - { - ItemStack stackInSlot = getStackInSlot(i); - if (stackInSlot != null) - { - Item itemInSlot = stackInSlot.getItem(); - if ((itemInSlot instanceof IHiveFrame)) { - hiveFrames.add((IHiveFrame)itemInSlot); + if (this.inventory.getStackInSlot(0) != null) { + if (this.getMultiblockLogic().getController().getBeekeepingLogic().canWork()) { + this.setActive(true); + if (tickCount % 1000 == 0) { + this.wearOutFrames(this, 1); } } - } - return hiveFrames; - } - - @Override - public IBeeModifier getBeeModifier() { - List<IBeeModifier> beeModifiers = new ArrayList<IBeeModifier>(); + else { + Utils.LOG_INFO("Cannot work - Probably no queen alive."); + } - //beeModifiers.add(this.beeModifier); - for (IHiveFrame frame : getFrames(this.inventory)) { - beeModifiers.add(frame.getBeeModifier()); } - return beeModifiers.get(0); - } + else { + this.setActive(false); + } + if (tickCount % 500 != 0) { + return; + } - private ItemStack getQueenStack() - { - ItemStack queenStack = ((MultiblockLogicAlveary)getMultiblockLogic()).getController().getBeeInventory().getQueen(); - return queenStack; } @Override - public void wearOutFrames(IBeeHousing beeHousing, int amount) - { - IBeekeepingMode beekeepingMode = BeeManager.beeRoot.getBeekeepingMode(beeHousing.getWorld()); - int wear = Math.round(amount * beekeepingMode.getWearModifier()); - for (int i = 0; i < this.inventory.getSizeInventory(); i++) - { - ItemStack hiveFrameStack = getStackInSlot(i); - if (hiveFrameStack != null) - { - Item hiveFrameItem = hiveFrameStack.getItem(); - if ((hiveFrameItem instanceof IHiveFrame)) - { - IHiveFrame hiveFrame = (IHiveFrame)hiveFrameItem; - Utils.LOG_INFO("Wearing out frame by "+amount); - ItemStack queenStack = getQueenStack(); - IBee queen = BeeManager.beeRoot.getMember(queenStack); - ItemStack usedFrame = hiveFrame.frameUsed(beeHousing, hiveFrameStack, queen, wear); - - //((MultiblockLogicAlveary)getMultiblockLogic()).getController().getBeeListeners(). - - setInventorySlotContents(i, usedFrame); + 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 inventory; - } + public void writeToNBT(final NBTTagCompound nbttagcompound) { + super.writeToNBT(nbttagcompound); + nbttagcompound.setBoolean("Active", this.active); - @Override - public IBeeListener getBeeListener() { - return beeListener; + 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); } - - static class AlvearyFrameHousingBeeListener - extends DefaultBeeListener - { - private final InventoryFrameHousing inventory; - - public AlvearyFrameHousingBeeListener(InventoryFrameHousing inventory) - { - this.inventory = inventory; - } - - @Override - public boolean onPollenRetrieved(IIndividual pollen) - { - /*if (!((Object) this.inventory).canStorePollen()) { - return false; - }*/ - ISpeciesRoot speciesRoot = AlleleManager.alleleRegistry.getSpeciesRoot(pollen.getClass()); - - 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 index 5e218667f6..c8e4081ee3 100644 --- a/src/Java/gtPlusPlus/xmod/forestry/bees/alveary/gui/CONTAINER_FrameHousing.java +++ b/src/Java/gtPlusPlus/xmod/forestry/bees/alveary/gui/CONTAINER_FrameHousing.java @@ -11,88 +11,75 @@ import net.minecraft.inventory.Slot; import net.minecraft.item.ItemStack; import net.minecraft.util.ResourceLocation; -public class CONTAINER_FrameHousing extends Container -{ - private TileAlvearyFrameHousing te; +public class CONTAINER_FrameHousing extends Container { + public static final int INPUT_1 = 0; - 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 final TileAlvearyFrameHousing te; + 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; + private int slotID = 0; - public CONTAINER_FrameHousing(TileAlvearyFrameHousing te, EntityPlayer player) - { + public CONTAINER_FrameHousing(final TileAlvearyFrameHousing te, final EntityPlayer player) { this.te = te; - this.beeFrameSlot = new SlotFrame(te, slotID++, 80, 35); + this.beeFrameSlot = new SlotFrame(te, this.slotID++, 80, 35); - //Fuel Slot A - beeFrameSlot.setBackgroundIconTexture(beeFrameIcon); - - addSlotToContainer(beeFrameSlot); + // Fuel Slot A + this.beeFrameSlot.setBackgroundIconTexture(this.beeFrameIcon); - //Inventory - for (int i = 0; i < 3; i++) - { - for (int j = 0; j < 9; j++) - { - addSlotToContainer(new Slot(player.inventory, j + i * 9 + 9, 8 + j * 18, 84 + i * 18)); + 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++) - { - addSlotToContainer(new Slot(player.inventory, i, 8 + i * 18, 142)); + for (int i = 0; i < 9; i++) { + this.addSlotToContainer(new Slot(player.inventory, i, 8 + i * 18, 142)); } } @Override - public ItemStack transferStackInSlot(EntityPlayer player, int slotRaw) - { + public boolean canInteractWith(final EntityPlayer player) { + return this.te.isUseableByPlayer(player); + } + + @Override + public ItemStack transferStackInSlot(final EntityPlayer player, final int slotRaw) { ItemStack stack = null; - Slot slot = (Slot)inventorySlots.get(slotRaw); + final Slot slot = (Slot) this.inventorySlots.get(slotRaw); - if (slot != null && slot.getHasStack()) - { - ItemStack stackInSlot = slot.getStack(); + 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: + + // 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 (!(stack.getItem() instanceof IHiveFrame)) { + return null; } - if (slotRaw < 1) - { - if (!mergeItemStack(stackInSlot, 3 * 9, inventorySlots.size(), true)) - { + if (slotRaw < 1) { + if (!this.mergeItemStack(stackInSlot, 3 * 9, this.inventorySlots.size(), true)) { return null; } } - else if (!mergeItemStack(stackInSlot, 0, 3 * 9, false)) - { + else if (!this.mergeItemStack(stackInSlot, 0, 3 * 9, false)) { return null; } - if (stackInSlot.stackSize == 0) - { - slot.putStack((ItemStack)null); + if (stackInSlot.stackSize == 0) { + slot.putStack((ItemStack) null); } - else - { + else { slot.onSlotChanged(); } } return stack; } - - @Override - public boolean canInteractWith(EntityPlayer player) - { - return 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 index 2a4000ddb4..1acbfd534e 100644 --- a/src/Java/gtPlusPlus/xmod/forestry/bees/alveary/gui/GUI_FrameHousing.java +++ b/src/Java/gtPlusPlus/xmod/forestry/bees/alveary/gui/GUI_FrameHousing.java @@ -11,39 +11,41 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.util.ResourceLocation; -public class GUI_FrameHousing extends GuiContainer -{ - private ResourceLocation texture = new ResourceLocation(CORE.MODID, "textures/gui/machine_Charger.png"); - - private InventoryPlayer inventory; - private TileAlvearyFrameHousing te; - - public GUI_FrameHousing(TileAlvearyFrameHousing te, EntityPlayer player) - { - super(new CONTAINER_FrameHousing(te, player)); - inventory = player.inventory; - this.te = te; - } - - @Override - protected void drawGuiContainerBackgroundLayer(float par1, int par2, int par3) - { - Minecraft.getMinecraft().renderEngine.bindTexture(texture); - - GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); - - int x = (width - xSize) / 2; - int y = (height - ySize) / 2; - - drawTexturedModalRect(x, y, 0, 0, xSize, ySize); - } - - @Override - protected void drawGuiContainerForegroundLayer(int par1, int par2) - { - fontRendererObj.drawString(I18n.format("Alveary Frame Housing"), (xSize / 2) - (fontRendererObj.getStringWidth(I18n.format("Alveary Frame Housing")) / 2), 6, 4210752, false); - fontRendererObj.drawString(I18n.format(inventory.getInventoryName()), 8, 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); - } +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 index 6c1b6310f4..1c562936bd 100644 --- a/src/Java/gtPlusPlus/xmod/forestry/bees/alveary/gui/InventoryFrameHousing.java +++ b/src/Java/gtPlusPlus/xmod/forestry/bees/alveary/gui/InventoryFrameHousing.java @@ -14,100 +14,98 @@ import net.minecraft.util.Vec3; import net.minecraft.world.World; import net.minecraft.world.biome.BiomeGenBase; -public class InventoryFrameHousing extends InventoryAdapterTile<TileAlvearyFrameHousing> implements IAlvearyFrameHousing -{ - +public class InventoryFrameHousing extends InventoryAdapterTile<TileAlvearyFrameHousing> + implements IAlvearyFrameHousing { + TileAlvearyFrameHousing alvearyFrame; - - public InventoryFrameHousing(TileAlvearyFrameHousing alvearyFrame) - { + + public InventoryFrameHousing(final TileAlvearyFrameHousing alvearyFrame) { super(alvearyFrame, 1, "FrameHousingInv"); this.alvearyFrame = alvearyFrame; } @Override - public boolean canSlotAccept(int slotIndex, ItemStack itemStack) - { + public boolean canBlockSeeTheSky() { + return this.alvearyFrame.canBlockSeeTheSky(); + } + + @Override + public boolean canSlotAccept(final int slotIndex, final ItemStack itemStack) { return ItemStackUtil.containsItemStack(BeeManager.inducers.keySet(), itemStack); } @Override - public boolean canBlockSeeTheSky() { - return alvearyFrame.canBlockSeeTheSky(); + public InventoryFrameHousing getAlvearyInventory() { + return this; } @Override public Vec3 getBeeFXCoordinates() { - return alvearyFrame.getBeeFXCoordinates(); + return this.alvearyFrame.getBeeFXCoordinates(); } @Override public IBeeHousingInventory getBeeInventory() { - return alvearyFrame.getBeeInventory(); + return this.alvearyFrame.getBeeInventory(); } @Override - public Iterable<IBeeListener> getBeeListeners() { - return alvearyFrame.getBeeListeners(); + public IBeekeepingLogic getBeekeepingLogic() { + return this.alvearyFrame.getBeekeepingLogic(); } @Override - public Iterable<IBeeModifier> getBeeModifiers() { - return alvearyFrame.getBeeModifiers(); + public Iterable<IBeeListener> getBeeListeners() { + return this.alvearyFrame.getBeeListeners(); } @Override - public IBeekeepingLogic getBeekeepingLogic() { - return alvearyFrame.getBeekeepingLogic(); + public Iterable<IBeeModifier> getBeeModifiers() { + return this.alvearyFrame.getBeeModifiers(); } @Override public BiomeGenBase getBiome() { - return alvearyFrame.getBiome(); + return this.alvearyFrame.getBiome(); } @Override public int getBlockLightValue() { - return alvearyFrame.getBlockLightValue(); - } - - @Override - public EnumHumidity getHumidity() { - return alvearyFrame.getHumidity(); + return this.alvearyFrame.getBlockLightValue(); } @Override - public GameProfile getOwner() { - return alvearyFrame.getOwner(); + public ChunkCoordinates getCoordinates() { + return this.alvearyFrame.getCoordinates(); } @Override - public EnumTemperature getTemperature() { - return alvearyFrame.getTemperature(); + public IErrorLogic getErrorLogic() { + return this.alvearyFrame.getErrorLogic(); } @Override - public World getWorld() { - return alvearyFrame.getWorld(); + public EnumHumidity getHumidity() { + return this.alvearyFrame.getHumidity(); } @Override - public ChunkCoordinates getCoordinates() { - return alvearyFrame.getCoordinates(); + public GameProfile getOwner() { + return this.alvearyFrame.getOwner(); } @Override - public IErrorLogic getErrorLogic() { - return alvearyFrame.getErrorLogic(); + public EnumTemperature getTemperature() { + return this.alvearyFrame.getTemperature(); } @Override - public InventoryFrameHousing getAlvearyInventory() { - return this; + public World getWorld() { + return this.alvearyFrame.getWorld(); } @Override - public void wearOutFrames(IBeeHousing beeHousing, int amount) { - alvearyFrame.wearOutFrames(beeHousing, amount); + public void wearOutFrames(final IBeeHousing beeHousing, final int amount) { + this.alvearyFrame.wearOutFrames(beeHousing, amount); } } diff --git a/src/Java/gtPlusPlus/xmod/forestry/bees/items/FR_ItemRegistry.java b/src/Java/gtPlusPlus/xmod/forestry/bees/items/FR_ItemRegistry.java index 9687feadc1..a4d1d8544d 100644 --- a/src/Java/gtPlusPlus/xmod/forestry/bees/items/FR_ItemRegistry.java +++ b/src/Java/gtPlusPlus/xmod/forestry/bees/items/FR_ItemRegistry.java @@ -9,6 +9,7 @@ * SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges ******************************************************************************/ package gtPlusPlus.xmod.forestry.bees.items; + import cpw.mods.fml.common.registry.GameRegistry; import forestry.core.items.ItemBlockForestry; import forestry.core.utils.StringUtil; @@ -22,73 +23,80 @@ import net.minecraftforge.common.ChestGenHooks; 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 MB_ItemFrame hiveFrameMutagenic; - public static MB_ItemFrame haveFrameBusy; - - //Extra Bee Frame Items - public static MB_ItemFrame hiveFrameCocoa; - public static MB_ItemFrame hiveFrameCaged; - public static MB_ItemFrame hiveFrameSoul; - public static MB_ItemFrame hiveFrameClay; - public static MB_ItemFrame hiveFrameNova; - - //Alveary Stuff - public static FR_BlockAlveary alveary; - - 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, "Longevity for bees isn't very common."); - hiveFrameVoid = new MB_ItemFrame(MB_FrameType.VOID, EnumRarity.rare, "??? (Dungeon Loot)"); - hiveFrameMutagenic = new MB_ItemFrame(MB_FrameType.MUTAGENIC, EnumRarity.epic, "Evolution of the fitest, finest and fastest."); - haveFrameBusy = new MB_ItemFrame(MB_FrameType.BUSY, "Busy bee, Busy Bee, make more honey please for me."); - 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)); - ChestGenHooks.addItem(ChestGenHooks.PYRAMID_DESERT_CHEST, new WeightedRandomChestContent(new ItemStack(hiveFrameMutagenic), 1, 1, 18)); - ChestGenHooks.addItem(ChestGenHooks.PYRAMID_JUNGLE_CHEST, new WeightedRandomChestContent(new ItemStack(hiveFrameMutagenic), 1, 3, 23)); - - //Extra Bee like Frames - if (!LoadedMods.ExtraBees){ - hiveFrameCocoa = new MB_ItemFrame(MB_FrameType.COCOA, EnumRarity.common, ""); - hiveFrameCaged = new MB_ItemFrame(MB_FrameType.CAGE, EnumRarity.common, ""); - hiveFrameSoul = new MB_ItemFrame(MB_FrameType.SOUL, EnumRarity.common, ""); - hiveFrameClay = new MB_ItemFrame(MB_FrameType.CLAY, EnumRarity.common, ""); - hiveFrameNova = new MB_ItemFrame(MB_FrameType.NOVA, EnumRarity.epic, "A Creative Only Frame."); - if (CORE.configSwitches.enableCustomAlvearyBlocks){ - alveary = registerBlock(new FR_BlockAlveary(), ItemBlockForestry.class, "alveary"); + // ----- 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 MB_ItemFrame hiveFrameMutagenic; + public static MB_ItemFrame haveFrameBusy; + + // Extra Bee Frame Items + public static MB_ItemFrame hiveFrameCocoa; + public static MB_ItemFrame hiveFrameCaged; + public static MB_ItemFrame hiveFrameSoul; + public static MB_ItemFrame hiveFrameClay; + public static MB_ItemFrame hiveFrameNova; + + // Alveary Stuff + public static FR_BlockAlveary alveary; + + 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 + FR_ItemRegistry.hiveFrameAccelerated = new MB_ItemFrame(MB_FrameType.ACCELERATED, + "Longevity for bees isn't very common."); + FR_ItemRegistry.hiveFrameVoid = new MB_ItemFrame(MB_FrameType.VOID, EnumRarity.rare, "??? (Dungeon Loot)"); + FR_ItemRegistry.hiveFrameMutagenic = new MB_ItemFrame(MB_FrameType.MUTAGENIC, EnumRarity.epic, + "Evolution of the fitest, finest and fastest."); + FR_ItemRegistry.haveFrameBusy = new MB_ItemFrame(MB_FrameType.BUSY, + "Busy bee, Busy Bee, make more honey please for me."); + ChestGenHooks.addItem(ChestGenHooks.STRONGHOLD_CORRIDOR, + new WeightedRandomChestContent(new ItemStack(FR_ItemRegistry.hiveFrameVoid), 1, 1, 18)); + ChestGenHooks.addItem(ChestGenHooks.STRONGHOLD_LIBRARY, + new WeightedRandomChestContent(new ItemStack(FR_ItemRegistry.hiveFrameVoid), 1, 3, 23)); + ChestGenHooks.addItem(ChestGenHooks.PYRAMID_DESERT_CHEST, + new WeightedRandomChestContent(new ItemStack(FR_ItemRegistry.hiveFrameMutagenic), 1, 1, 18)); + ChestGenHooks.addItem(ChestGenHooks.PYRAMID_JUNGLE_CHEST, + new WeightedRandomChestContent(new ItemStack(FR_ItemRegistry.hiveFrameMutagenic), 1, 3, 23)); + + // Extra Bee like Frames + if (!LoadedMods.ExtraBees) { + FR_ItemRegistry.hiveFrameCocoa = new MB_ItemFrame(MB_FrameType.COCOA, EnumRarity.common, ""); + FR_ItemRegistry.hiveFrameCaged = new MB_ItemFrame(MB_FrameType.CAGE, EnumRarity.common, ""); + FR_ItemRegistry.hiveFrameSoul = new MB_ItemFrame(MB_FrameType.SOUL, EnumRarity.common, ""); + FR_ItemRegistry.hiveFrameClay = new MB_ItemFrame(MB_FrameType.CLAY, EnumRarity.common, ""); + FR_ItemRegistry.hiveFrameNova = new MB_ItemFrame(MB_FrameType.NOVA, EnumRarity.epic, + "A Creative Only Frame."); + if (CORE.configSwitches.enableCustomAlvearyBlocks) { + FR_ItemRegistry.alveary = FR_ItemRegistry.registerBlock(new FR_BlockAlveary(), ItemBlockForestry.class, + "alveary"); } } + } - - + 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; } - protected static <T extends Item> T registerItem(T item, String name) { + protected static <T extends Item> T registerItem(final T item, final String name) { item.setUnlocalizedName(name); GameRegistry.registerItem(item, StringUtil.cleanItemName(item)); return item; } - - protected static <T extends Block> T registerBlock(T block, Class<? extends ItemBlock> itemClass, String name, 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/items/FR_StringUtil.java b/src/Java/gtPlusPlus/xmod/forestry/bees/items/FR_StringUtil.java index 69065bec24..f493e2cbbb 100644 --- a/src/Java/gtPlusPlus/xmod/forestry/bees/items/FR_StringUtil.java +++ b/src/Java/gtPlusPlus/xmod/forestry/bees/items/FR_StringUtil.java @@ -2,21 +2,16 @@ package gtPlusPlus.xmod.forestry.bees.items; import net.minecraft.util.StatCollector; -public class FR_StringUtil -{ - public static String getLocalizedString(String key) - { - if(StatCollector.canTranslate(key)) - { +public class FR_StringUtil { + public static String getLocalizedString(final 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)) - { + public static String getLocalizedString(final String key, final 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/gtPlusPlus/xmod/forestry/bees/items/MB_FrameType.java b/src/Java/gtPlusPlus/xmod/forestry/bees/items/MB_FrameType.java index 5a61c94196..76e5f76e03 100644 --- a/src/Java/gtPlusPlus/xmod/forestry/bees/items/MB_FrameType.java +++ b/src/Java/gtPlusPlus/xmod/forestry/bees/items/MB_FrameType.java @@ -3,48 +3,44 @@ package gtPlusPlus.xmod.forestry.bees.items; import forestry.api.apiculture.IBeeGenome; import forestry.api.apiculture.IBeeModifier; -public enum MB_FrameType implements IBeeModifier -{ - //ExtraBees Clone Frames - //Name, FrameHP, territory (1f), Mutation rate, lifespan rate, production rate, genetic decay (1f) - COCOA("Chocolate", 240, 1.0f, 1.0f, 0.50f, 1.50f, 1f), - CAGE("Restraint", 240, 0.5f, 1.0f, 0.75f, 0.75f, 1f), - SOUL("Soul", 80, 1.0f, 1.5f, 0.75f, 0.25f, 1f), - CLAY("Healing", 240, 1.0f, 0.5f, 1.50f, 0.75f, 1f), - NOVA("Nova", 240, 1.0f, 100.0f, 0.0001f, 1.00f, 1f), - - - //Name, FrameHP, territory (1f), Mutation rate, lifespan rate, production rate, genetic decay (1f) - ACCELERATED("Accelerated", 175, 1f, 2.5f, 0.9f, 1.8f, 1f), - VOID("Void", 20, 1f, 1f, 0.0001f, 10f, 1f), - MUTAGENIC("Mutagenic", 3, 1f, 10f, 0.0001f, 10f, 1f), - BUSY("Busy", 2000, 1f, 0f, 3f, 4f, 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) { +public enum MB_FrameType implements IBeeModifier { + // ExtraBees Clone Frames + // Name, FrameHP, territory (1f), Mutation rate, lifespan rate, production + // rate, genetic decay (1f) + COCOA("Chocolate", 240, 1.0f, 1.0f, 0.50f, 1.50f, 1f), CAGE("Restraint", 240, 0.5f, 1.0f, 0.75f, 0.75f, 1f), SOUL( + "Soul", 80, 1.0f, 1.5f, 0.75f, 0.25f, 1f), CLAY("Healing", 240, 1.0f, 0.5f, 1.50f, 0.75f, + 1f), NOVA("Nova", 240, 1.0f, 100.0f, 0.0001f, 1.00f, 1f), + + // Name, FrameHP, territory (1f), Mutation rate, lifespan rate, production + // rate, genetic decay (1f) + ACCELERATED("Accelerated", 175, 1f, 2.5f, 0.9f, 1.8f, 1f), VOID("Void", 20, 1f, 1f, 0.0001f, 10f, + 1f), MUTAGENIC("Mutagenic", 3, 1f, 10f, 0.0001f, 10f, 1f), BUSY("Busy", 2000, 1f, 0f, 3f, 4f, 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(final String name, final int damage, final float territory, final float mutation, final float lifespan, + final float production, final 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) - { + + MB_FrameType(final String name, final int damage, final float territory, final float mutation, final float lifespan, + final float production, final float flowering, final float geneticDecay, final boolean sealed, + final boolean lit, final boolean sunlit, final boolean hellish) { this.frameName = name; this.maxDamage = damage; - + this.territoryMod = territory; this.mutationMod = mutation; this.lifespanMod = lifespan; @@ -57,63 +53,61 @@ public enum MB_FrameType implements IBeeModifier this.isHellish = hellish; } - public String getName() - { - return this.frameName; - } - - public String getLocalizedName() - { - return FR_StringUtil.getLocalizedString("frame." + this.frameName); + @Override + public float getFloweringModifier(final IBeeGenome genome, final float currentModifier) { + return this.floweringMod; } @Override - public float getTerritoryModifier(IBeeGenome genome, float currentModifier) { - return territoryMod; + public float getGeneticDecay(final IBeeGenome genome, final float currentModifier) { + return this.geneticDecayMod; } @Override - public float getMutationModifier(IBeeGenome genome, IBeeGenome mate, float currentModifier) { - return mutationMod; + public float getLifespanModifier(final IBeeGenome genome, final IBeeGenome mate, final float currentModifier) { + return this.lifespanMod; + } + + public String getLocalizedName() { + return FR_StringUtil.getLocalizedString("frame." + this.frameName); } @Override - public float getLifespanModifier(IBeeGenome genome, IBeeGenome mate, float currentModifier) { - return lifespanMod; + public float getMutationModifier(final IBeeGenome genome, final IBeeGenome mate, final float currentModifier) { + return this.mutationMod; + } + + public String getName() { + return this.frameName; } @Override - public float getProductionModifier(IBeeGenome genome, float currentModifier) { - return productionMod; + public float getProductionModifier(final IBeeGenome genome, final float currentModifier) { + return this.productionMod; } @Override - public float getFloweringModifier(IBeeGenome genome, float currentModifier) { - return floweringMod; + public float getTerritoryModifier(final IBeeGenome genome, final float currentModifier) { + return this.territoryMod; } @Override - public float getGeneticDecay(IBeeGenome genome, float currentModifier) { - return geneticDecayMod; + public boolean isHellish() { + return this.isHellish; } @Override public boolean isSealed() { - return isSealed; + return this.isSealed; } @Override public boolean isSelfLighted() { - return isLit; + return this.isLit; } @Override public boolean isSunlightSimulated() { - return isSunlit; - } - - @Override - public boolean isHellish() { - return isHellish; + return this.isSunlit; } } diff --git a/src/Java/gtPlusPlus/xmod/forestry/bees/items/MB_ItemFrame.java b/src/Java/gtPlusPlus/xmod/forestry/bees/items/MB_ItemFrame.java index 1e3b5a5b01..f46391c725 100644 --- a/src/Java/gtPlusPlus/xmod/forestry/bees/items/MB_ItemFrame.java +++ b/src/Java/gtPlusPlus/xmod/forestry/bees/items/MB_ItemFrame.java @@ -13,19 +13,12 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.*; import net.minecraft.util.EnumChatFormatting; -public class MB_ItemFrame extends Item implements IHiveFrame -{ - private MB_FrameType type; - private EnumRarity rarity_value = EnumRarity.uncommon; - private final String toolTip; - - public MB_ItemFrame(MB_FrameType frameType, String description) - { - this(frameType, EnumRarity.uncommon, description); - } - - public MB_ItemFrame(MB_FrameType frameType, EnumRarity rarity, String description) - { +public class MB_ItemFrame extends Item implements IHiveFrame { + private final MB_FrameType type; + private EnumRarity rarity_value = EnumRarity.uncommon; + private final String toolTip; + + public MB_ItemFrame(final MB_FrameType frameType, final EnumRarity rarity, final String description) { super(); this.type = frameType; this.setMaxDamage(this.type.maxDamage); @@ -36,26 +29,21 @@ public class MB_ItemFrame extends Item implements IHiveFrame this.toolTip = description; GameRegistry.registerItem(this, "frame" + frameType.getName()); } - + + public MB_ItemFrame(final MB_FrameType frameType, final String description) { + this(frameType, EnumRarity.uncommon, description); + } + @Override - public void addInformation(ItemStack stack, EntityPlayer aPlayer, List list, boolean bool) { - if (toolTip != "" || !toolTip.equals("")){ - list.add(EnumChatFormatting.GRAY+toolTip); + public void addInformation(final ItemStack stack, final EntityPlayer aPlayer, final List list, final boolean bool) { + if (this.toolTip != "" || !this.toolTip.equals("")) { + list.add(EnumChatFormatting.GRAY + this.toolTip); } super.addInformation(stack, aPlayer, list, bool); - } - - @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) { + public ItemStack frameUsed(final IBeeHousing housing, ItemStack frame, final IBee queen, final int wear) { frame.setItemDamage(frame.getItemDamage() + wear); if (frame.getItemDamage() >= frame.getMaxDamage()) { @@ -65,70 +53,77 @@ public class MB_ItemFrame extends Item implements IHiveFrame return frame; } - - + + // --------- IHiveFrame functions ----------------------------------------- + @Override - @SideOnly(Side.CLIENT) - public EnumRarity getRarity(ItemStack par1ItemStack){ - return rarity_value; + public IBeeModifier getBeeModifier() { + return this.type; } - - @Override - public boolean hasEffect(ItemStack par1ItemStack){ - if (rarity_value == EnumRarity.uncommon || rarity_value == EnumRarity.common){ - return false; - } - return true; + + public float getFloweringModifier(final IBeeGenome genome, final float currentModifier) { + return this.type.getFloweringModifier(genome, currentModifier); } - public IBeeModifier getBeeModifier() { - return type; + public float getGeneticDecay(final IBeeGenome genome, final float currentModifier) { + return this.type.getGeneticDecay(genome, currentModifier); } - - @Override - public boolean isBookEnchantable(ItemStack itemstack1, ItemStack itemstack2) - { - return false; + + public float getLifespanModifier(final IBeeGenome genome, final IBeeGenome mate, final float currentModifier) { + return this.type.getLifespanModifier(genome, mate, currentModifier); } - - public float getTerritoryModifier(IBeeGenome genome, float currentModifier) { - return type.getTerritoryModifier(genome, currentModifier); + + public float getMutationModifier(final IBeeGenome genome, final IBeeGenome mate, final float currentModifier) { + return this.type.getMutationModifier(genome, mate, currentModifier); } - public float getMutationModifier(IBeeGenome genome, IBeeGenome mate, float currentModifier) { - return type.getMutationModifier(genome, mate, currentModifier); + public float getProductionModifier(final IBeeGenome genome, final float currentModifier) { + return this.type.getProductionModifier(genome, currentModifier); } - public float getLifespanModifier(IBeeGenome genome, IBeeGenome mate, float currentModifier) { - return type.getLifespanModifier(genome, mate, currentModifier); + @Override + @SideOnly(Side.CLIENT) + public EnumRarity getRarity(final ItemStack par1ItemStack) { + return this.rarity_value; } - public float getProductionModifier(IBeeGenome genome, float currentModifier) { - return type.getProductionModifier(genome, currentModifier); + public float getTerritoryModifier(final IBeeGenome genome, final float currentModifier) { + return this.type.getTerritoryModifier(genome, currentModifier); } - public float getFloweringModifier(IBeeGenome genome, float currentModifier) { - return type.getFloweringModifier(genome, currentModifier); + @Override + public boolean hasEffect(final ItemStack par1ItemStack) { + if (this.rarity_value == EnumRarity.uncommon || this.rarity_value == EnumRarity.common) { + return false; + } + return true; } - public float getGeneticDecay(IBeeGenome genome, float currentModifier) { - return type.getGeneticDecay(genome, currentModifier); + @Override + public boolean isBookEnchantable(final ItemStack itemstack1, final ItemStack itemstack2) { + return false; + } + + public boolean isHellish() { + return this.type.isHellish(); } public boolean isSealed() { - return type.isSealed(); + return this.type.isSealed(); } public boolean isSelfLighted() { - return type.isSelfLighted(); + return this.type.isSelfLighted(); } public boolean isSunlightSimulated() { - return type.isSunlightSimulated(); + return this.type.isSunlightSimulated(); } - - public boolean isHellish(){ - return type.isHellish(); + + @Override + @SideOnly(Side.CLIENT) + public void registerIcons(final IIconRegister par1IconRegister) { + this.itemIcon = par1IconRegister.registerIcon(CORE.MODID + ":frame" + this.type.getName()); } } diff --git a/src/Java/gtPlusPlus/xmod/forestry/bees/recipe/FR_Gregtech_Recipes.java b/src/Java/gtPlusPlus/xmod/forestry/bees/recipe/FR_Gregtech_Recipes.java index ced6dd1d27..5470891b68 100644 --- a/src/Java/gtPlusPlus/xmod/forestry/bees/recipe/FR_Gregtech_Recipes.java +++ b/src/Java/gtPlusPlus/xmod/forestry/bees/recipe/FR_Gregtech_Recipes.java @@ -9,74 +9,62 @@ import net.minecraft.init.Items; import net.minecraft.item.ItemStack; public class FR_Gregtech_Recipes { - - private static String rod_ElectrumFlux = "stickElectrumFlux"; - private static String rod_LongElectrumFlux = "stickLongElectrumFlux"; - private static String foil_Electrum = "foilElectrum"; - private static String rod_Uranium = "stickUranium"; - private static String rod_LongUranium = "stickLongUranium"; - private static String foil_Uranium235 = "foilUranium235"; - private static ItemStack hiveFrameAccelerated = ItemUtils.getSimpleStack(FR_ItemRegistry.hiveFrameAccelerated); - private static ItemStack hiveFrameMutagenic = ItemUtils.getSimpleStack(FR_ItemRegistry.hiveFrameMutagenic); - - private static ItemStack hiveFrameCocoa = ItemUtils.getSimpleStack(FR_ItemRegistry.hiveFrameCocoa); - private static ItemStack hiveFrameCaged = ItemUtils.getSimpleStack(FR_ItemRegistry.hiveFrameCaged); - private static ItemStack hiveFrameSoul = ItemUtils.getSimpleStack(FR_ItemRegistry.hiveFrameSoul); - private static ItemStack hiveFrameClay = ItemUtils.getSimpleStack(FR_ItemRegistry.hiveFrameClay); - private static ItemStack hiveFrameNova = ItemUtils.getSimpleStack(FR_ItemRegistry.hiveFrameNova); - - private static ItemStack hiveFrameImpregnated = ItemUtils.getItemStack("Forestry:frameImpregnated", 1); - private static ItemStack blockSoulSand = new ItemStack(Blocks.soul_sand, 1); - private static ItemStack blockIronBars = new ItemStack (Blocks.iron_bars, 1); - private static ItemStack itemClayDust = new ItemStack(Items.clay_ball, 1); - private static ItemStack itemCocoaBeans = new ItemStack(Items.dye, 1, 3); + private static String rod_ElectrumFlux = "stickElectrumFlux"; + private static String rod_LongElectrumFlux = "stickLongElectrumFlux"; + private static String foil_Electrum = "foilElectrum"; + private static String rod_Uranium = "stickUranium"; + private static String rod_LongUranium = "stickLongUranium"; + private static String foil_Uranium235 = "foilUranium235"; + private static ItemStack hiveFrameAccelerated = ItemUtils + .getSimpleStack(FR_ItemRegistry.hiveFrameAccelerated); + private static ItemStack hiveFrameMutagenic = ItemUtils.getSimpleStack(FR_ItemRegistry.hiveFrameMutagenic); + private static ItemStack hiveFrameCocoa = ItemUtils.getSimpleStack(FR_ItemRegistry.hiveFrameCocoa); + private static ItemStack hiveFrameCaged = ItemUtils.getSimpleStack(FR_ItemRegistry.hiveFrameCaged); + private static ItemStack hiveFrameSoul = ItemUtils.getSimpleStack(FR_ItemRegistry.hiveFrameSoul); + private static ItemStack hiveFrameClay = ItemUtils.getSimpleStack(FR_ItemRegistry.hiveFrameClay); + private static ItemStack hiveFrameNova = ItemUtils.getSimpleStack(FR_ItemRegistry.hiveFrameNova); - public static void registerItems(){ - - //Magic Bee Like Frames - RecipeUtils.recipeBuilder( - rod_LongElectrumFlux, rod_ElectrumFlux, rod_LongElectrumFlux, - rod_LongElectrumFlux, foil_Electrum, rod_LongElectrumFlux, - rod_ElectrumFlux, rod_ElectrumFlux, rod_ElectrumFlux, - hiveFrameAccelerated); - - RecipeUtils.recipeBuilder( - rod_LongUranium, rod_Uranium, rod_LongUranium, - rod_LongUranium, foil_Uranium235, rod_LongUranium, - rod_Uranium, rod_Uranium, rod_Uranium, - hiveFrameMutagenic); - - if (!LoadedMods.ExtraBees){ - //Extra Bee Like Frames - RecipeUtils.recipeBuilder( - null, itemCocoaBeans, null, - itemCocoaBeans, hiveFrameImpregnated, itemCocoaBeans, - null, itemCocoaBeans, null, - hiveFrameCocoa); - - RecipeUtils.recipeBuilder( - hiveFrameImpregnated, blockIronBars, null, - null, null, null, - null, null, null, - hiveFrameCaged); - - RecipeUtils.recipeBuilder( - hiveFrameImpregnated, blockSoulSand, null, - null, null, null, - null, null, null, - hiveFrameSoul); - - RecipeUtils.recipeBuilder( - null, itemClayDust, null, - itemClayDust, hiveFrameImpregnated, itemClayDust, - null, itemClayDust, null, - hiveFrameClay); + private static ItemStack hiveFrameImpregnated = ItemUtils.getItemStack("Forestry:frameImpregnated", 1); + private static ItemStack blockSoulSand = new ItemStack(Blocks.soul_sand, 1); + private static ItemStack blockIronBars = new ItemStack(Blocks.iron_bars, 1); + private static ItemStack itemClayDust = new ItemStack(Items.clay_ball, 1); + private static ItemStack itemCocoaBeans = new ItemStack(Items.dye, 1, 3); + + public static void registerItems() { + + // Magic Bee Like Frames + RecipeUtils.recipeBuilder(FR_Gregtech_Recipes.rod_LongElectrumFlux, FR_Gregtech_Recipes.rod_ElectrumFlux, + FR_Gregtech_Recipes.rod_LongElectrumFlux, FR_Gregtech_Recipes.rod_LongElectrumFlux, + FR_Gregtech_Recipes.foil_Electrum, FR_Gregtech_Recipes.rod_LongElectrumFlux, + FR_Gregtech_Recipes.rod_ElectrumFlux, FR_Gregtech_Recipes.rod_ElectrumFlux, + FR_Gregtech_Recipes.rod_ElectrumFlux, FR_Gregtech_Recipes.hiveFrameAccelerated); + + RecipeUtils.recipeBuilder(FR_Gregtech_Recipes.rod_LongUranium, FR_Gregtech_Recipes.rod_Uranium, + FR_Gregtech_Recipes.rod_LongUranium, FR_Gregtech_Recipes.rod_LongUranium, + FR_Gregtech_Recipes.foil_Uranium235, FR_Gregtech_Recipes.rod_LongUranium, + FR_Gregtech_Recipes.rod_Uranium, FR_Gregtech_Recipes.rod_Uranium, FR_Gregtech_Recipes.rod_Uranium, + FR_Gregtech_Recipes.hiveFrameMutagenic); + + if (!LoadedMods.ExtraBees) { + // Extra Bee Like Frames + RecipeUtils.recipeBuilder(null, FR_Gregtech_Recipes.itemCocoaBeans, null, + FR_Gregtech_Recipes.itemCocoaBeans, FR_Gregtech_Recipes.hiveFrameImpregnated, + FR_Gregtech_Recipes.itemCocoaBeans, null, FR_Gregtech_Recipes.itemCocoaBeans, null, + FR_Gregtech_Recipes.hiveFrameCocoa); + + RecipeUtils.recipeBuilder(FR_Gregtech_Recipes.hiveFrameImpregnated, FR_Gregtech_Recipes.blockIronBars, null, + null, null, null, null, null, null, FR_Gregtech_Recipes.hiveFrameCaged); + + RecipeUtils.recipeBuilder(FR_Gregtech_Recipes.hiveFrameImpregnated, FR_Gregtech_Recipes.blockSoulSand, null, + null, null, null, null, null, null, FR_Gregtech_Recipes.hiveFrameSoul); + + RecipeUtils.recipeBuilder(null, FR_Gregtech_Recipes.itemClayDust, null, FR_Gregtech_Recipes.itemClayDust, + FR_Gregtech_Recipes.hiveFrameImpregnated, FR_Gregtech_Recipes.itemClayDust, null, + FR_Gregtech_Recipes.itemClayDust, null, FR_Gregtech_Recipes.hiveFrameClay); } - - - + } - + } |