How to make a Skeleton Mob? (Skeleton Model isn't available!)

Started by Lakas on

Topic category: Help with modding (Java Edition)

Last seen on 21:54, 28. Mar 2024
Joined Dec 2016
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
How to make a Skeleton Mob? (Skeleton Model isn't available!)

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";
        }

    }

}

Last seen on 20:14, 7. Dec 2017
Joined Oct 2016
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
You just need to use
Mon, 01/30/2017 - 17:42

You just need to use ModelBiped.

Last seen on 21:37, 31. Jul 2017
Joined Jan 2017
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
RE:You can use this. It's the
Sat, 02/04/2017 - 19:00

Eonaut how do you ceate a mob

 

Last seen on 17:45, 14. Aug 2020
Joined Jul 2017
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
But the Techne Dont work
Sat, 08/05/2017 - 14:05

But the Techne Dont work