Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

BoonieQuafter-CrAfTeR

Members
  • Posts

    337
  • Joined

  • Last visited

Everything posted by BoonieQuafter-CrAfTeR

  1. Like This? public boolean shouldExecute() { EntityLivingBase entitylivingbase = ((EntityLiving) this.attacker).getAttackTarget(); if (entitylivingbase == null) { return false; } else if (!entitylivingbase.isEntityAlive()) { return false; } else if (entitylivingbase instanceof EntityUndead) { return false; } //All the other checks, etc. return hasAttacked;
  2. plus I want my mob to attack all mobs other than itself, im looking for a EntityAi for that or something, I already have an AI to attack all mobs, now I need something to override it and tell it to not attack its self
  3. dude that method will make it so that it will kill itself in combat, meaning if I spawn multiple it will kill itself
  4. I want to make the mob attack other mobs but not its self. so I gave it the task to attack all mobs. problem is it's a mob so how do I make it not attack itself if there are multiple of them? package com.OlympiansMod.entity; import net.minecraft.entity.EntityCreature; import net.minecraft.entity.EntityLiving; import net.minecraft.entity.SharedMonsterAttributes; import net.minecraft.entity.ai.EntityAIAttackOnCollide; import net.minecraft.entity.ai.EntityAIDefendVillage; import net.minecraft.entity.ai.EntityAIHurtByTarget; import net.minecraft.entity.ai.EntityAILookAtVillager; import net.minecraft.entity.ai.EntityAILookIdle; import net.minecraft.entity.ai.EntityAIMoveThroughVillage; import net.minecraft.entity.ai.EntityAIMoveTowardsRestriction; import net.minecraft.entity.ai.EntityAIMoveTowardsTarget; import net.minecraft.entity.ai.EntityAINearestAttackableTarget; import net.minecraft.entity.ai.EntityAIWander; import net.minecraft.entity.ai.EntityAIWatchClosest; import net.minecraft.entity.monster.EntityGolem; import net.minecraft.entity.monster.EntityMob; import net.minecraft.entity.monster.IMob; import net.minecraft.entity.passive.EntityAnimal; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.world.World; public class EntityUndead extends EntityMob{ public EntityUndead(World world) { super(world); this.setSize(1.4F, 2.9F); this.getNavigator().setAvoidsWater(true); this.tasks.addTask(1, new EntityAIAttackOnCollide(this, 1.0D, true)); this.tasks.addTask(2, new EntityAIMoveTowardsTarget(this, 0.9D, 32.0F)); this.tasks.addTask(4, new EntityAIMoveTowardsRestriction(this, 1.0D)); this.tasks.addTask(6, new EntityAIWander(this, 0.6D)); this.tasks.addTask(7, new EntityAIWatchClosest(this, EntityPlayer.class, 6.0F)); this.tasks.addTask(8, new EntityAILookIdle(this)); this.targetTasks.addTask(2, new EntityAIHurtByTarget(this, false)); this.targetTasks.addTask(3, new EntityAINearestAttackableTarget(this, EntityLiving.class, 0, false, true, IMob.mobSelector)); } protected boolean isAIEnabled(){ return true; } protected void applyEntityAttributes(){ super.applyEntityAttributes(); this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(100.0f); this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.25D); this.getEntityAttribute(SharedMonsterAttributes.attackDamage).setBaseValue(10); } } what task to I give it?
  5. so I am trying to make a spawn egg for a new mob in my mod, problem is when I try to spawn the entity, the console says the entity with the id of (My ID) has been skipped. so I go to check a tutorial to see if I did it right, turns out there were some differences, but no matter what I still got the same error. heres my stuff Entity Class package com.OlympiansMod.entity; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityList; import net.minecraft.entity.EnumCreatureType; import net.minecraft.world.biome.BiomeGenBase; import com.OlympiansMod.Main.MainRegistry; import cpw.mods.fml.common.registry.EntityRegistry; public class MEntity { public static void MainRegistry(){ registerEntity(); } public static void registerEntity(){ createEntity(EntityGreekFire.class, "GreekFire", 0x0004FF, 0x0004FF); createEntity(EntityBullet.class, "Bullet", 0x0004FF, 0x0004FF); createEntity(EntitySGuardian.class, "SGuardian", 0x0004FF, 0x0004FF); } public static void createEntity(Class entityClass, String entityName, int solidColour, int spotColour){ EntityRegistry.registerModEntity(EntityGreekFire.class, "GreekFire", 4013479, MainRegistry.modInstance, 1, 80, true); EntityRegistry.registerModEntity(EntityBullet.class, "Bullet", 302942, MainRegistry.modInstance, 1, 80, true); EntityRegistry.registerModEntity(EntitySGuardian.class, "SGaurdian", 301320, MainRegistry.modInstance, 80, 1, true); createEgg(EntitySGuardian.class, 301320, solidColour, spotColour); } private static void createEgg(Class entityClass, int i, int solidColour, int spotColour) { EntityList.entityEggs.put(Integer.valueOf(i), new EntityList.EntityEggInfo(i, spotColour, solidColour)); } } if u need any thing else tell me, btws I modified the code allot to see if I could make it work but it never made a difference.
  6. that's not what I actually mean and I fixed it my self i created specific ids and yeah it pretty much worked so thnx anyways
  7. nobody ever said it had anything to do with java, what i'm lacking is the knowledge of what functions and arguments exist in minecraft coding the whole time i'm coding i'm using shortcuts provided by minecraft to make everything work, you are correct i'm not programming no one every said I was programming, i'm coding and modding and I came here to learn how to do it, I know the basics but I do not know most of the functions created by minecraft, and im trying not to waste my time looking through the runtime environment to find them, now I would like to know if I will receive any help at all on this situation other than "go figure it out" im learning how to use java for coding, not programming.
  8. the entity will not register or render, because I need args to support what I want for individual entitys
  9. btws I know this is completely off topic but I just fixed my problem with the entitys rendering. its was actually super simple. remember? any way about those knew args
  10. dude I just don't know what the args are for minecraft, like all of them so its difficult to under stand how to write code unless you know what the args are.
  11. I'm saying this code public static void createEntity(Class entityClass, String entityName){ doesn't support these args for multiple registrys EntityRegistry.registerModEntity(EntityGreekFire.class, entityName, 5, MainRegistry.modInstance, 1, 80, true); Am I wrong here's my main mod class package com.OlympiansMod.Main; import net.minecraft.client.renderer.entity.RenderSnowball; import com.OlympiansMod.Block.ModBlocks; import com.OlympiansMod.Item.ModItems; import com.OlympiansMod.creativetabs.MCreativeTabs; import com.OlympiansMod.entity.EntityGreekFire; import com.OlympiansMod.entity.MEntity; import com.OlympiansMod.lib.Refstrings; import com.OlympiansMod.world.MWorld; import cpw.mods.fml.client.registry.RenderingRegistry; import cpw.mods.fml.common.Mod; import cpw.mods.fml.common.Mod.EventHandler; 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.event.FMLPostInitializationEvent; import cpw.mods.fml.common.event.FMLPreInitializationEvent; import cpw.mods.fml.common.registry.GameRegistry; @Mod(modid = Refstrings.MODID , name = Refstrings.NAME , version = Refstrings.VERSION) public class MainRegistry { @SidedProxy(clientSide = Refstrings.CLIENTSIDE , serverSide = Refstrings.SERVERSIDE) public static ServerProxy proxy; @Instance public static MainRegistry modInstance; @EventHandler public static void PreLoad(FMLPreInitializationEvent PreEvent) { MCreativeTabs.initialiseTabs(); ModBlocks.MainRegistry(); MEntity.MainRegistry(); ModItems.MainRegistry(); MWorld.MainRegistry(); CraftingManager.mainRegistry(); } @EventHandler public static void Load(FMLInitializationEvent event) { proxy.registerRenderInfo(); } @EventHandler public static void PostLoad(FMLPostInitializationEvent PostEvent) { } }
  12. Ok I do know why it's not working, the problem is I don't know how to fix it, at the moment im learning java but im still figuring things out so yeah. thnx. package com.OlympiansMod.entity; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityList; import com.OlympiansMod.Main.MainRegistry; import cpw.mods.fml.common.registry.EntityRegistry; public class MEntity { public static void MainRegistry(){ } public static void registerEntity(){ createEntity(EntityGreekFire.class, "GreekFire"); createEntity(EntityBullet.class, "Bullet"); } public static void createEntity(Class entityClass, String entityName){ EntityRegistry.registerModEntity(entityClass, entityName, 5, MainRegistry.modInstance, 1, 80, true); } } is there a different public static void function that I can use if there is I don't know it. I do know that you cant register an entity to the same entity Registry string but the public static void doesn't give me the write stuff I need to writ a better line of code. sorry if this makes no sense . if u cant help ill figure it out thanks anyway though.
  13. I've over this a million times, and yet like you said, and according to every other source for 1.7.x the entity should be rendered.
  14. Main package com.OlympiansMod.Main; import net.minecraft.client.renderer.entity.RenderSnowball; import com.OlympiansMod.Block.ModBlocks; import com.OlympiansMod.Item.ModItems; import com.OlympiansMod.creativetabs.MCreativeTabs; import com.OlympiansMod.entity.EntityGreekFire; import com.OlympiansMod.entity.MEntity; import com.OlympiansMod.lib.Refstrings; import com.OlympiansMod.world.MWorld; import cpw.mods.fml.client.registry.RenderingRegistry; import cpw.mods.fml.common.Mod; import cpw.mods.fml.common.Mod.EventHandler; 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.event.FMLPostInitializationEvent; import cpw.mods.fml.common.event.FMLPreInitializationEvent; import cpw.mods.fml.common.registry.GameRegistry; @Mod(modid = Refstrings.MODID , name = Refstrings.NAME , version = Refstrings.VERSION) public class MainRegistry { @SidedProxy(clientSide = Refstrings.CLIENTSIDE , serverSide = Refstrings.SERVERSIDE) public static ServerProxy proxy; @Instance public static MainRegistry modInstance; @EventHandler public static void PreLoad(FMLPreInitializationEvent PreEvent) { MCreativeTabs.initialiseTabs(); ModBlocks.MainRegistry(); MEntity.MainRegistry(); ModItems.MainRegistry(); MWorld.MainRegistry(); CraftingManager.mainRegistry(); } @EventHandler public static void Load(FMLInitializationEvent event) { proxy.registerRenderInfo(); } @EventHandler public static void PostLoad(FMLPostInitializationEvent PostEvent) { } } client proxy just for the future heres everything else package com.OlympiansMod.Main; import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.entity.RenderSnowball; import com.OlympiansMod.Item.ModItems; import com.OlympiansMod.entity.EntityGreekFire; import cpw.mods.fml.client.registry.RenderingRegistry; public class ClientProxy extends ServerProxy{ public void registerRenderInfo(){ RenderingRegistry.registerEntityRenderingHandler(EntityGreekFire.class, new RenderSnowball(ModItems.GreekFire)); } public int addArmor(String armor){ return RenderingRegistry.addNewArmourRendererPrefix(armor); } } GreekFire package com.OlympiansMod.Item; import com.OlympiansMod.entity.EntityGreekFire; import cpw.mods.fml.client.registry.RenderingRegistry; import net.minecraft.client.renderer.entity.RenderSnowball; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.world.World; public class GreekFire extends Item{ public ItemStack onItemRightClick(ItemStack itemstack, World world, EntityPlayer player){ if(!player.capabilities.isCreativeMode){ --itemstack.stackSize; } world.playSoundAtEntity(player, "random.fizz", 0.7f, 0.8f); if(!world.isRemote){ world.spawnEntityInWorld(new EntityGreekFire(world, player)); } return itemstack; } } GreekFireEntity package com.OlympiansMod.entity; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.effect.EntityLightningBolt; import net.minecraft.entity.projectile.EntityLargeFireball; import net.minecraft.entity.projectile.EntityThrowable; import net.minecraft.util.MovingObjectPosition; import net.minecraft.world.World; public class EntityGreekFire extends EntityThrowable{ public EntityGreekFire(World p_i1776_1_) { super(p_i1776_1_); } public EntityGreekFire(World world, EntityLivingBase entity){ super(world, entity); } @Override protected void onImpact(MovingObjectPosition p_70184_1_) { for(int i = 0; i < 10; i++){ this.worldObj.spawnParticle("largesmoke", this.posX, this.posY, this.posZ, 0f, 0f, 0f); this.worldObj.playSound(this.posX, this.posY, this.posZ, "random.explode", 10.0f, 1.0f, inGround); this.worldObj.spawnEntityInWorld(new EntityLightningBolt(worldObj, posX, posY, posZ)); } if (!this.worldObj.isRemote){ this.setDead(); this.worldObj.createExplosion((Entity) null, this.posX, this.posY, this.posZ, 15.0f, true); } } } MEntity package com.OlympiansMod.entity; import net.minecraft.entity.EntityList; import com.OlympiansMod.Main.MainRegistry; import cpw.mods.fml.common.registry.EntityRegistry; public class MEntity { public static void MainRegistry(){ } public static void registerEntity(){ createEntity(EntityGreekFire.class, "GreekFire"); } public static void createEntity(Class entityClass, String entityName){ EntityRegistry.registerModEntity(entityClass, entityName, 5, MainRegistry.modInstance, 80, 1, true); } }
  15. sorry lol, here is Itemspawn code. package com.OlympiansMod.Item; import com.OlympiansMod.entity.EntityGreekFire; import cpw.mods.fml.client.registry.RenderingRegistry; import net.minecraft.client.renderer.entity.RenderSnowball; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.world.World; public class GreekFire extends Item{ public ItemStack onItemRightClick(ItemStack itemstack, World world, EntityPlayer player){ if(!player.capabilities.isCreativeMode){ --itemstack.stackSize; } world.playSoundAtEntity(player, "random.fizz", 0.7f, 0.8f); if(!world.isRemote){ world.spawnEntityInWorld(new EntityGreekFire(world, player)); } return itemstack; } } the problem is here
  16. ok, so here is my problem. the entity that I have spawned in the game is a ghost on the client. there for I cant see it. I have searched on the web for a solution, but I was unable to come to a conclusion on what to do. in eclipse the difference in my code is an exclamation point before a string. this(!world.isRemote) after removing the explanation point I have now rendered the classes ability to spawn my explosion created from the impact of the entity in the server, so the entity never explodes. How should I fix this here is the code from my Client Proxy and other stuff ClientProxy package com.OlympiansMod.Main; import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.entity.RenderSnowball; import com.OlympiansMod.Item.ModItems; import com.OlympiansMod.entity.EntityGreekFire; import cpw.mods.fml.client.registry.RenderingRegistry; public class ClientProxy extends ServerProxy{ public void registerRenderInfo(){ RenderingRegistry.registerEntityRenderingHandler(EntityGreekFire.class, new RenderSnowball(ModItems.GreekFire)); } public int addArmor(String armor){ return RenderingRegistry.addNewArmourRendererPrefix(armor); } } Entity Classes package com.OlympiansMod.entity; import net.minecraft.entity.EntityList; import com.OlympiansMod.Main.MainRegistry; import cpw.mods.fml.common.registry.EntityRegistry; public class MEntity { public static void MainRegistry(){ } public static void registerEntity(){ createEntity(EntityGreekFire.class, "GreekFire", 0x008521, 0x00FF0800); } public static void createEntity(Class entityClass, String entityName, int solidColour, int spotColour){ int randomId = EntityRegistry.findGlobalUniqueEntityId(); EntityRegistry.registerModEntity(entityClass, entityName, randomId, MainRegistry.modInstance, 80, 1, false); createEgg(randomId, solidColour, spotColour); } private static void createEgg(int randomId, int solidColour, int spotColour){ EntityList.entityEggs.put(Integer.valueOf(randomId), new EntityList.EntityEggInfo(randomId, solidColour, spotColour)); } } package com.OlympiansMod.entity; import com.OlympiansMod.Item.ModItems; import cpw.mods.fml.client.registry.RenderingRegistry; import net.minecraft.client.renderer.entity.RenderSnowball; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.projectile.EntityThrowable; import net.minecraft.util.MovingObjectPosition; import net.minecraft.world.World; public class EntityGreekFire extends EntityThrowable{ public EntityGreekFire(World p_i1776_1_) { super(p_i1776_1_); } public EntityGreekFire(World world, EntityLivingBase entity){ super(world, entity); } @Override protected void onImpact(MovingObjectPosition p_70184_1_) { for(int i = 0; i < 10; i++){ this.worldObj.spawnParticle("largesmoke", this.posX, this.posY, this.posZ, 0f, 0f, 0f); this.worldObj.playSound(this.posX, this.posY, this.posZ, "random.explode", 10.0f, 1.0f, inGround); } if(!this.worldObj.isRemote){ this.setDead(); this.worldObj.createExplosion((Entity) null, this.posX, this.posY, this.posZ, 15.0f, true); } } } ok this is were my item extends off of greek fire, the problem that I can see is here. package com.OlympiansMod.entity; import com.OlympiansMod.Item.ModItems; import cpw.mods.fml.client.registry.RenderingRegistry; import net.minecraft.client.renderer.entity.RenderSnowball; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.projectile.EntityThrowable; import net.minecraft.util.MovingObjectPosition; import net.minecraft.world.World; public class EntityGreekFire extends EntityThrowable{ public EntityGreekFire(World p_i1776_1_) { super(p_i1776_1_); } public EntityGreekFire(World world, EntityLivingBase entity){ super(world, entity); } @Override protected void onImpact(MovingObjectPosition p_70184_1_) { for(int i = 0; i < 10; i++){ this.worldObj.spawnParticle("largesmoke", this.posX, this.posY, this.posZ, 0f, 0f, 0f); this.worldObj.playSound(this.posX, this.posY, this.posZ, "random.explode", 10.0f, 1.0f, inGround); } if(!this.worldObj.isRemote){ this.setDead(); this.worldObj.createExplosion((Entity) null, this.posX, this.posY, this.posZ, 15.0f, true); } } } what is the problem?
  17. change your number 50, to 1 and get rid of your find unique entity id.
×
×
  • Create New...

Important Information

By using this site, you agree to our Privacy Policy.