Jump to content

Recommended Posts

Posted

Hello mates!

 

I´m a newby to forge coding and I want to ask for help:

I created a custom mob and all is working perfekt, only I can´t get the name of the spawnegg ingame correct and I can`t figure out why....

 

Here`s the Entityclass:

 

package com.space.extended.mob;

 

import java.util.ArrayList;

import java.util.Iterator;

 

import com.space.extended.SpaceExtendedMain;

import com.space.extended.entity.render.RenderBeetle;

 

import net.minecraft.client.renderer.entity.Render;

import net.minecraft.client.renderer.entity.RenderManager;

import net.minecraft.entity.Entity;

import net.minecraft.entity.EntityList;

import net.minecraft.entity.EnumCreatureType;

import net.minecraft.init.Biomes;

import net.minecraft.util.ResourceLocation;

import net.minecraft.util.math.MathHelper;

import net.minecraft.world.biome.Biome;

import net.minecraft.world.biome.BiomeBeach;

import net.minecraftforge.common.DungeonHooks;

import net.minecraftforge.fml.client.registry.RenderingRegistry;

import net.minecraftforge.fml.common.registry.EntityRegistry;

 

public class EntityBeetle {

 

 

   

    public static void createEntity( Class entityClass,  Render render, String entityName) {

   

    int mobid = 0;

      int entityID = MathHelper.getRandomUUID().hashCode();

    mobid = entityID;

   

EntityRegistry.registerModEntity(entityClass,"Beetle", entityID, SpaceExtendedMain.INSTANCE, 64, 1, true,

(255 << 16) + (102 <<  8)+ 102, (204 << 16) + (255 <<  8) + 102);

 

EntityRegistry.addSpawn(entityClass, 15, 2, 5, EnumCreatureType.MONSTER,Biome.REGISTRY.getObject(new ResourceLocation("desert")));

 

DungeonHooks.addDungeonMob("Beetle", 160);

      }

   

     

   

    public static Biome[] clean(net.minecraft.util.registry.RegistryNamespaced<ResourceLocation, Biome> in) {

Iterator<Biome> itr = in.iterator();

ArrayList<Biome> ls = new ArrayList<Biome>();

while (itr.hasNext()) {

ls.add(itr.next());

}

return ls.toArray(new Biome[ls.size()]);

}

   

    }

 

 

 

 

 

 

 

the Renderclass;

 

package com.space.extended.entity.render;

 

import com.space.extended.model.ModelBeetle;

 

import net.minecraft.client.Minecraft;

import net.minecraft.client.model.ModelBase;

import net.minecraft.client.renderer.entity.RenderLiving;

import net.minecraft.client.renderer.entity.RenderManager;

import net.minecraft.entity.Entity;

import net.minecraft.util.ResourceLocation;

 

public class RenderBeetle extends RenderLiving{

 

public RenderBeetle(RenderManager renderManagerIn) {

 

super(renderManagerIn,new ModelBeetle(), 0);

 

}

 

@Override

protected ResourceLocation getEntityTexture(Entity entity) {

 

return new ResourceLocation("spaceextended", "textures/entity/Beetle.png");

}

 

 

 

}

 

 

 

 

 

Registry in Preinit:

 

 

RenderingRegistry.registerEntityRenderingHandler(EntityMobBeetle.class, new IRenderFactory<EntityMobBeetle>() {

 

            @Override

            public Render<? super EntityMobBeetle> createRenderFor(RenderManager manager) {

           

                return new RenderBeetle(manager);

            }

        });

 

EntityBeetle.createEntity(EntityMobBeetle.class, new RenderBeetle(null), "Beetle");

 

 

 

 

and this I put in langfolder: entity.Beetle.name=Beetle

 

The smiley was created by the site =8 (works ingame for spawnegg color).....

 

Thank you in advance for your help,

Norzeteus

Don't blame me if i always ask for your help. I just want to learn to be better....

Posted

First of all, WTF?:

int entityID = MathHelper.getRandomUUID().hashCode();

??? mod entities are per-mod, so just start at 0 and increment per entity added.

 

What is the

Item

name ingame? That is the line you should put in your language file.

Don't PM me with questions. They will be ignored! Make a thread on the appropriate board for support.

 

1.12 -> 1.13 primer by williewillus.

 

1.7.10 and older versions of Minecraft are no longer supported due to it's age! Update to the latest version for support.

 

http://www.howoldisminecraft1710.today/

Posted

@larsgerrits

 

I´m a little confused as you said "What is the Item name ingame?". The spawnegg shows up in the inventory by itself, only the name doesn`t show up correct.

I thought it should take its name from  EntityRegistry.registerModEntity(entityClass,"Beetle",.....?

Don't blame me if i always ask for your help. I just want to learn to be better....

Posted

It shows me  Spawn.entity.spaceextended.Beetle.name , so as I did not set the name in langfolder. There I wrote  entity.Beetle.name=Beetle

(spaceextended=MODID)

Don't blame me if i always ask for your help. I just want to learn to be better....

Posted

So ingame you get

spawn.entity.spaceextended.Beetle.name

? Than that's what you add to yout language file. It really isn't that hard.

Don't PM me with questions. They will be ignored! Make a thread on the appropriate board for support.

 

1.12 -> 1.13 primer by williewillus.

 

1.7.10 and older versions of Minecraft are no longer supported due to it's age! Update to the latest version for support.

 

http://www.howoldisminecraft1710.today/

Posted

It shows me  Spawn.entity.spaceextended.Beetle.name , so as I did not set the name in langfolder. There I wrote  entity.Beetle.name=Beetle

(spaceextended=MODID)

 

I just want to say that this post says:

 

"I saw A so I put down B=C. I don't know why it didn't translate."

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Posted

OMG, what a fool I am.... I didn`t add the modid in front of the name.... noobish...

Thanks a lot, now it works!  :)

 

Don't blame me if i always ask for your help. I just want to learn to be better....

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



×
×
  • Create New...

Important Information

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