Change EnderEye target without changing other things

This commit is contained in:
Jake Potrebic 2021-08-21 12:13:53 -07:00
parent c754319985
commit a6362921cc
2 changed files with 33 additions and 3 deletions

View file

@ -10,7 +10,30 @@
public class EyeOfEnder extends Entity implements ItemSupplier {
@@ -153,7 +156,7 @@
@@ -73,6 +76,11 @@
}
public void signalTo(BlockPos pos) {
+ // Paper start - Change EnderEye target without changing other things
+ this.signalTo(pos, true);
+ }
+ public void signalTo(BlockPos pos, boolean update) {
+ // Paper end - Change EnderEye target without changing other things
double d0 = (double) pos.getX();
int i = pos.getY();
double d1 = (double) pos.getZ();
@@ -90,8 +98,10 @@
this.tz = d1;
}
+ if (update) { // Paper - Change EnderEye target without changing other things
this.life = 0;
this.surviveAfterDeath = this.random.nextInt(5) > 0;
+ } // Paper - Change EnderEye target without changing other things
}
@Override
@@ -153,7 +163,7 @@
++this.life;
if (this.life > 80 && !this.level().isClientSide) {
this.playSound(SoundEvents.ENDER_EYE_DEATH, 1.0F, 1.0F);
@ -19,7 +42,7 @@
if (this.surviveAfterDeath) {
this.level().addFreshEntity(new ItemEntity(this.level(), this.getX(), this.getY(), this.getZ(), this.getItem()));
} else {
@@ -174,7 +177,12 @@
@@ -174,7 +184,12 @@
@Override
public void readAdditionalSaveData(CompoundTag nbt) {
if (nbt.contains("Item", 10)) {

View file

@ -32,8 +32,15 @@ public class CraftEnderSignal extends CraftEntity implements EnderSignal {
@Override
public void setTargetLocation(Location location) {
// Paper start - Change EnderEye target without changing other things
this.setTargetLocation(location, true);
}
@Override
public void setTargetLocation(Location location, boolean update) {
// Paper end - Change EnderEye target without changing other things
Preconditions.checkArgument(this.getWorld().equals(location.getWorld()), "Cannot target EnderSignal across worlds");
this.getHandle().signalTo(CraftLocation.toBlockPosition(location));
this.getHandle().signalTo(CraftLocation.toBlockPosition(location), update); // Paper - Change EnderEye target without changing other things
}
@Override