diff options
author | MiniDigger | Martin <[email protected]> | 2024-01-14 11:04:49 +0100 |
---|---|---|
committer | MiniDigger | Martin <[email protected]> | 2024-01-14 11:04:49 +0100 |
commit | bee74680e607c2e29b038329f62181238911cd83 (patch) | |
tree | 708fd1a4a0227d9071243adf2a42d5e9e96cde4a /patch-remap/mache-vineflower/net/minecraft/world/entity/monster/Evoker.java.patch | |
parent | 0a44692ef6ff6e255d48eb3ba1bb114166eafda9 (diff) | |
download | Paper-softspoon.tar.gz Paper-softspoon.zip |
add remapped patches as a testsoftspoon
Diffstat (limited to 'patch-remap/mache-vineflower/net/minecraft/world/entity/monster/Evoker.java.patch')
-rw-r--r-- | patch-remap/mache-vineflower/net/minecraft/world/entity/monster/Evoker.java.patch | 410 |
1 files changed, 410 insertions, 0 deletions
diff --git a/patch-remap/mache-vineflower/net/minecraft/world/entity/monster/Evoker.java.patch b/patch-remap/mache-vineflower/net/minecraft/world/entity/monster/Evoker.java.patch new file mode 100644 index 0000000000..fd571c6fc7 --- /dev/null +++ b/patch-remap/mache-vineflower/net/minecraft/world/entity/monster/Evoker.java.patch @@ -0,0 +1,410 @@ +--- a/net/minecraft/world/entity/monster/Evoker.java ++++ b/net/minecraft/world/entity/monster/Evoker.java +@@ -12,10 +12,11 @@ + import net.minecraft.world.damagesource.DamageSource; + import net.minecraft.world.entity.Entity; + import net.minecraft.world.entity.EntityType; ++import net.minecraft.world.entity.EnumMobSpawn; ++import net.minecraft.world.entity.EnumMonsterType; ++import net.minecraft.world.entity.GroupDataEntity; + import net.minecraft.world.entity.LivingEntity; + import net.minecraft.world.entity.Mob; +-import net.minecraft.world.entity.MobSpawnType; +-import net.minecraft.world.entity.MobType; + import net.minecraft.world.entity.ai.attributes.AttributeSupplier; + import net.minecraft.world.entity.ai.attributes.Attributes; + import net.minecraft.world.entity.ai.goal.AvoidEntityGoal; +@@ -34,13 +35,14 @@ + import net.minecraft.world.item.DyeColor; + import net.minecraft.world.level.GameRules; + import net.minecraft.world.level.Level; +-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.phys.Vec3; + import net.minecraft.world.phys.shapes.VoxelShape; + import net.minecraft.world.scores.PlayerTeam; + + public class Evoker extends SpellcasterIllager { ++ + @Nullable + private Sheep wololoTarget; + +@@ -54,21 +56,21 @@ + super.registerGoals(); + this.goalSelector.addGoal(0, new FloatGoal(this)); + this.goalSelector.addGoal(1, new Evoker.EvokerCastingSpellGoal()); +- this.goalSelector.addGoal(2, new AvoidEntityGoal<>(this, Player.class, 8.0F, 0.6, 1.0)); ++ this.goalSelector.addGoal(2, new AvoidEntityGoal<>(this, Player.class, 8.0F, 0.6D, 1.0D)); + this.goalSelector.addGoal(4, new Evoker.EvokerSummonSpellGoal()); + this.goalSelector.addGoal(5, new Evoker.EvokerAttackSpellGoal()); + this.goalSelector.addGoal(6, new Evoker.EvokerWololoSpellGoal()); +- this.goalSelector.addGoal(8, new RandomStrollGoal(this, 0.6)); ++ this.goalSelector.addGoal(8, new RandomStrollGoal(this, 0.6D)); + this.goalSelector.addGoal(9, new LookAtPlayerGoal(this, Player.class, 3.0F, 1.0F)); + this.goalSelector.addGoal(10, new LookAtPlayerGoal(this, Mob.class, 8.0F)); +- this.targetSelector.addGoal(1, new HurtByTargetGoal(this, Raider.class).setAlertOthers()); +- this.targetSelector.addGoal(2, new NearestAttackableTargetGoal<>(this, Player.class, true).setUnseenMemoryTicks(300)); +- this.targetSelector.addGoal(3, new NearestAttackableTargetGoal<>(this, AbstractVillager.class, false).setUnseenMemoryTicks(300)); ++ this.targetSelector.addGoal(1, (new HurtByTargetGoal(this, new Class[]{Raider.class})).setAlertOthers()); ++ this.targetSelector.addGoal(2, (new NearestAttackableTargetGoal<>(this, Player.class, true)).setUnseenMemoryTicks(300)); ++ this.targetSelector.addGoal(3, (new NearestAttackableTargetGoal<>(this, AbstractVillager.class, false)).setUnseenMemoryTicks(300)); + this.targetSelector.addGoal(3, new NearestAttackableTargetGoal<>(this, IronGolem.class, false)); + } + + public static AttributeSupplier.Builder createAttributes() { +- return Monster.createMonsterAttributes().add(Attributes.MOVEMENT_SPEED, 0.5).add(Attributes.FOLLOW_RANGE, 12.0).add(Attributes.MAX_HEALTH, 24.0); ++ return Monster.createMonsterAttributes().add(Attributes.MOVEMENT_SPEED, 0.5D).add(Attributes.FOLLOW_RANGE, 12.0D).add(Attributes.MAX_HEALTH, 24.0D); + } + + @Override +@@ -98,20 +100,7 @@ + + @Override + public boolean isAlliedTo(Entity entity) { +- if (entity == null) { +- return false; +- } else if (entity == this) { +- return true; +- } else if (super.isAlliedTo(entity)) { +- return true; +- } else { +- return entity instanceof Vex +- ? this.isAlliedTo(((Vex)entity).getOwner()) +- : entity instanceof LivingEntity +- && ((LivingEntity)entity).getMobType() == MobType.ILLAGER +- && this.getTeam() == null +- && entity.getTeam() == null; +- } ++ return entity == null ? false : (entity == this ? true : (super.isAlliedTo(entity) ? true : (entity instanceof Vex ? this.isAlliedTo((Entity) ((Vex) entity).getOwner()) : (entity instanceof LivingEntity && ((LivingEntity) entity).getMobType() == EnumMonsterType.ILLAGER ? this.getTeam() == null && entity.getTeam() == null : false)))); + } + + @Override +@@ -144,162 +133,192 @@ + } + + @Override +- public void applyRaidBuffs(int wave, boolean unusedFalse) { ++ public void applyRaidBuffs(int wave, boolean unusedFalse) {} ++ ++ private class EvokerCastingSpellGoal extends SpellcasterIllager.SpellcasterCastingSpellGoal { ++ ++ EvokerCastingSpellGoal() { ++ super(); ++ } ++ ++ @Override ++ public void tick() { ++ if (Evoker.this.getTarget() != null) { ++ Evoker.this.getLookControl().setLookAt(Evoker.this.getTarget(), (float) Evoker.this.getMaxHeadYRot(), (float) Evoker.this.getMaxHeadXRot()); ++ } else if (Evoker.this.getWololoTarget() != null) { ++ Evoker.this.getLookControl().setLookAt(Evoker.this.getWololoTarget(), (float) Evoker.this.getMaxHeadYRot(), (float) Evoker.this.getMaxHeadXRot()); ++ } ++ ++ } + } + +- class EvokerAttackSpellGoal extends SpellcasterIllager.SpellcasterUseSpellGoal { ++ private class EvokerSummonSpellGoal extends SpellcasterIllager.SpellcasterUseSpellGoal { ++ ++ private final TargetingConditions vexCountTargeting = TargetingConditions.forNonCombat().range(16.0D).ignoreLineOfSight().ignoreInvisibilityTesting(); ++ ++ EvokerSummonSpellGoal() { ++ super(); ++ } ++ + @Override ++ public boolean canUse() { ++ if (!super.canUse()) { ++ return false; ++ } else { ++ int i = Evoker.this.level().getNearbyEntities(Vex.class, this.vexCountTargeting, Evoker.this, Evoker.this.getBoundingBox().inflate(16.0D)).size(); ++ ++ return Evoker.this.random.nextInt(8) + 1 > i; ++ } ++ } ++ ++ @Override + protected int getCastingTime() { +- return 40; ++ return 100; + } + + @Override + protected int getCastingInterval() { +- return 100; ++ return 340; + } + + @Override + protected void performSpellCasting() { +- LivingEntity target = Evoker.this.getTarget(); +- double min = Math.min(target.getY(), Evoker.this.getY()); +- double d = Math.max(target.getY(), Evoker.this.getY()) + 1.0; +- float f = (float)Mth.atan2(target.getZ() - Evoker.this.getZ(), target.getX() - Evoker.this.getX()); +- if (Evoker.this.distanceToSqr(target) < 9.0) { +- for (int i = 0; i < 5; i++) { +- float f1 = f + (float)i * (float) Math.PI * 0.4F; +- this.createSpellEntity(Evoker.this.getX() + (double)Mth.cos(f1) * 1.5, Evoker.this.getZ() + (double)Mth.sin(f1) * 1.5, min, d, f1, 0); +- } ++ ServerLevel worldserver = (ServerLevel) Evoker.this.level(); ++ PlayerTeam scoreboardteam = Evoker.this.getTeam(); + +- for (int i = 0; i < 8; i++) { +- float f1 = f + (float)i * (float) Math.PI * 2.0F / 8.0F + (float) (Math.PI * 2.0 / 5.0); +- this.createSpellEntity(Evoker.this.getX() + (double)Mth.cos(f1) * 2.5, Evoker.this.getZ() + (double)Mth.sin(f1) * 2.5, min, d, f1, 3); +- } +- } else { +- for (int i = 0; i < 16; i++) { +- double d1 = 1.25 * (double)(i + 1); +- int i1 = 1 * i; +- this.createSpellEntity(Evoker.this.getX() + (double)Mth.cos(f) * d1, Evoker.this.getZ() + (double)Mth.sin(f) * d1, min, d, f, i1); +- } +- } +- } ++ for (int i = 0; i < 3; ++i) { ++ BlockPos blockposition = Evoker.this.blockPosition().offset(-2 + Evoker.this.random.nextInt(5), 1, -2 + Evoker.this.random.nextInt(5)); ++ Vex entityvex = (Vex) EntityType.VEX.create(Evoker.this.level()); + +- private void createSpellEntity(double x, double z, double minY, double maxY, float yRot, int warmupDelay) { +- BlockPos blockPos = BlockPos.containing(x, maxY, z); +- boolean flag = false; +- double d = 0.0; +- +- do { +- BlockPos blockPos1 = blockPos.below(); +- BlockState blockState = Evoker.this.level().getBlockState(blockPos1); +- if (blockState.isFaceSturdy(Evoker.this.level(), blockPos1, Direction.UP)) { +- if (!Evoker.this.level().isEmptyBlock(blockPos)) { +- BlockState blockState1 = Evoker.this.level().getBlockState(blockPos); +- VoxelShape collisionShape = blockState1.getCollisionShape(Evoker.this.level(), blockPos); +- if (!collisionShape.isEmpty()) { +- d = collisionShape.max(Direction.Axis.Y); +- } ++ if (entityvex != null) { ++ entityvex.moveTo(blockposition, 0.0F, 0.0F); ++ entityvex.finalizeSpawn(worldserver, Evoker.this.level().getCurrentDifficultyAt(blockposition), EnumMobSpawn.MOB_SUMMONED, (GroupDataEntity) null, (CompoundTag) null); ++ entityvex.setOwner(Evoker.this); ++ entityvex.setBoundOrigin(blockposition); ++ entityvex.setLimitedLife(20 * (30 + Evoker.this.random.nextInt(90))); ++ if (scoreboardteam != null) { ++ worldserver.getScoreboard().addPlayerToTeam(entityvex.getScoreboardName(), scoreboardteam); + } + +- flag = true; +- break; ++ worldserver.addFreshEntityWithPassengers(entityvex, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.SPELL); // CraftBukkit - Add SpawnReason ++ worldserver.gameEvent(GameEvent.ENTITY_PLACE, blockposition, GameEvent.Context.of((Entity) Evoker.this)); + } +- +- blockPos = blockPos.below(); +- } while (blockPos.getY() >= Mth.floor(minY) - 1); +- +- if (flag) { +- Evoker.this.level().addFreshEntity(new EvokerFangs(Evoker.this.level(), x, (double)blockPos.getY() + d, z, yRot, warmupDelay, Evoker.this)); +- Evoker.this.level().gameEvent(GameEvent.ENTITY_PLACE, new Vec3(x, (double)blockPos.getY() + d, z), GameEvent.Context.of(Evoker.this)); + } ++ + } + + @Override + protected SoundEvent getSpellPrepareSound() { +- return SoundEvents.EVOKER_PREPARE_ATTACK; ++ return SoundEvents.EVOKER_PREPARE_SUMMON; + } + + @Override + protected SpellcasterIllager.IllagerSpell getSpell() { +- return SpellcasterIllager.IllagerSpell.FANGS; ++ return SpellcasterIllager.IllagerSpell.SUMMON_VEX; + } + } + +- class EvokerCastingSpellGoal extends SpellcasterIllager.SpellcasterCastingSpellGoal { +- @Override +- public void tick() { +- if (Evoker.this.getTarget() != null) { +- Evoker.this.getLookControl().setLookAt(Evoker.this.getTarget(), (float)Evoker.this.getMaxHeadYRot(), (float)Evoker.this.getMaxHeadXRot()); +- } else if (Evoker.this.getWololoTarget() != null) { +- Evoker.this.getLookControl().setLookAt(Evoker.this.getWololoTarget(), (float)Evoker.this.getMaxHeadYRot(), (float)Evoker.this.getMaxHeadXRot()); +- } +- } +- } ++ private class EvokerAttackSpellGoal extends SpellcasterIllager.SpellcasterUseSpellGoal { + +- class EvokerSummonSpellGoal extends SpellcasterIllager.SpellcasterUseSpellGoal { +- private final TargetingConditions vexCountTargeting = TargetingConditions.forNonCombat().range(16.0).ignoreLineOfSight().ignoreInvisibilityTesting(); +- +- @Override +- public boolean canUse() { +- if (!super.canUse()) { +- return false; +- } else { +- int size = Evoker.this.level() +- .getNearbyEntities(Vex.class, this.vexCountTargeting, Evoker.this, Evoker.this.getBoundingBox().inflate(16.0)) +- .size(); +- return Evoker.this.random.nextInt(8) + 1 > size; +- } ++ EvokerAttackSpellGoal() { ++ super(); + } + + @Override + protected int getCastingTime() { +- return 100; ++ return 40; + } + + @Override + protected int getCastingInterval() { +- return 340; ++ return 100; + } + + @Override + protected void performSpellCasting() { +- ServerLevel serverLevel = (ServerLevel)Evoker.this.level(); +- PlayerTeam team = Evoker.this.getTeam(); ++ LivingEntity entityliving = Evoker.this.getTarget(); ++ double d0 = Math.min(entityliving.getY(), Evoker.this.getY()); ++ double d1 = Math.max(entityliving.getY(), Evoker.this.getY()) + 1.0D; ++ float f = (float) Mth.atan2(entityliving.getZ() - Evoker.this.getZ(), entityliving.getX() - Evoker.this.getX()); ++ int i; + +- for (int i = 0; i < 3; i++) { +- BlockPos blockPos = Evoker.this.blockPosition().offset(-2 + Evoker.this.random.nextInt(5), 1, -2 + Evoker.this.random.nextInt(5)); +- Vex vex = EntityType.VEX.create(Evoker.this.level()); +- if (vex != null) { +- vex.moveTo(blockPos, 0.0F, 0.0F); +- vex.finalizeSpawn(serverLevel, Evoker.this.level().getCurrentDifficultyAt(blockPos), MobSpawnType.MOB_SUMMONED, null, null); +- vex.setOwner(Evoker.this); +- vex.setBoundOrigin(blockPos); +- vex.setLimitedLife(20 * (30 + Evoker.this.random.nextInt(90))); +- if (team != null) { +- serverLevel.getScoreboard().addPlayerToTeam(vex.getScoreboardName(), team); ++ if (Evoker.this.distanceToSqr((Entity) entityliving) < 9.0D) { ++ float f1; ++ ++ for (i = 0; i < 5; ++i) { ++ f1 = f + (float) i * 3.1415927F * 0.4F; ++ this.createSpellEntity(Evoker.this.getX() + (double) Mth.cos(f1) * 1.5D, Evoker.this.getZ() + (double) Mth.sin(f1) * 1.5D, d0, d1, f1, 0); ++ } ++ ++ for (i = 0; i < 8; ++i) { ++ f1 = f + (float) i * 3.1415927F * 2.0F / 8.0F + 1.2566371F; ++ this.createSpellEntity(Evoker.this.getX() + (double) Mth.cos(f1) * 2.5D, Evoker.this.getZ() + (double) Mth.sin(f1) * 2.5D, d0, d1, f1, 3); ++ } ++ } else { ++ for (i = 0; i < 16; ++i) { ++ double d2 = 1.25D * (double) (i + 1); ++ int j = 1 * i; ++ ++ this.createSpellEntity(Evoker.this.getX() + (double) Mth.cos(f) * d2, Evoker.this.getZ() + (double) Mth.sin(f) * d2, d0, d1, f, j); ++ } ++ } ++ ++ } ++ ++ private void createSpellEntity(double x, double d1, double z, double d3, float minY, int i) { ++ BlockPos blockposition = BlockPos.containing(x, d3, d1); ++ boolean flag = false; ++ double d4 = 0.0D; ++ ++ do { ++ BlockPos blockposition1 = blockposition.below(); ++ IBlockData iblockdata = Evoker.this.level().getBlockState(blockposition1); ++ ++ if (iblockdata.isFaceSturdy(Evoker.this.level(), blockposition1, Direction.UP)) { ++ if (!Evoker.this.level().isEmptyBlock(blockposition)) { ++ IBlockData iblockdata1 = Evoker.this.level().getBlockState(blockposition); ++ VoxelShape voxelshape = iblockdata1.getCollisionShape(Evoker.this.level(), blockposition); ++ ++ if (!voxelshape.isEmpty()) { ++ d4 = voxelshape.max(Direction.Axis.Y); ++ } + } + +- serverLevel.addFreshEntityWithPassengers(vex); +- serverLevel.gameEvent(GameEvent.ENTITY_PLACE, blockPos, GameEvent.Context.of(Evoker.this)); ++ flag = true; ++ break; + } ++ ++ blockposition = blockposition.below(); ++ } while (blockposition.getY() >= Mth.floor(z) - 1); ++ ++ if (flag) { ++ Evoker.this.level().addFreshEntity(new EvokerFangs(Evoker.this.level(), x, (double) blockposition.getY() + d4, d1, minY, i, Evoker.this)); ++ Evoker.this.level().gameEvent(GameEvent.ENTITY_PLACE, new Vec3(x, (double) blockposition.getY() + d4, d1), GameEvent.Context.of((Entity) Evoker.this)); + } ++ + } + + @Override + protected SoundEvent getSpellPrepareSound() { +- return SoundEvents.EVOKER_PREPARE_SUMMON; ++ return SoundEvents.EVOKER_PREPARE_ATTACK; + } + + @Override + protected SpellcasterIllager.IllagerSpell getSpell() { +- return SpellcasterIllager.IllagerSpell.SUMMON_VEX; ++ return SpellcasterIllager.IllagerSpell.FANGS; + } + } + + public class EvokerWololoSpellGoal extends SpellcasterIllager.SpellcasterUseSpellGoal { +- private final TargetingConditions wololoTargeting = TargetingConditions.forNonCombat() +- .range(16.0) +- .selector(entity -> ((Sheep)entity).getColor() == DyeColor.BLUE); + ++ private final TargetingConditions wololoTargeting = TargetingConditions.forNonCombat().range(16.0D).selector((entityliving) -> { ++ return ((Sheep) entityliving).getColor() == DyeColor.BLUE; ++ }); ++ ++ public EvokerWololoSpellGoal() { ++ super(); ++ } ++ + @Override + public boolean canUse() { + if (Evoker.this.getTarget() != null) { +@@ -311,12 +330,12 @@ + } else if (!Evoker.this.level().getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING)) { + return false; + } else { +- List<Sheep> nearbyEntities = Evoker.this.level() +- .getNearbyEntities(Sheep.class, this.wololoTargeting, Evoker.this, Evoker.this.getBoundingBox().inflate(16.0, 4.0, 16.0)); +- if (nearbyEntities.isEmpty()) { ++ List<Sheep> list = Evoker.this.level().getNearbyEntities(Sheep.class, this.wololoTargeting, Evoker.this, Evoker.this.getBoundingBox().inflate(16.0D, 4.0D, 16.0D)); ++ ++ if (list.isEmpty()) { + return false; + } else { +- Evoker.this.setWololoTarget(nearbyEntities.get(Evoker.this.random.nextInt(nearbyEntities.size()))); ++ Evoker.this.setWololoTarget((Sheep) list.get(Evoker.this.random.nextInt(list.size()))); + return true; + } + } +@@ -330,15 +349,17 @@ + @Override + public void stop() { + super.stop(); +- Evoker.this.setWololoTarget(null); ++ Evoker.this.setWololoTarget((Sheep) null); + } + + @Override + protected void performSpellCasting() { +- Sheep wololoTarget = Evoker.this.getWololoTarget(); +- if (wololoTarget != null && wololoTarget.isAlive()) { +- wololoTarget.setColor(DyeColor.RED); ++ Sheep entitysheep = Evoker.this.getWololoTarget(); ++ ++ if (entitysheep != null && entitysheep.isAlive()) { ++ entitysheep.setColor(DyeColor.RED); + } ++ + } + + @Override |