Jump to content

Recommended Posts

Posted

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);
    }
}

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • Try the latest build: https://modrinth.com/mod/axiom/version/4.1.1
    • *** buffer overflow detected ***: terminated /usr/bin/forge-1.12.2d: line 162: 15787 Aborted                 (core dumped) ${SUDO_CMD} screen -S "${SESSION_NAME}" -Q select . > /dev/null Starting server...There are several suitable screens on:     14630.forge-1.12.2    (Detached)     15796.forge-1.12.2    (Detached) Use -S to specify a session How do i fix this issue?
    • Oh I forgot to update the title. I figured out the issue and I'm rather embarrassed to say that it was a file path issue. The game already knew I was accessing the achievements so I wasn't suppose to include advancements in the file path. Minecraft file paths have always confused me a little bit... ResourceLocation advancementId = new ResourceLocation( TheDeadRise.MODID,"adventure/spawntrigger");
    • Can someone help my with this? My forge server won't open and I'm not that good with this stuff. It gave me this error message:   C:\Users\apbeu\Desktop\Forge server>java -Xmx4G -Xms1G -jar server.jar nogui 2024-12-11 18:21:01,054 main WARN Advanced terminal features are not available in this environment [18:21:01] [main/INFO] [cp.mo.mo.Launcher/MODLAUNCHER]: ModLauncher running: args [--gameDir, ., --launchTarget, fmlserver, --fml.forgeVersion, 36.2.34, --fml.mcpVersion, 20210115.111550, --fml.mcVersion, 1.16.5, --fml.forgeGroup, net.minecraftforge, nogui] [18:21:01] [main/INFO] [cp.mo.mo.Launcher/MODLAUNCHER]: ModLauncher 8.1.3+8.1.3+main-8.1.x.c94d18ec starting: java version 21.0.4 by Oracle Corporation Exception in thread "main" java.lang.IllegalAccessError: class cpw.mods.modlauncher.SecureJarHandler (in unnamed module @0x402e37bc) cannot access class sun.security.util.ManifestEntryVerifier (in module java.base) because module java.base does not export sun.security.util to unnamed module @0x402e37bc         at cpw.mods.modlauncher.SecureJarHandler.lambda$static$1(SecureJarHandler.java:45)         at cpw.mods.modlauncher.api.LamdbaExceptionUtils.uncheck(LamdbaExceptionUtils.java:95)         at cpw.mods.modlauncher.SecureJarHandler.<clinit>(SecureJarHandler.java:45)         at cpw.mods.modlauncher.Launcher.lambda$new$6(Launcher.java:55)         at java.base/java.util.concurrent.ConcurrentHashMap.computeIfAbsent(ConcurrentHashMap.java:1708)         at cpw.mods.modlauncher.api.TypesafeMap.computeIfAbsent(TypesafeMap.java:52)         at cpw.mods.modlauncher.api.TypesafeMap.computeIfAbsent(TypesafeMap.java:47)         at cpw.mods.modlauncher.Environment.computePropertyIfAbsent(Environment.java:62)         at cpw.mods.modlauncher.Launcher.<init>(Launcher.java:55)         at cpw.mods.modlauncher.Launcher.main(Launcher.java:66)         at net.minecraftforge.server.ServerMain$Runner.runLauncher(ServerMain.java:63)         at net.minecraftforge.server.ServerMain$Runner.access$100(ServerMain.java:60)         at net.minecraftforge.server.ServerMain.main(ServerMain.java:57) C:\Users\apbeu\Desktop\Forge server>pause
    • Here is the url for the crash report if anyone can help me, please. https://mclo.gs/KGn5LWy  
  • Topics

×
×
  • Create New...

Important Information

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