Jump to content

Tanaku2010

Members
  • Posts

    1
  • Joined

  • Last visited

Everything posted by Tanaku2010

  1. My mod will include new golems with a bit custom AI, but I'm having trouble getting them to appear in game. They spawn naturally, spawn from eggs and will do all AI Tasks they're programmed for. The problem is that they're invisible, although a shadow does appear underneath them. I followed tutorials on youtube by WuppyGaming, but instead of using a custom Techne model I'm attempting to use the vanilla Iron Golem model. This may be my problem. Here is a bit of code: Snippet of my main.class @Init public void load(FMLInitializationEvent event) { //Registers - Not the full load method ClientProxy.registerRenders(); gameRegisters(); languageRegisters(); equipmentRegistries(); harvestLevels(); craftingRecipes(); smeltingRecipes(); entityRegistries(); forgeDictionary(); } public static int getUniqueEntityID() { do { startEntityID++; } while(EntityList.getStringFromID(startEntityID) != null); return startEntityID; } public void entityRegistries() { //Mithril Golems EntityRegistry.registerModEntity(EntityMithrilGolem.class, "Mithril Golem", 1, this, 80, 3, true); EntityRegistry.addSpawn(EntityMithrilGolem.class, 30, 1, 1, EnumCreatureType.monster, BiomeGenBase.desert); LanguageRegistry.instance().addStringLocalization("entity.DragonsReign.Mithril Golem.name", "Mithril Golem"); registerEntityEgg(EntityMithrilGolem.class, 0x666798, 0x3E405D); } public void registerEntityEgg(Class<? extends Entity> entity, int primaryColor, int secondaryColor) { int id = getUniqueEntityID(); EntityList.IDtoClassMapping.put(id, entity); EntityList.entityEggs.put(id, new EntityEggInfo(id, primaryColor, secondaryColor)); } Client Proxy package DragonsReign; import DragonsReign.Entity.Monster.EntityMithrilGolem; import DragonsReign.Render.Entity.RenderGolem; import cpw.mods.fml.client.registry.RenderingRegistry; import net.minecraft.client.model.ModelIronGolem; import net.minecraftforge.client.MinecraftForgeClient; public class ClientProxy extends CommonProxy { public static void registerRenders() { MinecraftForgeClient.preloadTexture(BLOCKS_PNG); MinecraftForgeClient.preloadTexture(ITEMS_PNG); RenderingRegistry.registerEntityRenderingHandler(EntityMithrilGolem.class, new RenderGolem()); } } EntityMithrilGolem.class package DragonsReign.Entity.Monster; import DragonsReign.DragonsReign; import DragonsReign.Entity.AI.EntityAIBreakDoorIron; import net.minecraft.block.Block; import net.minecraft.entity.Entity; import net.minecraft.entity.EnumCreatureAttribute; import net.minecraft.entity.ai.EntityAIAttackOnCollide; import net.minecraft.entity.ai.EntityAIBreakDoor; import net.minecraft.entity.ai.EntityAIHurtByTarget; import net.minecraft.entity.ai.EntityAINearestAttackableTarget; import net.minecraft.entity.ai.EntityAIWander; import net.minecraft.entity.ai.EntityAIWatchClosest; import net.minecraft.entity.monster.EntityMob; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.Item; import net.minecraft.world.World; public class EntityMithrilGolem extends EntityMob { public EntityMithrilGolem(World par1World) { super(par1World); this.texture = "/DragonsReign/Texture/Mob/mithrilGolemHostile.png"; this.moveSpeed = 0.15F; this.setSize(1.4F, 2.9F); this.getNavigator().setAvoidsWater(true); this.tasks.addTask(1, new EntityAIBreakDoor(this)); this.tasks.addTask(2, new EntityAIBreakDoorIron(this)); this.tasks.addTask(3, new EntityAIAttackOnCollide(this, EntityPlayer.class, 0.25F, false)); this.tasks.addTask(4, new EntityAIWatchClosest(this, EntityPlayer.class, 6.0F)); this.tasks.addTask(5, new EntityAIWander(this, this.moveSpeed)); this.targetTasks.addTask(1, new EntityAIHurtByTarget(this, false)); this.targetTasks.addTask(2, new EntityAINearestAttackableTarget(this, EntityPlayer.class, 16.0F, 0, true)); } protected boolean isAIEnabled() { return true; } public int getMaxHealth() { return 100; } public int getAttackStrength(Entity par1Entity) { return 7; } public EnumCreatureAttribute getCreatureAttribute() { return EnumCreatureAttribute.UNDEFINED; } protected void dropFewItems(boolean par1, int par2) { this.dropItem(DragonsReign.mithrilIngotID, 5); } protected String getLivingSound() { return "none"; } protected String getHurtSound() { return "mob.irongolem.hit"; } protected String getDeathSound() { return "mob.irongolem.death"; } protected void playStepSound(int par1, int par2, int par3, int par4) { this.playSound("mob.irongolem.walk", 1.0F, 1.0F); } } RenderGolem.class -- This is basically a copy of the IronGolem render file. I had to redo this file 3-4 times, and I stopped editing all the "IronGolem" to MithrilGolem. This will be changed when/if the problem can be found. package DragonsReign.Render.Entity; import org.lwjgl.opengl.GL11; import org.lwjgl.opengl.GL12; import DragonsReign.Entity.Monster.EntityMithrilGolem; import net.minecraft.client.model.ModelIronGolem; import net.minecraft.client.renderer.OpenGlHelper; import net.minecraft.client.renderer.entity.RenderLiving; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLiving; public class RenderGolem extends RenderLiving { /** Iron Golem's Model. */ private ModelIronGolem golemModel; public RenderGolem() { super(new ModelIronGolem(), 0.5F); this.golemModel = (ModelIronGolem)this.mainModel; } /** * Renders the Iron Golem. */ public void doRenderIronGolem(EntityMithrilGolem par1EntityMithrilGolem, double par2, double par4, double par6, float par8, float par9) { super.doRenderLiving(par1EntityMithrilGolem, par2, par4, par6, par8, par9); } /** * Rotates Iron Golem corpse. */ protected void rotateIronGolemCorpse(EntityMithrilGolem par1EntityMithrilGolem, float par2, float par3, float par4) { super.rotateCorpse(par1EntityMithrilGolem, par2, par3, par4); if ((double)par1EntityMithrilGolem.legYaw >= 0.01D) { float var5 = 13.0F; float var6 = par1EntityMithrilGolem.legSwing - par1EntityMithrilGolem.legYaw * (1.0F - par4) + 6.0F; float var7 = (Math.abs(var6 % var5 - var5 * 0.5F) - var5 * 0.25F) / (var5 * 0.25F); GL11.glRotatef(6.5F * var7, 0.0F, 0.0F, 1.0F); } } protected void rotateCorpse(EntityLiving par1EntityLiving, float par2, float par3, float par4) { this.rotateIronGolemCorpse((EntityMithrilGolem)par1EntityLiving, par2, par3, par4); } public void doRenderLiving(EntityLiving par1EntityLiving, double par2, double par4, double par6, float par8, float par9) { this.doRenderIronGolem((EntityMithrilGolem)par1EntityLiving, par2, par4, par6, par8, par9); } /** * Actually renders the given argument. This is a synthetic bridge method, always casting down its argument and then * handing it off to a worker function which does the actual work. In all probabilty, the class Render is generic * (Render<T extends Entity) and this method has signature public void doRender(T entity, double d, double d1, * double d2, float f, float f1). But JAD is pre 1.5 so doesn't do that. */ public void doRender(Entity par1Entity, double par2, double par4, double par6, float par8, float par9) { this.doRenderIronGolem((EntityMithrilGolem)par1Entity, par2, par4, par6, par8, par9); } }
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.