修复一个可能导致崩溃的问题
This commit is contained in:
parent
a66d34468c
commit
03a94a0917
6 changed files with 15 additions and 4 deletions
|
@ -3,7 +3,8 @@ package com.atsuishio.superbwarfare.entity.projectile;
|
||||||
import net.minecraft.world.phys.Vec3;
|
import net.minecraft.world.phys.Vec3;
|
||||||
|
|
||||||
public interface DecoyEntity {
|
public interface DecoyEntity {
|
||||||
String getStringUUID();
|
|
||||||
|
String getDecoyUUID();
|
||||||
|
|
||||||
Vec3 getPosition();
|
Vec3 getPosition();
|
||||||
}
|
}
|
||||||
|
|
|
@ -62,6 +62,11 @@ public class FlareDecoyEntity extends Entity implements DecoyEntity {
|
||||||
this.xRotO = this.getXRot();
|
this.xRotO = this.getXRot();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getDecoyUUID() {
|
||||||
|
return this.getStringUUID();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Vec3 getPosition() {
|
public Vec3 getPosition() {
|
||||||
return position();
|
return position();
|
||||||
|
|
|
@ -219,7 +219,7 @@ public class JavelinMissileEntity extends FastThrowableProjectile implements Geo
|
||||||
|
|
||||||
for (var e : decoy) {
|
for (var e : decoy) {
|
||||||
if (e instanceof DecoyEntity decoyEntity && !distracted) {
|
if (e instanceof DecoyEntity decoyEntity && !distracted) {
|
||||||
this.entityData.set(TARGET_UUID, decoyEntity.getStringUUID());
|
this.entityData.set(TARGET_UUID, decoyEntity.getDecoyUUID());
|
||||||
distracted = true;
|
distracted = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -69,4 +69,9 @@ public class SmokeDecoyEntity extends Entity implements DecoyEntity {
|
||||||
public Vec3 getPosition() {
|
public Vec3 getPosition() {
|
||||||
return position();
|
return position();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getDecoyUUID() {
|
||||||
|
return this.getStringUUID();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -197,7 +197,7 @@ public class SwarmDroneEntity extends FastThrowableProjectile implements GeoEnti
|
||||||
|
|
||||||
for (var e : decoy) {
|
for (var e : decoy) {
|
||||||
if (e instanceof DecoyEntity decoyEntity && !distracted) {
|
if (e instanceof DecoyEntity decoyEntity && !distracted) {
|
||||||
this.entityData.set(TARGET_UUID, decoyEntity.getStringUUID());
|
this.entityData.set(TARGET_UUID, decoyEntity.getDecoyUUID());
|
||||||
distracted = true;
|
distracted = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -122,7 +122,7 @@ public class JavelinItem extends GunItem implements GeoItem {
|
||||||
List<Entity> decoy = SeekTool.seekLivingEntities(player, player.level(), 512, 8);
|
List<Entity> decoy = SeekTool.seekLivingEntities(player, player.level(), 512, 8);
|
||||||
for (var e : decoy) {
|
for (var e : decoy) {
|
||||||
if (e instanceof DecoyEntity decoyEntity) {
|
if (e instanceof DecoyEntity decoyEntity) {
|
||||||
tag.putString("TargetEntity", decoyEntity.getStringUUID());
|
tag.putString("TargetEntity", decoyEntity.getDecoyUUID());
|
||||||
tag.putDouble("TargetPosX", decoyEntity.getPosition().x);
|
tag.putDouble("TargetPosX", decoyEntity.getPosition().x);
|
||||||
tag.putDouble("TargetPosY", decoyEntity.getPosition().y);
|
tag.putDouble("TargetPosY", decoyEntity.getPosition().y);
|
||||||
tag.putDouble("TargetPosZ", decoyEntity.getPosition().z);
|
tag.putDouble("TargetPosZ", decoyEntity.getPosition().z);
|
||||||
|
|
Loading…
Add table
Reference in a new issue