Topic category: Help with Minecraft modding (Java Edition)
Hello, I really want to make a Skeleton mob but the Model isn't available in the model option (when you create a mob).
So I tried to code and change the Model of the mob from ModelZombie to ModelSkeleton
but the mob is invisible and it allmost crashes the game everytime!
So can someone look at the code of my mob and tell what the problem is?
(The game doesn't crash so I got no error log)
Mob code:
package mod.mcreator;
import net.minecraft.world.biome.BiomeGenBase;
import net.minecraft.world.World;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.DamageSource;
import net.minecraft.item.ItemStack;
import net.minecraft.item.Item;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.monster.EntityMob;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.effect.EntityLightningBolt;
import net.minecraft.entity.boss.IBossDisplayData;
import net.minecraft.entity.boss.BossStatus;
import net.minecraft.entity.ai.EntityAIWander;
import net.minecraft.entity.ai.EntityAISwimming;
import net.minecraft.entity.ai.EntityAILookIdle;
import net.minecraft.entity.SharedMonsterAttributes;
import net.minecraft.entity.EnumCreatureType;
import net.minecraft.entity.EntityLiving;
import net.minecraft.entity.EntityList;
import net.minecraft.entity.Entity;
import net.minecraft.client.renderer.entity.RenderLiving;
import net.minecraft.client.model.ModelSkeleton;
import java.util.Random;
import cpw.mods.fml.relauncher.SideOnly;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.common.registry.EntityRegistry;
import cpw.mods.fml.common.event.FMLServerStartingEvent;
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
import cpw.mods.fml.client.registry.RenderingRegistry;
@SuppressWarnings("unchecked")
public class mcreator_obsidianSkeleton {
public static int mobid = 0;
public Object instance;
public void load() {
}
public void generateNether(World world, Random random, int chunkX, int chunkZ) {
}
public void generateSurface(World world, Random random, int chunkX, int chunkZ) {
}
public int addFuel(ItemStack fuel) {
return 0;
}
@SideOnly(Side.CLIENT)
public void registerRenderers() {
RenderingRegistry.registerEntityRenderingHandler(mcreator_obsidianSkeleton.EntityobsidianSkeleton.class, new RenderLiving(new ModelSkeleton(),
0) {
protected ResourceLocation getEntityTexture(Entity par1Entity) {
return new ResourceLocation("Obsidianskeleton.png");
}
public void doRender(EntityLiving par1EntityLiving, double par2, double par4, double par6, float par8, float par9) {
super.doRender(par1EntityLiving, par2, par4, par6, par8, par9);
BossStatus.setBossStatus((EntityobsidianSkeleton) par1EntityLiving, false);
}
});
}
public void serverLoad(FMLServerStartingEvent event) {
}
public void preInit(FMLPreInitializationEvent event) {
int entityID = EntityRegistry.findGlobalUniqueEntityId();
mobid = entityID;
EntityRegistry.registerGlobalEntityID(mcreator_obsidianSkeleton.EntityobsidianSkeleton.class, "obsidianSkeleton", entityID);
EntityRegistry.registerModEntity(mcreator_obsidianSkeleton.EntityobsidianSkeleton.class, "obsidianSkeleton", entityID, instance, 64, 1, true);
EntityList.entityEggs.put(Integer.valueOf(entityID), new EntityList.EntityEggInfo(entityID, (51 << 16) + (0 << 8) + 51, (0 << 16) + (0 << 8)
+ 0));
EntityRegistry.addSpawn(mcreator_obsidianSkeleton.EntityobsidianSkeleton.class, 0, 0, 0, EnumCreatureType.monster, new BiomeGenBase[]{
BiomeGenBase.ocean, BiomeGenBase.plains, BiomeGenBase.desert, BiomeGenBase.extremeHills, BiomeGenBase.forest, BiomeGenBase.taiga,
BiomeGenBase.swampland, BiomeGenBase.river, BiomeGenBase.frozenOcean, BiomeGenBase.frozenRiver, BiomeGenBase.icePlains,
BiomeGenBase.iceMountains, BiomeGenBase.mushroomIsland, BiomeGenBase.mushroomIslandShore, BiomeGenBase.beach,
BiomeGenBase.desertHills, BiomeGenBase.forestHills, BiomeGenBase.taigaHills, BiomeGenBase.extremeHillsEdge, BiomeGenBase.jungle,
BiomeGenBase.jungleHills, BiomeGenBase.jungleEdge, BiomeGenBase.deepOcean, BiomeGenBase.stoneBeach, BiomeGenBase.coldBeach,
BiomeGenBase.birchForest, BiomeGenBase.birchForestHills, BiomeGenBase.roofedForest, BiomeGenBase.coldTaiga,
BiomeGenBase.coldTaigaHills, BiomeGenBase.megaTaiga, BiomeGenBase.megaTaigaHills, BiomeGenBase.extremeHillsPlus,
BiomeGenBase.savanna, BiomeGenBase.savannaPlateau, BiomeGenBase.mesa, BiomeGenBase.mesaPlateau_F, BiomeGenBase.mesaPlateau});
}
/*
* public Entity spawnEntity(int var1, World var2, double var3, double var5,
* double var7) { if(var1==mobid) return new
* mcreator_obsidianSkeleton.EntityobsidianSkeleton(var2); else return null;
* }
*/
public static class EntityobsidianSkeleton extends EntityMob implements IBossDisplayData {
World world = null;
public EntityobsidianSkeleton(World var1) {
super(var1);
world = var1;
experienceValue = 100;
this.isImmuneToFire = true;
addRandomArmor();
this.tasks.addTask(0, new EntityAISwimming(this));
this.tasks.addTask(6, new EntityAIWander(this, 1.0D));
this.tasks.addTask(8, new EntityAILookIdle(this));
}
protected void applyEntityAttributes() {
super.applyEntityAttributes();
this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.75D);
this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(250D);
if (this.getEntityAttribute(SharedMonsterAttributes.attackDamage) != null)
this.getEntityAttribute(SharedMonsterAttributes.attackDamage).setBaseValue(20D);
}
protected void addRandomArmor() {
}
public boolean isAIEnabled() {
return false;
}
@Override
protected Item getDropItem() {
return new ItemStack(mcreator_obsidianShard.block).getItem();
}
/**
* Returns the sound this mob makes while it's alive.
*/
protected String getLivingSound() {
return "mob.skeleton.say";
}
/**
* Returns the sound this mob makes when it is hurt.
*/
protected String getHurtSound() {
return "mob.zombie.metal";
}
/**
* Returns the sound this mob makes on death.
*/
protected String getDeathSound() {
return "mob.skeleton.death";
}
public void onStruckByLightning(EntityLightningBolt entityLightningBolt) {
super.onStruckByLightning(entityLightningBolt);
int i = (int) this.posX;
int j = (int) this.posY;
int k = (int) this.posZ;
Entity entity = this;
}
protected void fall(float l) {
super.fall(l);
int i = (int) this.posX;
int j = (int) this.posY;
int k = (int) this.posZ;
super.fall(l);
Entity entity = this;
}
public void onDeath(DamageSource dsource) {
super.onDeath(dsource);
int i = (int) this.posX;
int j = (int) this.posY;
int k = (int) this.posZ;
Entity entity = this;
if ((Math.random() * 100) <= 5) {
EntityItem var14 = new EntityItem(world, (double) (i), (double) (j), (double) (k), new ItemStack(
mcreator_obsidianSkeletonSkull.block, 1, 0));
var14.delayBeforeCanPickup = 10;
world.spawnEntityInWorld(var14);
}
}
public void onKillEntity(EntityLiving entityLiving) {
super.onKillEntity(entityLiving);
int i = (int) this.posX;
int j = (int) this.posY;
int k = (int) this.posZ;
Entity entity = this;
}
public boolean interact(EntityPlayer entity) {
super.interact(entity);
int i = (int) this.posX;
int j = (int) this.posY;
int k = (int) this.posZ;
return true;
}
public String getEntityName() {
return "obsidianSkeleton";
}
}
}
You just need to use ModelBiped.
You can use this. It's the skeleton model I made for my Hodge-podge mod. The legs are slightly off and held items/armor won't render, but other than that it works
https://www.dropbox.com/s/smapv7d3edtki5d/skeleton.java?dl=0
Eonaut how do you ceate a mob
But the Techne Dont work
@#4 Techne Download
https://mcreator.net/forum/108472/tutorial-how-use-vanila-models-zombie-skeleton-etc
New solving of this problem