Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

这合理吗 #93

Open
seiuna opened this issue Feb 11, 2024 · 2 comments
Open

这合理吗 #93

seiuna opened this issue Feb 11, 2024 · 2 comments
Labels
question Further information is requested

Comments

@seiuna
Copy link

seiuna commented Feb 11, 2024

public EntityLivingBase getTarget() {
double x = Minecraft.getMinecraft().thePlayer.posX;
double y = Minecraft.getMinecraft().thePlayer.posY;
double z = Minecraft.getMinecraft().thePlayer.posZ;
int bound = 500;
List entityList = Minecraft.getMinecraft().theWorld.getEntitiesWithinAABB(EntityLivingBase.class, new AxisAlignedBB(x - (bound / 2d), y - (256 / 2d), z - (bound / 2d), x + (bound / 2d), y + (256 / 2d), z + (bound / 2d)), null);
if (!entityList.isEmpty()) {
EntityLivingBase[] Array = entityList.toArray(new EntityLivingBase[0]);
for (int i = 0; i < Array.length; i++) {
EntityLivingBase insertValue=Array[i];
int insertIndex=i-1;
while (insertIndex>=0 && insertValue.getPositionVector().distanceTo(Minecraft.getMinecraft().thePlayer.getPositionVector()) < Array[insertIndex].getPositionVector().distanceTo(Minecraft.getMinecraft().thePlayer.getPositionVector())) {
Array[insertIndex+1]=Array[insertIndex];
insertIndex--;
}
Array[insertIndex+1]=insertValue;
}
for(EntityLivingBase entity : Array){
if(isValid(entity)){
return entity;
}
}
}
return null;
}

这合理吗

@pysio2007 pysio2007 added the question Further information is requested label Feb 11, 2024
@pysio2007
Copy link
Collaborator

本项目已经停止维护 如有疑问/修改意见 建议直接发PR——ISS.jpg

@ItzGreenCat
Copy link
Owner

我不清楚
lol

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

3 participants