aboutsummaryrefslogtreecommitdiffhomepage
path: root/patch-remap/mache-vineflower/net/minecraft/world/entity/projectile/EyeOfEnder.java.patch
diff options
context:
space:
mode:
Diffstat (limited to 'patch-remap/mache-vineflower/net/minecraft/world/entity/projectile/EyeOfEnder.java.patch')
-rw-r--r--patch-remap/mache-vineflower/net/minecraft/world/entity/projectile/EyeOfEnder.java.patch245
1 files changed, 245 insertions, 0 deletions
diff --git a/patch-remap/mache-vineflower/net/minecraft/world/entity/projectile/EyeOfEnder.java.patch b/patch-remap/mache-vineflower/net/minecraft/world/entity/projectile/EyeOfEnder.java.patch
new file mode 100644
index 0000000000..c01a4e5a26
--- /dev/null
+++ b/patch-remap/mache-vineflower/net/minecraft/world/entity/projectile/EyeOfEnder.java.patch
@@ -0,0 +1,245 @@
+--- a/net/minecraft/world/entity/projectile/EyeOfEnder.java
++++ b/net/minecraft/world/entity/projectile/EyeOfEnder.java
+@@ -17,68 +17,73 @@
+ import net.minecraft.world.phys.Vec3;
+
+ public class EyeOfEnder extends Entity implements ItemSupplier {
++
+ private static final EntityDataAccessor<ItemStack> DATA_ITEM_STACK = SynchedEntityData.defineId(EyeOfEnder.class, EntityDataSerializers.ITEM_STACK);
+- private double tx;
+- private double ty;
+- private double tz;
+- private int life;
+- private boolean surviveAfterDeath;
++ public double tx;
++ public double ty;
++ public double tz;
++ public int life;
++ public boolean surviveAfterDeath;
+
+ public EyeOfEnder(EntityType<? extends EyeOfEnder> entityType, Level level) {
+ super(entityType, level);
+ }
+
+- public EyeOfEnder(Level level, double x, double y, double z) {
++ public EyeOfEnder(Level level, double x, double d1, double y) {
+ this(EntityType.EYE_OF_ENDER, level);
+- this.setPos(x, y, z);
++ this.setPos(x, d1, y);
+ }
+
+ public void setItem(ItemStack stack) {
+- if (!stack.is(Items.ENDER_EYE) || stack.hasTag()) {
+- this.getEntityData().set(DATA_ITEM_STACK, stack.copyWithCount(1));
++ if (true || !stack.is(Items.ENDER_EYE) || stack.hasTag()) { // CraftBukkit - always allow item changing
++ this.getEntityData().set(EyeOfEnder.DATA_ITEM_STACK, stack.copyWithCount(1));
+ }
++
+ }
+
+ private ItemStack getItemRaw() {
+- return this.getEntityData().get(DATA_ITEM_STACK);
++ return (ItemStack) this.getEntityData().get(EyeOfEnder.DATA_ITEM_STACK);
+ }
+
+ @Override
+ public ItemStack getItem() {
+- ItemStack itemRaw = this.getItemRaw();
+- return itemRaw.isEmpty() ? new ItemStack(Items.ENDER_EYE) : itemRaw;
++ ItemStack itemstack = this.getItemRaw();
++
++ return itemstack.isEmpty() ? new ItemStack(Items.ENDER_EYE) : itemstack;
+ }
+
+ @Override
+ protected void defineSynchedData() {
+- this.getEntityData().define(DATA_ITEM_STACK, ItemStack.EMPTY);
++ this.getEntityData().define(EyeOfEnder.DATA_ITEM_STACK, ItemStack.EMPTY);
+ }
+
+ @Override
+ public boolean shouldRenderAtSqrDistance(double distance) {
+- double d = this.getBoundingBox().getSize() * 4.0;
+- if (Double.isNaN(d)) {
+- d = 4.0;
++ double d1 = this.getBoundingBox().getSize() * 4.0D;
++
++ if (Double.isNaN(d1)) {
++ d1 = 4.0D;
+ }
+
+- d *= 64.0;
+- return distance < d * d;
++ d1 *= 64.0D;
++ return distance < d1 * d1;
+ }
+
+ public void signalTo(BlockPos pos) {
+- double d = (double)pos.getX();
+- int y = pos.getY();
+- double d1 = (double)pos.getZ();
+- double d2 = d - this.getX();
++ double d0 = (double) pos.getX();
++ int i = pos.getY();
++ double d1 = (double) pos.getZ();
++ double d2 = d0 - this.getX();
+ double d3 = d1 - this.getZ();
+- double squareRoot = Math.sqrt(d2 * d2 + d3 * d3);
+- if (squareRoot > 12.0) {
+- this.tx = this.getX() + d2 / squareRoot * 12.0;
+- this.tz = this.getZ() + d3 / squareRoot * 12.0;
+- this.ty = this.getY() + 8.0;
++ double d4 = Math.sqrt(d2 * d2 + d3 * d3);
++
++ if (d4 > 12.0D) {
++ this.tx = this.getX() + d2 / d4 * 12.0D;
++ this.tz = this.getZ() + d3 / d4 * 12.0D;
++ this.ty = this.getY() + 8.0D;
+ } else {
+- this.tx = d;
+- this.ty = (double)y;
++ this.tx = d0;
++ this.ty = (double) i;
+ this.tz = d1;
+ }
+
+@@ -87,74 +92,62 @@
+ }
+
+ @Override
+- public void lerpMotion(double x, double y, double z) {
+- this.setDeltaMovement(x, y, z);
++ public void lerpMotion(double x, double d1, double y) {
++ this.setDeltaMovement(x, d1, y);
+ if (this.xRotO == 0.0F && this.yRotO == 0.0F) {
+- double squareRoot = Math.sqrt(x * x + z * z);
+- this.setYRot((float)(Mth.atan2(x, z) * 180.0F / (float)Math.PI));
+- this.setXRot((float)(Mth.atan2(y, squareRoot) * 180.0F / (float)Math.PI));
++ double d3 = Math.sqrt(x * x + y * y);
++
++ this.setYRot((float) (Mth.atan2(x, y) * 57.2957763671875D));
++ this.setXRot((float) (Mth.atan2(d1, d3) * 57.2957763671875D));
+ this.yRotO = this.getYRot();
+ this.xRotO = this.getXRot();
+ }
++
+ }
+
+ @Override
+ public void tick() {
+ super.tick();
+- Vec3 deltaMovement = this.getDeltaMovement();
+- double d = this.getX() + deltaMovement.x;
+- double d1 = this.getY() + deltaMovement.y;
+- double d2 = this.getZ() + deltaMovement.z;
+- double d3 = deltaMovement.horizontalDistance();
+- this.setXRot(Projectile.lerpRotation(this.xRotO, (float)(Mth.atan2(deltaMovement.y, d3) * 180.0F / (float)Math.PI)));
+- this.setYRot(Projectile.lerpRotation(this.yRotO, (float)(Mth.atan2(deltaMovement.x, deltaMovement.z) * 180.0F / (float)Math.PI)));
++ Vec3 vec3d = this.getDeltaMovement();
++ double d0 = this.getX() + vec3d.x;
++ double d1 = this.getY() + vec3d.y;
++ double d2 = this.getZ() + vec3d.z;
++ double d3 = vec3d.horizontalDistance();
++
++ this.setXRot(Projectile.lerpRotation(this.xRotO, (float) (Mth.atan2(vec3d.y, d3) * 57.2957763671875D)));
++ this.setYRot(Projectile.lerpRotation(this.yRotO, (float) (Mth.atan2(vec3d.x, vec3d.z) * 57.2957763671875D)));
+ if (!this.level().isClientSide) {
+- double d4 = this.tx - d;
++ double d4 = this.tx - d0;
+ double d5 = this.tz - d2;
+- float f = (float)Math.sqrt(d4 * d4 + d5 * d5);
+- float f1 = (float)Mth.atan2(d5, d4);
+- double d6 = Mth.lerp(0.0025, d3, (double)f);
+- double d7 = deltaMovement.y;
++ float f = (float) Math.sqrt(d4 * d4 + d5 * d5);
++ float f1 = (float) Mth.atan2(d5, d4);
++ double d6 = Mth.lerp(0.0025D, d3, (double) f);
++ double d7 = vec3d.y;
++
+ if (f < 1.0F) {
+- d6 *= 0.8;
+- d7 *= 0.8;
++ d6 *= 0.8D;
++ d7 *= 0.8D;
+ }
+
+ int i = this.getY() < this.ty ? 1 : -1;
+- deltaMovement = new Vec3(Math.cos((double)f1) * d6, d7 + ((double)i - d7) * 0.015F, Math.sin((double)f1) * d6);
+- this.setDeltaMovement(deltaMovement);
++
++ vec3d = new Vec3(Math.cos((double) f1) * d6, d7 + ((double) i - d7) * 0.014999999664723873D, Math.sin((double) f1) * d6);
++ this.setDeltaMovement(vec3d);
+ }
+
+ float f2 = 0.25F;
++
+ if (this.isInWater()) {
+- for (int i1 = 0; i1 < 4; i1++) {
+- this.level()
+- .addParticle(
+- ParticleTypes.BUBBLE,
+- d - deltaMovement.x * 0.25,
+- d1 - deltaMovement.y * 0.25,
+- d2 - deltaMovement.z * 0.25,
+- deltaMovement.x,
+- deltaMovement.y,
+- deltaMovement.z
+- );
++ for (int j = 0; j < 4; ++j) {
++ this.level().addParticle(ParticleTypes.BUBBLE, d0 - vec3d.x * 0.25D, d1 - vec3d.y * 0.25D, d2 - vec3d.z * 0.25D, vec3d.x, vec3d.y, vec3d.z);
+ }
+ } else {
+- this.level()
+- .addParticle(
+- ParticleTypes.PORTAL,
+- d - deltaMovement.x * 0.25 + this.random.nextDouble() * 0.6 - 0.3,
+- d1 - deltaMovement.y * 0.25 - 0.5,
+- d2 - deltaMovement.z * 0.25 + this.random.nextDouble() * 0.6 - 0.3,
+- deltaMovement.x,
+- deltaMovement.y,
+- deltaMovement.z
+- );
++ this.level().addParticle(ParticleTypes.PORTAL, d0 - vec3d.x * 0.25D + this.random.nextDouble() * 0.6D - 0.3D, d1 - vec3d.y * 0.25D - 0.5D, d2 - vec3d.z * 0.25D + this.random.nextDouble() * 0.6D - 0.3D, vec3d.x, vec3d.y, vec3d.z);
+ }
+
+ if (!this.level().isClientSide) {
+- this.setPos(d, d1, d2);
+- this.life++;
++ this.setPos(d0, d1, d2);
++ ++this.life;
+ if (this.life > 80 && !this.level().isClientSide) {
+ this.playSound(SoundEvents.ENDER_EYE_DEATH, 1.0F, 1.0F);
+ this.discard();
+@@ -165,22 +158,26 @@
+ }
+ }
+ } else {
+- this.setPosRaw(d, d1, d2);
++ this.setPosRaw(d0, d1, d2);
+ }
++
+ }
+
+ @Override
+ public void addAdditionalSaveData(CompoundTag compound) {
+- ItemStack itemRaw = this.getItemRaw();
+- if (!itemRaw.isEmpty()) {
+- compound.put("Item", itemRaw.save(new CompoundTag()));
++ ItemStack itemstack = this.getItemRaw();
++
++ if (!itemstack.isEmpty()) {
++ compound.put("Item", itemstack.save(new CompoundTag()));
+ }
++
+ }
+
+ @Override
+ public void readAdditionalSaveData(CompoundTag compound) {
+- ItemStack itemStack = ItemStack.of(compound.getCompound("Item"));
+- this.setItem(itemStack);
++ ItemStack itemstack = ItemStack.of(compound.getCompound("Item"));
++
++ if (!itemstack.isEmpty()) this.setItem(itemstack); // CraftBukkit - SPIGOT-6103 summon, see also SPIGOT-5474
+ }
+
+ @Override