aboutsummaryrefslogtreecommitdiffhomepage
path: root/patch-remap/mache-spigotflower/net/minecraft/world/entity/monster/Drowned.java.patch
diff options
context:
space:
mode:
Diffstat (limited to 'patch-remap/mache-spigotflower/net/minecraft/world/entity/monster/Drowned.java.patch')
-rw-r--r--patch-remap/mache-spigotflower/net/minecraft/world/entity/monster/Drowned.java.patch509
1 files changed, 509 insertions, 0 deletions
diff --git a/patch-remap/mache-spigotflower/net/minecraft/world/entity/monster/Drowned.java.patch b/patch-remap/mache-spigotflower/net/minecraft/world/entity/monster/Drowned.java.patch
new file mode 100644
index 0000000000..df3f563a57
--- /dev/null
+++ b/patch-remap/mache-spigotflower/net/minecraft/world/entity/monster/Drowned.java.patch
@@ -0,0 +1,509 @@
+--- a/net/minecraft/world/entity/monster/Drowned.java
++++ b/net/minecraft/world/entity/monster/Drowned.java
+@@ -13,15 +13,15 @@
+ import net.minecraft.util.RandomSource;
+ import net.minecraft.world.Difficulty;
+ import net.minecraft.world.DifficultyInstance;
+-import net.minecraft.world.InteractionHand;
++import net.minecraft.world.EnumHand;
+ import net.minecraft.world.damagesource.DamageSource;
+ import net.minecraft.world.entity.EntityType;
++import net.minecraft.world.entity.EnumMobSpawn;
++import net.minecraft.world.entity.EnumMoveType;
+ import net.minecraft.world.entity.EquipmentSlot;
++import net.minecraft.world.entity.GroupDataEntity;
+ import net.minecraft.world.entity.LivingEntity;
+-import net.minecraft.world.entity.MobSpawnType;
+-import net.minecraft.world.entity.MoverType;
+ import net.minecraft.world.entity.PathfinderMob;
+-import net.minecraft.world.entity.SpawnGroupData;
+ import net.minecraft.world.entity.ai.attributes.Attributes;
+ import net.minecraft.world.entity.ai.control.MoveControl;
+ import net.minecraft.world.entity.ai.goal.Goal;
+@@ -56,11 +56,11 @@
+
+ public static final float NAUTILUS_SHELL_CHANCE = 0.03F;
+ boolean searchingForLand;
+- protected final WaterBoundPathNavigation waterNavigation;
+- protected final GroundPathNavigation groundNavigation;
++ public final WaterBoundPathNavigation waterNavigation;
++ public final GroundPathNavigation groundNavigation;
+
+- public Drowned(EntityType<? extends Drowned> entitytype, Level level) {
+- super(entitytype, level);
++ public Drowned(EntityType<? extends Drowned> entityType, Level level) {
++ super(entityType, level);
+ this.setMaxUpStep(1.0F);
+ this.moveControl = new Drowned.DrownedMoveControl(this);
+ this.setPathfindingMalus(BlockPathTypes.WATER, 0.0F);
+@@ -69,7 +69,6 @@
+ }
+
+ @Override
+- @Override
+ protected void addBehaviourGoals() {
+ this.goalSelector.addGoal(1, new Drowned.DrownedGoToWaterGoal(this, 1.0D));
+ this.goalSelector.addGoal(2, new Drowned.DrownedTridentAttackGoal(this, 1.0D, 40, 10.0F));
+@@ -86,79 +85,70 @@
+ }
+
+ @Override
+- @Override
+- public SpawnGroupData finalizeSpawn(ServerLevelAccessor serverlevelaccessor, DifficultyInstance difficultyinstance, MobSpawnType mobspawntype, @Nullable SpawnGroupData spawngroupdata, @Nullable CompoundTag compoundtag) {
+- spawngroupdata = super.finalizeSpawn(serverlevelaccessor, difficultyinstance, mobspawntype, spawngroupdata, compoundtag);
+- if (this.getItemBySlot(EquipmentSlot.OFFHAND).isEmpty() && serverlevelaccessor.getRandom().nextFloat() < 0.03F) {
++ public GroupDataEntity finalizeSpawn(ServerLevelAccessor level, DifficultyInstance difficulty, EnumMobSpawn reason, @Nullable GroupDataEntity spawnData, @Nullable CompoundTag dataTag) {
++ spawnData = super.finalizeSpawn(level, difficulty, reason, spawnData, dataTag);
++ if (this.getItemBySlot(EquipmentSlot.OFFHAND).isEmpty() && level.getRandom().nextFloat() < 0.03F) {
+ this.setItemSlot(EquipmentSlot.OFFHAND, new ItemStack(Items.NAUTILUS_SHELL));
+ this.setGuaranteedDrop(EquipmentSlot.OFFHAND);
+ }
+
+- return spawngroupdata;
++ return spawnData;
+ }
+
+- public static boolean checkDrownedSpawnRules(EntityType<Drowned> entitytype, ServerLevelAccessor serverlevelaccessor, MobSpawnType mobspawntype, BlockPos blockpos, RandomSource randomsource) {
+- if (!serverlevelaccessor.getFluidState(blockpos.below()).is(FluidTags.WATER) && !MobSpawnType.isSpawner(mobspawntype)) {
++ public static boolean checkDrownedSpawnRules(EntityType<Drowned> drowned, ServerLevelAccessor serverLevel, EnumMobSpawn mobSpawnType, BlockPos pos, RandomSource random) {
++ if (!serverLevel.getFluidState(pos.below()).is(FluidTags.WATER) && !EnumMobSpawn.isSpawner(mobSpawnType)) {
+ return false;
+ } else {
+- Holder<Biome> holder = serverlevelaccessor.getBiome(blockpos);
+- boolean flag = serverlevelaccessor.getDifficulty() != Difficulty.PEACEFUL && (MobSpawnType.ignoresLightRequirements(mobspawntype) || isDarkEnoughToSpawn(serverlevelaccessor, blockpos, randomsource)) && (MobSpawnType.isSpawner(mobspawntype) || serverlevelaccessor.getFluidState(blockpos).is(FluidTags.WATER));
++ Holder<Biome> holder = serverLevel.getBiome(pos);
++ boolean flag = serverLevel.getDifficulty() != Difficulty.PEACEFUL && (EnumMobSpawn.ignoresLightRequirements(mobSpawnType) || isDarkEnoughToSpawn(serverLevel, pos, random)) && (EnumMobSpawn.isSpawner(mobSpawnType) || serverLevel.getFluidState(pos).is(FluidTags.WATER));
+
+- return flag && MobSpawnType.isSpawner(mobspawntype) ? true : (holder.is(BiomeTags.MORE_FREQUENT_DROWNED_SPAWNS) ? randomsource.nextInt(15) == 0 && flag : randomsource.nextInt(40) == 0 && isDeepEnoughToSpawn(serverlevelaccessor, blockpos) && flag);
++ return flag && EnumMobSpawn.isSpawner(mobSpawnType) ? true : (holder.is(BiomeTags.MORE_FREQUENT_DROWNED_SPAWNS) ? random.nextInt(15) == 0 && flag : random.nextInt(40) == 0 && isDeepEnoughToSpawn(serverLevel, pos) && flag);
+ }
+ }
+
+- private static boolean isDeepEnoughToSpawn(LevelAccessor levelaccessor, BlockPos blockpos) {
+- return blockpos.getY() < levelaccessor.getSeaLevel() - 5;
++ private static boolean isDeepEnoughToSpawn(LevelAccessor level, BlockPos pos) {
++ return pos.getY() < level.getSeaLevel() - 5;
+ }
+
+ @Override
+- @Override
+ protected boolean supportsBreakDoorGoal() {
+ return false;
+ }
+
+ @Override
+- @Override
+ protected SoundEvent getAmbientSound() {
+ return this.isInWater() ? SoundEvents.DROWNED_AMBIENT_WATER : SoundEvents.DROWNED_AMBIENT;
+ }
+
+ @Override
+- @Override
+- protected SoundEvent getHurtSound(DamageSource damagesource) {
++ protected SoundEvent getHurtSound(DamageSource damageSource) {
+ return this.isInWater() ? SoundEvents.DROWNED_HURT_WATER : SoundEvents.DROWNED_HURT;
+ }
+
+ @Override
+- @Override
+ protected SoundEvent getDeathSound() {
+ return this.isInWater() ? SoundEvents.DROWNED_DEATH_WATER : SoundEvents.DROWNED_DEATH;
+ }
+
+ @Override
+- @Override
+ protected SoundEvent getStepSound() {
+ return SoundEvents.DROWNED_STEP;
+ }
+
+ @Override
+- @Override
+ protected SoundEvent getSwimSound() {
+ return SoundEvents.DROWNED_SWIM;
+ }
+
+ @Override
+- @Override
+ protected ItemStack getSkull() {
+ return ItemStack.EMPTY;
+ }
+
+ @Override
+- @Override
+- protected void populateDefaultEquipmentSlots(RandomSource randomsource, DifficultyInstance difficultyinstance) {
+- if ((double) randomsource.nextFloat() > 0.9D) {
+- int i = randomsource.nextInt(16);
++ protected void populateDefaultEquipmentSlots(RandomSource random, DifficultyInstance difficulty) {
++ if ((double) random.nextFloat() > 0.9D) {
++ int i = random.nextInt(16);
+
+ if (i < 10) {
+ this.setItemSlot(EquipmentSlot.MAINHAND, new ItemStack(Items.TRIDENT));
+@@ -170,29 +160,25 @@
+ }
+
+ @Override
+- @Override
+- protected boolean canReplaceCurrentItem(ItemStack itemstack, ItemStack itemstack1) {
+- return itemstack1.is(Items.NAUTILUS_SHELL) ? false : (itemstack1.is(Items.TRIDENT) ? (itemstack.is(Items.TRIDENT) ? itemstack.getDamageValue() < itemstack1.getDamageValue() : false) : (itemstack.is(Items.TRIDENT) ? true : super.canReplaceCurrentItem(itemstack, itemstack1)));
++ protected boolean canReplaceCurrentItem(ItemStack candidate, ItemStack existing) {
++ return existing.is(Items.NAUTILUS_SHELL) ? false : (existing.is(Items.TRIDENT) ? (candidate.is(Items.TRIDENT) ? candidate.getDamageValue() < existing.getDamageValue() : false) : (candidate.is(Items.TRIDENT) ? true : super.canReplaceCurrentItem(candidate, existing)));
+ }
+
+ @Override
+- @Override
+ protected boolean convertsInWater() {
+ return false;
+ }
+
+ @Override
+- @Override
+- public boolean checkSpawnObstruction(LevelReader levelreader) {
+- return levelreader.isUnobstructed(this);
++ public boolean checkSpawnObstruction(LevelReader level) {
++ return level.isUnobstructed(this);
+ }
+
+- public boolean okTarget(@Nullable LivingEntity livingentity) {
+- return livingentity != null ? !this.level().isDay() || livingentity.isInWater() : false;
++ public boolean okTarget(@Nullable LivingEntity target) {
++ return target != null ? !this.level().isDay() || target.isInWater() : false;
+ }
+
+ @Override
+- @Override
+ public boolean isPushedByFluid() {
+ return !this.isSwimming();
+ }
+@@ -201,27 +187,25 @@
+ if (this.searchingForLand) {
+ return true;
+ } else {
+- LivingEntity livingentity = this.getTarget();
++ LivingEntity entityliving = this.getTarget();
+
+- return livingentity != null && livingentity.isInWater();
++ return entityliving != null && entityliving.isInWater();
+ }
+ }
+
+ @Override
+- @Override
+- public void travel(Vec3 vec3) {
++ public void travel(Vec3 travelVector) {
+ if (this.isControlledByLocalInstance() && this.isInWater() && this.wantsToSwim()) {
+- this.moveRelative(0.01F, vec3);
+- this.move(MoverType.SELF, this.getDeltaMovement());
++ this.moveRelative(0.01F, travelVector);
++ this.move(EnumMoveType.SELF, this.getDeltaMovement());
+ this.setDeltaMovement(this.getDeltaMovement().scale(0.9D));
+ } else {
+- super.travel(vec3);
++ super.travel(travelVector);
+ }
+
+ }
+
+ @Override
+- @Override
+ public void updateSwimming() {
+ if (!this.level().isClientSide) {
+ if (this.isEffectiveAi() && this.isInWater() && this.wantsToSwim()) {
+@@ -236,19 +220,18 @@
+ }
+
+ @Override
+- @Override
+ public boolean isVisuallySwimming() {
+ return this.isSwimming();
+ }
+
+ protected boolean closeToNextPos() {
+- Path path = this.getNavigation().getPath();
++ Path pathentity = this.getNavigation().getPath();
+
+- if (path != null) {
+- BlockPos blockpos = path.getTarget();
++ if (pathentity != null) {
++ BlockPos blockposition = pathentity.getTarget();
+
+- if (blockpos != null) {
+- double d0 = this.distanceToSqr((double) blockpos.getX(), (double) blockpos.getY(), (double) blockpos.getZ());
++ if (blockposition != null) {
++ double d0 = this.distanceToSqr((double) blockposition.getX(), (double) blockposition.getY(), (double) blockposition.getZ());
+
+ if (d0 < 4.0D) {
+ return true;
+@@ -260,21 +243,20 @@
+ }
+
+ @Override
+- @Override
+- public void performRangedAttack(LivingEntity livingentity, float f) {
+- ThrownTrident throwntrident = new ThrownTrident(this.level(), this, new ItemStack(Items.TRIDENT));
+- double d0 = livingentity.getX() - this.getX();
+- double d1 = livingentity.getY(0.3333333333333333D) - throwntrident.getY();
+- double d2 = livingentity.getZ() - this.getZ();
++ public void performRangedAttack(LivingEntity target, float distanceFactor) {
++ ThrownTrident entitythrowntrident = new ThrownTrident(this.level(), this, this.getItemInHand(net.minecraft.world.entity.projectile.ProjectileUtil.getWeaponHoldingHand(this, Items.TRIDENT))); // CraftBukkit - Use Trident in hand like skeletons (SPIGOT-7025)
++ double d0 = target.getX() - this.getX();
++ double d1 = target.getY(0.3333333333333333D) - entitythrowntrident.getY();
++ double d2 = target.getZ() - this.getZ();
+ double d3 = Math.sqrt(d0 * d0 + d2 * d2);
+
+- throwntrident.shoot(d0, d1 + d3 * 0.20000000298023224D, d2, 1.6F, (float) (14 - this.level().getDifficulty().getId() * 4));
++ entitythrowntrident.shoot(d0, d1 + d3 * 0.20000000298023224D, d2, 1.6F, (float) (14 - this.level().getDifficulty().getId() * 4));
+ this.playSound(SoundEvents.DROWNED_SHOOT, 1.0F, 1.0F / (this.getRandom().nextFloat() * 0.4F + 0.8F));
+- this.level().addFreshEntity(throwntrident);
++ this.level().addFreshEntity(entitythrowntrident);
+ }
+
+- public void setSearchingForLand(boolean flag) {
+- this.searchingForLand = flag;
++ public void setSearchingForLand(boolean searchingForLand) {
++ this.searchingForLand = searchingForLand;
+ }
+
+ private static class DrownedMoveControl extends MoveControl {
+@@ -287,12 +269,11 @@
+ }
+
+ @Override
+- @Override
+ public void tick() {
+- LivingEntity livingentity = this.drowned.getTarget();
++ LivingEntity entityliving = this.drowned.getTarget();
+
+ if (this.drowned.wantsToSwim() && this.drowned.isInWater()) {
+- if (livingentity != null && livingentity.getY() > this.drowned.getY() || this.drowned.searchingForLand) {
++ if (entityliving != null && entityliving.getY() > this.drowned.getY() || this.drowned.searchingForLand) {
+ this.drowned.setDeltaMovement(this.drowned.getDeltaMovement().add(0.0D, 0.002D, 0.0D));
+ }
+
+@@ -336,42 +317,39 @@
+ private final double speedModifier;
+ private final Level level;
+
+- public DrownedGoToWaterGoal(PathfinderMob pathfindermob, double d0) {
+- this.mob = pathfindermob;
+- this.speedModifier = d0;
+- this.level = pathfindermob.level();
+- this.setFlags(EnumSet.of(Goal.Flag.MOVE));
++ public DrownedGoToWaterGoal(PathfinderMob mob, double speedModifier) {
++ this.mob = mob;
++ this.speedModifier = speedModifier;
++ this.level = mob.level();
++ this.setFlags(EnumSet.of(Goal.Type.MOVE));
+ }
+
+ @Override
+- @Override
+ public boolean canUse() {
+ if (!this.level.isDay()) {
+ return false;
+ } else if (this.mob.isInWater()) {
+ return false;
+ } else {
+- Vec3 vec3 = this.getWaterPos();
++ Vec3 vec3d = this.getWaterPos();
+
+- if (vec3 == null) {
++ if (vec3d == null) {
+ return false;
+ } else {
+- this.wantedX = vec3.x;
+- this.wantedY = vec3.y;
+- this.wantedZ = vec3.z;
++ this.wantedX = vec3d.x;
++ this.wantedY = vec3d.y;
++ this.wantedZ = vec3d.z;
+ return true;
+ }
+ }
+ }
+
+ @Override
+- @Override
+ public boolean canContinueToUse() {
+ return !this.mob.getNavigation().isDone();
+ }
+
+ @Override
+- @Override
+ public void start() {
+ this.mob.getNavigation().moveTo(this.wantedX, this.wantedY, this.wantedZ, this.speedModifier);
+ }
+@@ -379,13 +357,13 @@
+ @Nullable
+ private Vec3 getWaterPos() {
+ RandomSource randomsource = this.mob.getRandom();
+- BlockPos blockpos = this.mob.blockPosition();
++ BlockPos blockposition = this.mob.blockPosition();
+
+ for (int i = 0; i < 10; ++i) {
+- BlockPos blockpos1 = blockpos.offset(randomsource.nextInt(20) - 10, 2 - randomsource.nextInt(8), randomsource.nextInt(20) - 10);
++ BlockPos blockposition1 = blockposition.offset(randomsource.nextInt(20) - 10, 2 - randomsource.nextInt(8), randomsource.nextInt(20) - 10);
+
+- if (this.level.getBlockState(blockpos1).is(Blocks.WATER)) {
+- return Vec3.atBottomCenterOf(blockpos1);
++ if (this.level.getBlockState(blockposition1).is(Blocks.WATER)) {
++ return Vec3.atBottomCenterOf(blockposition1);
+ }
+ }
+
+@@ -397,27 +375,24 @@
+
+ private final Drowned drowned;
+
+- public DrownedTridentAttackGoal(RangedAttackMob rangedattackmob, double d0, int i, float f) {
+- super(rangedattackmob, d0, i, f);
+- this.drowned = (Drowned) rangedattackmob;
++ public DrownedTridentAttackGoal(RangedAttackMob rangedAttackMob, double speedModifier, int i, float attackInterval) {
++ super(rangedAttackMob, speedModifier, i, attackInterval);
++ this.drowned = (Drowned) rangedAttackMob;
+ }
+
+ @Override
+- @Override
+ public boolean canUse() {
+ return super.canUse() && this.drowned.getMainHandItem().is(Items.TRIDENT);
+ }
+
+ @Override
+- @Override
+ public void start() {
+ super.start();
+ this.drowned.setAggressive(true);
+- this.drowned.startUsingItem(InteractionHand.MAIN_HAND);
++ this.drowned.startUsingItem(EnumHand.MAIN_HAND);
+ }
+
+ @Override
+- @Override
+ public void stop() {
+ super.stop();
+ this.drowned.stopUsingItem();
+@@ -429,19 +404,17 @@
+
+ private final Drowned drowned;
+
+- public DrownedAttackGoal(Drowned drowned, double d0, boolean flag) {
+- super((Zombie) drowned, d0, flag);
++ public DrownedAttackGoal(Drowned drowned, double speedModifier, boolean flag) {
++ super((Zombie) drowned, speedModifier, flag);
+ this.drowned = drowned;
+ }
+
+ @Override
+- @Override
+ public boolean canUse() {
+ return super.canUse() && this.drowned.okTarget(this.drowned.getTarget());
+ }
+
+ @Override
+- @Override
+ public boolean canContinueToUse() {
+ return super.canContinueToUse() && this.drowned.okTarget(this.drowned.getTarget());
+ }
+@@ -451,33 +424,29 @@
+
+ private final Drowned drowned;
+
+- public DrownedGoToBeachGoal(Drowned drowned, double d0) {
+- super(drowned, d0, 8, 2);
++ public DrownedGoToBeachGoal(Drowned drowned, double speedModifier) {
++ super(drowned, speedModifier, 8, 2);
+ this.drowned = drowned;
+ }
+
+ @Override
+- @Override
+ public boolean canUse() {
+ return super.canUse() && !this.drowned.level().isDay() && this.drowned.isInWater() && this.drowned.getY() >= (double) (this.drowned.level().getSeaLevel() - 3);
+ }
+
+ @Override
+- @Override
+ public boolean canContinueToUse() {
+ return super.canContinueToUse();
+ }
+
+ @Override
+- @Override
+- protected boolean isValidTarget(LevelReader levelreader, BlockPos blockpos) {
+- BlockPos blockpos1 = blockpos.above();
++ protected boolean isValidTarget(LevelReader level, BlockPos pos) {
++ BlockPos blockposition1 = pos.above();
+
+- return levelreader.isEmptyBlock(blockpos1) && levelreader.isEmptyBlock(blockpos1.above()) ? levelreader.getBlockState(blockpos).entityCanStandOn(levelreader, blockpos, this.drowned) : false;
++ return level.isEmptyBlock(blockposition1) && level.isEmptyBlock(blockposition1.above()) ? level.getBlockState(pos).entityCanStandOn(level, pos, this.drowned) : false;
+ }
+
+ @Override
+- @Override
+ public void start() {
+ this.drowned.setSearchingForLand(false);
+ this.drowned.navigation = this.drowned.groundNavigation;
+@@ -485,7 +454,6 @@
+ }
+
+ @Override
+- @Override
+ public void stop() {
+ super.stop();
+ }
+@@ -498,49 +466,44 @@
+ private final int seaLevel;
+ private boolean stuck;
+
+- public DrownedSwimUpGoal(Drowned drowned, double d0, int i) {
++ public DrownedSwimUpGoal(Drowned drowned, double speedModifier, int i) {
+ this.drowned = drowned;
+- this.speedModifier = d0;
++ this.speedModifier = speedModifier;
+ this.seaLevel = i;
+ }
+
+ @Override
+- @Override
+ public boolean canUse() {
+ return !this.drowned.level().isDay() && this.drowned.isInWater() && this.drowned.getY() < (double) (this.seaLevel - 2);
+ }
+
+ @Override
+- @Override
+ public boolean canContinueToUse() {
+ return this.canUse() && !this.stuck;
+ }
+
+ @Override
+- @Override
+ public void tick() {
+ if (this.drowned.getY() < (double) (this.seaLevel - 1) && (this.drowned.getNavigation().isDone() || this.drowned.closeToNextPos())) {
+- Vec3 vec3 = DefaultRandomPos.getPosTowards(this.drowned, 4, 8, new Vec3(this.drowned.getX(), (double) (this.seaLevel - 1), this.drowned.getZ()), 1.5707963705062866D);
++ Vec3 vec3d = DefaultRandomPos.getPosTowards(this.drowned, 4, 8, new Vec3(this.drowned.getX(), (double) (this.seaLevel - 1), this.drowned.getZ()), 1.5707963705062866D);
+
+- if (vec3 == null) {
++ if (vec3d == null) {
+ this.stuck = true;
+ return;
+ }
+
+- this.drowned.getNavigation().moveTo(vec3.x, vec3.y, vec3.z, this.speedModifier);
++ this.drowned.getNavigation().moveTo(vec3d.x, vec3d.y, vec3d.z, this.speedModifier);
+ }
+
+ }
+
+ @Override
+- @Override
+ public void start() {
+ this.drowned.setSearchingForLand(true);
+ this.stuck = false;
+ }
+
+ @Override
+- @Override
+ public void stop() {
+ this.drowned.setSearchingForLand(false);
+ }