aboutsummaryrefslogtreecommitdiffhomepage
path: root/patch-remap/mache-spigotflower/net/minecraft/world/entity/monster/Silverfish.java.patch
diff options
context:
space:
mode:
Diffstat (limited to 'patch-remap/mache-spigotflower/net/minecraft/world/entity/monster/Silverfish.java.patch')
-rw-r--r--patch-remap/mache-spigotflower/net/minecraft/world/entity/monster/Silverfish.java.patch270
1 files changed, 270 insertions, 0 deletions
diff --git a/patch-remap/mache-spigotflower/net/minecraft/world/entity/monster/Silverfish.java.patch b/patch-remap/mache-spigotflower/net/minecraft/world/entity/monster/Silverfish.java.patch
new file mode 100644
index 0000000000..5049a1156e
--- /dev/null
+++ b/patch-remap/mache-spigotflower/net/minecraft/world/entity/monster/Silverfish.java.patch
@@ -0,0 +1,270 @@
+--- a/net/minecraft/world/entity/monster/Silverfish.java
++++ b/net/minecraft/world/entity/monster/Silverfish.java
+@@ -11,10 +11,10 @@
+ import net.minecraft.world.damagesource.DamageSource;
+ import net.minecraft.world.entity.Entity;
+ import net.minecraft.world.entity.EntityDimensions;
++import net.minecraft.world.entity.EntityPose;
+ import net.minecraft.world.entity.EntityType;
+-import net.minecraft.world.entity.MobSpawnType;
+-import net.minecraft.world.entity.MobType;
+-import net.minecraft.world.entity.Pose;
++import net.minecraft.world.entity.EnumMobSpawn;
++import net.minecraft.world.entity.EnumMonsterType;
+ import net.minecraft.world.entity.ai.attributes.AttributeSupplier;
+ import net.minecraft.world.entity.ai.attributes.Attributes;
+ import net.minecraft.world.entity.ai.goal.ClimbOnTopOfPowderSnowGoal;
+@@ -31,20 +31,23 @@
+ import net.minecraft.world.level.LevelReader;
+ import net.minecraft.world.level.block.Block;
+ import net.minecraft.world.level.block.InfestedBlock;
+-import net.minecraft.world.level.block.state.BlockState;
++import net.minecraft.world.level.block.state.IBlockData;
+ import org.joml.Vector3f;
+
++// CraftBukkit start
++import org.bukkit.craftbukkit.event.CraftEventFactory;
++// CraftBukkit end
++
+ public class Silverfish extends Monster {
+
+ @Nullable
+ private Silverfish.SilverfishWakeUpFriendsGoal friendsGoal;
+
+- public Silverfish(EntityType<? extends Silverfish> entitytype, Level level) {
+- super(entitytype, level);
++ public Silverfish(EntityType<? extends Silverfish> entityType, Level level) {
++ super(entityType, level);
+ }
+
+ @Override
+- @Override
+ protected void registerGoals() {
+ this.friendsGoal = new Silverfish.SilverfishWakeUpFriendsGoal(this);
+ this.goalSelector.addGoal(1, new FloatGoal(this));
+@@ -57,8 +60,7 @@
+ }
+
+ @Override
+- @Override
+- protected float getStandingEyeHeight(Pose pose, EntityDimensions entitydimensions) {
++ protected float getStandingEyeHeight(EntityPose pose, EntityDimensions size) {
+ return 0.13F;
+ }
+
+@@ -67,89 +69,78 @@
+ }
+
+ @Override
+- @Override
+ protected Entity.MovementEmission getMovementEmission() {
+ return Entity.MovementEmission.EVENTS;
+ }
+
+ @Override
+- @Override
+ protected SoundEvent getAmbientSound() {
+ return SoundEvents.SILVERFISH_AMBIENT;
+ }
+
+ @Override
+- @Override
+- protected SoundEvent getHurtSound(DamageSource damagesource) {
++ protected SoundEvent getHurtSound(DamageSource damageSource) {
+ return SoundEvents.SILVERFISH_HURT;
+ }
+
+ @Override
+- @Override
+ protected SoundEvent getDeathSound() {
+ return SoundEvents.SILVERFISH_DEATH;
+ }
+
+ @Override
+- @Override
+- protected void playStepSound(BlockPos blockpos, BlockState blockstate) {
++ protected void playStepSound(BlockPos pos, IBlockData block) {
+ this.playSound(SoundEvents.SILVERFISH_STEP, 0.15F, 1.0F);
+ }
+
+ @Override
+- @Override
+- public boolean hurt(DamageSource damagesource, float f) {
+- if (this.isInvulnerableTo(damagesource)) {
++ public boolean hurt(DamageSource source, float amount) {
++ if (this.isInvulnerableTo(source)) {
+ return false;
+ } else {
+- if ((damagesource.getEntity() != null || damagesource.is(DamageTypeTags.ALWAYS_TRIGGERS_SILVERFISH)) && this.friendsGoal != null) {
++ if ((source.getEntity() != null || source.is(DamageTypeTags.ALWAYS_TRIGGERS_SILVERFISH)) && this.friendsGoal != null) {
+ this.friendsGoal.notifyHurt();
+ }
+
+- return super.hurt(damagesource, f);
++ return super.hurt(source, amount);
+ }
+ }
+
+ @Override
+- @Override
+ public void tick() {
+ this.yBodyRot = this.getYRot();
+ super.tick();
+ }
+
+ @Override
+- @Override
+- public void setYBodyRot(float f) {
+- this.setYRot(f);
+- super.setYBodyRot(f);
++ public void setYBodyRot(float offset) {
++ this.setYRot(offset);
++ super.setYBodyRot(offset);
+ }
+
+ @Override
+- @Override
+- public float getWalkTargetValue(BlockPos blockpos, LevelReader levelreader) {
+- return InfestedBlock.isCompatibleHostBlock(levelreader.getBlockState(blockpos.below())) ? 10.0F : super.getWalkTargetValue(blockpos, levelreader);
++ public float getWalkTargetValue(BlockPos pos, LevelReader level) {
++ return InfestedBlock.isCompatibleHostBlock(level.getBlockState(pos.below())) ? 10.0F : super.getWalkTargetValue(pos, level);
+ }
+
+- public static boolean checkSilverfishSpawnRules(EntityType<Silverfish> entitytype, LevelAccessor levelaccessor, MobSpawnType mobspawntype, BlockPos blockpos, RandomSource randomsource) {
+- if (checkAnyLightMonsterSpawnRules(entitytype, levelaccessor, mobspawntype, blockpos, randomsource)) {
+- Player player = levelaccessor.getNearestPlayer((double) blockpos.getX() + 0.5D, (double) blockpos.getY() + 0.5D, (double) blockpos.getZ() + 0.5D, 5.0D, true);
++ public static boolean checkSilverfishSpawnRules(EntityType<Silverfish> silverfish, LevelAccessor level, EnumMobSpawn spawnType, BlockPos pos, RandomSource random) {
++ if (checkAnyLightMonsterSpawnRules(silverfish, level, spawnType, pos, random)) {
++ Player entityhuman = level.getNearestPlayer((double) pos.getX() + 0.5D, (double) pos.getY() + 0.5D, (double) pos.getZ() + 0.5D, 5.0D, true);
+
+- return player == null;
++ return entityhuman == null;
+ } else {
+ return false;
+ }
+ }
+
+ @Override
+- @Override
+- public MobType getMobType() {
+- return MobType.ARTHROPOD;
++ public EnumMonsterType getMobType() {
++ return EnumMonsterType.ARTHROPOD;
+ }
+
+ @Override
+- @Override
+- protected Vector3f getPassengerAttachmentPoint(Entity entity, EntityDimensions entitydimensions, float f) {
+- return new Vector3f(0.0F, entitydimensions.height - 0.0625F * f, 0.0F);
++ protected Vector3f getPassengerAttachmentPoint(Entity entity, EntityDimensions entitysize, float f) {
++ return new Vector3f(0.0F, entitysize.height - 0.0625F * f, 0.0F);
+ }
+
+ private static class SilverfishWakeUpFriendsGoal extends Goal {
+@@ -169,32 +160,35 @@
+ }
+
+ @Override
+- @Override
+ public boolean canUse() {
+ return this.lookForFriends > 0;
+ }
+
+ @Override
+- @Override
+ public void tick() {
+ --this.lookForFriends;
+ if (this.lookForFriends <= 0) {
+- Level level = this.silverfish.level();
++ Level world = this.silverfish.level();
+ RandomSource randomsource = this.silverfish.getRandom();
+- BlockPos blockpos = this.silverfish.blockPosition();
++ BlockPos blockposition = this.silverfish.blockPosition();
+
+ for (int i = 0; i <= 5 && i >= -5; i = (i <= 0 ? 1 : 0) - i) {
+ for (int j = 0; j <= 10 && j >= -10; j = (j <= 0 ? 1 : 0) - j) {
+ for (int k = 0; k <= 10 && k >= -10; k = (k <= 0 ? 1 : 0) - k) {
+- BlockPos blockpos1 = blockpos.offset(j, i, k);
+- BlockState blockstate = level.getBlockState(blockpos1);
+- Block block = blockstate.getBlock();
++ BlockPos blockposition1 = blockposition.offset(j, i, k);
++ IBlockData iblockdata = world.getBlockState(blockposition1);
++ Block block = iblockdata.getBlock();
+
+ if (block instanceof InfestedBlock) {
+- if (level.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING)) {
+- level.destroyBlock(blockpos1, true, this.silverfish);
++ // CraftBukkit start
++ if (!CraftEventFactory.callEntityChangeBlockEvent(this.silverfish, blockposition1, net.minecraft.world.level.block.Blocks.AIR.defaultBlockState())) {
++ continue;
++ }
++ // CraftBukkit end
++ if (world.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING)) {
++ world.destroyBlock(blockposition1, true, this.silverfish);
+ } else {
+- level.setBlock(blockpos1, ((InfestedBlock) block).hostStateByInfested(level.getBlockState(blockpos1)), 3);
++ world.setBlock(blockposition1, ((InfestedBlock) block).hostStateByInfested(world.getBlockState(blockposition1)), 3);
+ }
+
+ if (randomsource.nextBoolean()) {
+@@ -217,11 +211,10 @@
+
+ public SilverfishMergeWithStoneGoal(Silverfish silverfish) {
+ super(silverfish, 1.0D, 10);
+- this.setFlags(EnumSet.of(Goal.Flag.MOVE));
++ this.setFlags(EnumSet.of(Goal.Type.MOVE));
+ }
+
+ @Override
+- @Override
+ public boolean canUse() {
+ if (this.mob.getTarget() != null) {
+ return false;
+@@ -232,10 +225,10 @@
+
+ if (this.mob.level().getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING) && randomsource.nextInt(reducedTickDelay(10)) == 0) {
+ this.selectedDirection = Direction.getRandom(randomsource);
+- BlockPos blockpos = BlockPos.containing(this.mob.getX(), this.mob.getY() + 0.5D, this.mob.getZ()).relative(this.selectedDirection);
+- BlockState blockstate = this.mob.level().getBlockState(blockpos);
++ BlockPos blockposition = BlockPos.containing(this.mob.getX(), this.mob.getY() + 0.5D, this.mob.getZ()).relative(this.selectedDirection);
++ IBlockData iblockdata = this.mob.level().getBlockState(blockposition);
+
+- if (InfestedBlock.isCompatibleHostBlock(blockstate)) {
++ if (InfestedBlock.isCompatibleHostBlock(iblockdata)) {
+ this.doMerge = true;
+ return true;
+ }
+@@ -247,23 +240,26 @@
+ }
+
+ @Override
+- @Override
+ public boolean canContinueToUse() {
+ return this.doMerge ? false : super.canContinueToUse();
+ }
+
+ @Override
+- @Override
+ public void start() {
+ if (!this.doMerge) {
+ super.start();
+ } else {
+- Level level = this.mob.level();
+- BlockPos blockpos = BlockPos.containing(this.mob.getX(), this.mob.getY() + 0.5D, this.mob.getZ()).relative(this.selectedDirection);
+- BlockState blockstate = level.getBlockState(blockpos);
++ Level world = this.mob.level();
++ BlockPos blockposition = BlockPos.containing(this.mob.getX(), this.mob.getY() + 0.5D, this.mob.getZ()).relative(this.selectedDirection);
++ IBlockData iblockdata = world.getBlockState(blockposition);
+
+- if (InfestedBlock.isCompatibleHostBlock(blockstate)) {
+- level.setBlock(blockpos, InfestedBlock.infestedStateByHost(blockstate), 3);
++ if (InfestedBlock.isCompatibleHostBlock(iblockdata)) {
++ // CraftBukkit start
++ if (!CraftEventFactory.callEntityChangeBlockEvent(this.mob, blockposition, InfestedBlock.infestedStateByHost(iblockdata))) {
++ return;
++ }
++ // CraftBukkit end
++ world.setBlock(blockposition, InfestedBlock.infestedStateByHost(iblockdata), 3);
+ this.mob.spawnAnim();
+ this.mob.discard();
+ }