diff options
Diffstat (limited to 'patch-remap/mache-spigotflower/net/minecraft/world/entity/raid/Raider.java.patch')
-rw-r--r-- | patch-remap/mache-spigotflower/net/minecraft/world/entity/raid/Raider.java.patch | 566 |
1 files changed, 566 insertions, 0 deletions
diff --git a/patch-remap/mache-spigotflower/net/minecraft/world/entity/raid/Raider.java.patch b/patch-remap/mache-spigotflower/net/minecraft/world/entity/raid/Raider.java.patch new file mode 100644 index 0000000000..9d08e1beea --- /dev/null +++ b/patch-remap/mache-spigotflower/net/minecraft/world/entity/raid/Raider.java.patch @@ -0,0 +1,566 @@ +--- a/net/minecraft/world/entity/raid/Raider.java ++++ b/net/minecraft/world/entity/raid/Raider.java +@@ -22,10 +22,10 @@ + import net.minecraft.world.effect.MobEffects; + import net.minecraft.world.entity.Entity; + import net.minecraft.world.entity.EntityType; ++import net.minecraft.world.entity.EnumMobSpawn; + 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.SpawnGroupData; + import net.minecraft.world.entity.ai.goal.Goal; + import net.minecraft.world.entity.ai.goal.PathfindToRaidGoal; + import net.minecraft.world.entity.ai.targeting.TargetingConditions; +@@ -46,8 +46,8 @@ + public abstract class Raider extends PatrollingMonster { + + protected static final EntityDataAccessor<Boolean> IS_CELEBRATING = SynchedEntityData.defineId(Raider.class, EntityDataSerializers.BOOLEAN); +- static final Predicate<ItemEntity> ALLOWED_ITEMS = (itementity) -> { +- return !itementity.hasPickUpDelay() && itementity.isAlive() && ItemStack.matches(itementity.getItem(), Raid.getLeaderBannerInstance()); ++ static final Predicate<ItemEntity> ALLOWED_ITEMS = (entityitem) -> { ++ return !entityitem.hasPickUpDelay() && entityitem.isAlive() && ItemStack.matches(entityitem.getItem(), Raid.getLeaderBannerInstance()); + }; + @Nullable + protected Raid raid; +@@ -55,12 +55,11 @@ + private boolean canJoinRaid; + private int ticksOutsideRaid; + +- protected Raider(EntityType<? extends Raider> entitytype, Level level) { +- super(entitytype, level); ++ protected Raider(EntityType<? extends Raider> entityType, Level level) { ++ super(entityType, level); + } + + @Override +- @Override + protected void registerGoals() { + super.registerGoals(); + this.goalSelector.addGoal(1, new Raider.ObtainRaidLeaderBannerGoal<>(this)); +@@ -70,7 +69,6 @@ + } + + @Override +- @Override + protected void defineSynchedData() { + super.defineSynchedData(); + this.entityData.define(Raider.IS_CELEBRATING, false); +@@ -82,12 +80,11 @@ + return this.canJoinRaid; + } + +- public void setCanJoinRaid(boolean flag) { +- this.canJoinRaid = flag; ++ public void setCanJoinRaid(boolean canJoinRaid) { ++ this.canJoinRaid = canJoinRaid; + } + + @Override +- @Override + public void aiStep() { + if (this.level() instanceof ServerLevel && this.isAlive()) { + Raid raid = this.getCurrentRaid(); +@@ -102,9 +99,9 @@ + } + } + } else { +- LivingEntity livingentity = this.getTarget(); ++ LivingEntity entityliving = this.getTarget(); + +- if (livingentity != null && (livingentity.getType() == EntityType.PLAYER || livingentity.getType() == EntityType.IRON_GOLEM)) { ++ if (entityliving != null && (entityliving.getType() == EntityType.PLAYER || entityliving.getType() == EntityType.IRON_GOLEM)) { + this.noActionTime = 0; + } + } +@@ -115,16 +112,14 @@ + } + + @Override +- @Override + protected void updateNoActionTime() { + this.noActionTime += 2; + } + + @Override +- @Override +- public void die(DamageSource damagesource) { ++ public void die(DamageSource cause) { + if (this.level() instanceof ServerLevel) { +- Entity entity = damagesource.getEntity(); ++ Entity entity = cause.getEntity(); + Raid raid = this.getCurrentRaid(); + + if (raid != null) { +@@ -141,46 +136,45 @@ + + if (this.isPatrolLeader() && raid == null && ((ServerLevel) this.level()).getRaidAt(this.blockPosition()) == null) { + ItemStack itemstack = this.getItemBySlot(EquipmentSlot.HEAD); +- Player player = null; ++ Player entityhuman = null; + + if (entity instanceof Player) { +- player = (Player) entity; ++ entityhuman = (Player) entity; + } else if (entity instanceof Wolf) { +- Wolf wolf = (Wolf) entity; +- LivingEntity livingentity = wolf.getOwner(); ++ Wolf entitywolf = (Wolf) entity; ++ LivingEntity entityliving = entitywolf.getOwner(); + +- if (wolf.isTame() && livingentity instanceof Player) { +- player = (Player) livingentity; ++ if (entitywolf.isTame() && entityliving instanceof Player) { ++ entityhuman = (Player) entityliving; + } + } + +- if (!itemstack.isEmpty() && ItemStack.matches(itemstack, Raid.getLeaderBannerInstance()) && player != null) { +- MobEffectInstance mobeffectinstance = player.getEffect(MobEffects.BAD_OMEN); ++ if (!itemstack.isEmpty() && ItemStack.matches(itemstack, Raid.getLeaderBannerInstance()) && entityhuman != null) { ++ MobEffectInstance mobeffect = entityhuman.getEffect(MobEffects.BAD_OMEN); + byte b0 = 1; + int i; + +- if (mobeffectinstance != null) { +- i = b0 + mobeffectinstance.getAmplifier(); +- player.removeEffectNoUpdate(MobEffects.BAD_OMEN); ++ if (mobeffect != null) { ++ i = b0 + mobeffect.getAmplifier(); ++ entityhuman.removeEffectNoUpdate(MobEffects.BAD_OMEN); + } else { + i = b0 - 1; + } + + i = Mth.clamp(i, 0, 4); +- MobEffectInstance mobeffectinstance1 = new MobEffectInstance(MobEffects.BAD_OMEN, 120000, i, false, false, true); ++ MobEffectInstance mobeffect1 = new MobEffectInstance(MobEffects.BAD_OMEN, 120000, i, false, false, true); + + if (!this.level().getGameRules().getBoolean(GameRules.RULE_DISABLE_RAIDS)) { +- player.addEffect(mobeffectinstance1); ++ entityhuman.addEffect(mobeffect1, org.bukkit.event.entity.EntityPotionEffectEvent.Cause.PATROL_CAPTAIN); // CraftBukkit + } + } + } + } + +- super.die(damagesource); ++ super.die(cause); + } + + @Override +- @Override + public boolean canJoinPatrol() { + return !this.hasActiveRaid(); + } +@@ -198,8 +192,8 @@ + return this.getCurrentRaid() != null && this.getCurrentRaid().isActive(); + } + +- public void setWave(int i) { +- this.wave = i; ++ public void setWave(int wave) { ++ this.wave = wave; + } + + public int getWave() { +@@ -210,31 +204,29 @@ + return (Boolean) this.entityData.get(Raider.IS_CELEBRATING); + } + +- public void setCelebrating(boolean flag) { +- this.entityData.set(Raider.IS_CELEBRATING, flag); ++ public void setCelebrating(boolean celebrating) { ++ this.entityData.set(Raider.IS_CELEBRATING, celebrating); + } + + @Override +- @Override +- public void addAdditionalSaveData(CompoundTag compoundtag) { +- super.addAdditionalSaveData(compoundtag); +- compoundtag.putInt("Wave", this.wave); +- compoundtag.putBoolean("CanJoinRaid", this.canJoinRaid); ++ public void addAdditionalSaveData(CompoundTag compound) { ++ super.addAdditionalSaveData(compound); ++ compound.putInt("Wave", this.wave); ++ compound.putBoolean("CanJoinRaid", this.canJoinRaid); + if (this.raid != null) { +- compoundtag.putInt("RaidId", this.raid.getId()); ++ compound.putInt("RaidId", this.raid.getId()); + } + + } + + @Override +- @Override +- public void readAdditionalSaveData(CompoundTag compoundtag) { +- super.readAdditionalSaveData(compoundtag); +- this.wave = compoundtag.getInt("Wave"); +- this.canJoinRaid = compoundtag.getBoolean("CanJoinRaid"); +- if (compoundtag.contains("RaidId", 3)) { ++ public void readAdditionalSaveData(CompoundTag compound) { ++ super.readAdditionalSaveData(compound); ++ this.wave = compound.getInt("Wave"); ++ this.canJoinRaid = compound.getBoolean("CanJoinRaid"); ++ if (compound.contains("RaidId", 3)) { + if (this.level() instanceof ServerLevel) { +- this.raid = ((ServerLevel) this.level()).getRaids().get(compoundtag.getInt("RaidId")); ++ this.raid = ((ServerLevel) this.level()).getRaids().get(compound.getInt("RaidId")); + } + + if (this.raid != null) { +@@ -248,40 +240,37 @@ + } + + @Override +- @Override +- protected void pickUpItem(ItemEntity itementity) { +- ItemStack itemstack = itementity.getItem(); ++ protected void pickUpItem(ItemEntity itemEntity) { ++ ItemStack itemstack = itemEntity.getItem(); + boolean flag = this.hasActiveRaid() && this.getCurrentRaid().getLeader(this.getWave()) != null; + + if (this.hasActiveRaid() && !flag && ItemStack.matches(itemstack, Raid.getLeaderBannerInstance())) { +- EquipmentSlot equipmentslot = EquipmentSlot.HEAD; +- ItemStack itemstack1 = this.getItemBySlot(equipmentslot); +- double d0 = (double) this.getEquipmentDropChance(equipmentslot); ++ EquipmentSlot enumitemslot = EquipmentSlot.HEAD; ++ ItemStack itemstack1 = this.getItemBySlot(enumitemslot); ++ double d0 = (double) this.getEquipmentDropChance(enumitemslot); + + if (!itemstack1.isEmpty() && (double) Math.max(this.random.nextFloat() - 0.1F, 0.0F) < d0) { + this.spawnAtLocation(itemstack1); + } + +- this.onItemPickup(itementity); +- this.setItemSlot(equipmentslot, itemstack); +- this.take(itementity, itemstack.getCount()); +- itementity.discard(); ++ this.onItemPickup(itemEntity); ++ this.setItemSlot(enumitemslot, itemstack); ++ this.take(itemEntity, itemstack.getCount()); ++ itemEntity.discard(); + this.getCurrentRaid().setLeader(this.getWave(), this); + this.setPatrolLeader(true); + } else { +- super.pickUpItem(itementity); ++ super.pickUpItem(itemEntity); + } + + } + + @Override +- @Override +- public boolean removeWhenFarAway(double d0) { +- return this.getCurrentRaid() == null ? super.removeWhenFarAway(d0) : false; ++ public boolean removeWhenFarAway(double distanceToClosestPlayer) { ++ return this.getCurrentRaid() == null ? super.removeWhenFarAway(distanceToClosestPlayer) : false; + } + + @Override +- @Override + public boolean requiresCustomPersistence() { + return super.requiresCustomPersistence() || this.getCurrentRaid() != null; + } +@@ -290,26 +279,24 @@ + return this.ticksOutsideRaid; + } + +- public void setTicksOutsideRaid(int i) { +- this.ticksOutsideRaid = i; ++ public void setTicksOutsideRaid(int ticksOutsideRaid) { ++ this.ticksOutsideRaid = ticksOutsideRaid; + } + + @Override +- @Override +- public boolean hurt(DamageSource damagesource, float f) { ++ public boolean hurt(DamageSource source, float amount) { + if (this.hasActiveRaid()) { + this.getCurrentRaid().updateBossbar(); + } + +- return super.hurt(damagesource, f); ++ return super.hurt(source, amount); + } + + @Nullable + @Override +- @Override +- public SpawnGroupData finalizeSpawn(ServerLevelAccessor serverlevelaccessor, DifficultyInstance difficultyinstance, MobSpawnType mobspawntype, @Nullable SpawnGroupData spawngroupdata, @Nullable CompoundTag compoundtag) { +- this.setCanJoinRaid(this.getType() != EntityType.WITCH || mobspawntype != MobSpawnType.NATURAL); +- return super.finalizeSpawn(serverlevelaccessor, difficultyinstance, mobspawntype, spawngroupdata, compoundtag); ++ public GroupDataEntity finalizeSpawn(ServerLevelAccessor level, DifficultyInstance difficulty, EnumMobSpawn reason, @Nullable GroupDataEntity spawnData, @Nullable CompoundTag dataTag) { ++ this.setCanJoinRaid(this.getType() != EntityType.WITCH || reason != EnumMobSpawn.NATURAL); ++ return super.finalizeSpawn(level, difficulty, reason, spawnData, dataTag); + } + + public abstract SoundEvent getCelebrateSound(); +@@ -318,20 +305,19 @@ + + private final T mob; + +- public ObtainRaidLeaderBannerGoal(T t0) { +- this.mob = t0; +- this.setFlags(EnumSet.of(Goal.Flag.MOVE)); ++ public ObtainRaidLeaderBannerGoal(T entityraider) { // CraftBukkit - decompile error ++ this.mob = entityraider; ++ this.setFlags(EnumSet.of(Goal.Type.MOVE)); + } + + @Override +- @Override + public boolean canUse() { + Raid raid = this.mob.getCurrentRaid(); + + if (this.mob.hasActiveRaid() && !this.mob.getCurrentRaid().isOver() && this.mob.canBeLeader() && !ItemStack.matches(this.mob.getItemBySlot(EquipmentSlot.HEAD), Raid.getLeaderBannerInstance())) { +- Raider raider = raid.getLeader(this.mob.getWave()); ++ Raider entityraider = raid.getLeader(this.mob.getWave()); + +- if (raider == null || !raider.isAlive()) { ++ if (entityraider == null || !entityraider.isAlive()) { + List<ItemEntity> list = this.mob.level().getEntitiesOfClass(ItemEntity.class, this.mob.getBoundingBox().inflate(16.0D, 8.0D, 16.0D), Raider.ALLOWED_ITEMS); + + if (!list.isEmpty()) { +@@ -346,7 +332,6 @@ + } + + @Override +- @Override + public void tick() { + if (this.mob.getNavigation().getTargetPos().closerToCenterThan(this.mob.position(), 1.414D)) { + List<ItemEntity> list = this.mob.level().getEntitiesOfClass(ItemEntity.class, this.mob.getBoundingBox().inflate(4.0D, 4.0D, 4.0D), Raider.ALLOWED_ITEMS); +@@ -368,15 +353,14 @@ + private final int distanceToPoi; + private boolean stuck; + +- public RaiderMoveThroughVillageGoal(Raider raider, double d0, int i) { ++ public RaiderMoveThroughVillageGoal(Raider raider, double speedModifier, int i) { + this.raider = raider; +- this.speedModifier = d0; ++ this.speedModifier = speedModifier; + this.distanceToPoi = i; +- this.setFlags(EnumSet.of(Goal.Flag.MOVE)); ++ this.setFlags(EnumSet.of(Goal.Type.MOVE)); + } + + @Override +- @Override + public boolean canUse() { + this.updateVisited(); + return this.isValidRaid() && this.hasSuitablePoi() && this.raider.getTarget() == null; +@@ -387,11 +371,11 @@ + } + + private boolean hasSuitablePoi() { +- ServerLevel serverlevel = (ServerLevel) this.raider.level(); +- BlockPos blockpos = this.raider.blockPosition(); +- Optional<BlockPos> optional = serverlevel.getPoiManager().getRandom((holder) -> { ++ ServerLevel worldserver = (ServerLevel) this.raider.level(); ++ BlockPos blockposition = this.raider.blockPosition(); ++ Optional<BlockPos> optional = worldserver.getPoiManager().getRandom((holder) -> { + return holder.is(PoiTypes.HOME); +- }, this::hasNotVisited, PoiManager.Occupancy.ANY, blockpos, 48, this.raider.random); ++ }, this::hasNotVisited, PoiManager.Occupancy.ANY, blockposition, 48, this.raider.random); + + if (optional.isEmpty()) { + return false; +@@ -402,13 +386,11 @@ + } + + @Override +- @Override + public boolean canContinueToUse() { + return this.raider.getNavigation().isDone() ? false : this.raider.getTarget() == null && !this.poiPos.closerToCenterThan(this.raider.position(), (double) (this.raider.getBbWidth() + (float) this.distanceToPoi)) && !this.stuck; + } + + @Override +- @Override + public void stop() { + if (this.poiPos.closerToCenterThan(this.raider.position(), (double) this.distanceToPoi)) { + this.visited.add(this.poiPos); +@@ -417,7 +399,6 @@ + } + + @Override +- @Override + public void start() { + super.start(); + this.raider.setNoActionTime(0); +@@ -426,38 +407,37 @@ + } + + @Override +- @Override + public void tick() { + if (this.raider.getNavigation().isDone()) { +- Vec3 vec3 = Vec3.atBottomCenterOf(this.poiPos); +- Vec3 vec31 = DefaultRandomPos.getPosTowards(this.raider, 16, 7, vec3, 0.3141592741012573D); ++ Vec3 vec3d = Vec3.atBottomCenterOf(this.poiPos); ++ Vec3 vec3d1 = DefaultRandomPos.getPosTowards(this.raider, 16, 7, vec3d, 0.3141592741012573D); + +- if (vec31 == null) { +- vec31 = DefaultRandomPos.getPosTowards(this.raider, 8, 7, vec3, 1.5707963705062866D); ++ if (vec3d1 == null) { ++ vec3d1 = DefaultRandomPos.getPosTowards(this.raider, 8, 7, vec3d, 1.5707963705062866D); + } + +- if (vec31 == null) { ++ if (vec3d1 == null) { + this.stuck = true; + return; + } + +- this.raider.getNavigation().moveTo(vec31.x, vec31.y, vec31.z, this.speedModifier); ++ this.raider.getNavigation().moveTo(vec3d1.x, vec3d1.y, vec3d1.z, this.speedModifier); + } + + } + +- private boolean hasNotVisited(BlockPos blockpos) { ++ private boolean hasNotVisited(BlockPos pos) { + Iterator iterator = this.visited.iterator(); + +- BlockPos blockpos1; ++ BlockPos blockposition1; + + do { + if (!iterator.hasNext()) { + return true; + } + +- blockpos1 = (BlockPos) iterator.next(); +- } while (!Objects.equals(blockpos, blockpos1)); ++ blockposition1 = (BlockPos) iterator.next(); ++ } while (!Objects.equals(pos, blockposition1)); + + return false; + } +@@ -474,13 +454,12 @@ + + private final Raider mob; + +- RaiderCelebration(Raider raider) { +- this.mob = raider; +- this.setFlags(EnumSet.of(Goal.Flag.MOVE)); ++ RaiderCelebration(Raider entityraider) { ++ this.mob = entityraider; ++ this.setFlags(EnumSet.of(Goal.Type.MOVE)); + } + + @Override +- @Override + public boolean canUse() { + Raid raid = this.mob.getCurrentRaid(); + +@@ -488,21 +467,18 @@ + } + + @Override +- @Override + public void start() { + this.mob.setCelebrating(true); + super.start(); + } + + @Override +- @Override + public void stop() { + this.mob.setCelebrating(false); + super.stop(); + } + + @Override +- @Override + public void tick() { + if (!this.mob.isSilent() && this.mob.random.nextInt(this.adjustedTickDelay(100)) == 0) { + Raider.this.playSound(Raider.this.getCelebrateSound(), Raider.this.getSoundVolume(), Raider.this.getVoicePitch()); +@@ -522,22 +498,20 @@ + private final float hostileRadiusSqr; + public final TargetingConditions shoutTargeting = TargetingConditions.forNonCombat().range(8.0D).ignoreLineOfSight().ignoreInvisibilityTesting(); + +- public HoldGroundAttackGoal(AbstractIllager abstractillager, float f) { +- this.mob = abstractillager; ++ public HoldGroundAttackGoal(AbstractIllager entityillagerabstract, float f) { ++ this.mob = entityillagerabstract; + this.hostileRadiusSqr = f * f; +- this.setFlags(EnumSet.of(Goal.Flag.MOVE, Goal.Flag.LOOK)); ++ this.setFlags(EnumSet.of(Goal.Type.MOVE, Goal.Type.LOOK)); + } + + @Override +- @Override + public boolean canUse() { +- LivingEntity livingentity = this.mob.getLastHurtByMob(); ++ LivingEntity entityliving = this.mob.getLastHurtByMob(); + +- return this.mob.getCurrentRaid() == null && this.mob.isPatrolling() && this.mob.getTarget() != null && !this.mob.isAggressive() && (livingentity == null || livingentity.getType() != EntityType.PLAYER); ++ return this.mob.getCurrentRaid() == null && this.mob.isPatrolling() && this.mob.getTarget() != null && !this.mob.isAggressive() && (entityliving == null || entityliving.getType() != EntityType.PLAYER); + } + + @Override +- @Override + public void start() { + super.start(); + this.mob.getNavigation().stop(); +@@ -545,28 +519,27 @@ + Iterator iterator = list.iterator(); + + while (iterator.hasNext()) { +- Raider raider = (Raider) iterator.next(); ++ Raider entityraider = (Raider) iterator.next(); + +- raider.setTarget(this.mob.getTarget()); ++ entityraider.setTarget(this.mob.getTarget(), org.bukkit.event.entity.EntityTargetEvent.TargetReason.FOLLOW_LEADER, true); // CraftBukkit + } + + } + + @Override +- @Override + public void stop() { + super.stop(); +- LivingEntity livingentity = this.mob.getTarget(); ++ LivingEntity entityliving = this.mob.getTarget(); + +- if (livingentity != null) { ++ if (entityliving != null) { + List<Raider> list = this.mob.level().getNearbyEntities(Raider.class, this.shoutTargeting, this.mob, this.mob.getBoundingBox().inflate(8.0D, 8.0D, 8.0D)); + Iterator iterator = list.iterator(); + + while (iterator.hasNext()) { +- Raider raider = (Raider) iterator.next(); ++ Raider entityraider = (Raider) iterator.next(); + +- raider.setTarget(livingentity); +- raider.setAggressive(true); ++ entityraider.setTarget(this.mob.getTarget(), org.bukkit.event.entity.EntityTargetEvent.TargetReason.FOLLOW_LEADER, true); // CraftBukkit ++ entityraider.setAggressive(true); + } + + this.mob.setAggressive(true); +@@ -575,19 +548,17 @@ + } + + @Override +- @Override + public boolean requiresUpdateEveryTick() { + return true; + } + + @Override +- @Override + public void tick() { +- LivingEntity livingentity = this.mob.getTarget(); ++ LivingEntity entityliving = this.mob.getTarget(); + +- if (livingentity != null) { +- if (this.mob.distanceToSqr((Entity) livingentity) > (double) this.hostileRadiusSqr) { +- this.mob.getLookControl().setLookAt(livingentity, 30.0F, 30.0F); ++ if (entityliving != null) { ++ if (this.mob.distanceToSqr((Entity) entityliving) > (double) this.hostileRadiusSqr) { ++ this.mob.getLookControl().setLookAt(entityliving, 30.0F, 30.0F); + if (this.mob.random.nextInt(50) == 0) { + this.mob.playAmbientSound(); + } |