Jump to content

Custom Mobs are Invisible / Not Rendered


robodude

Recommended Posts

Hello when I run this mod and activate the spawn egg the mob spawns and makes its sound but is invisible and doesnt render

 

BaseMod:

package com.fredtech.tutorial.wuppy;

import java.awt.Color;
import java.util.Map;

import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.entity.RenderLiving;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.EntityEggInfo;
import net.minecraft.entity.EntityList;
import net.minecraft.entity.EnumCreatureType;
import net.minecraft.item.Item;
import net.minecraft.src.BaseMod;
import net.minecraft.src.ModLoader;
import cpw.mods.fml.client.registry.RenderingRegistry;
import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.Mod.Init;
import cpw.mods.fml.common.Mod.Instance;
import cpw.mods.fml.common.SidedProxy;
import cpw.mods.fml.common.event.FMLInitializationEvent;
import cpw.mods.fml.common.network.NetworkMod;
import cpw.mods.fml.common.registry.EntityRegistry;

@Mod(modid = Wuppy.modid, name = "Wuppy", version = "1.0")
@NetworkMod(clientSideRequired = true, serverSideRequired = false)
public class Wuppy extends BaseMod {

public static final String modid = "FredTech_Wuppy";

public static Block testBlock;

public static Item testItem;
public static Item blaster;

@Init
public void load(FMLInitializationEvent event){
	testBlock = new TestBlock(500, Material.rock).setUnlocalizedName("testBlock");
	testItem = new TestItem(5000).setUnlocalizedName("testItem");
	blaster = new Blaster(5001).setCreativeTab(CreativeTabs.tabCombat).setUnlocalizedName("blaster");
	EntityRegistry.registerModEntity(Bolt.class, "Bolt", 0,this,256,1,true);
	RenderingRegistry.registerEntityRenderingHandler(Bolt.class, new BoltRenderer());

	ModLoader.registerEntityID(MobTest.class, "TestMob", 31);
	ModLoader.addSpawn("TestMob", 15, -5, 1, EnumCreatureType.creature);
	ModLoader.addLocalization("entity.TestMob.name", "Test Mob");
	EntityList.entityEggs.put(Integer.valueOf(31), new EntityEggInfo(31, 894731, (new Color(21,15,6).getRGB())));


	Register.registerItems();


}

@Override
public String getVersion() {
	// TODO Auto-generated method stub
	return null;
}

@Override
public void load() {


}

@Override
public void addRenderer(Map var1)
{
	var1.put(MobTest.class, new RenderLiving(new ModelMob(),.5f));
}



}

 

Register:

package com.fredtech.tutorial.wuppy;

import java.awt.Color;

import net.minecraft.block.Block;
import net.minecraft.enchantment.Enchantment;
import net.minecraft.entity.EntityEggInfo;
import net.minecraft.entity.EntityList;
import net.minecraft.entity.EnumCreatureType;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.src.ModLoader;
import net.minecraftforge.common.MinecraftForge;
import cpw.mods.fml.client.registry.RenderingRegistry;
import cpw.mods.fml.common.registry.EntityRegistry;
import cpw.mods.fml.common.registry.GameRegistry;
import cpw.mods.fml.common.registry.LanguageRegistry;

public class Register {

public static void registerItems(){

	ItemStack godSword = new ItemStack(Item.swordDiamond);
	godSword.addEnchantment(Enchantment.unbreaking, 10);
	godSword.addEnchantment(Enchantment.smite, 10);
	godSword.addEnchantment(Enchantment.knockback, 2);
	godSword.addEnchantment(Enchantment.looting, 10);
	godSword.addEnchantment(Enchantment.fireAspect, 10);
	godSword.addEnchantment(Enchantment.sharpness, 10);
	godSword.addEnchantment(Enchantment.baneOfArthropods, 10);

	GameRegistry.registerBlock(Wuppy.testBlock, Wuppy.modid+Wuppy.testBlock.getUnlocalizedName2());
	GameRegistry.addShapelessRecipe(new ItemStack(Wuppy.testBlock), new Object[]{
		new ItemStack(Item.diamond, 1), new ItemStack(Block.stone, 1),new ItemStack(Item.dyePowder, 1, 15)
	});
	GameRegistry.addRecipe(new ItemStack(Wuppy.testBlock), new Object[]{
	"XZX",
	"CXC",
	'X', Item.ingotGold, 'C', Block.stone, 'Z', new ItemStack(Item.dyePowder, 1, 15)
	});
	GameRegistry.addRecipe(godSword, new Object[]{
	"  C",
	" B ",
	"A  ",
	'A', Item.stick, 'B', new ItemStack(Item.diamond, 5), 'C', new ItemStack(Item.emerald, 5)
	});	

	ModLoader.registerEntityID(MobTest.class, "TestMob", 50);
	ModLoader.addSpawn("TestMob", 15, -5, 1, EnumCreatureType.creature);
	ModLoader.addLocalization("enity.TestMob.name", "Test Mob");
	EntityList.entityEggs.put(Integer.valueOf(50), new EntityEggInfo(50,894731, (new Color(21,15,6).getRGB())));


	LanguageRegistry.addName(Wuppy.testBlock, "Test Block");
	LanguageRegistry.addName(Wuppy.testItem, "Test Item");
	LanguageRegistry.addName(Wuppy.blaster, "Blaster");



	MinecraftForge.EVENT_BUS.register(new ItemClickHandle());

}

}

 

MobTest:

package com.fredtech.tutorial.wuppy;

import net.minecraft.entity.EntityCreature;
import net.minecraft.entity.ai.EntityAIAttackOnCollide;
import net.minecraft.entity.ai.EntityAIHurtByTarget;
import net.minecraft.entity.ai.EntityAILookIdle;
import net.minecraft.entity.ai.EntityAIMoveTwardsRestriction;
import net.minecraft.entity.ai.EntityAINearestAttackableTarget;
import net.minecraft.entity.ai.EntityAISwimming;
import net.minecraft.entity.ai.EntityAIWander;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.world.World;

public class MobTest extends EntityCreature {

public MobTest(World worldObj) {
	super(worldObj);
	this.texture = "/mob/GreenMonster.png";
	this.moveSpeed = 0.4f;//sets how fast this mob moves
	isImmuneToFire = false;
	//below this is all the ai tasks that specify how the mob will behave mess around with it to see what happens
	this.tasks.addTask(0, new EntityAISwimming(this));
	this.tasks.addTask(1, new EntityAIAttackOnCollide(this, EntityPlayer.class, this.moveSpeed, false));
	this.tasks.addTask(2, new EntityAIMoveTwardsRestriction(this, this.moveSpeed));
	this.tasks.addTask(3, new EntityAIWander(this, this.moveSpeed));
	this.tasks.addTask(4, new EntityAILookIdle(this));
	this.targetTasks.addTask(0, new EntityAIHurtByTarget(this, false));
	this.targetTasks.addTask(1, new EntityAINearestAttackableTarget(this, EntityPlayer.class, 25.0F, 0, true));

}

@Override
public int getMaxHealth() {
	// TODO Auto-generated method stub
	return 10;
}

public boolean isAIEnabled()
{
	return true;
}

protected String getLivingSound()
{
return "mob.pig.say";
}

protected String getHurtSound()
{
return "mob.pig.say";
}

protected String getDeathSound()
{
return "mob.pig.death";
}

protected int getDropItemId()
{
return 200;
}
protected boolean canDespawn()
{
return true;
}


}

 

ModelMob (Generated by Techne):

package com.fredtech.tutorial.wuppy;

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

public class ModelMob extends ModelBase {

//fields
ModelRenderer Leg2;
ModelRenderer Leg1;
ModelRenderer Body;
ModelRenderer Arm1;
ModelRenderer Arm2;
ModelRenderer Head;

public ModelMob()
{
textureWidth = 64;
textureHeight = 128;

Leg2 = new ModelRenderer(this, 48, 49);
Leg2.addBox(-2F, 0F, -2F, 4, 11, 4);
Leg2.setRotationPoint(-4F, 13F, 0F);
Leg2.setTextureSize(64, 128);
Leg2.mirror = true;
setRotation(Leg2, 0F, 0F, 0F);
Leg1 = new ModelRenderer(this, 31, 49);
Leg1.addBox(-2F, 0F, -2F, 4, 11, 4);
Leg1.setRotationPoint(2F, 13F, 0F);
Leg1.setTextureSize(64, 128);
Leg1.mirror = true;
setRotation(Leg1, 0F, 0F, 0F);
Body = new ModelRenderer(this, 0, 68);
Body.addBox(0F, 0F, 0F, 12, 7, 7);
Body.setRotationPoint(-7F, 7F, -3F);
Body.setTextureSize(64, 128);
Body.mirror = true;
setRotation(Body, 0F, 0F, 0F);
Arm1 = new ModelRenderer(this, 0, 34);
Arm1.addBox(0F, -1F, -9F, 4, 3, 12);
Arm1.setRotationPoint(5F, 8F, -3F);
Arm1.setTextureSize(64, 128);
Arm1.mirror = true;
setRotation(Arm1, 0F, 0F, 0F);
Arm2 = new ModelRenderer(this, 0, 19);
Arm2.addBox(-4F, -1F, -10F, 4, 3, 12);
Arm2.setRotationPoint(-7F, 8F, -3F);
Arm2.setTextureSize(64, 128);
Arm2.mirror = true;
setRotation(Arm2, 0F, 0F, 0F);
Head = new ModelRenderer(this, 0, 0);
Head.addBox(-3F, -6F, -2F, 8, 6, 5);
Head.setRotationPoint(-2F, 7F, 0F);
Head.setTextureSize(64, 128);
Head.mirror = true;
setRotation(Head, 0F, 0F, 0F);
}

public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5)
{
super.render(entity, f, f1, f2, f3, f4, f5);
setRotationAngles(f, f1, f2, f3, f4, f5);
Leg2.render(f5);
Leg1.render(f5);
Body.render(f5);
Arm1.render(f5);
Arm2.render(f5);
Head.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)
{
// super.setRotationAngles(f, f1, f2, f3, f4, f5);
}
}

 

This is all the code that has to do with this issue GreenMonster.png is located at /forge/mcp/src/minecraft/mobs

Link to comment
Share on other sites

Wow, your base class is extending BaseMod and it has the @Mod annotation. You shouldn't extends BaseMod and add all the required things to make it a forge mod, suchlike: the @SidedProxy, the @PreInit and the @PostInit annotation.

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/

Link to comment
Share on other sites

		ModLoader.registerEntityID(MobTest.class, "TestMob", 50);
	ModLoader.addSpawn("TestMob", 15, -5, 1, EnumCreatureType.creature);
	ModLoader.addLocalization("enity.TestMob.name", "Test Mob");

 

Any reason you're not using the native Forge calls?

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.

Link to comment
Share on other sites

How do I do that and still get a spawn egg and natural spawns?

 

The magic of Forge methods.

EntityRegistry.addSpawn(...)

EntityList.entityEggs.put(...)

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.

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.