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



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • https://youtube.com/shorts/gqLTSMymgUg?si=5QOeSvA4TTs-bL46
    • CubeHaven is a SMP server with unique features that can't be found on the majority of other servers! Java: MC.CUBEHAVEN.NET Bedrock: MC.CUBEHAVEN.NET:19132 3 different stores: - CubeHaven Store: Our store to purchase using real money. - Bitcoin Store: Store for Bitcoin. Bitcoin can be earned from playing the server. Giving options for players if they want to spend real money or grind to obtain exclusive packages. - Black Market: A hidden store for trading that operates outside our traditional stores, like custom enchantments, exclusive items and more. Some of our features include: Rank Up: Progress through different ranks to unlock new privileges and perks. 📈 Skills: RPG-style skill system that enhances your gaming experience! 🎮 Leaderboards: Compete and shine! Top players are rewarded weekly! 🏆 Random Teleporter: Travel instantly across different worlds with a click! 🌐 Custom World Generation: Beautifully generated world. 🌍 Dungeons: Explore challenging and rewarding dungeons filled with treasures and monsters. 🏰 Kits: Unlock ranks and gain access to various kits. 🛠️ Fishing Tournament: Compete in a friendly fishing tournament! 🎣 Chat Games: Enjoy games right within the chat! 🎲 Minions: Get some help from your loyal minions. 👥 Piñata Party: Enjoy a festive party with Piñatas! 🎉 Quests: Over 1000 quests that you can complete! 📜 Bounty Hunter: Set a bounty on a player's head. 💰 Tags: Displayed on nametags, in the tab list, and in chat. 🏷️ Coinflip: Bet with other players on coin toss outcomes, victory, or defeat! 🟢 Invisible & Glowing Frames: Hide your frames for a cleaner look or apply a glow to it for a beautiful look. 🔲✨[ Player Warp: Set your own warp points for other players to teleport to. 🌟 Display Shop: Create your own shop and sell to other players! 🛒 Item Skins: Customize your items with unique skins. 🎨 Pets: Your cute loyal companion to follow you wherever you go! 🐾 Cosmetics: Enhance the look of your character with beautiful cosmetics! 💄 XP-Bottle: Store your exp safely in a bottle for later use! 🍶 Chest & Inventory Sorting: Keep your items neatly sorted in your inventory or chest! 📦 Glowing: Stand out from other players with a colorful glow! ✨ Player Particles: Over 100 unique particle effects to show off. 🎇 Portable Inventories: Over virtual inventories with ease. 🧳 And a lot more! Become part of our growing community today! Discord: https://cubehaven.net/discord Java: MC.CUBEHAVEN.NET Bedrock: MC.CUBEHAVEN.NET:19132
    • # Problematic frame: # C [libopenal.so+0x9fb4d] It is always the same issue - this refers to the Linux OS - so your system may prevent Java from working   I am not familiar with Linux - check for similar/related issues  
    • Create a new instance and start with Embeddium/Oculus and Valkyrien Skies Try different builds of Embeddium/Valkyrien Skies until you find a working combination - then add the rest of your mods one by one or in groups
  • Topics

×
×
  • Create New...

Important Information

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