Why does my Mob close the game

Started by The God Of Nails on

Topic category: Help with modding (Java Edition)

Last seen on 15:07, 5. Jan 2022
Joined Nov 2018
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Why does my Mob close the game
Sat, 12/01/2018 - 08:54 (edited)

Help me my mob "Robot" crashes the game while loading the mob 1.7.10

Edited by The God Of Nails on Sat, 12/01/2018 - 08:54
Last seen on 03:03, 6. Feb 2024
Joined Apr 2014
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Can you give Error log or…
Fri, 11/30/2018 - 17:50

Can you give Error log or Mob Code ?

Last seen on 15:07, 5. Jan 2022
Joined Nov 2018
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
package mod.mcreator; import…
Sat, 12/01/2018 - 08:24

package mod.mcreator;

import net.minecraftforge.common.DungeonHooks;

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.init.Items;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.passive.EntityWolf;
import net.minecraft.entity.monster.EntityMob;
import net.minecraft.entity.effect.EntityLightningBolt;
import net.minecraft.entity.ai.EntityAIWander;
import net.minecraft.entity.ai.EntityAISwimming;
import net.minecraft.entity.ai.EntityAINearestAttackableTarget;
import net.minecraft.entity.ai.EntityAILookIdle;
import net.minecraft.entity.ai.EntityAIHurtByTarget;
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.RenderBiped;
import net.minecraft.client.model.ModelBiped;

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_robot {

    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_robot.Entityrobot.class, new RenderBiped(new ModelBiped(), 0) {
            protected ResourceLocation getEntityTexture(Entity par1Entity) {
                return new ResourceLocation("robot.png");
            }
        });

    }

    public void serverLoad(FMLServerStartingEvent event) {
    }

    public void preInit(FMLPreInitializationEvent event) {
        int entityID = EntityRegistry.findGlobalUniqueEntityId();
        mobid = entityID;
        EntityRegistry.registerGlobalEntityID(mcreator_robot.Entityrobot.class, "robot", entityID);
        EntityRegistry.registerModEntity(mcreator_robot.Entityrobot.class, "robot", entityID, instance, 64, 1, true);
        EntityList.entityEggs.put(Integer.valueOf(entityID), new EntityList.EntityEggInfo(entityID, (153 << 16) + (153 << 8) + 153, (204 << 16)
                + (0 << 8) + 0));
        EntityRegistry.addSpawn(mcreator_robot.Entityrobot.class, 2, 1, 4, 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});

        DungeonHooks.addDungeonMob("robot", 180);

    }

    /*
     * public Entity spawnEntity(int var1, World var2, double var3, double var5,
     * double var7) { if(var1==mobid) return new
     * mcreator_robot.Entityrobot(var2); else return null; }
     */

    public static class Entityrobot extends EntityMob {
        World world = null;

        public Entityrobot(World var1) {
            super(var1);
            world = var1;
            experienceValue = 5;
            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));
            this.targetTasks.addTask(10, new EntityAINearestAttackableTarget(this, EntityPlayer.class, 2, true));
            this.targetTasks.addTask(11, new EntityAIHurtByTarget(this, false));
            this.targetTasks.addTask(10, new EntityAINearestAttackableTarget(this, EntityWolf.class, 2, true));
            this.targetTasks.addTask(11, new EntityAIHurtByTarget(this, false));

        }

        protected void applyEntityAttributes() {
            super.applyEntityAttributes();
            this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.15D);
            this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(30D);
            if (this.getEntityAttribute(SharedMonsterAttributes.attackDamage) != null)
                this.getEntityAttribute(SharedMonsterAttributes.attackDamage).setBaseValue(7D);
        }

        protected void addRandomArmor() {

        }

        public boolean isAIEnabled() {
            return true;
        }

        @Override
        protected Item getDropItem() {
            return new ItemStack(Items.redstone).getItem();
        }

        /**
         * Returns the sound this mob makes while it's alive.
         */
        protected String getLivingSound() {
            return "";
        }

        /**
         * Returns the sound this mob makes when it is hurt.
         */
        protected String getHurtSound() {
            return "";
        }

        /**
         * Returns the sound this mob makes on death.
         */
        protected String getDeathSound() {
            return "";
        }

        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;

        }

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

    }

}
 

 

THE ENTIRE CODE OF ROBOT

Last seen on 15:07, 5. Jan 2022
Joined Nov 2018
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
i cant show the crash cause…
Sat, 12/01/2018 - 14:42

i cant show the crash cause it works and closes the game upon spawning it

Last seen on 03:03, 6. Feb 2024
Joined Apr 2014
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
You didn't implemented model…
Sat, 12/01/2018 - 17:01

You didn't implemented model to your mob

 

Last seen on 15:07, 5. Jan 2022
Joined Nov 2018
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
the robot is biped
Sun, 12/02/2018 - 11:53

the robot is biped

Last seen on 15:07, 5. Jan 2022
Joined Nov 2018
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
so i dont know what happened
Sun, 12/02/2018 - 11:54

so i dont know what happened

Last seen on 03:03, 6. Feb 2024
Joined Apr 2014
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
We cant help you without…
Sun, 12/02/2018 - 15:11

We cant help you without checking this in Depth, error log could help here a lot.
But I suggest you to open Support Ticket for that

Last seen on 03:03, 6. Feb 2024
Joined Apr 2014
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
But before try to remade…
Sun, 12/02/2018 - 15:12

But before try to remade your mob