From 8b1bce69635018e08aa3b411f8bc13081812c7fe Mon Sep 17 00:00:00 2001 From: Nedelosk Date: Sat, 22 Oct 2016 18:56:37 +0200 Subject: [PATCH] Clean Up and start to work on flower models --- .../binnie/botany/api/EnumFlowerStage.java | 8 + .../botany/api/IAlleleFlowerSpecies.java | 17 + .../java/binnie/botany/api/IFlowerType.java | 14 + .../binnie/botany/flower/BlockFlower.java | 378 ++++++++++-------- .../botany/flower/TileEntityFlower.java | 21 +- .../botany/genetics/AlleleFlowerSpecies.java | 19 + .../botany/genetics/EnumFlowerType.java | 32 ++ .../binnie/botany/genetics/FlowerGenome.java | 6 +- .../java/binnie/botany/items/BotanyItems.java | 10 - .../binnie/core/proxy/BinnieProxyClient.java | 3 + .../craftgui/minecraft/ContainerCraftGUI.java | 11 +- 11 files changed, 317 insertions(+), 202 deletions(-) diff --git a/src/main/java/binnie/botany/api/EnumFlowerStage.java b/src/main/java/binnie/botany/api/EnumFlowerStage.java index 3925d140..58d38a53 100644 --- a/src/main/java/binnie/botany/api/EnumFlowerStage.java +++ b/src/main/java/binnie/botany/api/EnumFlowerStage.java @@ -13,7 +13,15 @@ public enum EnumFlowerStage implements ISpeciesType { EnumFlowerStage(final String name) { this.name = name; } + + public static EnumFlowerStage getStage(IFlower flower){ + return getStage(flower.getAge()); + } + public static EnumFlowerStage getStage(int age){ + return age == 0 ? EnumFlowerStage.SEED : EnumFlowerStage.FLOWER; + } + public String getName() { return this.name; } diff --git a/src/main/java/binnie/botany/api/IAlleleFlowerSpecies.java b/src/main/java/binnie/botany/api/IAlleleFlowerSpecies.java index 71b281a8..b5c04bfc 100644 --- a/src/main/java/binnie/botany/api/IAlleleFlowerSpecies.java +++ b/src/main/java/binnie/botany/api/IAlleleFlowerSpecies.java @@ -1,6 +1,13 @@ package binnie.botany.api; +import javax.annotation.Nonnull; + +import forestry.api.core.IModelManager; import forestry.api.genetics.IAlleleSpecies; +import net.minecraft.client.renderer.block.model.ModelResourceLocation; +import net.minecraft.item.Item; +import net.minecraftforge.fml.relauncher.Side; +import net.minecraftforge.fml.relauncher.SideOnly; public interface IAlleleFlowerSpecies extends IAlleleSpecies { IFlowerType getType(); @@ -8,4 +15,14 @@ public interface IAlleleFlowerSpecies extends IAlleleSpecies { EnumAcidity getPH(); EnumMoisture getMoisture(); + + @SideOnly(Side.CLIENT) + int getFlowerColour(EnumFlowerStage type, int renderPass); + + @SideOnly(Side.CLIENT) + @Nonnull + ModelResourceLocation getFlowerModel(EnumFlowerStage type); + + @SideOnly(Side.CLIENT) + void registerModels(Item item, IModelManager manager, EnumFlowerStage type); } diff --git a/src/main/java/binnie/botany/api/IFlowerType.java b/src/main/java/binnie/botany/api/IFlowerType.java index 9c0af876..f037f5ca 100644 --- a/src/main/java/binnie/botany/api/IFlowerType.java +++ b/src/main/java/binnie/botany/api/IFlowerType.java @@ -1,5 +1,13 @@ package binnie.botany.api; +import javax.annotation.Nonnull; + +import forestry.api.core.IModelManager; +import net.minecraft.client.renderer.block.model.ModelResourceLocation; +import net.minecraft.item.Item; +import net.minecraftforge.fml.relauncher.Side; +import net.minecraftforge.fml.relauncher.SideOnly; + //import net.minecraft.util.IIcon; public interface IFlowerType { @@ -8,6 +16,12 @@ public interface IFlowerType { // IIcon getPetalIcon(final EnumFlowerStage p0, final boolean p1, final int p2); // // IIcon getVariantIcon(final EnumFlowerStage p0, final boolean p1, final int p2); + + @SideOnly(Side.CLIENT) + void registerModels(Item item, IModelManager manager, EnumFlowerStage type); + + @Nonnull + ModelResourceLocation getModel(EnumFlowerStage type); int getID(); diff --git a/src/main/java/binnie/botany/flower/BlockFlower.java b/src/main/java/binnie/botany/flower/BlockFlower.java index e6913f88..937a7e4a 100644 --- a/src/main/java/binnie/botany/flower/BlockFlower.java +++ b/src/main/java/binnie/botany/flower/BlockFlower.java @@ -1,174 +1,204 @@ -package binnie.botany.flower; - -import net.minecraft.block.BlockContainer; -import net.minecraft.block.material.Material; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.world.World; - -public class BlockFlower extends BlockContainer { -// @Override -// public int getRenderType() { -// return RendererBotany.renderID; -// } -// -// @Override -// @SideOnly(Side.CLIENT) -// public void registerBlockIcons(final IIconRegister par1IconRegister) { -// for (final EnumFlowerType type : EnumFlowerType.values()) { -// type.registerIcons(par1IconRegister); -// } -// } - - public BlockFlower() { - super(Material.PLANTS); - final float f = 0.2f; - //this.setBlockBounds(0.5f - f, 0.0f, 0.5f - f, 0.5f + f, f * 3.0f, 0.5f + f); - this.setTickRandomly(true); - this.setRegistryName("flower"); - } - - @Override - public TileEntity createNewTileEntity(final World var1, final int i) { - return new TileEntityFlower(); - } - -// @Override -// public AxisAlignedBB getCollisionBoundingBoxFromPool(final World par1World, final int par2, final int par3, final int par4) { -// return null; -// } - -// @Override -// public boolean isOpaqueCube() { -// return false; -// } -// -// @Override -// public boolean renderAsNormalBlock() { -// return false; -// } - -// @Override -// public void onBlockPlacedBy(final World world, final int x, final int y, final int z, final EntityLivingBase living, final ItemStack stack) { -// super.onBlockPlacedBy(world, x, y, z, living, stack); -// final TileEntity flower = world.getTileEntity(x, y, z); -// if (!BinnieCore.proxy.isSimulating(world)) { -// if (flower != null && flower instanceof TileEntityFlower) { -// final IFlower f = BotanyCore.getFlowerRoot().getMember(stack); -// ((TileEntityFlower) flower).setRender(new TileEntityFlower.RenderInfo(f, (TileEntityFlower) flower)); -// } -// return; -// } -// final TileEntity below = world.getTileEntity(x, y - 1, z); -// if (flower != null && flower instanceof TileEntityFlower) { -// if (below instanceof TileEntityFlower) { -// ((TileEntityFlower) flower).setSection(((TileEntityFlower) below).getSection()); -// } -// else { -// final GameProfile owner = (living instanceof EntityPlayer) ? ((EntityPlayer) living).getGameProfile() : null; -// ((TileEntityFlower) flower).create(stack, owner); -// } -// } -// Gardening.tryGrowSection(world, x, y, z); -// } - -// @Override -// @SideOnly(Side.CLIENT) -// public IIcon getIcon(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 TileEntityFlower) { -// final TileEntityFlower f = (TileEntityFlower) tile; -// final EnumFlowerStage stage = (f.getAge() == 0) ? EnumFlowerStage.SEED : EnumFlowerStage.FLOWER; -// final IFlowerType flower = f.getType(); -// final int section = f.getRenderSection(); -// final boolean flowered = f.isFlowered(); -// return (RendererBotany.pass == 0) ? flower.getStem(stage, flowered, section) : ((RendererBotany.pass == 1) ? flower.getPetalIcon(stage, flowered, section) : flower.getVariantIcon(stage, flowered, section)); -// } -// return super.getIcon(world, x, y, z, side); -// } -// -// @Override -// @SideOnly(Side.CLIENT) -// public int colorMultiplier(final IBlockAccess world, final int x, final int y, final int z) { -// final TileEntity tile = world.getTileEntity(x, y, z); -// if (tile instanceof TileEntityFlower) { -// final TileEntityFlower f = (TileEntityFlower) tile; -// return (RendererBotany.pass == 0) ? f.getStemColour() : ((RendererBotany.pass == 1) ? f.getPrimaryColour() : f.getSecondaryColour()); -// } -// return 16777215; -// } - -// @Override -// public boolean canPlaceBlockAt(final World world, final int x, final int y, final int z) { -// return super.canPlaceBlockAt(world, x, y, z) && this.canBlockStay(world, x, y, z); -// } - -// protected boolean canPlaceBlockOn(final Block block) { -// return block == Blocks.grass || block == Blocks.dirt || block == Blocks.farmland || Gardening.isSoil(block); -// } - -// @Override -// public void onNeighborBlockChange(final World world, final int x, final int y, final int z, final Block block) { -// super.onNeighborBlockChange(world, x, y, z, block); -// this.checkAndDropBlock(world, x, y, z); -// final TileEntity tile = world.getTileEntity(x, y, z); -// if (tile instanceof TileEntityFlower) { -// final TileEntityFlower flower = (TileEntityFlower) tile; -// if (flower.getSection() == 0 && flower.getFlower() != null && flower.getFlower().getAge() > 0 && flower.getFlower().getGenome().getPrimary().getType().getSections() > 1 && world.getBlock(x, y + 1, z) != Botany.flower) { -// this.dropBlockAsItem(world, x, y, z, world.getBlockMetadata(x, y, z), 0); -// world.setBlockToAir(x, y, z); -// } -// } -// } -// -// @Override -// public void updateTick(final World world, final int x, final int y, final int z, final Random rand) { -// final TileEntity tile = world.getTileEntity(x, y, z); -// if (tile instanceof TileEntityFlower) { -// ((TileEntityFlower) tile).randomUpdate(rand); -// this.checkAndDropBlock(world, x, y, z); -// return; -// } -// world.setBlockToAir(x, y, z); -// } -// -// protected void checkAndDropBlock(final World world, final int x, final int y, final int z) { -// if (!this.canBlockStay(world, x, y, z)) { -// this.dropBlockAsItem(world, x, y, z, world.getBlockMetadata(x, y, z), 0); -// world.setBlockToAir(x, y, z); -// } -// } -// -// @Override -// public boolean canBlockStay(final World world, final int x, final int y, final int z) { -// final TileEntity tile = world.getTileEntity(x, y, z); -// if (tile instanceof TileEntityFlower && ((TileEntityFlower) tile).getSection() > 0) { -// return world.getBlock(x, y - 1, z) == Botany.flower; -// } -// return this.canPlaceBlockOn(world.getBlock(x, y - 1, z)); -// } -// -// @Override -// public ArrayList getDrops(final World world, final int x, final int y, final int z, final int blockMeta, final int fortune) { -// final ArrayList drops = new ArrayList(); -// final TileEntity tile = world.getTileEntity(x, y, z); -// if (tile instanceof TileEntityFlower && ((TileEntityFlower) tile).getSection() == 0) { -// final ItemStack flower = ((TileEntityFlower) tile).getItemStack(); -// if (flower != null) { -// drops.add(flower); -// } -// } -// return drops; -// } -// -// @Override -// public boolean removedByPlayer(final World world, final EntityPlayer player, final int x, final int y, final int z) { -// final List drops = this.getDrops(world, x, y, z, world.getBlockMetadata(x, y, z), 0); -// final boolean hasBeenBroken = world.setBlockToAir(x, y, z); -// if (hasBeenBroken && BinnieCore.proxy.isSimulating(world) && drops.size() > 0 && (player == null || !player.capabilities.isCreativeMode)) { -// for (final ItemStack drop : drops) { -// this.dropBlockAsItem(world, x, y, z, drop); -// } -// } -// return hasBeenBroken; -// } -} +package binnie.botany.flower; + +import java.util.ArrayList; +import java.util.List; +import java.util.Random; + +import com.mojang.authlib.GameProfile; + +import binnie.botany.Botany; +import binnie.botany.api.IFlower; +import binnie.botany.core.BotanyCore; +import binnie.botany.gardening.Gardening; +import binnie.core.BinnieCore; +import forestry.core.blocks.IColoredBlock; +import net.minecraft.block.Block; +import net.minecraft.block.BlockContainer; +import net.minecraft.block.material.Material; +import net.minecraft.block.state.IBlockState; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.init.Blocks; +import net.minecraft.item.ItemStack; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.math.AxisAlignedBB; +import net.minecraft.util.math.BlockPos; +import net.minecraft.world.IBlockAccess; +import net.minecraft.world.World; +import net.minecraftforge.fml.relauncher.Side; +import net.minecraftforge.fml.relauncher.SideOnly; + +public class BlockFlower extends BlockContainer implements /*IItemModelRegister, */IColoredBlock { + + public static final AxisAlignedBB FLOWER_BLOCK_AABB = new AxisAlignedBB(0.3F, 0.0F, 0.3, 0.7F, 0.6F, 0.7F); + + public BlockFlower() { + super(Material.PLANTS); + final float f = 0.2f; + this.setTickRandomly(true); + this.setRegistryName("flower"); + } + + @Override + public TileEntity createNewTileEntity(final World var1, final int i) { + return new TileEntityFlower(); + } + + + /*@Override + @SideOnly(Side.CLIENT) + public void registerModel(Item item, IModelManager manager) { + for (final EnumFlowerType type : EnumFlowerType.values()) { + type.registerIcons(par1IconRegister); + } + }*/ + + @Override + public AxisAlignedBB getCollisionBoundingBox(IBlockState blockState, World worldIn, BlockPos pos) { + //flowers have no collision + return null; + } + + @Override + public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos) { + return FLOWER_BLOCK_AABB; + } + + @Override + public AxisAlignedBB getSelectedBoundingBox(IBlockState state, World worldIn, BlockPos pos) { + return FLOWER_BLOCK_AABB; + } + + @Override + public boolean isOpaqueCube(IBlockState state) { + return false; + } + + @Override + public void onBlockPlacedBy(World world, BlockPos pos, IBlockState state, EntityLivingBase placer, ItemStack stack) { + super.onBlockPlacedBy(world, pos, state, placer, stack); + final TileEntity flower = world.getTileEntity(pos); + if (!BinnieCore.proxy.isSimulating(world)) { + if (flower != null && flower instanceof TileEntityFlower) { + final IFlower f = BotanyCore.getFlowerRoot().getMember(stack); + ((TileEntityFlower) flower).setRender(new TileEntityFlower.RenderInfo(f, (TileEntityFlower) flower)); + } + return; + } + final TileEntity below = world.getTileEntity(pos.down()); + if (flower != null && flower instanceof TileEntityFlower) { + if (below instanceof TileEntityFlower) { + ((TileEntityFlower) flower).setSection(((TileEntityFlower) below).getSection()); + } else { + final GameProfile owner = (placer instanceof EntityPlayer) ? ((EntityPlayer) placer).getGameProfile() : null; + ((TileEntityFlower) flower).create(stack, owner); + } + } + Gardening.tryGrowSection(world, pos); + } + + /*@Override + @SideOnly(Side.CLIENT) + public IIcon getIcon(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 TileEntityFlower) { + final TileEntityFlower f = (TileEntityFlower) tile; + final EnumFlowerStage stage = (f.getAge() == 0) ? EnumFlowerStage.SEED : EnumFlowerStage.FLOWER; + final IFlowerType flower = f.getType(); + final int section = f.getRenderSection(); + final boolean flowered = f.isFlowered(); + return (RendererBotany.pass == 0) ? flower.getStem(stage, flowered, section) : ((RendererBotany.pass == 1) ? flower.getPetalIcon(stage, flowered, section) : flower.getVariantIcon(stage, flowered, section)); + } + return super.getIcon(world, x, y, z, side); + }*/ + @Override + @SideOnly(Side.CLIENT) + public int colorMultiplier(IBlockState state, IBlockAccess world, BlockPos pos, int tintIndex) { + final TileEntity tile = world.getTileEntity(pos); + if (tile instanceof TileEntityFlower) { + final TileEntityFlower f = (TileEntityFlower) tile; + if(tintIndex == 0){ + return f.getStemColour(); + }else if(tintIndex == 1){ + return f.getPrimaryColour(); + }else{ + return f.getSecondaryColour(); + } + } + return 16777215; + } + + @Override + public boolean canPlaceBlockAt(World world, BlockPos pos) { + return super.canPlaceBlockAt(world, pos) && canBlockStay(world, pos); + } + + public boolean canBlockStay(World world, BlockPos pos) { + TileEntity tile = world.getTileEntity(pos); + IBlockState downState = world.getBlockState(pos.down()); + if (tile instanceof TileEntityFlower && ((TileEntityFlower) tile).getSection() > 0) { + return downState.getBlock() == Botany.flower; + } + return this.canPlaceBlockOn(blockState.getBlock()); + } + + protected boolean canPlaceBlockOn(final Block block) { + return block == Blocks.GRASS || block == Blocks.DIRT || block == Blocks.FARMLAND || Gardening.isSoil(block); + } + + @Override + public void neighborChanged(IBlockState state, World world, BlockPos pos, Block blockIn) { + this.checkAndDropBlock(world, pos); + final TileEntity tile = world.getTileEntity(pos); + if (tile instanceof TileEntityFlower) { + final TileEntityFlower flower = (TileEntityFlower) tile; + if (flower.getSection() == 0 && flower.getFlower() != null && flower.getFlower().getAge() > 0 && flower.getFlower().getGenome().getPrimary().getType().getSections() > 1 && world.getBlockState(pos.up()).getBlock() != Botany.flower) { + this.dropBlockAsItem(world, pos, world.getBlockState(pos), 0); + world.setBlockToAir(pos); + } + } + } + + @Override + public void updateTick(World world, BlockPos pos, IBlockState state, Random rand) { + final TileEntity tile = world.getTileEntity(pos); + if (tile instanceof TileEntityFlower) { + ((TileEntityFlower) tile).randomUpdate(rand); + this.checkAndDropBlock(world, pos); + return; + } + world.setBlockToAir(pos); + } + + protected void checkAndDropBlock(final World world, final BlockPos pos) { + if (!this.canBlockStay(world, pos)) { + this.dropBlockAsItem(world, pos, world.getBlockState(pos), 0); + world.setBlockToAir(pos); + } + } + + @Override + public List getDrops(IBlockAccess world, BlockPos pos, IBlockState state, int fortune) { + ArrayList drops = new ArrayList(); + TileEntity tile = world.getTileEntity(pos); + if (tile instanceof TileEntityFlower && ((TileEntityFlower) tile).getSection() == 0) { + ItemStack flower = ((TileEntityFlower) tile).getItemStack(); + if (flower != null) { + drops.add(flower); + } + } + return drops; + } + + @Override + public boolean removedByPlayer(IBlockState state, World world, BlockPos pos, EntityPlayer player, boolean willHarvest) { + final List drops = this.getDrops(world, pos, world.getBlockState(pos), 0); + final boolean hasBeenBroken = world.setBlockToAir(pos); + if (hasBeenBroken && BinnieCore.proxy.isSimulating(world) && drops.size() > 0 && (player == null || !player.capabilities.isCreativeMode)) { + for (final ItemStack drop : drops) { + spawnAsEntity(world, pos, drop); + } + } + return hasBeenBroken; + } +} diff --git a/src/main/java/binnie/botany/flower/TileEntityFlower.java b/src/main/java/binnie/botany/flower/TileEntityFlower.java index 746bc3fd..f89574ef 100644 --- a/src/main/java/binnie/botany/flower/TileEntityFlower.java +++ b/src/main/java/binnie/botany/flower/TileEntityFlower.java @@ -1,6 +1,7 @@ package binnie.botany.flower; import binnie.Binnie; +import binnie.botany.api.EnumFlowerStage; import binnie.botany.api.IFlower; import binnie.botany.api.IFlowerColour; import binnie.botany.api.IFlowerType; @@ -123,10 +124,10 @@ public class TileEntityFlower extends TileEntity //implements IPollinatable, IBu if (this.getSection() <= 0) { return this.flower; } -// final TileEntity tile = this.worldObj.getTileEntity(this.xCoord, this.yCoord - this.getSection(), this.zCoord); -// if (tile instanceof TileEntityFlower) { -// return ((TileEntityFlower) tile).getFlower(); -// } + TileEntity tile = this.worldObj.getTileEntity(pos.down(getSection())); + if (tile instanceof TileEntityFlower) { + return ((TileEntityFlower) tile).getFlower(); + } return null; } @@ -282,12 +283,12 @@ public class TileEntityFlower extends TileEntity //implements IPollinatable, IBu } } -// public ItemStack getItemStack() { -// if (this.flower == null) { -// return null; -// } -// return Binnie.Genetics.getFlowerRoot().getMemberStack(this.getFlower(), (this.flower.getAge() == 0) ? EnumFlowerStage.SEED.ordinal() : EnumFlowerStage.FLOWER.ordinal()); -// } + public ItemStack getItemStack() { + if (this.flower == null) { + return null; + } + return Binnie.Genetics.getFlowerRoot().getMemberStack(this.getFlower(), EnumFlowerStage.getStage(getFlower())); + } // private TileEntityFlower getRoot() { // if (this.getSection() == 0) { diff --git a/src/main/java/binnie/botany/genetics/AlleleFlowerSpecies.java b/src/main/java/binnie/botany/genetics/AlleleFlowerSpecies.java index 0849e7eb..43462969 100644 --- a/src/main/java/binnie/botany/genetics/AlleleFlowerSpecies.java +++ b/src/main/java/binnie/botany/genetics/AlleleFlowerSpecies.java @@ -4,15 +4,19 @@ import javax.annotation.Nonnull; import binnie.botany.api.EnumAcidity; import binnie.botany.api.EnumFlowerChromosome; +import binnie.botany.api.EnumFlowerStage; import binnie.botany.api.EnumMoisture; import binnie.botany.api.IAlleleFlowerSpecies; import binnie.botany.api.IAlleleFlowerSpeciesBuilder; import binnie.botany.api.IFlowerType; import binnie.botany.core.BotanyCore; +import forestry.api.core.IModelManager; import forestry.api.genetics.AlleleManager; import forestry.api.genetics.IClassification; import forestry.api.genetics.ISpeciesRoot; import forestry.core.genetics.alleles.AlleleSpecies; +import net.minecraft.client.renderer.block.model.ModelResourceLocation; +import net.minecraft.item.Item; public class AlleleFlowerSpecies extends AlleleSpecies implements IAlleleFlowerSpecies, IAlleleFlowerSpeciesBuilder { @@ -80,4 +84,19 @@ public class AlleleFlowerSpecies extends AlleleSpecies implements IAlleleFlowerS return 0; } + @Override + public int getFlowerColour(EnumFlowerStage type, int renderPass) { + return 0; + } + + @Override + public ModelResourceLocation getFlowerModel(EnumFlowerStage type) { + return flowerType.getModel(type); + } + + @Override + public void registerModels(Item item, IModelManager manager, EnumFlowerStage type) { + flowerType.registerModels(item, manager, type); + } + } diff --git a/src/main/java/binnie/botany/genetics/EnumFlowerType.java b/src/main/java/binnie/botany/genetics/EnumFlowerType.java index be5eef62..93dab26e 100644 --- a/src/main/java/binnie/botany/genetics/EnumFlowerType.java +++ b/src/main/java/binnie/botany/genetics/EnumFlowerType.java @@ -1,6 +1,10 @@ package binnie.botany.genetics; +import binnie.botany.api.EnumFlowerStage; import binnie.botany.api.IFlowerType; +import forestry.api.core.IModelManager; +import net.minecraft.client.renderer.block.model.ModelResourceLocation; +import net.minecraft.item.Item; public enum EnumFlowerType implements IFlowerType { Dandelion, @@ -108,6 +112,25 @@ public enum EnumFlowerType implements IFlowerType { // this.pollenPetal = Botany.proxy.getIcon(register, "flowers/pollen.1"); // this.pollenVariant = Botany.proxy.getIcon(register, "flowers/pollen.2"); // } + + /* @SideOnly(Side.CLIENT) + public void registerModel(Item item, IModelManager manager){ + for (int i = 0; i < this.sections; ++i) { + final String suf = (i == 0) ? "" : ("" + (i + 1)); + final String pre = (this.sections == 1) ? "" : "double/"; + this.stem[i] = Botany.proxy.getIcon(register, "flowers/" + pre + this.toString().toLowerCase() + suf + ".0"); + this.petal[i] = Botany.proxy.getIcon(register, "flowers/" + pre + this.toString().toLowerCase() + suf + ".1"); + this.variant[i] = Botany.proxy.getIcon(register, "flowers/" + pre + this.toString().toLowerCase() + suf + ".2"); + this.unflowered[i] = Botany.proxy.getIcon(register, "flowers/" + pre + this.toString().toLowerCase() + suf + ".3"); + } + this.blank = Botany.proxy.getIcon(register, "flowers/blank"); + this.seedStem = Botany.proxy.getIcon(register, "flowers/seed.0"); + this.seedPetal = Botany.proxy.getIcon(register, "flowers/seed.1"); + this.seedVariant = Botany.proxy.getIcon(register, "flowers/seed.2"); + this.pollenStem = Botany.proxy.getIcon(register, "flowers/pollen.0"); + this.pollenPetal = Botany.proxy.getIcon(register, "flowers/pollen.1"); + this.pollenVariant = Botany.proxy.getIcon(register, "flowers/pollen.2"); + }*/ @Override public int getID() { @@ -119,6 +142,15 @@ public enum EnumFlowerType implements IFlowerType { return this.sections; } + @Override + public void registerModels(Item item, IModelManager manager, EnumFlowerStage type) { + } + + @Override + public ModelResourceLocation getModel(EnumFlowerStage type) { + return null; + } + // public IIcon getBlank() { // return this.blank; // } diff --git a/src/main/java/binnie/botany/genetics/FlowerGenome.java b/src/main/java/binnie/botany/genetics/FlowerGenome.java index 8afe6b11..7c9abd43 100644 --- a/src/main/java/binnie/botany/genetics/FlowerGenome.java +++ b/src/main/java/binnie/botany/genetics/FlowerGenome.java @@ -34,17 +34,17 @@ public class FlowerGenome extends Genome implements IFlowerGenome { @Override public EnumFlowerColor getPrimaryColor() { - return ((AlleleColor) this.getActiveAllele(EnumFlowerChromosome.PRIMARY)).getColor(); + return ((EnumFlowerColor) this.getActiveAllele(EnumFlowerChromosome.PRIMARY)); } @Override public EnumFlowerColor getSecondaryColor() { - return ((AlleleColor) this.getActiveAllele(EnumFlowerChromosome.SECONDARY)).getColor(); + return ((EnumFlowerColor) this.getActiveAllele(EnumFlowerChromosome.SECONDARY)); } @Override public EnumFlowerColor getStemColor() { - return ((AlleleColor) this.getActiveAllele(EnumFlowerChromosome.STEM)).getColor(); + return ((EnumFlowerColor)this.getActiveAllele(EnumFlowerChromosome.STEM)); } @Override diff --git a/src/main/java/binnie/botany/items/BotanyItems.java b/src/main/java/binnie/botany/items/BotanyItems.java index f7f823d1..cac2cc1d 100644 --- a/src/main/java/binnie/botany/items/BotanyItems.java +++ b/src/main/java/binnie/botany/items/BotanyItems.java @@ -25,16 +25,6 @@ public enum BotanyItems implements IItemMisc { this.iconPath = iconPath; } -// @Override -// public IIcon getIcon(final ItemStack stack) { -// return this.icon; -// } -// -// @Override -// public void registerIcons(final IIconRegister register) { -// this.icon = Botany.proxy.getIcon(register, this.iconPath); -// } - @Override public void addInformation(final List par3List) { } diff --git a/src/main/java/binnie/core/proxy/BinnieProxyClient.java b/src/main/java/binnie/core/proxy/BinnieProxyClient.java index 21839d7d..66849b49 100644 --- a/src/main/java/binnie/core/proxy/BinnieProxyClient.java +++ b/src/main/java/binnie/core/proxy/BinnieProxyClient.java @@ -171,6 +171,9 @@ public final class BinnieProxyClient extends BinnieProxy implements IBinnieProxy @Override public TextureAtlasSprite getTextureAtlasSprite(ResourceLocation location) { + if(location == null){ + return null; + } return Minecraft.getMinecraft().getTextureMapBlocks().getAtlasSprite(location.toString()); } diff --git a/src/main/java/binnie/craftgui/minecraft/ContainerCraftGUI.java b/src/main/java/binnie/craftgui/minecraft/ContainerCraftGUI.java index 373fa1fa..709067c1 100644 --- a/src/main/java/binnie/craftgui/minecraft/ContainerCraftGUI.java +++ b/src/main/java/binnie/craftgui/minecraft/ContainerCraftGUI.java @@ -61,11 +61,6 @@ public class ContainerCraftGUI extends Container { } } - @Override - protected Slot addSlotToContainer(final Slot slot) { - return super.addSlotToContainer(slot); - } - private Side getSide() { return this.window.isServer() ? Side.SERVER : Side.CLIENT; } @@ -231,6 +226,12 @@ public class ContainerCraftGUI extends Container { @Override public void detectAndSendChanges() { + for (int i = 0; i < this.inventorySlots.size(); ++i){ + Object o = this.inventorySlots.get(i); + if(o == null){ + getClass(); + } + } super.detectAndSendChanges(); final ITankMachine tanks = Machine.getInterface(ITankMachine.class, this.window.getInventory()); final IPoweredMachine powered = Machine.getInterface(IPoweredMachine.class, this.window.getInventory());