Add new coccon models and improve IAlleleCoocon

This commit is contained in:
Nedelosk committed 2016-05-01 01:06:12 +02:00
1 parent cc34078ab4
commit 8f68f49759
48 files changed
+740 -264

No files matched your search

@@ -1,17 +0,0 @@
/*******************************************************************************
* Copyright (c) 2011-2014 SirSengir.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the GNU Lesser Public License v3
* which accompanies this distribution, and is available at
* http://www.gnu.org/licenses/lgpl-3.0.txt
*
* Various Contributors including, but not limited to:
* SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges
******************************************************************************/
package forestry.api.lepidopterology;
public enum EnumCocoonType {
DEFAULT, SILK
}
@@ -12,18 +12,16 @@ package forestry.api.lepidopterology;
import java.util.Map;
import forestry.api.genetics.IAllele;
import forestry.api.genetics.IAlleleProperty;
import net.minecraft.client.resources.model.ModelResourceLocation;
import net.minecraft.item.ItemStack;
public interface IAlleleButterflyCocoon extends IAllele {
EnumCocoonType getCocoonType();
String getCocoonTexture(int age);
public interface IAlleleButterflyCocoon extends IAlleleProperty<IAlleleButterflyCocoon> {
ModelResourceLocation getCocoonItemModel(int age);
String getCocoonName();
Map<ItemStack, Float> getCocoonLoot();
}
@@ -1,3 +1,13 @@
/*******************************************************************************
* Copyright (c) 2011-2014 SirSengir.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the GNU Lesser Public License v3
* which accompanies this distribution, and is available at
* http://www.gnu.org/licenses/lgpl-3.0.txt
*
* Various Contributors including, but not limited to:
* SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges
******************************************************************************/
package forestry.arboriculture.blocks;
import javax.annotation.Nonnull;
@@ -1,3 +1,13 @@
/*******************************************************************************
* Copyright (c) 2011-2014 SirSengir.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the GNU Lesser Public License v3
* which accompanies this distribution, and is available at
* http://www.gnu.org/licenses/lgpl-3.0.txt
*
* Various Contributors including, but not limited to:
* SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges
******************************************************************************/
package forestry.arboriculture.blocks;
import java.util.Collection;
@@ -1,3 +1,13 @@
/*******************************************************************************
* Copyright (c) 2011-2014 SirSengir.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the GNU Lesser Public License v3
* which accompanies this distribution, and is available at
* http://www.gnu.org/licenses/lgpl-3.0.txt
*
* Various Contributors including, but not limited to:
* SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges
******************************************************************************/
package forestry.arboriculture.blocks.property;
import com.google.common.base.Objects;
@@ -1,3 +1,13 @@
/*******************************************************************************
* Copyright (c) 2011-2014 SirSengir.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the GNU Lesser Public License v3
* which accompanies this distribution, and is available at
* http://www.gnu.org/licenses/lgpl-3.0.txt
*
* Various Contributors including, but not limited to:
* SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges
******************************************************************************/
package forestry.arboriculture.blocks.property;
import com.google.common.collect.Collections2;
@@ -1,3 +1,13 @@
/*******************************************************************************
* Copyright (c) 2011-2014 SirSengir.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the GNU Lesser Public License v3
* which accompanies this distribution, and is available at
* http://www.gnu.org/licenses/lgpl-3.0.txt
*
* Various Contributors including, but not limited to:
* SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges
******************************************************************************/
package forestry.arboriculture.blocks.property;
import com.google.common.collect.Collections2;
@@ -118,7 +118,6 @@ public class PluginLepidopterology extends BlankForestryPlugin {
ButterflyBranchDefinition.createAlleles();
AlleleButterflyEffect.createAlleles();
AlleleButterflyCocoon.createAlleles();
GameRegistry.registerTileEntity(TileCocoon.class, "forestry.Cocoon");
proxy.preInitializeRendering();
@@ -142,6 +141,7 @@ public class PluginLepidopterology extends BlankForestryPlugin {
MothDefinition.initMoths();
ButterflyDefinition.initButterflies();
AlleleButterflyCocoon.createLoot();
blocks.lepidopterology.init();
@@ -16,11 +16,13 @@ import java.util.Random;
import forestry.api.core.IStateMapperRegister;
import forestry.core.proxy.Proxies;
import forestry.core.render.EmptyStateMapper;
import forestry.core.tiles.TileUtil;
import forestry.lepidopterology.blocks.property.PropertyCocoon;
import forestry.lepidopterology.genetics.alleles.AlleleButterflyCocoon;
import forestry.lepidopterology.tiles.TileCocoon;
import net.minecraft.block.Block;
import net.minecraft.block.ITileEntityProvider;
import net.minecraft.block.state.BlockState;
import net.minecraft.block.state.IBlockState;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
@@ -33,11 +35,35 @@ import net.minecraftforge.fml.relauncher.SideOnly;
public class BlockCocoon extends Block implements ITileEntityProvider, IStateMapperRegister {
private static final PropertyCocoon COCOON = AlleleButterflyCocoon.COCOON;
public BlockCocoon() {
super(new MaterialCocoon());
setTickRandomly(true);
setStepSound(soundTypeGrass);
setCreativeTab(null);
setDefaultState(this.blockState.getBaseState().withProperty(COCOON, AlleleButterflyCocoon.cocoonDefault).withProperty(AlleleButterflyCocoon.AGE, 0));
}
@Override
protected BlockState createBlockState() {
return new BlockState(this, COCOON, AlleleButterflyCocoon.AGE);
}
@SideOnly(Side.CLIENT)
@Override
public IBlockState getActualState(IBlockState state, IBlockAccess world, BlockPos pos) {
TileCocoon cocoon = TileUtil.getTile(world, pos, TileCocoon.class);
if(cocoon != null){
state = state.withProperty(COCOON, cocoon.getCaterpillar().getGenome().getCocoon()).withProperty(AlleleButterflyCocoon.AGE, cocoon.getAge());
}
return super.getActualState(state, world, pos);
}
@SideOnly(Side.CLIENT)
@Override
public void registerStateMapper() {
Proxies.render.registerStateMapper(this, new CocoonStateMapper());
}
@Override
@@ -77,17 +103,6 @@ public class BlockCocoon extends Block implements ITileEntityProvider, IStateMap
return 0;
}
@Override
public int getRenderType() {
return 2;
}
@SideOnly(Side.CLIENT)
@Override
public void registerStateMapper() {
Proxies.render.registerStateMapper(this, EmptyStateMapper.instance);
}
@Override
public void onNeighborBlockChange(World worldIn, BlockPos pos, IBlockState state, Block neighborBlock) {
IBlockState stateUp = worldIn.getBlockState(pos.up());
@@ -103,35 +118,13 @@ public class BlockCocoon extends Block implements ITileEntityProvider, IStateMap
@Override
public AxisAlignedBB getSelectedBoundingBox(World world, BlockPos pos) {
TileCocoon cocoon = TileUtil.getTile(world, pos, TileCocoon.class);
if(cocoon != null){
if(cocoon.getAge() == 0){
setBlockBounds(0.375F, 0.5F, 0.4375F, 0.5625F, 1F, 0.6875F);
}else if(cocoon.getAge() == 1){
setBlockBounds(0.34375F, 0.375F, 0.40625F, 0.59375F, 1F, 0.71875F);
}else if(cocoon.getAge() == 2){
setBlockBounds(0.34375F, 0.25F, 0.28125F, 0.71875F, 1F, 0.71875F);
}else{
setBlockBounds(0, 0, 0, 1, 1, 1);
}
}
setBlockBounds(0.3125F, 0.3125F, 0.3125F, 0.6875F, 1F, 0.6875F);
return super.getSelectedBoundingBox(world, pos);
}
@Override
public AxisAlignedBB getCollisionBoundingBox(World world, BlockPos pos, IBlockState state) {
TileCocoon cocoon = TileUtil.getTile(world, pos, TileCocoon.class);
if(cocoon != null){
if(cocoon.getAge() == 0){
setBlockBounds(0.375F, 0.5F, 0.4375F, 0.5625F, 1F, 0.6875F);
}else if(cocoon.getAge() == 1){
setBlockBounds(0.34375F, 0.375F, 0.40625F, 0.59375F, 1F, 0.71875F);
}else if(cocoon.getAge() == 2){
setBlockBounds(0.34375F, 0.25F, 0.28125F, 0.71875F, 1F, 0.71875F);
}else{
setBlockBounds(0, 0, 0, 1, 1, 1);
}
}
setBlockBounds(0, 0, 0, 1, 1, 1);
return super.getCollisionBoundingBox(world, pos, state);
}
@@ -12,6 +12,7 @@ package forestry.lepidopterology.blocks;
import forestry.core.blocks.BlockRegistry;
import forestry.core.items.ItemBlockForestry;
import forestry.lepidopterology.genetics.alleles.AlleleButterflyCocoon;
public class BlockRegistryLepidopterology extends BlockRegistry {
public final BlockLepidopterology lepidopterology;
@@ -20,6 +21,7 @@ public class BlockRegistryLepidopterology extends BlockRegistry {
public BlockRegistryLepidopterology() {
lepidopterology = registerBlock(new BlockLepidopterology(), ItemBlockForestry.class, "lepidopterology");
AlleleButterflyCocoon.createAlleles();
cocoon = registerBlock(new BlockCocoon(), ItemBlockForestry.class, "cocoon");
solidCocoon = registerBlock(new BlockSolidCocoon(), ItemBlockForestry.class, "cocoon.solid");
}
@@ -17,9 +17,12 @@ import forestry.core.proxy.Proxies;
import forestry.core.render.EmptyStateMapper;
import forestry.core.tiles.TileUtil;
import forestry.core.utils.ItemStackUtil;
import forestry.lepidopterology.blocks.property.PropertyCocoon;
import forestry.lepidopterology.genetics.alleles.AlleleButterflyCocoon;
import forestry.lepidopterology.tiles.TileCocoon;
import net.minecraft.block.Block;
import net.minecraft.block.ITileEntityProvider;
import net.minecraft.block.state.BlockState;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
@@ -33,6 +36,8 @@ import net.minecraftforge.fml.relauncher.SideOnly;
public class BlockSolidCocoon extends Block implements ITileEntityProvider, IStateMapperRegister {
private static final PropertyCocoon COCOON = AlleleButterflyCocoon.COCOON;
public BlockSolidCocoon() {
super(new MaterialCocoon());
setHarvestLevel("scoop", 0);
@@ -40,6 +45,28 @@ public class BlockSolidCocoon extends Block implements ITileEntityProvider, ISta
setTickRandomly(true);
setStepSound(soundTypeGrass);
setCreativeTab(null);
setDefaultState(this.blockState.getBaseState().withProperty(COCOON, AlleleButterflyCocoon.cocoonDefault).withProperty(AlleleButterflyCocoon.AGE, 0));
}
@Override
protected BlockState createBlockState() {
return new BlockState(this, COCOON, AlleleButterflyCocoon.AGE);
}
@SideOnly(Side.CLIENT)
@Override
public IBlockState getActualState(IBlockState state, IBlockAccess world, BlockPos pos) {
TileCocoon cocoon = TileUtil.getTile(world, pos, TileCocoon.class);
if(cocoon != null){
state = state.withProperty(COCOON, cocoon.getCaterpillar().getGenome().getCocoon()).withProperty(AlleleButterflyCocoon.AGE, cocoon.getAge());
}
return super.getActualState(state, world, pos);
}
@SideOnly(Side.CLIENT)
@Override
public void registerStateMapper() {
Proxies.render.registerStateMapper(this, new CocoonStateMapper());
}
@Override
@@ -83,17 +110,6 @@ public class BlockSolidCocoon extends Block implements ITileEntityProvider, ISta
return 0;
}
@Override
public int getRenderType() {
return 2;
}
@SideOnly(Side.CLIENT)
@Override
public void registerStateMapper() {
Proxies.render.registerStateMapper(this, EmptyStateMapper.instance);
}
@Override
public void onNeighborBlockChange(World worldIn, BlockPos pos, IBlockState state, Block neighborBlock) {
IBlockState stateUp = worldIn.getBlockState(pos.up());
@@ -0,0 +1,44 @@
package forestry.lepidopterology.blocks;
import java.util.Map;
import net.minecraft.block.Block;
import net.minecraft.block.state.BlockState;
import net.minecraft.block.state.IBlockState;
import net.minecraft.client.resources.model.ModelResourceLocation;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import forestry.api.arboriculture.IAlleleFruit;
import forestry.api.genetics.AlleleManager;
import forestry.api.genetics.IAllele;
import forestry.api.lepidopterology.IAlleleButterflyCocoon;
import forestry.arboriculture.blocks.BlockFruitPod;
import forestry.core.config.Constants;
import forestry.core.render.ForestryStateMapper;
import forestry.lepidopterology.blocks.property.PropertyCocoon;
import forestry.lepidopterology.genetics.alleles.AlleleButterflyCocoon;
@SideOnly(Side.CLIENT)
public class CocoonStateMapper extends ForestryStateMapper {
@Override
public Map<IBlockState, ModelResourceLocation> putStateModelLocations(Block block) {
if (block instanceof BlockCocoon || block instanceof BlockSolidCocoon) {
for(IAllele allele :AlleleManager.alleleRegistry.getRegisteredAlleles().values()){
if(allele instanceof IAlleleButterflyCocoon){
for(int age = 0;age < 3;age++){
IAlleleButterflyCocoon cocoon = (IAlleleButterflyCocoon) allele;
String resourcePath = Constants.RESOURCE_ID + ":cocoons/cocoon_" + cocoon.getCocoonName();
IBlockState state = block.getDefaultState().withProperty(AlleleButterflyCocoon.COCOON, cocoon).withProperty(AlleleButterflyCocoon.AGE, age);
String propertyString = "age=" + age;
mapStateModelLocations.put(state, new ModelResourceLocation(resourcePath, propertyString));
}
}
}
}
return mapStateModelLocations;
}
}
@@ -0,0 +1,61 @@
/*******************************************************************************
* Copyright (c) 2011-2014 SirSengir.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the GNU Lesser Public License v3
* which accompanies this distribution, and is available at
* http://www.gnu.org/licenses/lgpl-3.0.txt
*
* Various Contributors including, but not limited to:
* SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges
******************************************************************************/
package forestry.lepidopterology.blocks.property;
import com.google.common.base.Objects;
import java.util.ArrayList;
import java.util.List;
import forestry.api.arboriculture.IAlleleTreeSpecies;
import forestry.api.genetics.AlleleManager;
import forestry.api.genetics.IAllele;
import forestry.api.lepidopterology.IAlleleButterflyCocoon;
import forestry.core.blocks.propertys.PropertyAllele;
public class PropertyCocoon extends PropertyAllele<IAlleleButterflyCocoon> {
public PropertyCocoon(String name) {
super(name);
}
@Override
public Class<IAlleleButterflyCocoon> getValueClass() {
return IAlleleButterflyCocoon.class;
}
@Override
public String toString() {
return Objects.toStringHelper(this).add("name", this.name).add("clazz", IAlleleButterflyCocoon.class).add("values", this.getAllowedValues()).toString();
}
@Override
public int hashCode() {
return 31 * IAlleleTreeSpecies.class.hashCode() + this.name.hashCode();
}
@Override
public List<IAlleleButterflyCocoon> getAllowedValues() {
List<IAlleleButterflyCocoon> trees = new ArrayList<>();
for (IAllele allele : AlleleManager.alleleRegistry.getRegisteredAlleles().values()) {
if (allele instanceof IAlleleButterflyCocoon) {
trees.add((IAlleleButterflyCocoon) allele);
}
}
return trees;
}
@Override
public String getName(IAlleleButterflyCocoon value) {
return value.getCocoonName();
}
}
@@ -15,60 +15,68 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.annotation.Nonnull;
import forestry.api.genetics.AlleleManager;
import forestry.api.lepidopterology.EnumButterflyChromosome;
import forestry.api.lepidopterology.EnumCocoonType;
import forestry.api.lepidopterology.IAlleleButterflyCocoon;
import forestry.core.PluginCore;
import forestry.core.config.Constants;
import forestry.core.genetics.alleles.AlleleCategorized;
import forestry.lepidopterology.blocks.property.PropertyCocoon;
import net.minecraft.block.properties.PropertyInteger;
import net.minecraft.client.resources.model.ModelResourceLocation;
import net.minecraft.item.ItemStack;
public class AlleleButterflyCocoon extends AlleleCategorized implements IAlleleButterflyCocoon {
public static final PropertyCocoon COCOON = new PropertyCocoon("cocoon");
public static final PropertyInteger AGE = PropertyInteger.create("age", 0, 2);
public static IAlleleButterflyCocoon cocoonDefault;
public static IAlleleButterflyCocoon cocoonSilk;
private static List<IAlleleButterflyCocoon> cocoonAlleles;
public static void createAlleles() {
List<IAlleleButterflyCocoon> cocoonAlleles = Arrays.asList(
cocoonDefault = new AlleleButterflyCocoon("default", EnumCocoonType.DEFAULT, false),
cocoonSilk = new AlleleButterflyCocoon("silk", EnumCocoonType.SILK, false)
cocoonDefault = new AlleleButterflyCocoon("default", false),
cocoonSilk = new AlleleButterflyCocoon("silk", false)
);
cocoonSilk.getCocoonLoot().put(PluginCore.items.craftingMaterial.getSilkWisp(), 0.75F);
cocoonSilk.getCocoonLoot().put(PluginCore.items.craftingMaterial.getSilkWisp(), 0.25F);
for (IAlleleButterflyCocoon cocoonAllele : cocoonAlleles) {
AlleleManager.alleleRegistry.registerAllele(cocoonAllele, EnumButterflyChromosome.COCOON);
}
}
@Nonnull
private EnumCocoonType type;
public static void createLoot(){
cocoonSilk.getCocoonLoot().put(PluginCore.items.craftingMaterial.getSilkWisp(), 0.75F);
cocoonSilk.getCocoonLoot().put(PluginCore.items.craftingMaterial.getSilkWisp(), 0.25F);
}
private Map<ItemStack, Float> loot = new HashMap();
private String name;
public AlleleButterflyCocoon(String name, @Nonnull EnumCocoonType type, boolean isDominant) {
public AlleleButterflyCocoon(String name, boolean isDominant) {
super(Constants.MOD_ID, "cocoon", name, isDominant);
this.type = type;
this.name = name;
}
@Override
public EnumCocoonType getCocoonType() {
return type;
private static String getAgeKey(int age){
if(age == 0){
return "early";
}else if(age == 1){
return "middle";
}else{
return "late";
}
}
@Override
public String getCocoonTexture(int age) {
return "textures/blocks/lepidopterology/cocoons/" + type + "_" + age + ".png";
public String getCocoonName() {
return name;
}
@Override
public ModelResourceLocation getCocoonItemModel(int age) {
return new ModelResourceLocation(Constants.RESOURCE_ID + ":lepidopterology/cocoons/" + type + "_" + age + ".png", "inventory");
return new ModelResourceLocation(Constants.RESOURCE_ID + ":lepidopterology/cocoons/cocoon_" + name + "_" + getAgeKey(age), "inventory");
}
@Override
@@ -76,4 +84,9 @@ public class AlleleButterflyCocoon extends AlleleCategorized implements IAlleleB
return loot;
}
@Override
public int compareTo(IAlleleButterflyCocoon o) {
return 0;
}
}
@@ -27,6 +27,7 @@ import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import forestry.api.arboriculture.IAlleleTreeSpecies;
import forestry.api.arboriculture.ITree;
import forestry.api.core.IModelManager;
import forestry.api.core.Tabs;
@@ -36,6 +37,7 @@ import forestry.api.genetics.IAlleleSpecies;
import forestry.api.genetics.IIndividual;
import forestry.api.lepidopterology.ButterflyManager;
import forestry.api.lepidopterology.EnumFlutterType;
import forestry.api.lepidopterology.IAlleleButterflyCocoon;
import forestry.api.lepidopterology.IAlleleButterflySpecies;
import forestry.api.lepidopterology.IButterfly;
import forestry.api.lepidopterology.IButterflyGenome;
@@ -193,6 +195,13 @@ public class ItemButterflyGE extends ItemGE {
break;
case COCOON:
manager.registerItemModel(item, new CocoonMeshDefinition());
for (IAllele allele : AlleleManager.alleleRegistry.getRegisteredAlleles().values()) {
if (allele instanceof IAlleleButterflyCocoon) {
for(int age = 0;age < 3;age++){
manager.registerVariant(this, ((IAlleleButterflyCocoon) allele).getCocoonItemModel(age));
}
}
}
break;
default:
manager.registerItemModel(item, 0, "liquids/jar");
@@ -10,7 +10,6 @@
******************************************************************************/
package forestry.lepidopterology.proxy;
import net.minecraftforge.fml.client.registry.ClientRegistry;
import net.minecraftforge.fml.client.registry.RenderingRegistry;
import forestry.core.models.ModelIndex;
import forestry.core.models.ModelManager;
@@ -18,8 +17,6 @@ import forestry.core.proxy.Proxies;
import forestry.lepidopterology.entities.EntityButterfly;
import forestry.lepidopterology.render.ModelButterflyItem;
import forestry.lepidopterology.render.RenderButterflyEntity;
import forestry.lepidopterology.render.RendererCocoon;
import forestry.lepidopterology.tiles.TileCocoon;
public class ProxyLepidopterologyClient extends ProxyLepidopterology {
@@ -27,6 +24,5 @@ public class ProxyLepidopterologyClient extends ProxyLepidopterology {
public void preInitializeRendering() {
RenderingRegistry.registerEntityRenderingHandler(EntityButterfly.class, new RenderButterflyEntity.Factory());
Proxies.render.registerModel(new ModelIndex(ModelManager.getInstance().getModelLocation("butterflyGE"), new ModelButterflyItem()));
ClientRegistry.bindTileEntitySpecialRenderer(TileCocoon.class, new RendererCocoon());
}
}
@@ -1,111 +0,0 @@
package forestry.lepidopterology.render;
import net.minecraft.client.model.ModelBase;
import net.minecraft.client.model.ModelRenderer;
public class ModelCocoon extends ModelBase {
public ModelRenderer cocoonbody_0_age_2;
public ModelRenderer cocoonbody_1_age_2;
public ModelRenderer cocoonbody_2_age_2;
public ModelRenderer cocoonbody_3_age_2;
public ModelRenderer cocoonbody_4_age_2;
public ModelRenderer cocoonbody_5_age_2;
public ModelRenderer cocoonbody_0_age_1;
public ModelRenderer cocoonbody_1_age_1;
public ModelRenderer cocoonbody_2_age_1;
public ModelRenderer cocoonbody_3_age_1;
public ModelRenderer cocoonbody_4_age_1;
public ModelRenderer cocoonbody_5_age_1;
public ModelRenderer cocoonbody_0_age_0;
public ModelRenderer cocoonbody_1_age_0;
public ModelRenderer cocoonbody_2_age_0;
public ModelRenderer cocoonbody_3_age_0;
public ModelRenderer cocoonbody_4_age_0;
public ModelRenderer cocoonbody_5_age_0;
public ModelCocoon() {
this.textureWidth = 64;
this.textureHeight = 32;
this.cocoonbody_1_age_2 = new ModelRenderer(this, 48, 0);
this.cocoonbody_1_age_2.setRotationPoint(-1.5F, 9.0F, -1.5F);
this.cocoonbody_1_age_2.addBox(0.0F, 0.0F, 0.0F, 4, 1, 4, 0.0F);
this.cocoonbody_0_age_2 = new ModelRenderer(this, 31, 0);
this.cocoonbody_0_age_2.setRotationPoint(-0.5F, 8.0F, -0.5F);
this.cocoonbody_0_age_2.addBox(0.0F, 0.0F, 0.0F, 2, 1, 2, 0.0F);
this.cocoonbody_2_age_2 = new ModelRenderer(this, 0, 18);
this.cocoonbody_2_age_2.setRotationPoint(-2.5F, 10.0F, -2.5F);
this.cocoonbody_2_age_2.addBox(0.0F, 0.0F, 0.0F, 6, 8, 6, 0.0F);
this.cocoonbody_4_age_2 = new ModelRenderer(this, 0, 7);
this.cocoonbody_4_age_2.setRotationPoint(-2.5F, 18.0F, -2.5F);
this.cocoonbody_4_age_2.addBox(0.0F, 0.0F, 0.0F, 6, 1, 5, 0.0F);
this.cocoonbody_3_age_2 = new ModelRenderer(this, 30, 24);
this.cocoonbody_3_age_2.setRotationPoint(-2.5F, 11.0F, -3.5F);
this.cocoonbody_3_age_2.addBox(0.0F, 0.0F, 0.0F, 6, 7, 1, 0.0F);
this.cocoonbody_5_age_2 = new ModelRenderer(this, 0, 0);
this.cocoonbody_5_age_2.setRotationPoint(-1.5F, 19.0F, -1.0F);
this.cocoonbody_5_age_2.addBox(0.0F, 0.0F, 0.0F, 4, 1, 2, 0.0F);
this.cocoonbody_2_age_1 = new ModelRenderer(this, 0, 18);
this.cocoonbody_2_age_1.setRotationPoint(-2.5F, 10.0F, -2.5F);
this.cocoonbody_2_age_1.addBox(0.0F, 0.0F, 0.0F, 4, 6, 4, 0.0F);
this.cocoonbody_0_age_1 = new ModelRenderer(this, 31, 0);
this.cocoonbody_0_age_1.setRotationPoint(-1.0F, 8.0F, -1.0F);
this.cocoonbody_0_age_1.addBox(0.0F, 0.0F, 0.0F, 1, 1, 1, 0.0F);
this.cocoonbody_3_age_1 = new ModelRenderer(this, 30, 24);
this.cocoonbody_3_age_1.setRotationPoint(-2.5F, 11.0F, -3.5F);
this.cocoonbody_3_age_1.addBox(0.0F, 0.0F, 0.0F, 4, 5, 1, 0.0F);
this.cocoonbody_1_age_1 = new ModelRenderer(this, 48, 0);
this.cocoonbody_1_age_1.setRotationPoint(-1.5F, 9.0F, -1.5F);
this.cocoonbody_1_age_1.addBox(0.0F, 0.0F, 0.0F, 2, 1, 2, 0.0F);
this.cocoonbody_5_age_1 = new ModelRenderer(this, 0, 0);
this.cocoonbody_5_age_1.setRotationPoint(-1.0F, 17.0F, -2.5F);
this.cocoonbody_5_age_1.addBox(0.0F, 0.0F, 0.0F, 2, 1, 3, 0.0F);
this.cocoonbody_4_age_1 = new ModelRenderer(this, 0, 7);
this.cocoonbody_4_age_1.setRotationPoint(-1.5F, 16.0F, -3.0F);
this.cocoonbody_4_age_1.addBox(0.0F, 0.0F, 0.0F, 3, 1, 4, 0.0F);
this.cocoonbody_3_age_0 = new ModelRenderer(this, 30, 24);
this.cocoonbody_3_age_0.setRotationPoint(-2.0F, 11.0F, -3.0F);
this.cocoonbody_3_age_0.addBox(0.0F, 0.0F, 0.0F, 3, 3, 1, 0.0F);
this.cocoonbody_2_age_0 = new ModelRenderer(this, 0, 18);
this.cocoonbody_2_age_0.setRotationPoint(-2.0F, 10.0F, -2.0F);
this.cocoonbody_2_age_0.addBox(0.0F, 0.0F, 0.0F, 3, 4, 3, 0.0F);
this.cocoonbody_4_age_0 = new ModelRenderer(this, 0, 7);
this.cocoonbody_4_age_0.setRotationPoint(-1.5F, 14.0F, -2.5F);
this.cocoonbody_4_age_0.addBox(0.0F, 0.0F, 0.0F, 2, 1, 3, 0.0F);
this.cocoonbody_1_age_0 = new ModelRenderer(this, 48, 0);
this.cocoonbody_1_age_0.setRotationPoint(-1.5F, 9.0F, -1.5F);
this.cocoonbody_1_age_0.addBox(0.0F, 0.0F, 0.0F, 2, 1, 2, 0.0F);
this.cocoonbody_5_age_0 = new ModelRenderer(this, 0, 0);
this.cocoonbody_5_age_0.setRotationPoint(-1.0F, 15.0F, -2.0F);
this.cocoonbody_5_age_0.addBox(0.0F, 0.0F, 0.0F, 1, 1, 2, 0.0F);
this.cocoonbody_0_age_0 = new ModelRenderer(this, 31, 0);
this.cocoonbody_0_age_0.setRotationPoint(-1.0F, 8.0F, -1.0F);
this.cocoonbody_0_age_0.addBox(0.0F, 0.0F, 0.0F, 1, 1, 1, 0.0F);
}
public void renderCucoon(int age){
float pixel = 0.0625F;
if(age == 0){
this.cocoonbody_3_age_0.render(pixel);
this.cocoonbody_2_age_0.render(pixel);
this.cocoonbody_4_age_0.render(pixel);
this.cocoonbody_1_age_0.render(pixel);
this.cocoonbody_5_age_0.render(pixel);
this.cocoonbody_0_age_0.render(pixel);
}else if(age == 1){
this.cocoonbody_2_age_1.render(pixel);
this.cocoonbody_0_age_1.render(pixel);
this.cocoonbody_3_age_1.render(pixel);
this.cocoonbody_1_age_1.render(pixel);
this.cocoonbody_5_age_1.render(pixel);
this.cocoonbody_4_age_1.render(pixel);
}else if(age == 2){
this.cocoonbody_1_age_2.render(pixel);
this.cocoonbody_0_age_2.render(pixel);
this.cocoonbody_2_age_2.render(pixel);
this.cocoonbody_4_age_2.render(pixel);
this.cocoonbody_3_age_2.render(pixel);
this.cocoonbody_5_age_2.render(pixel);
}
}
}
@@ -1,58 +0,0 @@
/*******************************************************************************
* Copyright (c) 2011-2014 SirSengir.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the GNU Lesser Public License v3
* which accompanies this distribution, and is available at
* http://www.gnu.org/licenses/lgpl-3.0.txt
*
* Various Contributors including, but not limited to:
* SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges
******************************************************************************/
package forestry.lepidopterology.render;
import net.minecraft.block.state.IBlockState;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
import net.minecraft.util.ResourceLocation;
import forestry.api.lepidopterology.IAlleleButterflySpecies;
import forestry.api.lepidopterology.IButterfly;
import forestry.core.proxy.Proxies;
import forestry.lepidopterology.blocks.BlockCocoon;
import forestry.lepidopterology.blocks.BlockSolidCocoon;
import forestry.lepidopterology.genetics.MothDefinition;
import forestry.lepidopterology.tiles.TileCocoon;
public class RendererCocoon extends TileEntitySpecialRenderer<TileCocoon> {
private static ModelCocoon modelCocoon = new ModelCocoon();
public RendererCocoon() {
}
@Override
public void renderTileEntityAt(TileCocoon te, double x, double y, double z, float partialTicks, int destroyStage) {
IBlockState state = te.getWorld().getBlockState(te.getPos());
if(state == null || !(state.getBlock() instanceof BlockCocoon) && !(state.getBlock() instanceof BlockSolidCocoon)){
return;
}
IButterfly butterfly = te.getCaterpillar();
if(butterfly == null){
butterfly = MothDefinition.BombyxMori.getIndividual();
}
render(butterfly, te.getAge(), x, y, z);
}
private static void render(IButterfly butterfly, int age, double x, double y, double z){
IAlleleButterflySpecies species = butterfly.getGenome().getPrimary();
GlStateManager.pushMatrix();
GlStateManager.translate((float) x + 0.5F, (float) y + 1.5F, (float) z + 0.5F);
GlStateManager.rotate(180, 0F, 0F, 1F);
GlStateManager.rotate(180.0F, 0.0F, 1.0F, 0.0F);
Proxies.render.bindTexture(new ResourceLocation(species.getModID(), butterfly.getGenome().getCocoon().getCocoonTexture(age)));
modelCocoon.renderCucoon(age);
GlStateManager.popMatrix();
}
}