Jump to content

(1.16.5 MCP) ray trace entity


ElTotisPro50

Recommended Posts

so i have a code that ray trace entity but just like 7 blocks away(i cant manage the raytrace distance) and i want to know if there is a better way to do it (if i can manage the detecting distance IS BETTER)

RayTraceResult entityResult = Minecraft.getInstance().objectMouseOver;
if(entityResult.getType() == RayTraceResult.Type.ENTITY) {
      Entity lookedEntity = ((EntityRayTraceResult)entityResult).getEntity();
	  lookedEntity.DOSOMETHINGWITHLOOKEDENTITY;
}

)

Edited by ElTotisPro50
Link to comment
Share on other sites

10 hours ago, diesieben07 said:

This is client side only, so most likely this doesn't do what you want. Look at BucketItem for an example.

And you once again posted in the wrong Forum.

it uses the method raytrace "if Type.BLOCK"  but i dont see anything about .Type.ENTITY or the cow for extract its milk

 

are you sure im in the wrong spot my post says 14 hours ago in Modder Support, it doesnt say in forgegradle and i wrote the post in Modder Support only hmm

Edited by ElTotisPro50
Link to comment
Share on other sites

10 hours ago, diesieben07 said:

This is client side only, so most likely this doesn't do what you want. Look at BucketItem for an example.

And you once again posted in the wrong Forum.

would this work?

RayTraceResult entityResult = rayTrace(world,player, RayTraceContext.FluidMode.NONE);

if(entityResult.getType() == RayTraceResult.Type.ENTITY) {
      LivingEntity lookedEntity = (LivingEntity)((EntityRayTraceResult)entityResult).getEntity();
}

 

Link to comment
Share on other sites

1 hour ago, diesieben07 said:

Under what circumstances?

hmm, when i right click my item, give glowing to the entity im looking at(with raytrace)

i dont want a method or event that detects if i right click an entity because i want to give it the effect at more distance(it would be nice if i can controll the entity detecting distance)

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.

Announcements



×
×
  • Create New...

Important Information

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