aboutsummaryrefslogtreecommitdiffhomepage
path: root/patch-remap/mache-spigotflower/net/minecraft/world/entity/monster/Ravager.java.patch
diff options
context:
space:
mode:
Diffstat (limited to 'patch-remap/mache-spigotflower/net/minecraft/world/entity/monster/Ravager.java.patch')
-rw-r--r--patch-remap/mache-spigotflower/net/minecraft/world/entity/monster/Ravager.java.patch306
1 files changed, 306 insertions, 0 deletions
diff --git a/patch-remap/mache-spigotflower/net/minecraft/world/entity/monster/Ravager.java.patch b/patch-remap/mache-spigotflower/net/minecraft/world/entity/monster/Ravager.java.patch
new file mode 100644
index 0000000000..02751015fc
--- /dev/null
+++ b/patch-remap/mache-spigotflower/net/minecraft/world/entity/monster/Ravager.java.patch
@@ -0,0 +1,306 @@
+--- a/net/minecraft/world/entity/monster/Ravager.java
++++ b/net/minecraft/world/entity/monster/Ravager.java
+@@ -36,13 +36,17 @@
+ import net.minecraft.world.level.LevelReader;
+ import net.minecraft.world.level.block.Block;
+ import net.minecraft.world.level.block.LeavesBlock;
+-import net.minecraft.world.level.block.state.BlockState;
++import net.minecraft.world.level.block.state.IBlockData;
+ import net.minecraft.world.level.gameevent.GameEvent;
+ import net.minecraft.world.level.pathfinder.BlockPathTypes;
+ import net.minecraft.world.phys.AABB;
+ import net.minecraft.world.phys.Vec3;
+ import org.joml.Vector3f;
+
++// CraftBukkit start
++import org.bukkit.craftbukkit.event.CraftEventFactory;
++// CraftBukkit end
++
+ public class Ravager extends Raider {
+
+ private static final Predicate<Entity> NO_RAVAGER_AND_ALIVE = (entity) -> {
+@@ -60,15 +64,14 @@
+ private int stunnedTick;
+ private int roarTick;
+
+- public Ravager(EntityType<? extends Ravager> entitytype, Level level) {
+- super(entitytype, level);
++ public Ravager(EntityType<? extends Ravager> entityType, Level level) {
++ super(entityType, level);
+ this.setMaxUpStep(1.0F);
+ this.xpReward = 20;
+ this.setPathfindingMalus(BlockPathTypes.LEAVES, 0.0F);
+ }
+
+ @Override
+- @Override
+ protected void registerGoals() {
+ super.registerGoals();
+ this.goalSelector.addGoal(0, new FloatGoal(this));
+@@ -78,22 +81,21 @@
+ this.goalSelector.addGoal(10, new LookAtPlayerGoal(this, Mob.class, 8.0F));
+ this.targetSelector.addGoal(2, (new HurtByTargetGoal(this, new Class[]{Raider.class})).setAlertOthers());
+ this.targetSelector.addGoal(3, new NearestAttackableTargetGoal<>(this, Player.class, true));
+- this.targetSelector.addGoal(4, new NearestAttackableTargetGoal<>(this, AbstractVillager.class, true, (livingentity) -> {
+- return !livingentity.isBaby();
++ this.targetSelector.addGoal(4, new NearestAttackableTargetGoal<>(this, AbstractVillager.class, true, (entityliving) -> {
++ return !entityliving.isBaby();
+ }));
+ this.targetSelector.addGoal(4, new NearestAttackableTargetGoal<>(this, IronGolem.class, true));
+ }
+
+ @Override
+- @Override
+ protected void updateControlFlags() {
+ boolean flag = !(this.getControllingPassenger() instanceof Mob) || this.getControllingPassenger().getType().is(EntityTypeTags.RAIDERS);
+ boolean flag1 = !(this.getVehicle() instanceof Boat);
+
+- this.goalSelector.setControlFlag(Goal.Flag.MOVE, flag);
+- this.goalSelector.setControlFlag(Goal.Flag.JUMP, flag && flag1);
+- this.goalSelector.setControlFlag(Goal.Flag.LOOK, flag);
+- this.goalSelector.setControlFlag(Goal.Flag.TARGET, flag);
++ this.goalSelector.setControlFlag(Goal.Type.MOVE, flag);
++ this.goalSelector.setControlFlag(Goal.Type.JUMP, flag && flag1);
++ this.goalSelector.setControlFlag(Goal.Type.LOOK, flag);
++ this.goalSelector.setControlFlag(Goal.Type.TARGET, flag);
+ }
+
+ public static AttributeSupplier.Builder createAttributes() {
+@@ -101,43 +103,37 @@
+ }
+
+ @Override
+- @Override
+- public void addAdditionalSaveData(CompoundTag compoundtag) {
+- super.addAdditionalSaveData(compoundtag);
+- compoundtag.putInt("AttackTick", this.attackTick);
+- compoundtag.putInt("StunTick", this.stunnedTick);
+- compoundtag.putInt("RoarTick", this.roarTick);
++ public void addAdditionalSaveData(CompoundTag compound) {
++ super.addAdditionalSaveData(compound);
++ compound.putInt("AttackTick", this.attackTick);
++ compound.putInt("StunTick", this.stunnedTick);
++ compound.putInt("RoarTick", this.roarTick);
+ }
+
+ @Override
+- @Override
+- public void readAdditionalSaveData(CompoundTag compoundtag) {
+- super.readAdditionalSaveData(compoundtag);
+- this.attackTick = compoundtag.getInt("AttackTick");
+- this.stunnedTick = compoundtag.getInt("StunTick");
+- this.roarTick = compoundtag.getInt("RoarTick");
++ public void readAdditionalSaveData(CompoundTag compound) {
++ super.readAdditionalSaveData(compound);
++ this.attackTick = compound.getInt("AttackTick");
++ this.stunnedTick = compound.getInt("StunTick");
++ this.roarTick = compound.getInt("RoarTick");
+ }
+
+ @Override
+- @Override
+ public SoundEvent getCelebrateSound() {
+ return SoundEvents.RAVAGER_CELEBRATE;
+ }
+
+ @Override
+- @Override
+ public int getMaxHeadYRot() {
+ return 45;
+ }
+
+ @Override
+- @Override
+- protected Vector3f getPassengerAttachmentPoint(Entity entity, EntityDimensions entitydimensions, float f) {
+- return new Vector3f(0.0F, entitydimensions.height + 0.0625F * f, -0.0625F * f);
++ protected Vector3f getPassengerAttachmentPoint(Entity entity, EntityDimensions entitysize, float f) {
++ return new Vector3f(0.0F, entitysize.height + 0.0625F * f, -0.0625F * f);
+ }
+
+ @Override
+- @Override
+ public void aiStep() {
+ super.aiStep();
+ if (this.isAlive()) {
+@@ -152,16 +148,21 @@
+
+ if (this.horizontalCollision && this.level().getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING)) {
+ boolean flag = false;
+- AABB aabb = this.getBoundingBox().inflate(0.2D);
+- Iterator iterator = BlockPos.betweenClosed(Mth.floor(aabb.minX), Mth.floor(aabb.minY), Mth.floor(aabb.minZ), Mth.floor(aabb.maxX), Mth.floor(aabb.maxY), Mth.floor(aabb.maxZ)).iterator();
++ AABB axisalignedbb = this.getBoundingBox().inflate(0.2D);
++ Iterator iterator = BlockPos.betweenClosed(Mth.floor(axisalignedbb.minX), Mth.floor(axisalignedbb.minY), Mth.floor(axisalignedbb.minZ), Mth.floor(axisalignedbb.maxX), Mth.floor(axisalignedbb.maxY), Mth.floor(axisalignedbb.maxZ)).iterator();
+
+ while (iterator.hasNext()) {
+- BlockPos blockpos = (BlockPos) iterator.next();
+- BlockState blockstate = this.level().getBlockState(blockpos);
+- Block block = blockstate.getBlock();
++ BlockPos blockposition = (BlockPos) iterator.next();
++ IBlockData iblockdata = this.level().getBlockState(blockposition);
++ Block block = iblockdata.getBlock();
+
+ if (block instanceof LeavesBlock) {
+- flag = this.level().destroyBlock(blockpos, true, this) || flag;
++ // CraftBukkit start
++ if (!CraftEventFactory.callEntityChangeBlockEvent(this, blockposition, net.minecraft.world.level.block.Blocks.AIR.defaultBlockState())) {
++ continue;
++ }
++ // CraftBukkit end
++ flag = this.level().destroyBlock(blockposition, true, this) || flag;
+ }
+ }
+
+@@ -205,31 +206,28 @@
+ }
+
+ @Override
+- @Override
+ protected boolean isImmobile() {
+ return super.isImmobile() || this.attackTick > 0 || this.stunnedTick > 0 || this.roarTick > 0;
+ }
+
+ @Override
+- @Override
+ public boolean hasLineOfSight(Entity entity) {
+ return this.stunnedTick <= 0 && this.roarTick <= 0 ? super.hasLineOfSight(entity) : false;
+ }
+
+ @Override
+- @Override
+- protected void blockedByShield(LivingEntity livingentity) {
++ protected void blockedByShield(LivingEntity entity) {
+ if (this.roarTick == 0) {
+ if (this.random.nextDouble() < 0.5D) {
+ this.stunnedTick = 40;
+ this.playSound(SoundEvents.RAVAGER_STUNNED, 1.0F, 1.0F);
+ this.level().broadcastEntityEvent(this, (byte) 39);
+- livingentity.push(this);
++ entity.push(this);
+ } else {
+- this.strongKnockback(livingentity);
++ this.strongKnockback(entity);
+ }
+
+- livingentity.hurtMarked = true;
++ entity.hurtMarked = true;
+ }
+
+ }
+@@ -238,23 +236,23 @@
+ if (this.isAlive()) {
+ List<? extends LivingEntity> list = this.level().getEntitiesOfClass(LivingEntity.class, this.getBoundingBox().inflate(4.0D), Ravager.NO_RAVAGER_AND_ALIVE);
+
+- LivingEntity livingentity;
++ LivingEntity entityliving;
+
+- for (Iterator iterator = list.iterator(); iterator.hasNext(); this.strongKnockback(livingentity)) {
+- livingentity = (LivingEntity) iterator.next();
+- if (!(livingentity instanceof AbstractIllager)) {
+- livingentity.hurt(this.damageSources().mobAttack(this), 6.0F);
++ for (Iterator iterator = list.iterator(); iterator.hasNext(); this.strongKnockback(entityliving)) {
++ entityliving = (LivingEntity) iterator.next();
++ if (!(entityliving instanceof AbstractIllager)) {
++ entityliving.hurt(this.damageSources().mobAttack(this), 6.0F);
+ }
+ }
+
+- Vec3 vec3 = this.getBoundingBox().getCenter();
++ Vec3 vec3d = this.getBoundingBox().getCenter();
+
+ for (int i = 0; i < 40; ++i) {
+ double d0 = this.random.nextGaussian() * 0.2D;
+ double d1 = this.random.nextGaussian() * 0.2D;
+ double d2 = this.random.nextGaussian() * 0.2D;
+
+- this.level().addParticle(ParticleTypes.POOF, vec3.x, vec3.y, vec3.z, d0, d1, d2);
++ this.level().addParticle(ParticleTypes.POOF, vec3d.x, vec3d.y, vec3d.z, d0, d1, d2);
+ }
+
+ this.gameEvent(GameEvent.ENTITY_ACTION);
+@@ -271,16 +269,15 @@
+ }
+
+ @Override
+- @Override
+- public void handleEntityEvent(byte b0) {
+- if (b0 == 4) {
++ public void handleEntityEvent(byte id) {
++ if (id == 4) {
+ this.attackTick = 10;
+ this.playSound(SoundEvents.RAVAGER_ATTACK, 1.0F, 1.0F);
+- } else if (b0 == 39) {
++ } else if (id == 39) {
+ this.stunnedTick = 40;
+ }
+
+- super.handleEntityEvent(b0);
++ super.handleEntityEvent(id);
+ }
+
+ public int getAttackTick() {
+@@ -296,7 +293,6 @@
+ }
+
+ @Override
+- @Override
+ public boolean doHurtTarget(Entity entity) {
+ this.attackTick = 10;
+ this.level().broadcastEntityEvent(this, (byte) 4);
+@@ -306,50 +302,42 @@
+
+ @Nullable
+ @Override
+- @Override
+ protected SoundEvent getAmbientSound() {
+ return SoundEvents.RAVAGER_AMBIENT;
+ }
+
+ @Override
+- @Override
+- protected SoundEvent getHurtSound(DamageSource damagesource) {
++ protected SoundEvent getHurtSound(DamageSource damageSource) {
+ return SoundEvents.RAVAGER_HURT;
+ }
+
+ @Override
+- @Override
+ protected SoundEvent getDeathSound() {
+ return SoundEvents.RAVAGER_DEATH;
+ }
+
+ @Override
+- @Override
+- protected void playStepSound(BlockPos blockpos, BlockState blockstate) {
++ protected void playStepSound(BlockPos pos, IBlockData block) {
+ this.playSound(SoundEvents.RAVAGER_STEP, 0.15F, 1.0F);
+ }
+
+ @Override
+- @Override
+- public boolean checkSpawnObstruction(LevelReader levelreader) {
+- return !levelreader.containsAnyLiquid(this.getBoundingBox());
++ public boolean checkSpawnObstruction(LevelReader level) {
++ return !level.containsAnyLiquid(this.getBoundingBox());
+ }
+
+ @Override
+- @Override
+- public void applyRaidBuffs(int i, boolean flag) {}
++ public void applyRaidBuffs(int wave, boolean unusedFalse) {}
+
+ @Override
+- @Override
+ public boolean canBeLeader() {
+ return false;
+ }
+
+ @Override
+- @Override
+ protected AABB getAttackBoundingBox() {
+- AABB aabb = super.getAttackBoundingBox();
++ AABB axisalignedbb = super.getAttackBoundingBox();
+
+- return aabb.deflate(0.05D, 0.0D, 0.05D);
++ return axisalignedbb.deflate(0.05D, 0.0D, 0.05D);
+ }
+ }