Jump to content

Mooshroom Mushrooms on back


SilasOtoko

Recommended Posts

Well I found where the code is. Now I am only having issues with my custom mob rendering. It spawns in the world, but it is invisible, and somehow it is overlapping with my custom throwable item, because it shows the image of the item in place of the mob texture.

 

Render

@SideOnly(Side.CLIENT)
public class RenderEnt extends RenderLiving
{
/** Iron Golem's Model. */
    protected ModelEnt ModelEnt;

    public RenderEnt(ModelEnt model, float f)
    {
        super(new ModelEnt(), 0.5F);
        model = (ModelEnt)mainModel;
    }

    public void renderLivingEnt(EntityEnt par1EntityEnt, double par2, double par4, double par6, float par8, float par9)
    {
        super.doRenderLiving(par1EntityEnt, par2, par4, par6, par8, par9);
    }

    protected void renderEntEquippedItems(EntityEnt par1EntityEnt, float par2)
    {
        super.renderEquippedItems(par1EntityEnt, par2);

        if (!par1EntityEnt.isChild())
        {
            this.loadTexture("/terrain.png");
            GL11.glEnable(GL11.GL_CULL_FACE);
            GL11.glPushMatrix();
            GL11.glScalef(1.0F, -1.0F, 1.0F);
            GL11.glTranslatef(0.2F, 0.4F, 0.5F);
            GL11.glRotatef(42.0F, 0.0F, 1.0F, 0.0F);
            this.renderBlocks.renderBlockAsItem(Block.sapling, 0, 1.0F);
            GL11.glTranslatef(0.1F, 0.0F, -0.6F);
            GL11.glRotatef(42.0F, 0.0F, 1.0F, 0.0F);
            this.renderBlocks.renderBlockAsItem(Block.sapling, 0, 1.0F);
            GL11.glPopMatrix();
            GL11.glPushMatrix();
            ((ModelQuadruped)this.mainModel).head.postRender(0.0625F);
            GL11.glScalef(1.0F, -1.0F, 1.0F);
            GL11.glTranslatef(0.0F, 0.75F, -0.2F);
            GL11.glRotatef(12.0F, 0.0F, 1.0F, 0.0F);
            this.renderBlocks.renderBlockAsItem(Block.sapling, 0, 1.0F);
            GL11.glPopMatrix();
            GL11.glDisable(GL11.GL_CULL_FACE);
        }
    }

    protected void renderEquippedItems(EntityLiving par1EntityLiving, float par2)
    {
        this.renderEntEquippedItems((EntityEnt)par1EntityLiving, par2);
    }

    public void doRenderLiving(EntityLiving par1EntityLiving, double par2, double par4, double par6, float par8, float par9)
    {
        this.renderLivingEnt((EntityEnt)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.renderLivingEnt((EntityEnt)par1Entity, par2, par4, par6, par8, par9);
    }
}

 

Entity

public class EntityEnt extends EntityMob {
public EntityEnt(World par1World){
	super(par1World);
        this.texture = "/mob/villager_golem.png";
        this.setSize(1.4F, 2.9F);
        this.getNavigator().setAvoidsWater(true);
        this.tasks.addTask(1, new EntityAIAttackOnCollide(this, 0.25F, true));
        this.tasks.addTask(2, new EntityAIMoveTowardsTarget(this, 0.22F, 32.0F));
        this.tasks.addTask(4, new EntityAIMoveTwardsRestriction(this, 0.16F));
        this.tasks.addTask(5, new EntityAIWander(this, 0.16F));
        this.tasks.addTask(6, new EntityAIWatchClosest(this, EntityPlayer.class, 6.0F));
        this.tasks.addTask(7, new EntityAILookIdle(this));
        this.targetTasks.addTask(1, new EntityAIHurtByTarget(this, false));
}

public String getTexture()
{
	return "/mob/villager_golem.png";
}
@Override
public int getMaxHealth() {
	return 100;
}

/**
     * Returns true if the newer Entity AI code should be run
     */
    public boolean isAIEnabled()
    {
        return true;
    }
    
    /**
     * Decrements the entity's air supply when underwater
     */
    protected int decreaseAirSupply(int par1)
    {
        return par1;
    }
    
    /**
     * Returns the sound this mob makes while it's alive.
     */
    protected String getLivingSound()
    {
        return "none";
    }
    
    /**
     * Returns the sound this mob makes when it is hurt.
     */
    protected String getHurtSound()
    {
        return "mob.irongolem.hit";
    }

    /**
     * Returns the sound this mob makes on death.
     */
    protected String getDeathSound()
    {
        return "mob.irongolem.death";
    }
    
    /**
     * Plays step sound at given x, y, z for the entity
     */
    protected void playStepSound(int par1, int par2, int par3, int par4)
    {
        this.playSound("mob.irongolem.walk", 1.0F, 1.0F);
    }
    
    /**
     * Drop 0-2 items of this living's type. @param par1 - Whether this entity has recently been hit by a player. @param
     * par2 - Level of Looting used to kill this mob.
     */
    protected void dropFewItems(boolean par1, int par2)
    {
        int j = this.rand.nextInt(3);
        int k;

        for (k = 0; k < j; ++k)
        {
            this.dropItem(TutorialMod.EarthRune.itemID, 1);
        }

        k = 3 + this.rand.nextInt(3);

        for (int l = 0; l < k; ++l)
        {
            this.dropItem(TutorialMod.SilverNugget.itemID, 4);
        }
    }

}

 

Main Class Custom Registers

GameRegistry.registerWorldGenerator(new WorldGeneratorJosiah());

	EntityRegistry.registerModEntity(EntityCreeperHeart.class, "CreeperHeart", 1, this, 80, 3, true);
    LanguageRegistry.instance().addStringLocalization("entity.CreeperHeart.name", "CreeperHeart");
    
    RenderingRegistry.registerEntityRenderingHandler(EntityCreeperHeart.class, new RenderCreeperHeart(TutorialMod.CreeperHeart));
    EntityRegistry.registerModEntity(EntityEnt.class, "Ent", 1, this, 40, 1, true);
    EntityRegistry.addSpawn(EntityEnt.class, 10, 1, 7, EnumCreatureType.monster, BiomeGenBase.beach, BiomeGenBase.extremeHills, BiomeGenBase.extremeHillsEdge, BiomeGenBase.forest, BiomeGenBase.forestHills, BiomeGenBase.jungle, BiomeGenBase.jungleHills, BiomeGenBase.mushroomIsland, BiomeGenBase.mushroomIslandShore, BiomeGenBase.ocean, BiomeGenBase.plains, BiomeGenBase.river, BiomeGenBase.swampland);
    LanguageRegistry.instance().addStringLocalization("entity.Josiah.FirstMod_TutorialMod.Tutorial.name", "Ent");
    RenderingRegistry.registerEntityRenderingHandler(EntityEnt.class, new RenderEnt(new ModelEnt(), 0.5F));
    

Link to comment
Share on other sites

Man, i see wrong code everywhere... :'(

 

Let's begin with

public RenderEnt(ModelEnt model, float f)
    {
        super(new ModelEnt(), 0.5F);
        model = (ModelEnt)mainModel;
    }

that is one stupid constructor. Fix needed.

then

((ModelQuadruped)this.mainModel).head.postRender(0.0625F);

i am pretty sure your model isn't a ModelQuadruped, but who knows ?

finally

EntityRegistry.registerModEntity(EntityCreeperHeart.class, "CreeperHeart", 1, this, 80, 3, true);
    LanguageRegistry.instance().addStringLocalization("entity.CreeperHeart.name", "CreeperHeart");
    
    RenderingRegistry.registerEntityRenderingHandler(EntityCreeperHeart.class, new RenderCreeperHeart(TutorialMod.CreeperHeart));
    EntityRegistry.registerModEntity(EntityEnt.class, "Ent", 1, this, 40, 1, true);

both entities have same id, and the rendering should only be registered on client side.

Link to comment
Share on other sites

Try to take it a little easy on me. This is my first minecraft mod and I am just trying out everything to do a trial and error method of figuring out what works. I am a kinesthetic learner so I learn best by doing. I fixed the first problem with the constructor, something which I copied from a tutorial example online, and since my mod is a biped I removed the Quadrupled bit. The last problem with the Entity ID is fixed but I'm not sure what I need to change to render it only on client side?

 

By the way the rendering of the items on top of my model works if anyone was wondering. It's the same way that Mushrooms are on the back of the mooshroom. Only thing is that the details of the placement need to be changed to suit your specific model. I didn't change it on mine because that's a little beyond what I know how to do and the way it turned out on my model suits me just fine.

Link to comment
Share on other sites

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.



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • why when I launch the forge version of minecraft in full screen and turn on screen recording, only the first static image of the launch is recorded and the gameplay itself is not recorded
    • As a software developer from Sakha Republic, Russia. and like many in my field, I am quite tech-savvy. However, I recently became a victim of a cryptocurrency scam that cost me more than 10 million in my currency. The experience was not only financially devastating but also emotionally draining. I reported the crime to the authorities, hoping for a swift resolution, but I was frustrated and lacked results. It felt like I was in a maze with no exit. Feeling stuck and desperate, I turned to fellow developers for advice. One of them recommended a company called Muyern Trust Hacker. Initially, I was hesitant; I had heard mixed reviews about recovery services and I was concerned about falling victim to another scam. However, after speaking with their team, I was impressed by their professionalism and the clarity of their recovery methods. The team at Muyern Trust Hacker was dedicated and responsive, providing regular updates on their progress. It was refreshing to work with professionals who genuinely cared about my situation and were committed to helping me recover my lost funds. To my astonishment, they managed to recover most of my lost funds. The experience taught me valuable lessons about the risks of cryptocurrency investments and the importance of vigilance in the digital space.
    • Hello! I am the leader of this rp community for a Minecraft rp server and I would like to lend out an invitation to you all to join! We are on a rp server meaning we are going to do some rp and have characters, lore, stories and more! If you want to join just click the discord link below and I’ll help guide you through the process in joining the server and joining us on the server which should be easy. (NOTE: server requires you have to be 16 years old or older) (Java only!) Discord: https://discord.gg/V9uxjKQ7dB
    • these are the errors at startup [06nov2024 19:13:37.566] [main/INFO] [cpw.mods.modlauncher.Launcher/MODLAUNCHER]: ModLauncher running: args [--launchTarget, forgeserver, --fml.forgeVersion, 47.3.11, --fml.mcVersion, 1.20.1, --fml.forgeGroup, net.minecraftforge, --fml.mcpVersion, 20230612.114412] [06nov2024 19:13:37.570] [main/INFO] [cpw.mods.modlauncher.Launcher/MODLAUNCHER]: ModLauncher 10.0.9+10.0.9+main.dcd20f30 starting: java version 23.0.1 by Oracle Corporation; OS Windows 11 arch amd64 version 10.0 [06nov2024 19:13:39.173] [main/INFO] [net.minecraftforge.fml.loading.ImmediateWindowHandler/]: ImmediateWindowProvider not loading because launch target is forgeserver [06nov2024 19:13:39.178] [main/INFO] [mixin-transmog/]: Mixin Transmogrifier is definitely up to no good... [06nov2024 19:13:39.398] [main/INFO] [mixin-transmog/]: Redefining 5 mixin classes [06nov2024 19:13:39.412] [main/INFO] [mixin-transmog/]: crimes against java were committed [06nov2024 19:13:39.413] [main/INFO] [com.teampotato.redirector.Redirector/]: Redirector CoreMod initialized successfully! [06nov2024 19:13:39.424] [main/INFO] [mixin-transmog/]: Original mixin transformation service successfully crobbed by mixin-transmogrifier! [06nov2024 19:13:39.453] [main/INFO] [mixin/]: SpongePowered MIXIN Subsystem Version=0.8.5 Source=union:/C:/Users/zappi/OneDrive/Desktop/server%20forge/mods/Connector-1.0.0-beta.18+1.20.1-full.jar%23386%23390!/ Service=ModLauncher Env=SERVER [06nov2024 19:13:40.424] [main/WARN] [net.minecraftforge.fml.loading.moddiscovery.ModFileParser/LOADING]: Mod file C:\Users\zappi\OneDrive\Desktop\server forge\libraries\net\minecraftforge\fmlcore\1.20.1-47.3.11\fmlcore-1.20.1-47.3.11.jar is missing mods.toml file [06nov2024 19:13:40.427] [main/WARN] [net.minecraftforge.fml.loading.moddiscovery.ModFileParser/LOADING]: Mod file C:\Users\zappi\OneDrive\Desktop\server forge\libraries\net\minecraftforge\javafmllanguage\1.20.1-47.3.11\javafmllanguage-1.20.1-47.3.11.jar is missing mods.toml file [06nov2024 19:13:40.430] [main/WARN] [net.minecraftforge.fml.loading.moddiscovery.ModFileParser/LOADING]: Mod file C:\Users\zappi\OneDrive\Desktop\server forge\libraries\net\minecraftforge\lowcodelanguage\1.20.1-47.3.11\lowcodelanguage-1.20.1-47.3.11.jar is missing mods.toml file [06nov2024 19:13:40.433] [main/WARN] [net.minecraftforge.fml.loading.moddiscovery.ModFileParser/LOADING]: Mod file C:\Users\zappi\OneDrive\Desktop\server forge\libraries\net\minecraftforge\mclanguage\1.20.1-47.3.11\mclanguage-1.20.1-47.3.11.jar is missing mods.toml file [06nov2024 19:13:41.061] [main/WARN] [net.minecraftforge.jarjar.selection.JarSelector/]: Attempted to select two dependency jars from JarJar which have the same identification: Mod File:  and Mod File: . Using Mod File:  [06nov2024 19:13:41.062] [main/WARN] [net.minecraftforge.jarjar.selection.JarSelector/]: Attempted to select two dependency jars from JarJar which have the same identification: Mod File:  and Mod File: . Using Mod File:  [06nov2024 19:13:41.063] [main/WARN] [net.minecraftforge.jarjar.selection.JarSelector/]: Attempted to select a dependency jar for JarJar which was passed in as source: curios. Using Mod File: C:\Users\zappi\OneDrive\Desktop\server forge\mods\curios-forge-5.10.0+1.20.1.jar [06nov2024 19:13:41.063] [main/WARN] [net.minecraftforge.jarjar.selection.JarSelector/]: Attempted to select a dependency jar for JarJar which was passed in as source: terrablender. Using Mod File: C:\Users\zappi\OneDrive\Desktop\server forge\mods\TerraBlender-forge-1.20.1-3.0.1.7.jar [06nov2024 19:13:41.063] [main/WARN] [net.minecraftforge.jarjar.selection.JarSelector/]: Attempted to select a dependency jar for JarJar which was passed in as source: aeroblender. Using Mod File: C:\Users\zappi\OneDrive\Desktop\server forge\mods\aeroblender-1.20.1-1.0.1-neoforge.jar [06nov2024 19:13:41.063] [main/INFO] [net.minecraftforge.fml.loading.moddiscovery.JarInJarDependencyLocator/]: Found 97 dependencies adding them to mods collection [06nov2024 19:13:42.637] [main/INFO] [dev.su5ed.sinytra.connector.locator.DependencyResolver/]: Dependency resolution found 11 candidates to load [06nov2024 19:13:43.954] [main/INFO] [Configured Defaults/]: Applying default files...
  • Topics

×
×
  • Create New...

Important Information

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