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-spigotflower/net/minecraft/world/entity/monster/ZombifiedPiglin.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-spigotflower/net/minecraft/world/entity/monster/ZombifiedPiglin.java.patch')
-rw-r--r-- | patch-remap/mache-spigotflower/net/minecraft/world/entity/monster/ZombifiedPiglin.java.patch | 259 |
1 files changed, 259 insertions, 0 deletions
diff --git a/patch-remap/mache-spigotflower/net/minecraft/world/entity/monster/ZombifiedPiglin.java.patch b/patch-remap/mache-spigotflower/net/minecraft/world/entity/monster/ZombifiedPiglin.java.patch new file mode 100644 index 0000000000..c9954f35e0 --- /dev/null +++ b/patch-remap/mache-spigotflower/net/minecraft/world/entity/monster/ZombifiedPiglin.java.patch @@ -0,0 +1,259 @@ +--- a/net/minecraft/world/entity/monster/ZombifiedPiglin.java ++++ b/net/minecraft/world/entity/monster/ZombifiedPiglin.java +@@ -15,13 +15,13 @@ + 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.EntitySelector; + import net.minecraft.world.entity.EntityType; ++import net.minecraft.world.entity.EnumMobSpawn; + import net.minecraft.world.entity.EquipmentSlot; + import net.minecraft.world.entity.LivingEntity; +-import net.minecraft.world.entity.MobSpawnType; + import net.minecraft.world.entity.NeutralMob; +-import net.minecraft.world.entity.Pose; + import net.minecraft.world.entity.ai.attributes.AttributeInstance; + import net.minecraft.world.entity.ai.attributes.AttributeModifier; + import net.minecraft.world.entity.ai.attributes.AttributeSupplier; +@@ -58,19 +58,17 @@ + private static final float ZOMBIFIED_PIGLIN_EYE_HEIGHT = 1.79F; + private static final float ZOMBIFIED_PIGLIN_BABY_EYE_HEIGHT_ADJUSTMENT = 0.82F; + +- public ZombifiedPiglin(EntityType<? extends ZombifiedPiglin> entitytype, Level level) { +- super(entitytype, level); ++ public ZombifiedPiglin(EntityType<? extends ZombifiedPiglin> entityType, Level level) { ++ super(entityType, level); + this.setPathfindingMalus(BlockPathTypes.LAVA, 8.0F); + } + + @Override +- @Override +- public void setPersistentAngerTarget(@Nullable UUID uuid) { +- this.persistentAngerTarget = uuid; ++ public void setPersistentAngerTarget(@Nullable UUID target) { ++ this.persistentAngerTarget = target; + } + + @Override +- @Override + protected void addBehaviourGoals() { + this.goalSelector.addGoal(2, new ZombieAttackGoal(this, 1.0D, false)); + this.goalSelector.addGoal(7, new WaterAvoidingRandomStrollGoal(this, 1.0D)); +@@ -84,30 +82,27 @@ + } + + @Override +- @Override +- protected float getStandingEyeHeight(Pose pose, EntityDimensions entitydimensions) { ++ protected float getStandingEyeHeight(EntityPose pose, EntityDimensions size) { + return this.isBaby() ? 0.96999997F : 1.79F; + } + + @Override +- @Override + protected boolean convertsInWater() { + return false; + } + + @Override +- @Override + protected void customServerAiStep() { +- AttributeInstance attributeinstance = this.getAttribute(Attributes.MOVEMENT_SPEED); ++ AttributeInstance attributemodifiable = this.getAttribute(Attributes.MOVEMENT_SPEED); + + if (this.isAngry()) { +- if (!this.isBaby() && !attributeinstance.hasModifier(ZombifiedPiglin.SPEED_MODIFIER_ATTACKING)) { +- attributeinstance.addTransientModifier(ZombifiedPiglin.SPEED_MODIFIER_ATTACKING); ++ if (!this.isBaby() && !attributemodifiable.hasModifier(ZombifiedPiglin.SPEED_MODIFIER_ATTACKING)) { ++ attributemodifiable.addTransientModifier(ZombifiedPiglin.SPEED_MODIFIER_ATTACKING); + } + + this.maybePlayFirstAngerSound(); +- } else if (attributeinstance.hasModifier(ZombifiedPiglin.SPEED_MODIFIER_ATTACKING)) { +- attributeinstance.removeModifier(ZombifiedPiglin.SPEED_MODIFIER_ATTACKING.getId()); ++ } else if (attributemodifiable.hasModifier(ZombifiedPiglin.SPEED_MODIFIER_ATTACKING)) { ++ attributemodifiable.removeModifier(ZombifiedPiglin.SPEED_MODIFIER_ATTACKING.getId()); + } + + this.updatePersistentAnger((ServerLevel) this.level(), true); +@@ -146,16 +141,16 @@ + + private void alertOthers() { + double d0 = this.getAttributeValue(Attributes.FOLLOW_RANGE); +- AABB aabb = AABB.unitCubeFromLowerCorner(this.position()).inflate(d0, 10.0D, d0); ++ AABB axisalignedbb = AABB.unitCubeFromLowerCorner(this.position()).inflate(d0, 10.0D, d0); + +- this.level().getEntitiesOfClass(ZombifiedPiglin.class, aabb, EntitySelector.NO_SPECTATORS).stream().filter((zombifiedpiglin) -> { +- return zombifiedpiglin != this; +- }).filter((zombifiedpiglin) -> { +- return zombifiedpiglin.getTarget() == null; +- }).filter((zombifiedpiglin) -> { +- return !zombifiedpiglin.isAlliedTo((Entity) this.getTarget()); +- }).forEach((zombifiedpiglin) -> { +- zombifiedpiglin.setTarget(this.getTarget()); ++ this.level().getEntitiesOfClass(ZombifiedPiglin.class, axisalignedbb, EntitySelector.NO_SPECTATORS).stream().filter((entitypigzombie) -> { ++ return entitypigzombie != this; ++ }).filter((entitypigzombie) -> { ++ return entitypigzombie.getTarget() == null; ++ }).filter((entitypigzombie) -> { ++ return !entitypigzombie.isAlliedTo((Entity) this.getTarget()); ++ }).forEach((entitypigzombie) -> { ++ entitypigzombie.setTarget(this.getTarget(), org.bukkit.event.entity.EntityTargetEvent.TargetReason.TARGET_ATTACKED_NEARBY_ENTITY, true); // CraftBukkit + }); + } + +@@ -164,120 +159,112 @@ + } + + @Override +- @Override +- public void setTarget(@Nullable LivingEntity livingentity) { +- if (this.getTarget() == null && livingentity != null) { ++ public boolean setTarget(@Nullable LivingEntity entityliving, org.bukkit.event.entity.EntityTargetEvent.TargetReason reason, boolean fireEvent) { // CraftBukkit - signature ++ if (this.getTarget() == null && entityliving != null) { + this.playFirstAngerSoundIn = ZombifiedPiglin.FIRST_ANGER_SOUND_DELAY.sample(this.random); + this.ticksUntilNextAlert = ZombifiedPiglin.ALERT_INTERVAL.sample(this.random); + } + +- if (livingentity instanceof Player) { +- this.setLastHurtByPlayer((Player) livingentity); ++ if (entityliving instanceof Player) { ++ this.setLastHurtByPlayer((Player) entityliving); + } + +- super.setTarget(livingentity); ++ return super.setTarget(entityliving, reason, fireEvent); // CraftBukkit + } + + @Override +- @Override + public void startPersistentAngerTimer() { +- this.setRemainingPersistentAngerTime(ZombifiedPiglin.PERSISTENT_ANGER_TIME.sample(this.random)); ++ // CraftBukkit start ++ Entity entity = ((ServerLevel) this.level()).getEntity(getPersistentAngerTarget()); ++ org.bukkit.event.entity.PigZombieAngerEvent event = new org.bukkit.event.entity.PigZombieAngerEvent((org.bukkit.entity.PigZombie) this.getBukkitEntity(), (entity == null) ? null : entity.getBukkitEntity(), ZombifiedPiglin.PERSISTENT_ANGER_TIME.sample(this.random)); ++ this.level().getCraftServer().getPluginManager().callEvent(event); ++ if (event.isCancelled()) { ++ this.setPersistentAngerTarget(null); ++ return; ++ } ++ this.setRemainingPersistentAngerTime(event.getNewAnger()); ++ // CraftBukkit end + } + +- public static boolean checkZombifiedPiglinSpawnRules(EntityType<ZombifiedPiglin> entitytype, LevelAccessor levelaccessor, MobSpawnType mobspawntype, BlockPos blockpos, RandomSource randomsource) { +- return levelaccessor.getDifficulty() != Difficulty.PEACEFUL && !levelaccessor.getBlockState(blockpos.below()).is(Blocks.NETHER_WART_BLOCK); ++ public static boolean checkZombifiedPiglinSpawnRules(EntityType<ZombifiedPiglin> zombifiedPiglin, LevelAccessor level, EnumMobSpawn spawnType, BlockPos pos, RandomSource random) { ++ return level.getDifficulty() != Difficulty.PEACEFUL && !level.getBlockState(pos.below()).is(Blocks.NETHER_WART_BLOCK); + } + + @Override +- @Override +- public boolean checkSpawnObstruction(LevelReader levelreader) { +- return levelreader.isUnobstructed(this) && !levelreader.containsAnyLiquid(this.getBoundingBox()); ++ public boolean checkSpawnObstruction(LevelReader level) { ++ return level.isUnobstructed(this) && !level.containsAnyLiquid(this.getBoundingBox()); + } + + @Override +- @Override +- public void addAdditionalSaveData(CompoundTag compoundtag) { +- super.addAdditionalSaveData(compoundtag); +- this.addPersistentAngerSaveData(compoundtag); ++ public void addAdditionalSaveData(CompoundTag compound) { ++ super.addAdditionalSaveData(compound); ++ this.addPersistentAngerSaveData(compound); + } + + @Override +- @Override +- public void readAdditionalSaveData(CompoundTag compoundtag) { +- super.readAdditionalSaveData(compoundtag); +- this.readPersistentAngerSaveData(this.level(), compoundtag); ++ public void readAdditionalSaveData(CompoundTag compound) { ++ super.readAdditionalSaveData(compound); ++ this.readPersistentAngerSaveData(this.level(), compound); + } + + @Override +- @Override +- public void setRemainingPersistentAngerTime(int i) { +- this.remainingPersistentAngerTime = i; ++ public void setRemainingPersistentAngerTime(int time) { ++ this.remainingPersistentAngerTime = time; + } + + @Override +- @Override + public int getRemainingPersistentAngerTime() { + return this.remainingPersistentAngerTime; + } + + @Override +- @Override + protected SoundEvent getAmbientSound() { + return this.isAngry() ? SoundEvents.ZOMBIFIED_PIGLIN_ANGRY : SoundEvents.ZOMBIFIED_PIGLIN_AMBIENT; + } + + @Override +- @Override +- protected SoundEvent getHurtSound(DamageSource damagesource) { ++ protected SoundEvent getHurtSound(DamageSource damageSource) { + return SoundEvents.ZOMBIFIED_PIGLIN_HURT; + } + + @Override +- @Override + protected SoundEvent getDeathSound() { + return SoundEvents.ZOMBIFIED_PIGLIN_DEATH; + } + + @Override +- @Override +- protected void populateDefaultEquipmentSlots(RandomSource randomsource, DifficultyInstance difficultyinstance) { ++ protected void populateDefaultEquipmentSlots(RandomSource random, DifficultyInstance difficulty) { + this.setItemSlot(EquipmentSlot.MAINHAND, new ItemStack(Items.GOLDEN_SWORD)); + } + + @Override +- @Override + protected ItemStack getSkull() { + return ItemStack.EMPTY; + } + + @Override +- @Override + protected void randomizeReinforcementsChance() { + this.getAttribute(Attributes.SPAWN_REINFORCEMENTS_CHANCE).setBaseValue(0.0D); + } + + @Nullable + @Override +- @Override + public UUID getPersistentAngerTarget() { + return this.persistentAngerTarget; + } + + @Override +- @Override + public boolean isPreventingPlayerRest(Player player) { + return this.isAngryAt(player); + } + + @Override +- @Override +- public boolean wantsToPickUp(ItemStack itemstack) { +- return this.canHoldItem(itemstack); ++ public boolean wantsToPickUp(ItemStack stack) { ++ return this.canHoldItem(stack); + } + + @Override +- @Override +- protected Vector3f getPassengerAttachmentPoint(Entity entity, EntityDimensions entitydimensions, float f) { +- return new Vector3f(0.0F, entitydimensions.height + 0.05F * f, 0.0F); ++ protected Vector3f getPassengerAttachmentPoint(Entity entity, EntityDimensions entitysize, float f) { ++ return new Vector3f(0.0F, entitysize.height + 0.05F * f, 0.0F); + } + } |