diff options
Diffstat (limited to 'patch-remap/mache-vineflower/net/minecraft/world/entity/projectile/LlamaSpit.java.patch')
-rw-r--r-- | patch-remap/mache-vineflower/net/minecraft/world/entity/projectile/LlamaSpit.java.patch | 119 |
1 files changed, 119 insertions, 0 deletions
diff --git a/patch-remap/mache-vineflower/net/minecraft/world/entity/projectile/LlamaSpit.java.patch b/patch-remap/mache-vineflower/net/minecraft/world/entity/projectile/LlamaSpit.java.patch new file mode 100644 index 0000000000..ab781fd084 --- /dev/null +++ b/patch-remap/mache-vineflower/net/minecraft/world/entity/projectile/LlamaSpit.java.patch @@ -0,0 +1,119 @@ +--- a/net/minecraft/world/entity/projectile/LlamaSpit.java ++++ b/net/minecraft/world/entity/projectile/LlamaSpit.java +@@ -3,6 +3,7 @@ + import net.minecraft.core.particles.ParticleTypes; + import net.minecraft.network.protocol.game.ClientboundAddEntityPacket; + import net.minecraft.util.Mth; ++import net.minecraft.world.entity.Entity; + import net.minecraft.world.entity.EntityType; + import net.minecraft.world.entity.LivingEntity; + import net.minecraft.world.entity.animal.horse.Llama; +@@ -14,6 +15,7 @@ + import net.minecraft.world.phys.Vec3; + + public class LlamaSpit extends Projectile { ++ + public LlamaSpit(EntityType<? extends LlamaSpit> entityType, Level level) { + super(entityType, level); + } +@@ -21,45 +23,49 @@ + public LlamaSpit(Level level, Llama spitter) { + this(EntityType.LLAMA_SPIT, level); + this.setOwner(spitter); +- this.setPos( +- spitter.getX() - (double)(spitter.getBbWidth() + 1.0F) * 0.5 * (double)Mth.sin(spitter.yBodyRot * (float) (Math.PI / 180.0)), +- spitter.getEyeY() - 0.1F, +- spitter.getZ() + (double)(spitter.getBbWidth() + 1.0F) * 0.5 * (double)Mth.cos(spitter.yBodyRot * (float) (Math.PI / 180.0)) +- ); ++ this.setPos(spitter.getX() - (double) (spitter.getBbWidth() + 1.0F) * 0.5D * (double) Mth.sin(spitter.yBodyRot * 0.017453292F), spitter.getEyeY() - 0.10000000149011612D, spitter.getZ() + (double) (spitter.getBbWidth() + 1.0F) * 0.5D * (double) Mth.cos(spitter.yBodyRot * 0.017453292F)); + } + + @Override + public void tick() { + super.tick(); +- Vec3 deltaMovement = this.getDeltaMovement(); +- HitResult hitResultOnMoveVector = ProjectileUtil.getHitResultOnMoveVector(this, this::canHitEntity); +- this.onHit(hitResultOnMoveVector); +- double d = this.getX() + deltaMovement.x; +- double d1 = this.getY() + deltaMovement.y; +- double d2 = this.getZ() + deltaMovement.z; ++ Vec3 vec3d = this.getDeltaMovement(); ++ HitResult movingobjectposition = ProjectileUtil.getHitResultOnMoveVector(this, this::canHitEntity); ++ ++ this.preOnHit(movingobjectposition); // CraftBukkit - projectile hit event ++ double d0 = this.getX() + vec3d.x; ++ double d1 = this.getY() + vec3d.y; ++ double d2 = this.getZ() + vec3d.z; ++ + this.updateRotation(); + float f = 0.99F; + float f1 = 0.06F; ++ + if (this.level().getBlockStates(this.getBoundingBox()).noneMatch(BlockBehaviour.BlockStateBase::isAir)) { + this.discard(); + } else if (this.isInWaterOrBubble()) { + this.discard(); + } else { +- this.setDeltaMovement(deltaMovement.scale(0.99F)); ++ this.setDeltaMovement(vec3d.scale(0.9900000095367432D)); + if (!this.isNoGravity()) { +- this.setDeltaMovement(this.getDeltaMovement().add(0.0, -0.06F, 0.0)); ++ this.setDeltaMovement(this.getDeltaMovement().add(0.0D, -0.05999999865889549D, 0.0D)); + } + +- this.setPos(d, d1, d2); ++ this.setPos(d0, d1, d2); + } + } + + @Override + protected void onHitEntity(EntityHitResult result) { + super.onHitEntity(result); +- if (this.getOwner() instanceof LivingEntity livingEntity) { +- result.getEntity().hurt(this.damageSources().mobProjectile(this, livingEntity), 1.0F); ++ Entity entity = this.getOwner(); ++ ++ if (entity instanceof LivingEntity) { ++ LivingEntity entityliving = (LivingEntity) entity; ++ ++ result.getEntity().hurt(this.damageSources().mobProjectile(this, entityliving), 1.0F); + } ++ + } + + @Override +@@ -68,24 +74,25 @@ + if (!this.level().isClientSide) { + this.discard(); + } ++ + } + + @Override +- protected void defineSynchedData() { +- } ++ protected void defineSynchedData() {} + + @Override + public void recreateFromPacket(ClientboundAddEntityPacket packet) { + super.recreateFromPacket(packet); +- double xa = packet.getXa(); +- double ya = packet.getYa(); +- double za = packet.getZa(); ++ double d0 = packet.getXa(); ++ double d1 = packet.getYa(); ++ double d2 = packet.getZa(); + +- for (int i = 0; i < 7; i++) { +- double d = 0.4 + 0.1 * (double)i; +- this.level().addParticle(ParticleTypes.SPIT, this.getX(), this.getY(), this.getZ(), xa * d, ya, za * d); ++ for (int i = 0; i < 7; ++i) { ++ double d3 = 0.4D + 0.1D * (double) i; ++ ++ this.level().addParticle(ParticleTypes.SPIT, this.getX(), this.getY(), this.getZ(), d0 * d3, d1, d2 * d3); + } + +- this.setDeltaMovement(xa, ya, za); ++ this.setDeltaMovement(d0, d1, d2); + } + } |