aboutsummaryrefslogtreecommitdiffhomepage
path: root/patch-remap/mache-vineflower/net/minecraft/world/entity/monster/ZombifiedPiglin.java.patch
diff options
context:
space:
mode:
Diffstat (limited to 'patch-remap/mache-vineflower/net/minecraft/world/entity/monster/ZombifiedPiglin.java.patch')
-rw-r--r--patch-remap/mache-vineflower/net/minecraft/world/entity/monster/ZombifiedPiglin.java.patch202
1 files changed, 202 insertions, 0 deletions
diff --git a/patch-remap/mache-vineflower/net/minecraft/world/entity/monster/ZombifiedPiglin.java.patch b/patch-remap/mache-vineflower/net/minecraft/world/entity/monster/ZombifiedPiglin.java.patch
new file mode 100644
index 0000000000..e8ce6c3e73
--- /dev/null
+++ b/patch-remap/mache-vineflower/net/minecraft/world/entity/monster/ZombifiedPiglin.java.patch
@@ -0,0 +1,202 @@
+--- 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;
+@@ -43,10 +43,9 @@
+ import org.joml.Vector3f;
+
+ public class ZombifiedPiglin extends Zombie implements NeutralMob {
++
+ private static final UUID SPEED_MODIFIER_ATTACKING_UUID = UUID.fromString("49455A49-7EC5-45BA-B886-3B90B23A1718");
+- private static final AttributeModifier SPEED_MODIFIER_ATTACKING = new AttributeModifier(
+- SPEED_MODIFIER_ATTACKING_UUID, "Attacking speed boost", 0.05, AttributeModifier.Operation.ADDITION
+- );
++ private static final AttributeModifier SPEED_MODIFIER_ATTACKING = new AttributeModifier(ZombifiedPiglin.SPEED_MODIFIER_ATTACKING_UUID, "Attacking speed boost", 0.05D, AttributeModifier.Operation.ADDITION);
+ private static final UniformInt FIRST_ANGER_SOUND_DELAY = TimeUtil.rangeOfSeconds(0, 1);
+ private int playFirstAngerSoundIn;
+ private static final UniformInt PERSISTENT_ANGER_TIME = TimeUtil.rangeOfSeconds(20, 39);
+@@ -71,22 +70,19 @@
+
+ @Override
+ protected void addBehaviourGoals() {
+- this.goalSelector.addGoal(2, new ZombieAttackGoal(this, 1.0, false));
+- this.goalSelector.addGoal(7, new WaterAvoidingRandomStrollGoal(this, 1.0));
+- this.targetSelector.addGoal(1, new HurtByTargetGoal(this).setAlertOthers());
++ this.goalSelector.addGoal(2, new ZombieAttackGoal(this, 1.0D, false));
++ this.goalSelector.addGoal(7, new WaterAvoidingRandomStrollGoal(this, 1.0D));
++ this.targetSelector.addGoal(1, (new HurtByTargetGoal(this, new Class[0])).setAlertOthers());
+ this.targetSelector.addGoal(2, new NearestAttackableTargetGoal<>(this, Player.class, 10, true, false, this::isAngryAt));
+ this.targetSelector.addGoal(3, new ResetUniversalAngerTargetGoal<>(this, true));
+ }
+
+ public static AttributeSupplier.Builder createAttributes() {
+- return Zombie.createAttributes()
+- .add(Attributes.SPAWN_REINFORCEMENTS_CHANCE, 0.0)
+- .add(Attributes.MOVEMENT_SPEED, 0.23F)
+- .add(Attributes.ATTACK_DAMAGE, 5.0);
++ return Zombie.createAttributes().add(Attributes.SPAWN_REINFORCEMENTS_CHANCE, 0.0D).add(Attributes.MOVEMENT_SPEED, 0.23000000417232513D).add(Attributes.ATTACK_DAMAGE, 5.0D);
+ }
+
+ @Override
+- protected float getStandingEyeHeight(Pose pose, EntityDimensions size) {
++ protected float getStandingEyeHeight(EntityPose pose, EntityDimensions size) {
+ return this.isBaby() ? 0.96999997F : 1.79F;
+ }
+
+@@ -97,18 +93,19 @@
+
+ @Override
+ protected void customServerAiStep() {
+- AttributeInstance attribute = this.getAttribute(Attributes.MOVEMENT_SPEED);
++ AttributeInstance attributemodifiable = this.getAttribute(Attributes.MOVEMENT_SPEED);
++
+ if (this.isAngry()) {
+- if (!this.isBaby() && !attribute.hasModifier(SPEED_MODIFIER_ATTACKING)) {
+- attribute.addTransientModifier(SPEED_MODIFIER_ATTACKING);
++ if (!this.isBaby() && !attributemodifiable.hasModifier(ZombifiedPiglin.SPEED_MODIFIER_ATTACKING)) {
++ attributemodifiable.addTransientModifier(ZombifiedPiglin.SPEED_MODIFIER_ATTACKING);
+ }
+
+ this.maybePlayFirstAngerSound();
+- } else if (attribute.hasModifier(SPEED_MODIFIER_ATTACKING)) {
+- attribute.removeModifier(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);
++ this.updatePersistentAnger((ServerLevel) this.level(), true);
+ if (this.getTarget() != null) {
+ this.maybeAlertOthers();
+ }
+@@ -122,35 +119,39 @@
+
+ private void maybePlayFirstAngerSound() {
+ if (this.playFirstAngerSoundIn > 0) {
+- this.playFirstAngerSoundIn--;
++ --this.playFirstAngerSoundIn;
+ if (this.playFirstAngerSoundIn == 0) {
+ this.playAngerSound();
+ }
+ }
++
+ }
+
+ private void maybeAlertOthers() {
+ if (this.ticksUntilNextAlert > 0) {
+- this.ticksUntilNextAlert--;
++ --this.ticksUntilNextAlert;
+ } else {
+ if (this.getSensing().hasLineOfSight(this.getTarget())) {
+ this.alertOthers();
+ }
+
+- this.ticksUntilNextAlert = ALERT_INTERVAL.sample(this.random);
++ this.ticksUntilNextAlert = ZombifiedPiglin.ALERT_INTERVAL.sample(this.random);
+ }
+ }
+
+ private void alertOthers() {
+- double attributeValue = this.getAttributeValue(Attributes.FOLLOW_RANGE);
+- AABB aABB = AABB.unitCubeFromLowerCorner(this.position()).inflate(attributeValue, 10.0, attributeValue);
+- this.level()
+- .getEntitiesOfClass(ZombifiedPiglin.class, aABB, EntitySelector.NO_SPECTATORS)
+- .stream()
+- .filter(zombifiedPiglin -> zombifiedPiglin != this)
+- .filter(zombifiedPiglin -> zombifiedPiglin.getTarget() == null)
+- .filter(zombifiedPiglin -> !zombifiedPiglin.isAlliedTo(this.getTarget()))
+- .forEach(zombifiedPiglin -> zombifiedPiglin.setTarget(this.getTarget()));
++ double d0 = this.getAttributeValue(Attributes.FOLLOW_RANGE);
++ AABB axisalignedbb = AABB.unitCubeFromLowerCorner(this.position()).inflate(d0, 10.0D, d0);
++
++ 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
++ });
+ }
+
+ private void playAngerSound() {
+@@ -158,27 +159,34 @@
+ }
+
+ @Override
+- public void setTarget(@Nullable LivingEntity livingEntity) {
+- if (this.getTarget() == null && livingEntity != null) {
+- this.playFirstAngerSoundIn = FIRST_ANGER_SOUND_DELAY.sample(this.random);
+- this.ticksUntilNextAlert = ALERT_INTERVAL.sample(this.random);
++ 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
+ public void startPersistentAngerTimer() {
+- this.setRemainingPersistentAngerTime(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> zombifiedPiglin, LevelAccessor level, MobSpawnType spawnType, BlockPos pos, RandomSource random
+- ) {
++ 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);
+ }
+
+@@ -236,7 +244,7 @@
+
+ @Override
+ protected void randomizeReinforcementsChance() {
+- this.getAttribute(Attributes.SPAWN_REINFORCEMENTS_CHANCE).setBaseValue(0.0);
++ this.getAttribute(Attributes.SPAWN_REINFORCEMENTS_CHANCE).setBaseValue(0.0D);
+ }
+
+ @Nullable
+@@ -256,7 +264,7 @@
+ }
+
+ @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);
+ }
+ }