Posted May 3, 201312 yr The subject pretty much say it all. Has just begone to work with custom render blocks in minecraft forge when i run in to this bug and now i can't find out what's wrong. [EDIT:] To be clearer on the bug itself... The model is being drawn always on the blocks x and z axis while the y axis follows the heigth of the player for some odd reason. Mod-File package mods.dnd91.minecraft.hivecraft; import net.minecraft.block.Block; import net.minecraft.block.material.MapColor; import net.minecraft.block.material.Material; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.src.ModLoader; import net.minecraftforge.common.MinecraftForge; import cpw.mods.fml.client.registry.RenderingRegistry; import cpw.mods.fml.common.Mod; import cpw.mods.fml.common.Mod.Init; import cpw.mods.fml.common.Mod.Instance; import cpw.mods.fml.common.Mod.PostInit; import cpw.mods.fml.common.Mod.PreInit; import cpw.mods.fml.common.SidedProxy; import cpw.mods.fml.common.event.FMLInitializationEvent; import cpw.mods.fml.common.event.FMLPostInitializationEvent; import cpw.mods.fml.common.event.FMLPreInitializationEvent; import cpw.mods.fml.common.network.NetworkMod; import cpw.mods.fml.common.registry.GameRegistry; import cpw.mods.fml.common.registry.LanguageRegistry; @Mod(modid="HiveCraft", name="HiveCraft", version="0.0.0") @NetworkMod(clientSideRequired=true, serverSideRequired=false) public class HiveCraft { public static int modelAscenderID; public static int organicCompoundID = 500; public static int biomassID = 5000; public static int ascenderID = 501; public static Block blockOrganicCompound; public static Block blockAscender; public static Item itemBiomass; public static Material materialBiomass = new MaterialBiomass(MapColor.foliageColor); // The instance of your mod that Forge uses. @Instance("HiveCraft") public static HiveCraft instance; // Says where the client and server 'proxy' code is loaded. @SidedProxy(clientSide="mods.dnd91.minecraft.hivecraft.client.ClientProxy", serverSide="mods.dnd91.minecraft.hivecraft.CommonProxy") public static CommonProxy proxy; @PreInit public void preInit(FMLPreInitializationEvent event) { // Load Configure files } @Init public void load(FMLInitializationEvent event) { blockOrganicCompound = new BlockOrganicCompound(organicCompoundID, materialBiomass); GameRegistry.registerBlock(blockOrganicCompound, "blockOrganicCompound"); LanguageRegistry.addName(blockOrganicCompound, "Organic Compound"); MinecraftForge.setBlockHarvestLevel(blockOrganicCompound, "shovel", 1); blockAscender = new BlockAscender(ascenderID, materialBiomass); GameRegistry.registerBlock(blockAscender, "blockAscender"); LanguageRegistry.addName(blockAscender, "Organic Ascender"); MinecraftForge.setBlockHarvestLevel(blockAscender, "shovel", 1); itemBiomass = new ItemBiomass(biomassID); GameRegistry.registerItem(itemBiomass, "biomass"); LanguageRegistry.addName(itemBiomass, "Biomass"); GameRegistry.addRecipe(new ItemStack(blockOrganicCompound, 4), "xxx", "xyx", "xxx", 'x', new ItemStack(Block.sapling), 'y', new ItemStack(Block.dirt)); GameRegistry.addSmelting(organicCompoundID, new ItemStack(itemBiomass), 0.2f); GameRegistry.registerTileEntity(TileEntityAscender.class, "orgasc"); proxy.registerRenderers(); } @PostInit public void postInit(FMLPostInitializationEvent event) { // Get along with other mods } } Block file package mods.dnd91.minecraft.hivecraft; import java.util.Random; import net.minecraft.block.Block; import net.minecraft.block.BlockContainer; import net.minecraft.block.material.Material; import net.minecraft.client.renderer.texture.IconRegister; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.entity.Entity; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.AxisAlignedBB; import net.minecraft.util.Vec3; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; public class BlockAscender extends BlockContainer { public BlockAscender (int id, Material material) { super(id, material); this.setHardness(0.5F); this.setStepSound(Block.soundSnowFootstep); this.setUnlocalizedName("blockAscender"); this.setCreativeTab(CreativeTabs.tabBlock); this.setLightOpacity(3); //this.setTickRandomly(true); } @Override public void registerIcons(IconRegister ires){ this.blockIcon = ires.registerIcon("dnd91/minecraft/hivecraft:OrganicCompound"); } @Override public boolean renderAsNormalBlock() { return false; } @Override public int getRenderType() { return -1; } // where and what to render @Override public boolean isOpaqueCube() { return false; } // make it opaque cube, or else you will be able to see trough the world ! @Override public TileEntity createNewTileEntity(World world) { return new TileEntityAscender(); } } Have a TitleEntityA that Extends TitleEntity and is empty. Client Proxy package mods.dnd91.minecraft.hivecraft.client; import cpw.mods.fml.client.registry.ClientRegistry; import cpw.mods.fml.client.registry.RenderingRegistry; import mods.dnd91.minecraft.hivecraft.CommonProxy; import mods.dnd91.minecraft.hivecraft.HiveCraft; import mods.dnd91.minecraft.hivecraft.TileEntityAscender; import net.minecraftforge.client.MinecraftForgeClient; public class ClientProxy extends CommonProxy { @Override public void registerRenderers() { ClientRegistry.bindTileEntitySpecialRenderer(TileEntityAscender.class, new RenderAscender()); } } Model class package mods.dnd91.minecraft.hivecraft.client; import net.minecraft.client.model.ModelBase; import net.minecraft.client.model.ModelRenderer; import net.minecraft.entity.Entity; public class ModelAscender extends ModelBase { //fields ModelRenderer bottom; ModelRenderer middel; ModelRenderer top; public ModelAscender() { textureWidth = 128; textureHeight = 128; bottom = new ModelRenderer(this, 0, 0); bottom.addBox(-8F, 0F, -8F, 16, 2, 16); bottom.setRotationPoint(0F, 22F, 0F); bottom.setTextureSize(128, 128); setRotation(bottom, 0F, 0F, 0F); middel = new ModelRenderer(this, 4, 19); middel.addBox(-7F, 0F, -7F, 14, 2, 14); middel.setRotationPoint(0F, 20F, 0F); middel.setTextureSize(128, 128); setRotation(middel, 0F, 0F, 0F); top = new ModelRenderer(this, 13, 36); top.addBox(-5F, 0F, -5F, 10, 3, 10); top.setRotationPoint(0F, 17F, 0F); top.setTextureSize(128, 128); setRotation(top, 0F, 0F, 0F); } public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) { //super.render(entity, f, f1, f2, f3, f4, f5); //setRotationAngles(f, f1, f2, f3, f4, f5); // bottom.render(f5); // middel.render(f5); // top.render(f5); } public void renderModel(float f5) { bottom.render(f5); middel.render(f5); top.render(f5); } private void setRotation(ModelRenderer model, float x, float y, float z) { //model.rotateAngleX = x; //model.rotateAngleY = y; //model.rotateAngleZ = z; } public void setRotationAngles(float f, float f1, float f2, float f3, float f4, float f5) { //super.setRotationAngles(f, f1, f2, f3, f4, f5); } } Render class package mods.dnd91.minecraft.hivecraft.client; import org.lwjgl.opengl.GL11; import org.lwjgl.opengl.GL12; import mods.dnd91.minecraft.hivecraft.TileEntityAscender; import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer; import net.minecraft.tileentity.TileEntity; public class RenderAscender extends TileEntitySpecialRenderer { ModelAscender model; public RenderAscender() { //super(); model = new ModelAscender(); } @Override public void renderTileEntityAt(TileEntity tileentity, double d0, double d1, double d2, float f) { renderAscenderModelAt((TileEntityAscender)tileentity, d0,1,d2,f); } private void renderAscenderModelAt(TileEntityAscender te, double d, double d1, double d2, float f) { int i = 0; if(te.worldObj != null) { i = (te.worldObj.getBlockMetadata(te.xCoord, te.yCoord, te.zCoord)); } //directory of the model's texture file bindTextureByName("/mods/dnd91/minecraft/hivecraft/textures/models/Ascender.png"); GL11.glPushMatrix(); GL11.glEnable(GL12.GL_RESCALE_NORMAL); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); GL11.glTranslatef((float)d + 0.5F, (float)d1 + 0.0F, (float)d2 + 0.5F); GL11.glScalef(1.0F, -1.0F, -1.0F); //GL11.glTranslatef(0.5F, 1.0F, 0.5F); model.renderModel(0.0625F); GL11.glDisable(GL12.GL_RESCALE_NORMAL); GL11.glPopMatrix(); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); } } Anyone have a clue of what is wrong? Been looking at the code for hours and even comparde it to other codes i found trought google. Regards DND
May 3, 201312 yr renderAscenderModelAt((TileEntityAscender)tileentity, d0,1,d2,f); There's a typo, you forgot to prepend a 'd' before the 1: renderAscenderModelAt((TileEntityAscender)tileentity, d0,d1,d2,f); Don't ask for support per PM! They'll get ignored! | If a post helped you, click the "Thank You" button at the top right corner of said post! | mah twitter This thread makes me sad because people just post copy-paste-ready code when it's obvious that the OP has little to no programming experience. This is not how learning works.
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.