Jump to content

[1.6.2] Solved Mob won't render correct


kmccmk9

Recommended Posts

Hello, I've been trying to add a mob to the game and have been able to get an egg that can spawn my new mob. However, it comes out like the picture below instead of what it should be, a bee. What is wrong with my code? Below I have posted everything I got for you.

 

P3PtNmh.png

 

Main Class:

package kmccmk9.witchcraft;

import java.awt.Color;

import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityEggInfo;
import net.minecraft.entity.EntityList;
import net.minecraft.entity.EnumCreatureType;
import net.minecraft.src.ModLoader;
import net.minecraft.world.biome.BiomeGenBase;

import kmccmk9.witchcraft.CommonProxy;
import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.SidedProxy;
import cpw.mods.fml.common.Mod.EventHandler;
import cpw.mods.fml.common.Mod.Instance;
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.EntityRegistry;
import cpw.mods.fml.common.registry.LanguageRegistry;

@Mod(modid="witchcraft", name="WitchCraft", version="0.0.1")
@NetworkMod(clientSideRequired=true, serverSideRequired=false)

public class WitchCraft {
// The instance of your mod that Forge uses.
    @Instance("WitchCraft")
    public static WitchCraft instance;
    
    // Says where the client and server 'proxy' code is loaded.
    @SidedProxy(clientSide="kmccmk9.witchcraft.client.ClientProxy", serverSide="kmccmk9.witchcraft.CommonProxy")
    public static CommonProxy proxy;
    
    @EventHandler
    public void preInit(FMLPreInitializationEvent event) {
            // Stub Method
    }
    
    @EventHandler
    public void load(FMLInitializationEvent event) {
    	int background = (Color.YELLOW.getRed() << 16) + (Color.YELLOW.getGreen() <<  + Color.YELLOW.getBlue();
    	int foreground = (Color.BLACK.getRed() << 16) + (Color.BLACK.getGreen() <<  + Color.BLACK.getBlue();
    	int id = ModLoader.getUniqueEntityId();
    	EntityRegistry.registerModEntity(EntityBee.class, "Bee", 1, this, 80, 5, true);
    	ModLoader.registerEntityID(EntityBee.class, "Bee",  id, background, foreground);
    	EntityRegistry.addSpawn(EntityBee.class, 7, 1, 4, EnumCreatureType.monster, BiomeGenBase.beach, BiomeGenBase.forest, BiomeGenBase.jungle, BiomeGenBase.plains);
    	LanguageRegistry.instance().addStringLocalization("entity.witchcraft.Bee.name", "Bee");
    	
    	EntityList.IDtoClassMapping.put(id, EntityBee.class);
    	EntityList.entityEggs.put(id, new EntityEggInfo(id, background, foreground));
    	
    }
    
    @EventHandler
    public void postInit(FMLPostInitializationEvent event) {
            // Stub Method
    }
}

 

EntityClass:

package kmccmk9.witchcraft;

import net.minecraft.client.renderer.EntityRenderer;
import net.minecraft.entity.EntityLiving;
import net.minecraft.entity.ai.EntityAIWander;
import net.minecraft.item.Item;
import net.minecraft.world.World;
import net.minecraft.src.*;

public class EntityBee extends EntityLiving {

public EntityBee(World par1World) {
	super(par1World);
	this.getNavigator().setAvoidsWater(true);
	this.setSize(0.5F, 0.5F);
	this.setEntityHealth(15F);
	this.setAIMoveSpeed(3F);
}

protected int getDropItemId()
    {
        return Item.porkRaw.itemID;
    }

public String getTexture() {
	return "textures/bee.png";
}

}

 

ModelClass:

package kmccmk9.witchcraft.client;

import net.minecraft.client.model.ModelBase;
import net.minecraft.client.model.ModelRenderer;
import net.minecraft.entity.Entity;




public class ModelBee extends ModelBase
{
  //fields
    ModelRenderer BeeBody;
    ModelRenderer BeeHead;
    ModelRenderer ant1;
    ModelRenderer ant2;
    ModelRenderer wing2;
    ModelRenderer wing1;
  
  public ModelBee()
  {
//constructor:
ant1 = new ModelRenderer(this, 0, 0);
ant1.mirror = true;
ant1.addBox(2F, 4F, -1F, 1, 4, 1);
ant1.rotateAngleZ = 0.17453292519943295F;

ant2 = new ModelRenderer(this, 41, 5);
ant2.mirror = true;
ant2.addBox(2F, 3F, -1F, 1, 4, 1);
ant2.rotateAngleZ = 6.1086523819801535F;

BeeBody = new ModelRenderer(this, 0, 0);
BeeBody.mirror = true;
BeeBody.addBox(0F, 0F, 0F, 5, 4, ;

BeeHead = new ModelRenderer(this, 19, 2);
BeeHead.mirror = true;
BeeHead.addBox(0F, 0F, 0F, 3, 3, 2);
//BeeHead.setPosition(1F, 1F, -2F);

wing1 = new ModelRenderer(this, 31, 1);
wing1.mirror = true;
wing1.addBox(5F, 1F, 2F, 4, 1, 3);
wing1.rotateAngleZ = 6.126105674500097F;

wing2 = new ModelRenderer(this, 31, 5);
wing2.mirror = true;
wing2.addBox(-4F, 2F, 2F, 4, 1, 3);
wing2.rotateAngleZ = 0.15707963267948966F;
  }
  
  public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5)
  {
    	//render:
ant1.render(f5);
ant2.render(f5);
BeeBody.render(f5);
BeeHead.render(f5);
wing1.render(f5);
wing2.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, Entity entity)
  {
    super.setRotationAngles(f, f1, f2, f3, f4, f5, entity);
  }
}

 

RendererClass:

package kmccmk9.witchcraft;

import kmccmk9.witchcraft.client.ModelBee;
import net.minecraft.client.Minecraft;
import net.minecraft.client.model.ModelBase;
import net.minecraft.client.renderer.EntityRenderer;
import net.minecraft.client.renderer.entity.RenderLiving;
import net.minecraft.entity.Entity;
import net.minecraft.util.ResourceLocation;

public class RendererBee extends RenderLiving {
protected ModelBee model;
private static final ResourceLocation field_110775_a = new ResourceLocation("textures/bee.png");
public RendererBee(ModelBee par1ModelBase, float par2) {
	super(par1ModelBase, par2);
	model = (ModelBee)par1ModelBase;
}
@Override
protected ResourceLocation func_110775_a(Entity entity) {
	// TODO Auto-generated method stub
	return null;
}


}

 

Any help is greatly appreciated!

Link to comment
Share on other sites

private static final ResourceLocation field_110775_a = new ResourceLocation("textures/bee.png");
@Override
protected ResourceLocation func_110775_a(Entity entity) {
	// TODO Auto-generated method stub
	return null;
}

*facepalm*

Why do you think that should work ?

Link to comment
Share on other sites

private static final ResourceLocation field_110775_a = new ResourceLocation("textures/bee.png");
@Override
protected ResourceLocation func_110775_a(Entity entity) {
	// TODO Auto-generated method stub
	return null;
}

*facepalm*

Why do you think that should work ?

 

Ya I had a feeling it may be in that class. But I keep trying to follow different tutorials for different forge versions since no one seems to have one for 1.6.2 as of yet. Okay so what would I need to return then?

Link to comment
Share on other sites

I don't recall Minecraft having a bee texture.  :P

Look for "texture" threads, the proper use of ResourceLocation would be explained.

 

Ok I'll check it out cause the tutorials explained that the way I wrote it, would be the root of the mod folder, then textures and then bee.png.

Link to comment
Share on other sites

#RenderingRegistry

 

Great thanks. I was able to get the resuilt below. Okay, now the model seems to be upside down. The texture problem, I have to figure out still.

 

7IcEWbd.png

 

Is there something I can do with the mirror part of the model code? What I"m shooting for is like the below image.

 

0gzyQIl.png

Link to comment
Share on other sites

The way that resource locations are done is defaulted to the vanilla minecraft assets folder

you need to change it to so it's directed towards yours

 

for instance, with mine it's

    private static final ResourceLocation field_110890_f = new ResourceLocation("jnosh_advzelda", "textures/entity/chu.png");

 

as the folder structure goes

 

"assets" folder > "jnosh_advzelda" folder > "textures" folder > "entity" folder > "chu.png"

assets/jnosh_advzelda/textures/entity/chu

 

you need to do yours in a similar way, but using your own folders (obviously)

Link to comment
Share on other sites

The way that resource locations are done is defaulted to the vanilla minecraft assets folder

you need to change it to so it's directed towards yours

 

for instance, with mine it's

    private static final ResourceLocation field_110890_f = new ResourceLocation("jnosh_advzelda", "textures/entity/chu.png");

 

as the folder structure goes

 

"assets" folder > "jnosh_advzelda" folder > "textures" folder > "entity" folder > "chu.png"

assets/jnosh_advzelda/textures/entity/chu

 

you need to do yours in a similar way, but using your own folders (obviously)

 

So textures are no longer placed within your mod folder?

Link to comment
Share on other sites

no, if you're working in Eclipse, they're placed in forge/mcp/src/minecraft/assets

mine is

forge/mcp/src/minecraft/assets/jnosh_advzelda/textures/entity/chu.png

at least, that's the way that I've seen them all set up since 1.6.1 arrived

 

you might wanna invest some time into looking up how to update from 1.5.2 to 1.6.x if you've still got things set up the old way

Link to comment
Share on other sites

no, if you're working in Eclipse, they're placed in forge/mcp/src/minecraft/assets

mine is

forge/mcp/src/minecraft/assets/jnosh_advzelda/textures/entity/chu.png

at least, that's the way that I've seen them all set up since 1.6.1 arrived

 

you might wanna invest some time into looking up how to update from 1.5.2 to 1.6.x if you've still got things set up the old way

 

Okay thanks. Also, following another mod I explored, it was done like so kmccmk9/witchCraft/assets/minecraft/textures/entities/file

Link to comment
Share on other sites

no, if you're working in Eclipse, they're placed in forge/mcp/src/minecraft/assets

mine is

forge/mcp/src/minecraft/assets/jnosh_advzelda/textures/entity/chu.png

at least, that's the way that I've seen them all set up since 1.6.1 arrived

 

you might wanna invest some time into looking up how to update from 1.5.2 to 1.6.x if you've still got things set up the old way

 

OMG thank you I finally got it! Now do you have any idea what's wrong with my model?

Link to comment
Share on other sites

At a guess I'd say that it's because there isn't really alot in your render file atm, so it might not be connecting the render and entity to the model

 

erm... I'd suggest taking a look at the bat render file

it's probably the closest you're gunna get to a bee in vanilla

 

it could be this

 

    public void func_82443_a(EntityBat par1EntityBat, double par2, double par4, double par6, float par8, float par9)
    {
        int i = ((ModelBat)this.mainModel).getBatSize();

        if (i != this.renderedBatSize)
        {
            this.renderedBatSize = i;
            this.mainModel = new ModelBat();
        }

        super.doRenderLiving(par1EntityBat, par2, par4, par6, par8, par9);
    }

 

so try

 

    public void func_82443_a(EntityBee par1EntityBat, double par2, double par4, double par6, float par8, float par9)
    {
        int i = ((ModelBee)this.mainModel);

        this.mainModel = new ModelBee();

        super.doRenderLiving(par1EntityBat, par2, par4, par6, par8, par9);
    }

 

however, that is just a guess

exploring the render files would be a better option

and there are some 1.6.2 entity tutorials out there that may be a better help than me

Link to comment
Share on other sites

the correct texture calling would be for example ("foldername:textures/mob/bee.png")

 

what this means is that bee.png is located in    ("assets/foldername/textures/mob/bee.png")\

 

for a normal icon texture the calling would be different for example a normal icon texture would be ("foldername:icon")

which means the icon would be in ("assets/foldername/textures/[blocks][items]/icon.png")

 

I hope this helps

if (You.likescoding == false){
      You.goaway;
}

Link to comment
Share on other sites

At a guess I'd say that it's because there isn't really alot in your render file atm, so it might not be connecting the render and entity to the model

 

erm... I'd suggest taking a look at the bat render file

it's probably the closest you're gunna get to a bee in vanilla

 

it could be this

 

    public void func_82443_a(EntityBat par1EntityBat, double par2, double par4, double par6, float par8, float par9)
    {
        int i = ((ModelBat)this.mainModel).getBatSize();

        if (i != this.renderedBatSize)
        {
            this.renderedBatSize = i;
            this.mainModel = new ModelBat();
        }

        super.doRenderLiving(par1EntityBat, par2, par4, par6, par8, par9);
    }

 

so try

 

    public void func_82443_a(EntityBee par1EntityBat, double par2, double par4, double par6, float par8, float par9)
    {
        int i = ((ModelBee)this.mainModel);

        this.mainModel = new ModelBee();

        super.doRenderLiving(par1EntityBat, par2, par4, par6, par8, par9);
    }

 

however, that is just a guess

exploring the render files would be a better option

and there are some 1.6.2 entity tutorials out there that may be a better help than me

 

the correct texture calling would be for example ("foldername:textures/mob/bee.png")

 

what this means is that bee.png is located in    ("assets/foldername/textures/mob/bee.png")\

 

for a normal icon texture the calling would be different for example a normal icon texture would be ("foldername:icon")

which means the icon would be in ("assets/foldername/textures/[blocks][items]/icon.png")

 

I hope this helps

 

Ok well from what I gathered, what's messed up is the beehead. Nothing else. But if you look at my model class you 'll see I had to comment out a setPosition line. I think that is the problem. But setPosition is valid so I had to comment it. Otherwise everything is right, the head is just inside the body.

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.

Announcements



×
×
  • Create New...

Important Information

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