diff options
Diffstat (limited to 'patch-remap/mache-vineflower/net/minecraft/world/entity/monster/AbstractSkeleton.java.patch')
-rw-r--r-- | patch-remap/mache-vineflower/net/minecraft/world/entity/monster/AbstractSkeleton.java.patch | 238 |
1 files changed, 238 insertions, 0 deletions
diff --git a/patch-remap/mache-vineflower/net/minecraft/world/entity/monster/AbstractSkeleton.java.patch b/patch-remap/mache-vineflower/net/minecraft/world/entity/monster/AbstractSkeleton.java.patch new file mode 100644 index 0000000000..c20b81663c --- /dev/null +++ b/patch-remap/mache-vineflower/net/minecraft/world/entity/monster/AbstractSkeleton.java.patch @@ -0,0 +1,238 @@ +--- 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,11 +44,12 @@ + 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.0, 20, 15.0F); +- private final MeleeAttackGoal meleeGoal = new MeleeAttackGoal(this, 1.2, false) { ++ ++ private final RangedBowAttackGoal<AbstractSkeleton> bowGoal = new RangedBowAttackGoal<>(this, 1.0D, 20, 15.0F); ++ private final MeleeAttackGoal meleeGoal = new MeleeAttackGoal(this, 1.2D, false) { + @Override + public void stop() { + super.stop(); +@@ -70,51 +71,53 @@ + @Override + protected void registerGoals() { + this.goalSelector.addGoal(2, new RestrictSunGoal(this)); +- this.goalSelector.addGoal(3, new FleeSunGoal(this, 1.0)); +- this.goalSelector.addGoal(3, new AvoidEntityGoal<>(this, Wolf.class, 6.0F, 1.0, 1.2)); +- this.goalSelector.addGoal(5, new WaterAvoidingRandomStrollGoal(this, 1.0)); ++ this.goalSelector.addGoal(3, new FleeSunGoal(this, 1.0D)); ++ this.goalSelector.addGoal(3, new AvoidEntityGoal<>(this, Wolf.class, 6.0F, 1.0D, 1.2D)); ++ this.goalSelector.addGoal(5, new WaterAvoidingRandomStrollGoal(this, 1.0D)); + this.goalSelector.addGoal(6, new LookAtPlayerGoal(this, Player.class, 8.0F)); + this.goalSelector.addGoal(6, new RandomLookAroundGoal(this)); +- this.targetSelector.addGoal(1, new HurtByTargetGoal(this)); ++ this.targetSelector.addGoal(1, new HurtByTargetGoal(this, new Class[0])); + this.targetSelector.addGoal(2, new NearestAttackableTargetGoal<>(this, Player.class, true)); + this.targetSelector.addGoal(3, new NearestAttackableTargetGoal<>(this, IronGolem.class, true)); + this.targetSelector.addGoal(3, new NearestAttackableTargetGoal<>(this, Turtle.class, 10, true, false, Turtle.BABY_ON_LAND_SELECTOR)); + } + + public static AttributeSupplier.Builder createAttributes() { +- return Monster.createMonsterAttributes().add(Attributes.MOVEMENT_SPEED, 0.25); ++ return Monster.createMonsterAttributes().add(Attributes.MOVEMENT_SPEED, 0.25D); + } + + @Override +- protected void playStepSound(BlockPos pos, BlockState block) { ++ protected void playStepSound(BlockPos pos, IBlockData block) { + this.playSound(this.getStepSound(), 0.15F, 1.0F); + } + + abstract SoundEvent getStepSound(); + + @Override +- public MobType getMobType() { +- return MobType.UNDEAD; ++ public EnumMonsterType getMobType() { ++ return EnumMonsterType.UNDEAD; + } + + @Override + public void aiStep() { +- boolean isSunBurnTick = this.isSunBurnTick(); +- if (isSunBurnTick) { +- ItemStack itemBySlot = this.getItemBySlot(EquipmentSlot.HEAD); +- if (!itemBySlot.isEmpty()) { +- if (itemBySlot.isDamageableItem()) { +- itemBySlot.setDamageValue(itemBySlot.getDamageValue() + this.random.nextInt(2)); +- if (itemBySlot.getDamageValue() >= itemBySlot.getMaxDamage()) { ++ boolean flag = this.isSunBurnTick(); ++ ++ if (flag) { ++ ItemStack itemstack = this.getItemBySlot(EquipmentSlot.HEAD); ++ ++ if (!itemstack.isEmpty()) { ++ if (itemstack.isDamageableItem()) { ++ itemstack.setDamageValue(itemstack.getDamageValue() + this.random.nextInt(2)); ++ if (itemstack.getDamageValue() >= itemstack.getMaxDamage()) { + this.broadcastBreakEvent(EquipmentSlot.HEAD); + this.setItemSlot(EquipmentSlot.HEAD, ItemStack.EMPTY); + } + } + +- isSunBurnTick = false; ++ flag = false; + } + +- if (isSunBurnTick) { ++ if (flag) { + this.setSecondsOnFire(8); + } + } +@@ -125,9 +128,14 @@ + @Override + public void rideTick() { + super.rideTick(); +- if (this.getControlledVehicle() instanceof PathfinderMob pathfinderMob) { +- this.yBodyRot = pathfinderMob.yBodyRot; ++ Entity entity = this.getControlledVehicle(); ++ ++ if (entity instanceof PathfinderMob) { ++ PathfinderMob entitycreature = (PathfinderMob) entity; ++ ++ this.yBodyRot = entitycreature.yBodyRot; + } ++ + } + + @Override +@@ -138,58 +146,73 @@ + + @Nullable + @Override +- public SpawnGroupData finalizeSpawn( +- ServerLevelAccessor level, DifficultyInstance difficulty, MobSpawnType reason, @Nullable SpawnGroupData spawnData, @Nullable CompoundTag dataTag +- ) { +- SpawnGroupData var10 = super.finalizeSpawn(level, difficulty, reason, spawnData, dataTag); +- RandomSource random = level.getRandom(); +- this.populateDefaultEquipmentSlots(random, difficulty); +- this.populateDefaultEquipmentEnchantments(random, difficulty); ++ 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, difficulty); ++ this.populateDefaultEquipmentEnchantments(randomsource, difficulty); + this.reassessWeaponGoal(); +- this.setCanPickUpLoot(random.nextFloat() < 0.55F * difficulty.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); +- int i1 = localDate.get(ChronoField.MONTH_OF_YEAR); +- if (i1 == 10 && i == 31 && random.nextFloat() < 0.25F) { +- this.setItemSlot(EquipmentSlot.HEAD, new ItemStack(random.nextFloat() < 0.1F ? Blocks.JACK_O_LANTERN : Blocks.CARVED_PUMPKIN)); ++ LocalDate localdate = LocalDate.now(); ++ int i = localdate.get(ChronoField.DAY_OF_MONTH); ++ int j = localdate.get(ChronoField.MONTH_OF_YEAR); ++ ++ if (j == 10 && i == 31 && randomsource.nextFloat() < 0.25F) { ++ this.setItemSlot(EquipmentSlot.HEAD, new ItemStack(randomsource.nextFloat() < 0.1F ? Blocks.JACK_O_LANTERN : Blocks.CARVED_PUMPKIN)); + this.armorDropChances[EquipmentSlot.HEAD.getIndex()] = 0.0F; + } + } + +- return var10; ++ return spawnData; + } + + public void reassessWeaponGoal() { + if (this.level() != null && !this.level().isClientSide) { + this.goalSelector.removeGoal(this.meleeGoal); + this.goalSelector.removeGoal(this.bowGoal); +- ItemStack itemInHand = this.getItemInHand(ProjectileUtil.getWeaponHoldingHand(this, Items.BOW)); +- if (itemInHand.is(Items.BOW)) { +- int i = 20; ++ ItemStack itemstack = this.getItemInHand(ProjectileUtil.getWeaponHoldingHand(this, Items.BOW)); ++ ++ if (itemstack.is(Items.BOW)) { ++ byte b0 = 20; ++ + if (this.level().getDifficulty() != Difficulty.HARD) { +- i = 40; ++ b0 = 40; + } + +- this.bowGoal.setMinAttackInterval(i); ++ this.bowGoal.setMinAttackInterval(b0); + this.goalSelector.addGoal(4, this.bowGoal); + } else { + this.goalSelector.addGoal(4, this.meleeGoal); + } ++ + } + } + + @Override + public void performRangedAttack(LivingEntity target, float distanceFactor) { +- ItemStack projectile = this.getProjectile(this.getItemInHand(ProjectileUtil.getWeaponHoldingHand(this, Items.BOW))); +- AbstractArrow arrow = this.getArrow(projectile, distanceFactor); +- double d = target.getX() - this.getX(); +- double d1 = target.getY(0.3333333333333333) - arrow.getY(); ++ ItemStack itemstack = this.getProjectile(this.getItemInHand(ProjectileUtil.getWeaponHoldingHand(this, Items.BOW))); ++ 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 squareRoot = Math.sqrt(d * d + d2 * d2); +- arrow.shoot(d, d1 + squareRoot * 0.2F, d2, 1.6F, (float)(14 - this.level().getDifficulty().getId() * 4)); ++ double d3 = Math.sqrt(d0 * d0 + d2 * d2); ++ ++ 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(arrow); ++ // this.level().addFreshEntity(entityarrow); // CraftBukkit - moved up + } + + protected AbstractArrow getArrow(ItemStack arrowStack, float velocity) { +@@ -213,10 +236,11 @@ + if (!this.level().isClientSide) { + this.reassessWeaponGoal(); + } ++ + } + + @Override +- protected float getStandingEyeHeight(Pose pose, EntityDimensions size) { ++ protected float getStandingEyeHeight(EntityPose pose, EntityDimensions size) { + return 1.74F; + } + |