qxjl1010
-
Posts
24 -
Joined
-
Last visited
Posts posted by qxjl1010
-
-
Doesn't have this class :'(
I'm using minecraft 1.8.
There is one class called "EntityAIAttackOnCollide".
Is that what you say?
-
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.
-
I guess after setposition I still need a method to spawn the entity, right?
-
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?
-
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?
-
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.
-
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? :'(
-
Changed to posX += 5; posY += 5;
Still didn't work :'(
-
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.
-
errr, I've already posX+=200, posY+=200.
-
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; } }
-
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); } }
-
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!
-
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?
-
Hey guys,
I've finished a class which be used to count killings.
package com.practise.request; import net.minecraft.entity.passive.EntityChicken; import net.minecraft.init.Items; import net.minecraft.world.World; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.event.entity.living.LivingDeathEvent; import net.minecraftforge.fml.common.FMLCommonHandler; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; public class KillingRequest { public int KillingNumbers = 0; public boolean ifFinished = false; public KillingRequest() { FMLCommonHandler.instance().bus().register(this); MinecraftForge.EVENT_BUS.register(this); } @SubscribeEvent public void KillingCount(LivingDeathEvent event){ System.out.println("position.1,the killingNumbers is "+KillingNumbers); if((event.entity instanceof EntityChicken)){ System.out.println("position.2,the killingNumbers is "+KillingNumbers); KillingNumbers += 1; System.out.println("position.3,the killingNumbers is "+KillingNumbers); if(KillingNumbers >= 5) ifFinished = true; } } }
However, in the game, as soon as I kill a chicken, the console gives me this:
[16:03:41] [server thread/INFO]: Player483 joined the game
[16:03:51] [server thread/INFO] [sTDOUT]: [com.practise.request.KillingRequest:KillingCount:23]: position.1,the killingNumbers is 0
[16:03:51] [server thread/INFO] [sTDOUT]: [com.practise.request.KillingRequest:KillingCount:25]: position.2,the killingNumbers is 0
[16:03:51] [server thread/INFO] [sTDOUT]: [com.practise.request.KillingRequest:KillingCount:27]: position.3,the killingNumbers is 1
[16:03:51] [server thread/INFO] [sTDOUT]: [com.practise.request.KillingRequest:KillingCount:23]: position.1,the killingNumbers is 0
[16:03:51] [server thread/INFO] [sTDOUT]: [com.practise.request.KillingRequest:KillingCount:25]: position.2,the killingNumbers is 0
[16:03:51] [server thread/INFO] [sTDOUT]: [com.practise.request.KillingRequest:KillingCount:27]: position.3,the killingNumbers is 1
[16:03:51] [server thread/INFO] [sTDOUT]: [com.practise.request.KillingRequest:KillingCount:23]: position.1,the killingNumbers is 0
[16:03:51] [server thread/INFO] [sTDOUT]: [com.practise.request.KillingRequest:KillingCount:25]: position.2,the killingNumbers is 0
[16:03:51] [server thread/INFO] [sTDOUT]: [com.practise.request.KillingRequest:KillingCount:27]: position.3,the killingNumbers is 1
[16:03:51] [server thread/INFO] [sTDOUT]: [com.practise.request.KillingRequest:KillingCount:23]: position.1,the killingNumbers is 0
[16:03:51] [server thread/INFO] [sTDOUT]: [com.practise.request.KillingRequest:KillingCount:25]: position.2,the killingNumbers is 0
[16:03:51] [server thread/INFO] [sTDOUT]: [com.practise.request.KillingRequest:KillingCount:27]: position.3,the killingNumbers is 1
[16:03:51] [server thread/INFO] [sTDOUT]: [com.practise.request.KillingRequest:KillingCount:23]: position.1,the killingNumbers is 0
[16:03:51] [server thread/INFO] [sTDOUT]: [com.practise.request.KillingRequest:KillingCount:25]: position.2,the killingNumbers is 0
[16:03:51] [server thread/INFO] [sTDOUT]: [com.practise.request.KillingRequest:KillingCount:27]: position.3,the killingNumbers is 1
[16:03:51] [server thread/INFO] [sTDOUT]: [com.practise.request.KillingRequest:KillingCount:23]: position.1,the killingNumbers is 0
[16:03:51] [server thread/INFO] [sTDOUT]: [com.practise.request.KillingRequest:KillingCount:25]: position.2,the killingNumbers is 0
[16:03:51] [server thread/INFO] [sTDOUT]: [com.practise.request.KillingRequest:KillingCount:27]: position.3,the killingNumbers is 1
[16:03:51] [server thread/INFO] [sTDOUT]: [com.practise.request.KillingRequest:KillingCount:23]: position.1,the killingNumbers is 0
[16:03:51] [server thread/INFO] [sTDOUT]: [com.practise.request.KillingRequest:KillingCount:25]: position.2,the killingNumbers is 0
[16:03:51] [server thread/INFO] [sTDOUT]: [com.practise.request.KillingRequest:KillingCount:27]: position.3,the killingNumbers is 1
[16:03:51] [Client thread/INFO] [sTDOUT]: [com.practise.request.KillingRequest:KillingCount:23]: position.1,the killingNumbers is 1
[16:03:51] [Client thread/INFO] [sTDOUT]: [com.practise.request.KillingRequest:KillingCount:25]: position.2,the killingNumbers is 1
[16:03:51] [Client thread/INFO] [sTDOUT]: [com.practise.request.KillingRequest:KillingCount:27]: position.3,the killingNumbers is 2
[16:03:51] [Client thread/INFO] [sTDOUT]: [com.practise.request.KillingRequest:KillingCount:23]: position.1,the killingNumbers is 1
[16:03:51] [Client thread/INFO] [sTDOUT]: [com.practise.request.KillingRequest:KillingCount:25]: position.2,the killingNumbers is 1
[16:03:51] [Client thread/INFO] [sTDOUT]: [com.practise.request.KillingRequest:KillingCount:27]: position.3,the killingNumbers is 2
[16:03:51] [Client thread/INFO] [sTDOUT]: [com.practise.request.KillingRequest:KillingCount:23]: position.1,the killingNumbers is 1
[16:03:51] [Client thread/INFO] [sTDOUT]: [com.practise.request.KillingRequest:KillingCount:25]: position.2,the killingNumbers is 1
[16:03:51] [Client thread/INFO] [sTDOUT]: [com.practise.request.KillingRequest:KillingCount:27]: position.3,the killingNumbers is 2
[16:03:51] [Client thread/INFO] [sTDOUT]: [com.practise.request.KillingRequest:KillingCount:23]: position.1,the killingNumbers is 1
[16:03:51] [Client thread/INFO] [sTDOUT]: [com.practise.request.KillingRequest:KillingCount:25]: position.2,the killingNumbers is 1
[16:03:51] [Client thread/INFO] [sTDOUT]: [com.practise.request.KillingRequest:KillingCount:27]: position.3,the killingNumbers is 2
[16:03:51] [Client thread/INFO] [sTDOUT]: [com.practise.request.KillingRequest:KillingCount:23]: position.1,the killingNumbers is 1
[16:03:51] [Client thread/INFO] [sTDOUT]: [com.practise.request.KillingRequest:KillingCount:25]: position.2,the killingNumbers is 1
[16:03:51] [Client thread/INFO] [sTDOUT]: [com.practise.request.KillingRequest:KillingCount:27]: position.3,the killingNumbers is 2
[16:03:51] [Client thread/INFO] [sTDOUT]: [com.practise.request.KillingRequest:KillingCount:23]: position.1,the killingNumbers is 1
[16:03:51] [Client thread/INFO] [sTDOUT]: [com.practise.request.KillingRequest:KillingCount:25]: position.2,the killingNumbers is 1
[16:03:51] [Client thread/INFO] [sTDOUT]: [com.practise.request.KillingRequest:KillingCount:27]: position.3,the killingNumbers is 2
[16:03:51] [Client thread/INFO] [sTDOUT]: [com.practise.request.KillingRequest:KillingCount:23]: position.1,the killingNumbers is 1
[16:03:51] [Client thread/INFO] [sTDOUT]: [com.practise.request.KillingRequest:KillingCount:25]: position.2,the killingNumbers is 1
[16:03:51] [Client thread/INFO] [sTDOUT]: [com.practise.request.KillingRequest:KillingCount:27]: position.3,the killingNumbers is 2
[16:03:55] [server thread/INFO]: Saving and pausing game...
Does it mean I trigger this method several times when I kill only one chicken?
-
Thanks buddy!
I'll try that.
-
Thanks buddy!
I'll try that.
-
Oh, that function is what I "suppose" to do.
Not accomplish yet.
And I don't understand how to make it.
-
Oh, that function is what I "suppose" to do.
Not accomplish yet.
And I don't understand how to make it.
-
Hey guys,
I'm a new modder here, wanna make an NPC which can give "request" to player.
When a player close to the NPC, there is a sentence print above him, like "kill 5 chickens for me".
I've already made a mob. How can I accomplish it?
-
Hey guys,
I'm a new modder here, wanna make an NPC which can give "request" to player.
When a player close to the NPC, there is a sentence print above him, like "kill 5 chickens for me".
I've already made a mob. How can I accomplish it?
[1.8] Entity doesn't attack player
in Modder Support
Posted
Hi there, here is my entity class
I use the spawn egg create the entity, but the EntityAIAttackOnCollide doesn't work, the entity doesn't attack player.