Jump to content

Recommended Posts

Posted (edited)

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
Posted (edited)
  On 2/18/2022 at 11:06 AM, 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.

Expand  

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
Posted
  On 2/18/2022 at 11:06 AM, 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.

Expand  

would this work?

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

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

 

Posted
  On 2/18/2022 at 9:31 PM, diesieben07 said:

Under what circumstances?

Expand  

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)

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.