Jump to content

qxjl1010

Members
  • Posts

    24
  • Joined

  • Last visited

Converted

  • Gender
    Undisclosed
  • Personal Text
    I am new!

qxjl1010's Achievements

Tree Puncher

Tree Puncher (2/8)

0

Reputation

  1. Hi there, here is my entity class package com.practise.NPC; import com.practise.ai.AttackerAi; import net.minecraft.entity.ai.EntityAIAttackOnCollide; import net.minecraft.entity.passive.EntityWolf; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.world.World; public class Attacker extends EntityWolf{ public Attacker(World worldIn) { super(worldIn); this.tasks.addTask(1, new EntityAIAttackOnCollide(this, EntityPlayer.class, 1.2D, false)); } } I use the spawn egg create the entity, but the EntityAIAttackOnCollide doesn't work, the entity doesn't attack player.
  2. Doesn't have this class :'( I'm using minecraft 1.8. There is one class called "EntityAIAttackOnCollide". Is that what you say?
  3. Hey guys, I've made entity A and B. Now I wanna add an AI which letting entity B attack entity A. Is there any AI class I can use directly in the reference library? Or if I need to make a new AI class? (In the new class, which method can be used?) Thx.
  4. I guess after setposition I still need a method to spawn the entity, right?
  5. Thanks buddy, I've checked EntityRegistry.addSpawn: EntityRegistry.addSpawn(entityClass, weightedProb, min, max, typeOfCreature, biomes); But after reading the addSpawn method, I still don't know with which parameter I can choose where it spawn?
  6. Hey guys, I've made a moving entity. Now I wanna spawn entities(like sheep or cow) automatically beside the road which it just passed by. Which method I need to use?
  7. is interact being called when it should be? I believe so, with other classes I made, I used it a bunch of times, they work perfectly. Do you ever clear ifTrigger to false? Oh, I forgot about it, I'll definitely add this when the entity moves to certain position. But the problem is: it doesn't even move now. Does anything ever test for being at the XYZ so you can stop executing? The same answer with last one, it doesn't move now.
  8. I changed my code to this: package com.practise.ai; import com.practise.NPC.EscortRequestNPC; import net.minecraft.entity.EntityCreature; import net.minecraft.entity.ai.EntityAIBase; import net.minecraft.entity.ai.EntityAIMoveToBlock; import net.minecraft.util.BlockPos; import net.minecraft.world.World; public class EscortRequestNPCai extends EntityAIBase{ private final EscortRequestNPC entity; BlockPos NPCpos; int posX; int posY; int posZ; public EscortRequestNPCai(EscortRequestNPC entity){ this.entity = entity; NPCpos = entity.getPosition(); posX = NPCpos.getX(); posY = NPCpos.getY(); posZ = NPCpos.getZ(); posX += 5; posY += 5; } @Override public boolean shouldExecute() { if(entity.ifTrigger == true) return true; else return false; } @Override public void startExecuting() { System.out.println(entity.getNavigator().tryMoveToXYZ((double)posX, (double)posY, (double)posZ, 2)); } } And the console gave me "false" result. So I guess there must be something wrong with parameters? :'(
  9. Changed to posX += 5; posY += 5; Still didn't work :'(
  10. Ok, the problem is, I can enter the method startExcuting, but it doesn't work. I've changed my code to this: package com.practise.ai; import com.practise.NPC.EscortRequestNPC; import net.minecraft.entity.EntityCreature; import net.minecraft.entity.ai.EntityAIBase; import net.minecraft.entity.ai.EntityAIMoveToBlock; import net.minecraft.util.BlockPos; import net.minecraft.world.World; public class EscortRequestNPCai extends EntityAIBase{ private final EscortRequestNPC entity; BlockPos NPCpos; int posX; int posY; int posZ; public EscortRequestNPCai(EscortRequestNPC entity){ this.entity = entity; NPCpos = entity.getPosition(); posX = NPCpos.getX(); posY = NPCpos.getY(); posZ = NPCpos.getZ(); posX += 200; posY += 200; } @Override public boolean shouldExecute() { if(entity.ifTrigger == true) return true; else return false; } @Override public void startExecuting() { for(int i=0;i !=10;i++) System.out.println("enter startExecuting!!!"); entity.getNavigator().tryMoveToXYZ(posX, posY, posZ, 0.5); } } When I right click the entity, the console gave me this: [13:03:53] [server thread/INFO]: Player98 joined the game [13:03:57] [server thread/INFO] [sTDOUT]: [com.practise.ai.EscortRequestNPCai:startExecuting:42]: enter startExecuting!!! [13:03:57] [server thread/INFO] [sTDOUT]: [com.practise.ai.EscortRequestNPCai:startExecuting:42]: enter startExecuting!!! [13:03:57] [server thread/INFO] [sTDOUT]: [com.practise.ai.EscortRequestNPCai:startExecuting:42]: enter startExecuting!!! [13:03:57] [server thread/INFO] [sTDOUT]: [com.practise.ai.EscortRequestNPCai:startExecuting:42]: enter startExecuting!!! [13:03:57] [server thread/INFO] [sTDOUT]: [com.practise.ai.EscortRequestNPCai:startExecuting:42]: enter startExecuting!!! [13:03:57] [server thread/INFO] [sTDOUT]: [com.practise.ai.EscortRequestNPCai:startExecuting:42]: enter startExecuting!!! [13:03:57] [server thread/INFO] [sTDOUT]: [com.practise.ai.EscortRequestNPCai:startExecuting:42]: enter startExecuting!!! [13:03:57] [server thread/INFO] [sTDOUT]: [com.practise.ai.EscortRequestNPCai:startExecuting:42]: enter startExecuting!!! [13:03:57] [server thread/INFO] [sTDOUT]: [com.practise.ai.EscortRequestNPCai:startExecuting:42]: enter startExecuting!!! [13:03:57] [server thread/INFO] [sTDOUT]: [com.practise.ai.EscortRequestNPCai:startExecuting:42]: enter startExecuting!!! [13:03:58] [server thread/INFO]: Saving and pausing game... So, it seems the "tryMoveToXYZ" method did not work.
  11. errr, I've already posX+=200, posY+=200.
  12. Thanks buddy! package com.practise.NPC; import com.practise.ai.EscortRequestNPCai; import net.minecraft.entity.ai.EntityAIMoveToBlock; import net.minecraft.entity.passive.EntityVillager; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.world.World; public class EscortRequestNPC extends EntityVillager{ public EscortRequestNPC(World worldIn) { super(worldIn); this.tasks.addTask(0, new EscortRequestNPCai(this)); } public boolean ifTrigger = false; @Override public boolean interact(EntityPlayer player) { ifTrigger = true; return true; } }
  13. I tried to build an AI class, but it doesn't work :'( package com.practise.ai; import com.practise.NPC.EscortRequestNPC; import net.minecraft.entity.EntityCreature; import net.minecraft.entity.ai.EntityAIBase; import net.minecraft.entity.ai.EntityAIMoveToBlock; import net.minecraft.util.BlockPos; import net.minecraft.world.World; public class EscortRequestNPCai extends EntityAIBase{ private final EscortRequestNPC entity; public EscortRequestNPCai(EscortRequestNPC entity){ this.entity = entity; } @Override public boolean shouldExecute() { if(entity.ifTrigger == true) return true; else return false; } @Override public void startExecuting() { BlockPos NPCpos = entity.getPosition(); int posX = NPCpos.getX(); int posY = NPCpos.getY(); int posZ = NPCpos.getZ(); posX += 200; posY += 200; entity.getNavigator().tryMoveToXYZ(posX, posY, posZ, 2); } }
  14. Hi there, I'm a newbie here. I wanna build an entity that when I right click him, the entity moves to the certain position. How can I make it? Thx!
  15. I read the document and checked my reference library, cannot find a package called "capabilities". My forge version is 1.8, can use something else instead?
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.