diff options
Diffstat (limited to 'patch-remap/mache-spigotflower/net/minecraft/world/entity/monster/AbstractSkeleton.java.patch')
-rw-r--r-- | patch-remap/mache-spigotflower/net/minecraft/world/entity/monster/AbstractSkeleton.java.patch | 224 |
1 files changed, 224 insertions, 0 deletions
diff --git a/patch-remap/mache-spigotflower/net/minecraft/world/entity/monster/AbstractSkeleton.java.patch b/patch-remap/mache-spigotflower/net/minecraft/world/entity/monster/AbstractSkeleton.java.patch new file mode 100644 index 0000000000..c6647fe81c --- /dev/null +++ b/patch-remap/mache-spigotflower/net/minecraft/world/entity/monster/AbstractSkeleton.java.patch @@ -0,0 +1,224 @@ +--- a/net/minecraft/world/entity/monster/AbstractSkeleton.java ++++ b/net/minecraft/world/entity/monster/AbstractSkeleton.java +@@ -12,14 +12,14 @@ + import net.minecraft.world.DifficultyInstance; + 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.EnumMobSpawn; ++import net.minecraft.world.entity.EnumMonsterType; + 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.MobType; + import net.minecraft.world.entity.PathfinderMob; +-import net.minecraft.world.entity.Pose; +-import net.minecraft.world.entity.SpawnGroupData; + import net.minecraft.world.entity.ai.attributes.AttributeSupplier; + import net.minecraft.world.entity.ai.attributes.Attributes; + import net.minecraft.world.entity.ai.goal.AvoidEntityGoal; +@@ -44,34 +44,31 @@ + import net.minecraft.world.level.Level; + import net.minecraft.world.level.ServerLevelAccessor; + import net.minecraft.world.level.block.Blocks; +-import net.minecraft.world.level.block.state.BlockState; ++import net.minecraft.world.level.block.state.IBlockData; + + public abstract class AbstractSkeleton extends Monster implements RangedAttackMob { + + private final RangedBowAttackGoal<AbstractSkeleton> bowGoal = new RangedBowAttackGoal<>(this, 1.0D, 20, 15.0F); + private final MeleeAttackGoal meleeGoal = new MeleeAttackGoal(this, 1.2D, false) { + @Override +- @Override + public void stop() { + super.stop(); + AbstractSkeleton.this.setAggressive(false); + } + + @Override +- @Override + public void start() { + super.start(); + AbstractSkeleton.this.setAggressive(true); + } + }; + +- protected AbstractSkeleton(EntityType<? extends AbstractSkeleton> entitytype, Level level) { +- super(entitytype, level); ++ protected AbstractSkeleton(EntityType<? extends AbstractSkeleton> entityType, Level level) { ++ super(entityType, level); + this.reassessWeaponGoal(); + } + + @Override +- @Override + protected void registerGoals() { + this.goalSelector.addGoal(2, new RestrictSunGoal(this)); + this.goalSelector.addGoal(3, new FleeSunGoal(this, 1.0D)); +@@ -90,21 +87,18 @@ + } + + @Override +- @Override +- protected void playStepSound(BlockPos blockpos, BlockState blockstate) { ++ protected void playStepSound(BlockPos pos, IBlockData block) { + this.playSound(this.getStepSound(), 0.15F, 1.0F); + } + + abstract SoundEvent getStepSound(); + + @Override +- @Override +- public MobType getMobType() { +- return MobType.UNDEAD; ++ public EnumMonsterType getMobType() { ++ return EnumMonsterType.UNDEAD; + } + + @Override +- @Override + public void aiStep() { + boolean flag = this.isSunBurnTick(); + +@@ -132,37 +126,34 @@ + } + + @Override +- @Override + public void rideTick() { + super.rideTick(); + Entity entity = this.getControlledVehicle(); + + if (entity instanceof PathfinderMob) { +- PathfinderMob pathfindermob = (PathfinderMob) entity; ++ PathfinderMob entitycreature = (PathfinderMob) entity; + +- this.yBodyRot = pathfindermob.yBodyRot; ++ this.yBodyRot = entitycreature.yBodyRot; + } + + } + + @Override +- @Override +- protected void populateDefaultEquipmentSlots(RandomSource randomsource, DifficultyInstance difficultyinstance) { +- super.populateDefaultEquipmentSlots(randomsource, difficultyinstance); ++ protected void populateDefaultEquipmentSlots(RandomSource random, DifficultyInstance difficulty) { ++ super.populateDefaultEquipmentSlots(random, difficulty); + this.setItemSlot(EquipmentSlot.MAINHAND, new ItemStack(Items.BOW)); + } + + @Nullable + @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); +- RandomSource randomsource = serverlevelaccessor.getRandom(); ++ public GroupDataEntity finalizeSpawn(ServerLevelAccessor level, DifficultyInstance difficulty, EnumMobSpawn reason, @Nullable GroupDataEntity spawnData, @Nullable CompoundTag dataTag) { ++ spawnData = super.finalizeSpawn(level, difficulty, reason, spawnData, dataTag); ++ RandomSource randomsource = level.getRandom(); + +- this.populateDefaultEquipmentSlots(randomsource, difficultyinstance); +- this.populateDefaultEquipmentEnchantments(randomsource, difficultyinstance); ++ this.populateDefaultEquipmentSlots(randomsource, difficulty); ++ this.populateDefaultEquipmentEnchantments(randomsource, difficulty); + this.reassessWeaponGoal(); +- this.setCanPickUpLoot(randomsource.nextFloat() < 0.55F * difficultyinstance.getSpecialMultiplier()); ++ this.setCanPickUpLoot(randomsource.nextFloat() < 0.55F * difficulty.getSpecialMultiplier()); + if (this.getItemBySlot(EquipmentSlot.HEAD).isEmpty()) { + LocalDate localdate = LocalDate.now(); + int i = localdate.get(ChronoField.DAY_OF_MONTH); +@@ -174,7 +165,7 @@ + } + } + +- return spawngroupdata; ++ return spawnData; + } + + public void reassessWeaponGoal() { +@@ -200,41 +191,48 @@ + } + + @Override +- @Override +- public void performRangedAttack(LivingEntity livingentity, float f) { ++ public void performRangedAttack(LivingEntity target, float distanceFactor) { + ItemStack itemstack = this.getProjectile(this.getItemInHand(ProjectileUtil.getWeaponHoldingHand(this, Items.BOW))); +- AbstractArrow abstractarrow = this.getArrow(itemstack, f); +- double d0 = livingentity.getX() - this.getX(); +- double d1 = livingentity.getY(0.3333333333333333D) - abstractarrow.getY(); +- double d2 = livingentity.getZ() - this.getZ(); ++ AbstractArrow entityarrow = this.getArrow(itemstack, distanceFactor); ++ double d0 = target.getX() - this.getX(); ++ double d1 = target.getY(0.3333333333333333D) - entityarrow.getY(); ++ double d2 = target.getZ() - this.getZ(); + double d3 = Math.sqrt(d0 * d0 + d2 * d2); + +- abstractarrow.shoot(d0, d1 + d3 * 0.20000000298023224D, d2, 1.6F, (float) (14 - this.level().getDifficulty().getId() * 4)); ++ entityarrow.shoot(d0, d1 + d3 * 0.20000000298023224D, d2, 1.6F, (float) (14 - this.level().getDifficulty().getId() * 4)); ++ // CraftBukkit start ++ org.bukkit.event.entity.EntityShootBowEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.callEntityShootBowEvent(this, this.getMainHandItem(), null, entityarrow, net.minecraft.world.EnumHand.MAIN_HAND, 0.8F, true); ++ if (event.isCancelled()) { ++ event.getProjectile().remove(); ++ return; ++ } ++ ++ if (event.getProjectile() == entityarrow.getBukkitEntity()) { ++ this.level().addFreshEntity(entityarrow); ++ } ++ // CraftBukkit end + this.playSound(SoundEvents.SKELETON_SHOOT, 1.0F, 1.0F / (this.getRandom().nextFloat() * 0.4F + 0.8F)); +- this.level().addFreshEntity(abstractarrow); ++ // this.level().addFreshEntity(entityarrow); // CraftBukkit - moved up + } + +- protected AbstractArrow getArrow(ItemStack itemstack, float f) { +- return ProjectileUtil.getMobArrow(this, itemstack, f); ++ protected AbstractArrow getArrow(ItemStack arrowStack, float velocity) { ++ return ProjectileUtil.getMobArrow(this, arrowStack, velocity); + } + + @Override +- @Override +- public boolean canFireProjectileWeapon(ProjectileWeaponItem projectileweaponitem) { +- return projectileweaponitem == Items.BOW; ++ public boolean canFireProjectileWeapon(ProjectileWeaponItem projectileWeapon) { ++ return projectileWeapon == Items.BOW; + } + + @Override +- @Override +- public void readAdditionalSaveData(CompoundTag compoundtag) { +- super.readAdditionalSaveData(compoundtag); ++ public void readAdditionalSaveData(CompoundTag compound) { ++ super.readAdditionalSaveData(compound); + this.reassessWeaponGoal(); + } + + @Override +- @Override +- public void setItemSlot(EquipmentSlot equipmentslot, ItemStack itemstack) { +- super.setItemSlot(equipmentslot, itemstack); ++ public void setItemSlot(EquipmentSlot slot, ItemStack stack) { ++ super.setItemSlot(slot, stack); + if (!this.level().isClientSide) { + this.reassessWeaponGoal(); + } +@@ -242,13 +240,11 @@ + } + + @Override +- @Override +- protected float getStandingEyeHeight(Pose pose, EntityDimensions entitydimensions) { ++ protected float getStandingEyeHeight(EntityPose pose, EntityDimensions size) { + return 1.74F; + } + + @Override +- @Override + protected float ridingOffset(Entity entity) { + return -0.7F; + } |