diff options
Diffstat (limited to 'patch-remap/mache-spigotflower/net/minecraft/world/entity/projectile/AbstractHurtingProjectile.java.patch')
-rw-r--r-- | patch-remap/mache-spigotflower/net/minecraft/world/entity/projectile/AbstractHurtingProjectile.java.patch | 269 |
1 files changed, 269 insertions, 0 deletions
diff --git a/patch-remap/mache-spigotflower/net/minecraft/world/entity/projectile/AbstractHurtingProjectile.java.patch b/patch-remap/mache-spigotflower/net/minecraft/world/entity/projectile/AbstractHurtingProjectile.java.patch new file mode 100644 index 0000000000..e2315535a2 --- /dev/null +++ b/patch-remap/mache-spigotflower/net/minecraft/world/entity/projectile/AbstractHurtingProjectile.java.patch @@ -0,0 +1,269 @@ +--- a/net/minecraft/world/entity/projectile/AbstractHurtingProjectile.java ++++ b/net/minecraft/world/entity/projectile/AbstractHurtingProjectile.java +@@ -16,26 +16,35 @@ + import net.minecraft.world.level.Level; + import net.minecraft.world.phys.HitResult; + import net.minecraft.world.phys.Vec3; ++import org.bukkit.craftbukkit.event.CraftEventFactory; // CraftBukkit + + public abstract class AbstractHurtingProjectile extends Projectile { + + public double xPower; + public double yPower; + public double zPower; ++ public float bukkitYield = 1; // CraftBukkit ++ public boolean isIncendiary = true; // CraftBukkit + +- protected AbstractHurtingProjectile(EntityType<? extends AbstractHurtingProjectile> entitytype, Level level) { +- super(entitytype, level); ++ protected AbstractHurtingProjectile(EntityType<? extends AbstractHurtingProjectile> entityType, Level level) { ++ super(entityType, level); + } + +- protected AbstractHurtingProjectile(EntityType<? extends AbstractHurtingProjectile> entitytype, double d0, double d1, double d2, Level level) { +- this(entitytype, level); ++ protected AbstractHurtingProjectile(EntityType<? extends AbstractHurtingProjectile> entitytypes, double d0, double d1, double d2, Level world) { ++ this(entitytypes, world); + this.setPos(d0, d1, d2); + } + +- public AbstractHurtingProjectile(EntityType<? extends AbstractHurtingProjectile> entitytype, double d0, double d1, double d2, double d3, double d4, double d5, Level level) { +- this(entitytype, level); +- this.moveTo(d0, d1, d2, this.getYRot(), this.getXRot()); ++ public AbstractHurtingProjectile(EntityType<? extends AbstractHurtingProjectile> entityType, double x, double d1, double y, double d3, double z, double d5, Level offsetX) { ++ this(entityType, offsetX); ++ this.moveTo(x, d1, y, this.getYRot(), this.getXRot()); + this.reapplyPosition(); ++ // CraftBukkit start - Added setDirection method ++ this.setDirection(d3, z, d5); ++ } ++ ++ public void setDirection(double d3, double d4, double d5) { ++ // CraftBukkit end + double d6 = Math.sqrt(d3 * d3 + d4 * d4 + d5 * d5); + + if (d6 != 0.0D) { +@@ -46,19 +55,17 @@ + + } + +- public AbstractHurtingProjectile(EntityType<? extends AbstractHurtingProjectile> entitytype, LivingEntity livingentity, double d0, double d1, double d2, Level level) { +- this(entitytype, livingentity.getX(), livingentity.getY(), livingentity.getZ(), d0, d1, d2, level); +- this.setOwner(livingentity); +- this.setRot(livingentity.getYRot(), livingentity.getXRot()); ++ public AbstractHurtingProjectile(EntityType<? extends AbstractHurtingProjectile> entityType, LivingEntity shooter, double offsetX, double d1, double offsetY, Level world) { ++ this(entityType, shooter.getX(), shooter.getY(), shooter.getZ(), offsetX, d1, offsetY, world); ++ this.setOwner(shooter); ++ this.setRot(shooter.getYRot(), shooter.getXRot()); + } + + @Override +- @Override + protected void defineSynchedData() {} + + @Override +- @Override +- public boolean shouldRenderAtSqrDistance(double d0) { ++ public boolean shouldRenderAtSqrDistance(double distance) { + double d1 = this.getBoundingBox().getSize() * 4.0D; + + if (Double.isNaN(d1)) { +@@ -66,7 +73,7 @@ + } + + d1 *= 64.0D; +- return d0 < d1 * d1; ++ return distance < d1 * d1; + } + + protected ClipContext.Block getClipType() { +@@ -74,7 +81,6 @@ + } + + @Override +- @Override + public void tick() { + Entity entity = this.getOwner(); + +@@ -86,17 +92,23 @@ + this.setSecondsOnFire(1); + } + +- HitResult hitresult = ProjectileUtil.getHitResultOnMoveVector(this, this::canHitEntity, this.getClipType()); ++ HitResult movingobjectposition = ProjectileUtil.getHitResultOnMoveVector(this, this::canHitEntity, this.getClipType()); + +- if (hitresult.getType() != HitResult.Type.MISS) { +- this.onHit(hitresult); ++ if (movingobjectposition.getType() != HitResult.EnumMovingObjectType.MISS) { ++ this.preOnHit(movingobjectposition); // CraftBukkit - projectile hit event ++ ++ // CraftBukkit start - Fire ProjectileHitEvent ++ if (this.isRemoved()) { ++ CraftEventFactory.callProjectileHitEvent(this, movingobjectposition); ++ } ++ // CraftBukkit end + } + + this.checkInsideBlocks(); +- Vec3 vec3 = this.getDeltaMovement(); +- double d0 = this.getX() + vec3.x; +- double d1 = this.getY() + vec3.y; +- double d2 = this.getZ() + vec3.z; ++ Vec3 vec3d = this.getDeltaMovement(); ++ double d0 = this.getX() + vec3d.x; ++ double d1 = this.getY() + vec3d.y; ++ double d2 = this.getZ() + vec3d.z; + + ProjectileUtil.rotateTowardsMovement(this, 0.2F); + float f; +@@ -105,7 +117,7 @@ + for (int i = 0; i < 4; ++i) { + float f1 = 0.25F; + +- this.level().addParticle(ParticleTypes.BUBBLE, d0 - vec3.x * 0.25D, d1 - vec3.y * 0.25D, d2 - vec3.z * 0.25D, vec3.x, vec3.y, vec3.z); ++ 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); + } + + f = this.getLiquidInertia(); +@@ -113,11 +125,11 @@ + f = this.getInertia(); + } + +- this.setDeltaMovement(vec3.add(this.xPower, this.yPower, this.zPower).scale((double) f)); +- ParticleOptions particleoptions = this.getTrailParticle(); ++ this.setDeltaMovement(vec3d.add(this.xPower, this.yPower, this.zPower).scale((double) f)); ++ ParticleOptions particleparam = this.getTrailParticle(); + +- if (particleoptions != null) { +- this.level().addParticle(particleoptions, d0, d1 + 0.5D, d2, 0.0D, 0.0D, 0.0D); ++ if (particleparam != null) { ++ this.level().addParticle(particleparam, d0, d1 + 0.5D, d2, 0.0D, 0.0D, 0.0D); + } + + this.setPos(d0, d1, d2); +@@ -125,9 +137,8 @@ + } + + @Override +- @Override +- protected boolean canHitEntity(Entity entity) { +- return super.canHitEntity(entity) && !entity.noPhysics; ++ protected boolean canHitEntity(Entity target) { ++ return super.canHitEntity(target) && !target.noPhysics; + } + + protected boolean shouldBurn() { +@@ -148,57 +159,57 @@ + } + + @Override +- @Override +- public void addAdditionalSaveData(CompoundTag compoundtag) { +- super.addAdditionalSaveData(compoundtag); +- compoundtag.put("power", this.newDoubleList(new double[]{this.xPower, this.yPower, this.zPower})); ++ public void addAdditionalSaveData(CompoundTag compound) { ++ super.addAdditionalSaveData(compound); ++ compound.put("power", this.newDoubleList(new double[]{this.xPower, this.yPower, this.zPower})); + } + + @Override +- @Override +- public void readAdditionalSaveData(CompoundTag compoundtag) { +- super.readAdditionalSaveData(compoundtag); +- if (compoundtag.contains("power", 9)) { +- ListTag listtag = compoundtag.getList("power", 6); ++ public void readAdditionalSaveData(CompoundTag compound) { ++ super.readAdditionalSaveData(compound); ++ if (compound.contains("power", 9)) { ++ ListTag nbttaglist = compound.getList("power", 6); + +- if (listtag.size() == 3) { +- this.xPower = listtag.getDouble(0); +- this.yPower = listtag.getDouble(1); +- this.zPower = listtag.getDouble(2); ++ if (nbttaglist.size() == 3) { ++ this.xPower = nbttaglist.getDouble(0); ++ this.yPower = nbttaglist.getDouble(1); ++ this.zPower = nbttaglist.getDouble(2); + } + } + + } + + @Override +- @Override + public boolean isPickable() { + return true; + } + + @Override +- @Override + public float getPickRadius() { + return 1.0F; + } + + @Override +- @Override +- public boolean hurt(DamageSource damagesource, float f) { +- if (this.isInvulnerableTo(damagesource)) { ++ public boolean hurt(DamageSource source, float amount) { ++ if (this.isInvulnerableTo(source)) { + return false; + } else { + this.markHurt(); +- Entity entity = damagesource.getEntity(); ++ Entity entity = source.getEntity(); + + if (entity != null) { + if (!this.level().isClientSide) { +- Vec3 vec3 = entity.getLookAngle(); ++ // CraftBukkit start ++ if (CraftEventFactory.handleNonLivingEntityDamageEvent(this, source, amount, false)) { ++ return false; ++ } ++ // CraftBukkit end ++ Vec3 vec3d = entity.getLookAngle(); + +- this.setDeltaMovement(vec3); +- this.xPower = vec3.x * 0.1D; +- this.yPower = vec3.y * 0.1D; +- this.zPower = vec3.z * 0.1D; ++ this.setDeltaMovement(vec3d); ++ this.xPower = vec3d.x * 0.1D; ++ this.yPower = vec3d.y * 0.1D; ++ this.zPower = vec3d.z * 0.1D; + this.setOwner(entity); + } + +@@ -210,13 +221,11 @@ + } + + @Override +- @Override + public float getLightLevelDependentMagicValue() { + return 1.0F; + } + + @Override +- @Override + public Packet<ClientGamePacketListener> getAddEntityPacket() { + Entity entity = this.getOwner(); + int i = entity == null ? 0 : entity.getId(); +@@ -225,12 +234,11 @@ + } + + @Override +- @Override +- public void recreateFromPacket(ClientboundAddEntityPacket clientboundaddentitypacket) { +- super.recreateFromPacket(clientboundaddentitypacket); +- double d0 = clientboundaddentitypacket.getXa(); +- double d1 = clientboundaddentitypacket.getYa(); +- double d2 = clientboundaddentitypacket.getZa(); ++ public void recreateFromPacket(ClientboundAddEntityPacket packet) { ++ super.recreateFromPacket(packet); ++ double d0 = packet.getXa(); ++ double d1 = packet.getYa(); ++ double d2 = packet.getZa(); + double d3 = Math.sqrt(d0 * d0 + d1 * d1 + d2 * d2); + + if (d3 != 0.0D) { |