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)
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
Posted
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();
}

 

Posted
1 hour ago, diesieben07 said:

There is no method to do entity ray tracing on the server (mostly because it won't be accurate).

What are you trying to do?

for example remove the entity im looking at or give it glowing effect or set it on fire

Posted
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)

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.