aboutsummaryrefslogtreecommitdiffhomepage
path: root/patch-remap/mache-vineflower/net/minecraft/world/entity/monster/Ravager.java.patch
diff options
context:
space:
mode:
Diffstat (limited to 'patch-remap/mache-vineflower/net/minecraft/world/entity/monster/Ravager.java.patch')
-rw-r--r--patch-remap/mache-vineflower/net/minecraft/world/entity/monster/Ravager.java.patch313
1 files changed, 313 insertions, 0 deletions
diff --git a/patch-remap/mache-vineflower/net/minecraft/world/entity/monster/Ravager.java.patch b/patch-remap/mache-vineflower/net/minecraft/world/entity/monster/Ravager.java.patch
new file mode 100644
index 0000000000..2819d9219e
--- /dev/null
+++ b/patch-remap/mache-vineflower/net/minecraft/world/entity/monster/Ravager.java.patch
@@ -0,0 +1,313 @@
+--- a/net/minecraft/world/entity/monster/Ravager.java
++++ b/net/minecraft/world/entity/monster/Ravager.java
+@@ -1,5 +1,7 @@
+ package net.minecraft.world.entity.monster;
+
++import java.util.Iterator;
++import java.util.List;
+ import java.util.function.Predicate;
+ import javax.annotation.Nullable;
+ import net.minecraft.core.BlockPos;
+@@ -34,21 +36,28 @@
+ 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 -> entity.isAlive() && !(entity instanceof Ravager);
+- private static final double BASE_MOVEMENT_SPEED = 0.3;
+- private static final double ATTACK_MOVEMENT_SPEED = 0.35;
++
++ private static final Predicate<Entity> NO_RAVAGER_AND_ALIVE = (entity) -> {
++ return entity.isAlive() && !(entity instanceof Ravager);
++ };
++ private static final double BASE_MOVEMENT_SPEED = 0.3D;
++ private static final double ATTACK_MOVEMENT_SPEED = 0.35D;
+ private static final int STUNNED_COLOR = 8356754;
+- private static final double STUNNED_COLOR_BLUE = 0.5725490196078431;
+- private static final double STUNNED_COLOR_GREEN = 0.5137254901960784;
+- private static final double STUNNED_COLOR_RED = 0.4980392156862745;
++ private static final double STUNNED_COLOR_BLUE = 0.5725490196078431D;
++ private static final double STUNNED_COLOR_GREEN = 0.5137254901960784D;
++ private static final double STUNNED_COLOR_RED = 0.4980392156862745D;
+ private static final int ATTACK_DURATION = 10;
+ public static final int STUN_DURATION = 40;
+ private int attackTick;
+@@ -66,13 +75,15 @@
+ protected void registerGoals() {
+ super.registerGoals();
+ this.goalSelector.addGoal(0, new FloatGoal(this));
+- this.goalSelector.addGoal(4, new MeleeAttackGoal(this, 1.0, true));
+- this.goalSelector.addGoal(5, new WaterAvoidingRandomStrollGoal(this, 0.4));
++ this.goalSelector.addGoal(4, new MeleeAttackGoal(this, 1.0D, true));
++ this.goalSelector.addGoal(5, new WaterAvoidingRandomStrollGoal(this, 0.4D));
+ this.goalSelector.addGoal(6, new LookAtPlayerGoal(this, Player.class, 6.0F));
+ this.goalSelector.addGoal(10, new LookAtPlayerGoal(this, Mob.class, 8.0F));
+- this.targetSelector.addGoal(2, new HurtByTargetGoal(this, Raider.class).setAlertOthers());
++ 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, entity -> !entity.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));
+ }
+
+@@ -80,20 +91,15 @@
+ 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() {
+- return Monster.createMonsterAttributes()
+- .add(Attributes.MAX_HEALTH, 100.0)
+- .add(Attributes.MOVEMENT_SPEED, 0.3)
+- .add(Attributes.KNOCKBACK_RESISTANCE, 0.75)
+- .add(Attributes.ATTACK_DAMAGE, 12.0)
+- .add(Attributes.ATTACK_KNOCKBACK, 1.5)
+- .add(Attributes.FOLLOW_RANGE, 32.0);
++ return Monster.createMonsterAttributes().add(Attributes.MAX_HEALTH, 100.0D).add(Attributes.MOVEMENT_SPEED, 0.3D).add(Attributes.KNOCKBACK_RESISTANCE, 0.75D).add(Attributes.ATTACK_DAMAGE, 12.0D).add(Attributes.ATTACK_KNOCKBACK, 1.5D).add(Attributes.FOLLOW_RANGE, 32.0D);
+ }
+
+ @Override
+@@ -123,8 +129,8 @@
+ }
+
+ @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
+@@ -132,24 +138,31 @@
+ super.aiStep();
+ if (this.isAlive()) {
+ if (this.isImmobile()) {
+- this.getAttribute(Attributes.MOVEMENT_SPEED).setBaseValue(0.0);
++ this.getAttribute(Attributes.MOVEMENT_SPEED).setBaseValue(0.0D);
+ } else {
+- double d = this.getTarget() != null ? 0.35 : 0.3;
+- double baseValue = this.getAttribute(Attributes.MOVEMENT_SPEED).getBaseValue();
+- this.getAttribute(Attributes.MOVEMENT_SPEED).setBaseValue(Mth.lerp(0.1, baseValue, d));
++ double d0 = this.getTarget() != null ? 0.35D : 0.3D;
++ double d1 = this.getAttribute(Attributes.MOVEMENT_SPEED).getBaseValue();
++
++ this.getAttribute(Attributes.MOVEMENT_SPEED).setBaseValue(Mth.lerp(0.1D, d1, d0));
+ }
+
+ if (this.horizontalCollision && this.level().getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING)) {
+ boolean flag = false;
+- AABB aABB = this.getBoundingBox().inflate(0.2);
++ 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();
+
+- for (BlockPos blockPos : 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)
+- )) {
+- BlockState blockState = this.level().getBlockState(blockPos);
+- Block block = blockState.getBlock();
++ while (iterator.hasNext()) {
++ 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;
+ }
+ }
+
+@@ -159,38 +172,37 @@
+ }
+
+ if (this.roarTick > 0) {
+- this.roarTick--;
++ --this.roarTick;
+ if (this.roarTick == 10) {
+ this.roar();
+ }
+ }
+
+ if (this.attackTick > 0) {
+- this.attackTick--;
++ --this.attackTick;
+ }
+
+ if (this.stunnedTick > 0) {
+- this.stunnedTick--;
++ --this.stunnedTick;
+ this.stunEffect();
+ if (this.stunnedTick == 0) {
+ this.playSound(SoundEvents.RAVAGER_ROAR, 1.0F, 1.0F);
+ this.roarTick = 20;
+ }
+ }
++
+ }
+ }
+
+ private void stunEffect() {
+ if (this.random.nextInt(6) == 0) {
+- double d = this.getX()
+- - (double)this.getBbWidth() * Math.sin((double)(this.yBodyRot * (float) (Math.PI / 180.0)))
+- + (this.random.nextDouble() * 0.6 - 0.3);
+- double d1 = this.getY() + (double)this.getBbHeight() - 0.3;
+- double d2 = this.getZ()
+- + (double)this.getBbWidth() * Math.cos((double)(this.yBodyRot * (float) (Math.PI / 180.0)))
+- + (this.random.nextDouble() * 0.6 - 0.3);
+- this.level().addParticle(ParticleTypes.ENTITY_EFFECT, d, d1, d2, 0.4980392156862745, 0.5137254901960784, 0.5725490196078431);
++ double d0 = this.getX() - (double) this.getBbWidth() * Math.sin((double) (this.yBodyRot * 0.017453292F)) + (this.random.nextDouble() * 0.6D - 0.3D);
++ double d1 = this.getY() + (double) this.getBbHeight() - 0.3D;
++ double d2 = this.getZ() + (double) this.getBbWidth() * Math.cos((double) (this.yBodyRot * 0.017453292F)) + (this.random.nextDouble() * 0.6D - 0.3D);
++
++ this.level().addParticle(ParticleTypes.ENTITY_EFFECT, d0, d1, d2, 0.4980392156862745D, 0.5137254901960784D, 0.5725490196078431D);
+ }
++
+ }
+
+ @Override
+@@ -200,16 +212,16 @@
+
+ @Override
+ public boolean hasLineOfSight(Entity entity) {
+- return this.stunnedTick <= 0 && this.roarTick <= 0 && super.hasLineOfSight(entity);
++ return this.stunnedTick <= 0 && this.roarTick <= 0 ? super.hasLineOfSight(entity) : false;
+ }
+
+ @Override
+ protected void blockedByShield(LivingEntity entity) {
+ if (this.roarTick == 0) {
+- if (this.random.nextDouble() < 0.5) {
++ if (this.random.nextDouble() < 0.5D) {
+ this.stunnedTick = 40;
+ this.playSound(SoundEvents.RAVAGER_STUNNED, 1.0F, 1.0F);
+- this.level().broadcastEntityEvent(this, (byte)39);
++ this.level().broadcastEntityEvent(this, (byte) 39);
+ entity.push(this);
+ } else {
+ this.strongKnockback(entity);
+@@ -217,36 +229,43 @@
+
+ entity.hurtMarked = true;
+ }
++
+ }
+
+ private void roar() {
+ if (this.isAlive()) {
+- for (LivingEntity livingEntity : this.level().getEntitiesOfClass(LivingEntity.class, this.getBoundingBox().inflate(4.0), NO_RAVAGER_AND_ALIVE)) {
+- if (!(livingEntity instanceof AbstractIllager)) {
+- livingEntity.hurt(this.damageSources().mobAttack(this), 6.0F);
+- }
++ List<? extends LivingEntity> list = this.level().getEntitiesOfClass(LivingEntity.class, this.getBoundingBox().inflate(4.0D), Ravager.NO_RAVAGER_AND_ALIVE);
+
+- this.strongKnockback(livingEntity);
++ LivingEntity entityliving;
++
++ 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 center = this.getBoundingBox().getCenter();
++ Vec3 vec3d = this.getBoundingBox().getCenter();
+
+- for (int i = 0; i < 40; i++) {
+- double d = this.random.nextGaussian() * 0.2;
+- double d1 = this.random.nextGaussian() * 0.2;
+- double d2 = this.random.nextGaussian() * 0.2;
+- this.level().addParticle(ParticleTypes.POOF, center.x, center.y, center.z, d, d1, d2);
++ 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, vec3d.x, vec3d.y, vec3d.z, d0, d1, d2);
+ }
+
+ this.gameEvent(GameEvent.ENTITY_ACTION);
+ }
++
+ }
+
+ private void strongKnockback(Entity entity) {
+- double d = entity.getX() - this.getX();
++ double d0 = entity.getX() - this.getX();
+ double d1 = entity.getZ() - this.getZ();
+- double max = Math.max(d * d + d1 * d1, 0.001);
+- entity.push(d / max * 4.0, 0.2, d1 / max * 4.0);
++ double d2 = Math.max(d0 * d0 + d1 * d1, 0.001D);
++
++ entity.push(d0 / d2 * 4.0D, 0.2D, d1 / d2 * 4.0D);
+ }
+
+ @Override
+@@ -276,7 +295,7 @@
+ @Override
+ public boolean doHurtTarget(Entity entity) {
+ this.attackTick = 10;
+- this.level().broadcastEntityEvent(this, (byte)4);
++ this.level().broadcastEntityEvent(this, (byte) 4);
+ this.playSound(SoundEvents.RAVAGER_ATTACK, 1.0F, 1.0F);
+ return super.doHurtTarget(entity);
+ }
+@@ -298,7 +317,7 @@
+ }
+
+ @Override
+- protected void playStepSound(BlockPos pos, BlockState block) {
++ protected void playStepSound(BlockPos pos, IBlockData block) {
+ this.playSound(SoundEvents.RAVAGER_STEP, 0.15F, 1.0F);
+ }
+
+@@ -308,8 +327,7 @@
+ }
+
+ @Override
+- public void applyRaidBuffs(int wave, boolean unusedFalse) {
+- }
++ public void applyRaidBuffs(int wave, boolean unusedFalse) {}
+
+ @Override
+ public boolean canBeLeader() {
+@@ -318,7 +336,8 @@
+
+ @Override
+ protected AABB getAttackBoundingBox() {
+- AABB aABB = super.getAttackBoundingBox();
+- return aABB.deflate(0.05, 0.0, 0.05);
++ AABB axisalignedbb = super.getAttackBoundingBox();
++
++ return axisalignedbb.deflate(0.05D, 0.0D, 0.05D);
+ }
+ }