mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-30 16:19:03 +01:00
Change EnderEye target without changing other things
This commit is contained in:
parent
c754319985
commit
a6362921cc
2 changed files with 33 additions and 3 deletions
|
@ -10,7 +10,30 @@
|
||||||
|
|
||||||
public class EyeOfEnder extends Entity implements ItemSupplier {
|
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;
|
++this.life;
|
||||||
if (this.life > 80 && !this.level().isClientSide) {
|
if (this.life > 80 && !this.level().isClientSide) {
|
||||||
this.playSound(SoundEvents.ENDER_EYE_DEATH, 1.0F, 1.0F);
|
this.playSound(SoundEvents.ENDER_EYE_DEATH, 1.0F, 1.0F);
|
||||||
|
@ -19,7 +42,7 @@
|
||||||
if (this.surviveAfterDeath) {
|
if (this.surviveAfterDeath) {
|
||||||
this.level().addFreshEntity(new ItemEntity(this.level(), this.getX(), this.getY(), this.getZ(), this.getItem()));
|
this.level().addFreshEntity(new ItemEntity(this.level(), this.getX(), this.getY(), this.getZ(), this.getItem()));
|
||||||
} else {
|
} else {
|
||||||
@@ -174,7 +177,12 @@
|
@@ -174,7 +184,12 @@
|
||||||
@Override
|
@Override
|
||||||
public void readAdditionalSaveData(CompoundTag nbt) {
|
public void readAdditionalSaveData(CompoundTag nbt) {
|
||||||
if (nbt.contains("Item", 10)) {
|
if (nbt.contains("Item", 10)) {
|
||||||
|
|
|
@ -32,8 +32,15 @@ public class CraftEnderSignal extends CraftEntity implements EnderSignal {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setTargetLocation(Location location) {
|
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");
|
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
|
@Override
|
||||||
|
|
Loading…
Reference in a new issue