Topic category: Help with Minecraft modding (Java Edition)
Yes I know there are millions of these pages, but they all have the same answer Change EntityEntityPLayer to EntityPlayer, but I dont have EntityEnttityPlayer mine is already normal, and clearly my mob wont attack me. Yes I have the AI set to act agresivly twords player. Help me please. Here is my code for this mob:
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.effect.EntityLightningBolt;
import net.minecraft.entity.ai.EntityAIPanic;
import net.minecraft.entity.ai.EntityAINearestAttackableTarget;
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_timeremenentone {
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_timeremenentone.Entitytimeremenentone.class, new RenderBiped(new ModelBiped(), 0) {
protected ResourceLocation getEntityTexture(Entity par1Entity) {
return new ResourceLocation("skin_2017103120005531356.png");
}
});
}
public void serverLoad(FMLServerStartingEvent event) {
}
public void preInit(FMLPreInitializationEvent event) {
int entityID = EntityRegistry.findGlobalUniqueEntityId();
mobid = entityID;
EntityRegistry.registerGlobalEntityID(mcreator_timeremenentone.Entitytimeremenentone.class, "timeremenentone", entityID);
EntityRegistry.registerModEntity(mcreator_timeremenentone.Entitytimeremenentone.class, "timeremenentone", entityID, instance, 64, 1, true);
EntityList.entityEggs.put(Integer.valueOf(entityID), new EntityList.EntityEggInfo(entityID, (255 << 16) + (255 << 8) + 255, (255 << 16)
+ (255 << 8) + 255));
EntityRegistry.addSpawn(mcreator_timeremenentone.Entitytimeremenentone.class, 0, 1, 37, 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_timeremenentone.Entitytimeremenentone(var2); else return null; }
*/
public static class Entitytimeremenentone extends EntityMob {
World world = null;
public Entitytimeremenentone(World var1) {
super(var1);
world = var1;
experienceValue = 5;
this.isImmuneToFire = false;
addRandomArmor();
this.tasks.addTask(1, new EntityAIPanic(this, 1.2D));
this.targetTasks.addTask(1, new EntityAINearestAttackableTarget(this, EntityPlayer.class, 2, true));
this.targetTasks.addTask(2, new EntityAIHurtByTarget(this, false));
}
protected void applyEntityAttributes() {
super.applyEntityAttributes();
this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(2.05D);
this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(45D);
if (this.getEntityAttribute(SharedMonsterAttributes.attackDamage) != null)
this.getEntityAttribute(SharedMonsterAttributes.attackDamage).setBaseValue(15D);
}
protected void addRandomArmor() {
}
protected void dropRareDrop(int par1) {
this.dropItem(mcreator_futureDust.block, 1);
}
public boolean isAIEnabled() {
return true;
}
@Override
protected Item getDropItem() {
return new ItemStack(mcreator_timenia.block).getItem();
}
/**
* Returns the sound this mob makes while it's alive.
*/
protected String getLivingSound() {
return "ambient.weather.thunder2";
}
/**
* Returns the sound this mob makes when it is hurt.
*/
protected String getHurtSound() {
return "damage.hit";
}
/**
* Returns the sound this mob makes on death.
*/
protected String getDeathSound() {
return "damage.hit3";
}
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 "timeremenentone";
}
}
}
I had the same problem just set the AI base from (none) to Zombie or something. Your mob will attack you but it doesnt drop your custom drop :/
Ahh well I might have a solution for you:
1. First of all set your mob type to monster
2. Set behavioral characteristics to mob
3. Set AI base to (none) if you want your mob to drop your custom drop
4. Try AI task Attack on Collide
5. Also add act aggressively against EntityPlayerMP with Priority 20 (NOT ENTITYPLAYER!!!)
Now it could work
I solved it guys nvm, thanks for the help.
how did you fix it?
How did you fix it?