aboutsummaryrefslogtreecommitdiffhomepage
path: root/patch-remap/mache-vineflower/net/minecraft/world/entity/monster/Witch.java.patch
diff options
context:
space:
mode:
Diffstat (limited to 'patch-remap/mache-vineflower/net/minecraft/world/entity/monster/Witch.java.patch')
-rw-r--r--patch-remap/mache-vineflower/net/minecraft/world/entity/monster/Witch.java.patch313
1 files changed, 313 insertions, 0 deletions
diff --git a/patch-remap/mache-vineflower/net/minecraft/world/entity/monster/Witch.java.patch b/patch-remap/mache-vineflower/net/minecraft/world/entity/monster/Witch.java.patch
new file mode 100644
index 0000000000..64cc833019
--- /dev/null
+++ b/patch-remap/mache-vineflower/net/minecraft/world/entity/monster/Witch.java.patch
@@ -0,0 +1,313 @@
+--- a/net/minecraft/world/entity/monster/Witch.java
++++ b/net/minecraft/world/entity/monster/Witch.java
+@@ -1,7 +1,9 @@
+ package net.minecraft.world.entity.monster;
+
++import java.util.Iterator;
+ import java.util.List;
+ import java.util.UUID;
++import java.util.function.Predicate;
+ import net.minecraft.core.particles.ParticleTypes;
+ import net.minecraft.network.syncher.EntityDataAccessor;
+ import net.minecraft.network.syncher.EntityDataSerializers;
+@@ -15,10 +17,10 @@
+ import net.minecraft.world.effect.MobEffects;
+ 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.EquipmentSlot;
+ import net.minecraft.world.entity.LivingEntity;
+-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;
+@@ -45,10 +47,9 @@
+ import org.joml.Vector3f;
+
+ public class Witch extends Raider implements RangedAttackMob {
++
+ private static final UUID SPEED_MODIFIER_DRINKING_UUID = UUID.fromString("5CD17E52-A79A-43D3-A529-90FDE04B181E");
+- private static final AttributeModifier SPEED_MODIFIER_DRINKING = new AttributeModifier(
+- SPEED_MODIFIER_DRINKING_UUID, "Drinking speed penalty", -0.25, AttributeModifier.Operation.ADDITION
+- );
++ private static final AttributeModifier SPEED_MODIFIER_DRINKING = new AttributeModifier(Witch.SPEED_MODIFIER_DRINKING_UUID, "Drinking speed penalty", -0.25D, AttributeModifier.Operation.ADDITION);
+ private static final EntityDataAccessor<Boolean> DATA_USING_ITEM = SynchedEntityData.defineId(Witch.class, EntityDataSerializers.BOOLEAN);
+ private int usingTime;
+ private NearestHealableRaiderTargetGoal<Raider> healRaidersGoal;
+@@ -61,16 +62,16 @@
+ @Override
+ protected void registerGoals() {
+ super.registerGoals();
+- this.healRaidersGoal = new NearestHealableRaiderTargetGoal<>(
+- this, Raider.class, true, livingEntity -> livingEntity != null && this.hasActiveRaid() && livingEntity.getType() != EntityType.WITCH
+- );
+- this.attackPlayersGoal = new NearestAttackableWitchTargetGoal<>(this, Player.class, 10, true, false, null);
++ this.healRaidersGoal = new NearestHealableRaiderTargetGoal<>(this, Raider.class, true, (entityliving) -> {
++ return entityliving != null && this.hasActiveRaid() && entityliving.getType() != EntityType.WITCH;
++ });
++ this.attackPlayersGoal = new NearestAttackableWitchTargetGoal<>(this, Player.class, 10, true, false, (Predicate) null);
+ this.goalSelector.addGoal(1, new FloatGoal(this));
+- this.goalSelector.addGoal(2, new RangedAttackGoal(this, 1.0, 60, 10.0F));
+- this.goalSelector.addGoal(2, new WaterAvoidingRandomStrollGoal(this, 1.0));
++ this.goalSelector.addGoal(2, new RangedAttackGoal(this, 1.0D, 60, 10.0F));
++ this.goalSelector.addGoal(2, new WaterAvoidingRandomStrollGoal(this, 1.0D));
+ this.goalSelector.addGoal(3, new LookAtPlayerGoal(this, Player.class, 8.0F));
+ this.goalSelector.addGoal(3, new RandomLookAroundGoal(this));
+- this.targetSelector.addGoal(1, new HurtByTargetGoal(this, Raider.class));
++ this.targetSelector.addGoal(1, new HurtByTargetGoal(this, new Class[]{Raider.class}));
+ this.targetSelector.addGoal(2, this.healRaidersGoal);
+ this.targetSelector.addGoal(3, this.attackPlayersGoal);
+ }
+@@ -78,7 +79,7 @@
+ @Override
+ protected void defineSynchedData() {
+ super.defineSynchedData();
+- this.getEntityData().define(DATA_USING_ITEM, false);
++ this.getEntityData().define(Witch.DATA_USING_ITEM, false);
+ }
+
+ @Override
+@@ -97,15 +98,15 @@
+ }
+
+ public void setUsingItem(boolean usingItem) {
+- this.getEntityData().set(DATA_USING_ITEM, usingItem);
++ this.getEntityData().set(Witch.DATA_USING_ITEM, usingItem);
+ }
+
+ public boolean isDrinkingPotion() {
+- return this.getEntityData().get(DATA_USING_ITEM);
++ return (Boolean) this.getEntityData().get(Witch.DATA_USING_ITEM);
+ }
+
+ public static AttributeSupplier.Builder createAttributes() {
+- return Monster.createMonsterAttributes().add(Attributes.MAX_HEALTH, 26.0).add(Attributes.MOVEMENT_SPEED, 0.25);
++ return Monster.createMonsterAttributes().add(Attributes.MAX_HEALTH, 26.0D).add(Attributes.MOVEMENT_SPEED, 0.25D);
+ }
+
+ @Override
+@@ -121,63 +122,56 @@
+ if (this.isDrinkingPotion()) {
+ if (this.usingTime-- <= 0) {
+ this.setUsingItem(false);
+- ItemStack mainHandItem = this.getMainHandItem();
++ ItemStack itemstack = this.getMainHandItem();
++
+ this.setItemSlot(EquipmentSlot.MAINHAND, ItemStack.EMPTY);
+- if (mainHandItem.is(Items.POTION)) {
+- List<MobEffectInstance> mobEffects = PotionUtils.getMobEffects(mainHandItem);
+- if (mobEffects != null) {
+- for (MobEffectInstance mobEffectInstance : mobEffects) {
+- this.addEffect(new MobEffectInstance(mobEffectInstance));
++ if (itemstack.is(Items.POTION)) {
++ List<MobEffectInstance> list = PotionUtils.getMobEffects(itemstack);
++
++ if (list != null) {
++ Iterator iterator = list.iterator();
++
++ while (iterator.hasNext()) {
++ MobEffectInstance mobeffect = (MobEffectInstance) iterator.next();
++
++ this.addEffect(new MobEffectInstance(mobeffect), org.bukkit.event.entity.EntityPotionEffectEvent.Cause.ATTACK); // CraftBukkit
+ }
+ }
+ }
+
+ this.gameEvent(GameEvent.DRINK);
+- this.getAttribute(Attributes.MOVEMENT_SPEED).removeModifier(SPEED_MODIFIER_DRINKING.getId());
++ this.getAttribute(Attributes.MOVEMENT_SPEED).removeModifier(Witch.SPEED_MODIFIER_DRINKING.getId());
+ }
+ } else {
+- Potion potion = null;
++ Potion potionregistry = null;
++
+ if (this.random.nextFloat() < 0.15F && this.isEyeInFluid(FluidTags.WATER) && !this.hasEffect(MobEffects.WATER_BREATHING)) {
+- potion = Potions.WATER_BREATHING;
+- } else if (this.random.nextFloat() < 0.15F
+- && (this.isOnFire() || this.getLastDamageSource() != null && this.getLastDamageSource().is(DamageTypeTags.IS_FIRE))
+- && !this.hasEffect(MobEffects.FIRE_RESISTANCE)) {
+- potion = Potions.FIRE_RESISTANCE;
++ potionregistry = Potions.WATER_BREATHING;
++ } else if (this.random.nextFloat() < 0.15F && (this.isOnFire() || this.getLastDamageSource() != null && this.getLastDamageSource().is(DamageTypeTags.IS_FIRE)) && !this.hasEffect(MobEffects.FIRE_RESISTANCE)) {
++ potionregistry = Potions.FIRE_RESISTANCE;
+ } else if (this.random.nextFloat() < 0.05F && this.getHealth() < this.getMaxHealth()) {
+- potion = Potions.HEALING;
+- } else if (this.random.nextFloat() < 0.5F
+- && this.getTarget() != null
+- && !this.hasEffect(MobEffects.MOVEMENT_SPEED)
+- && this.getTarget().distanceToSqr(this) > 121.0) {
+- potion = Potions.SWIFTNESS;
++ potionregistry = Potions.HEALING;
++ } else if (this.random.nextFloat() < 0.5F && this.getTarget() != null && !this.hasEffect(MobEffects.MOVEMENT_SPEED) && this.getTarget().distanceToSqr((Entity) this) > 121.0D) {
++ potionregistry = Potions.SWIFTNESS;
+ }
+
+- if (potion != null) {
+- this.setItemSlot(EquipmentSlot.MAINHAND, PotionUtils.setPotion(new ItemStack(Items.POTION), potion));
++ if (potionregistry != null) {
++ this.setItemSlot(EquipmentSlot.MAINHAND, PotionUtils.setPotion(new ItemStack(Items.POTION), potionregistry));
+ this.usingTime = this.getMainHandItem().getUseDuration();
+ this.setUsingItem(true);
+ if (!this.isSilent()) {
+- this.level()
+- .playSound(
+- null,
+- this.getX(),
+- this.getY(),
+- this.getZ(),
+- SoundEvents.WITCH_DRINK,
+- this.getSoundSource(),
+- 1.0F,
+- 0.8F + this.random.nextFloat() * 0.4F
+- );
++ this.level().playSound((Player) null, this.getX(), this.getY(), this.getZ(), SoundEvents.WITCH_DRINK, this.getSoundSource(), 1.0F, 0.8F + this.random.nextFloat() * 0.4F);
+ }
+
+- AttributeInstance attribute = this.getAttribute(Attributes.MOVEMENT_SPEED);
+- attribute.removeModifier(SPEED_MODIFIER_DRINKING.getId());
+- attribute.addTransientModifier(SPEED_MODIFIER_DRINKING);
++ AttributeInstance attributemodifiable = this.getAttribute(Attributes.MOVEMENT_SPEED);
++
++ attributemodifiable.removeModifier(Witch.SPEED_MODIFIER_DRINKING.getId());
++ attributemodifiable.addTransientModifier(Witch.SPEED_MODIFIER_DRINKING);
+ }
+ }
+
+ if (this.random.nextFloat() < 7.5E-4F) {
+- this.level().broadcastEntityEvent(this, (byte)15);
++ this.level().broadcastEntityEvent(this, (byte) 15);
+ }
+ }
+
+@@ -192,97 +186,80 @@
+ @Override
+ public void handleEntityEvent(byte id) {
+ if (id == 15) {
+- for (int i = 0; i < this.random.nextInt(35) + 10; i++) {
+- this.level()
+- .addParticle(
+- ParticleTypes.WITCH,
+- this.getX() + this.random.nextGaussian() * 0.13F,
+- this.getBoundingBox().maxY + 0.5 + this.random.nextGaussian() * 0.13F,
+- this.getZ() + this.random.nextGaussian() * 0.13F,
+- 0.0,
+- 0.0,
+- 0.0
+- );
++ for (int i = 0; i < this.random.nextInt(35) + 10; ++i) {
++ this.level().addParticle(ParticleTypes.WITCH, this.getX() + this.random.nextGaussian() * 0.12999999523162842D, this.getBoundingBox().maxY + 0.5D + this.random.nextGaussian() * 0.12999999523162842D, this.getZ() + this.random.nextGaussian() * 0.12999999523162842D, 0.0D, 0.0D, 0.0D);
+ }
+ } else {
+ super.handleEntityEvent(id);
+ }
++
+ }
+
+ @Override
+ protected float getDamageAfterMagicAbsorb(DamageSource source, float damage) {
+- float var3 = super.getDamageAfterMagicAbsorb(source, damage);
++ damage = super.getDamageAfterMagicAbsorb(source, damage);
+ if (source.getEntity() == this) {
+- var3 = 0.0F;
++ damage = 0.0F;
+ }
+
+ if (source.is(DamageTypeTags.WITCH_RESISTANT_TO)) {
+- var3 *= 0.15F;
++ damage *= 0.15F;
+ }
+
+- return var3;
++ return damage;
+ }
+
+ @Override
+ public void performRangedAttack(LivingEntity target, float distanceFactor) {
+ if (!this.isDrinkingPotion()) {
+- Vec3 deltaMovement = target.getDeltaMovement();
+- double d = target.getX() + deltaMovement.x - this.getX();
+- double d1 = target.getEyeY() - 1.1F - this.getY();
+- double d2 = target.getZ() + deltaMovement.z - this.getZ();
+- double squareRoot = Math.sqrt(d * d + d2 * d2);
+- Potion potion = Potions.HARMING;
++ Vec3 vec3d = target.getDeltaMovement();
++ double d0 = target.getX() + vec3d.x - this.getX();
++ double d1 = target.getEyeY() - 1.100000023841858D - this.getY();
++ double d2 = target.getZ() + vec3d.z - this.getZ();
++ double d3 = Math.sqrt(d0 * d0 + d2 * d2);
++ Potion potionregistry = Potions.HARMING;
++
+ if (target instanceof Raider) {
+ if (target.getHealth() <= 4.0F) {
+- potion = Potions.HEALING;
++ potionregistry = Potions.HEALING;
+ } else {
+- potion = Potions.REGENERATION;
++ potionregistry = Potions.REGENERATION;
+ }
+
+- this.setTarget(null);
+- } else if (squareRoot >= 8.0 && !target.hasEffect(MobEffects.MOVEMENT_SLOWDOWN)) {
+- potion = Potions.SLOWNESS;
++ this.setTarget((LivingEntity) null);
++ } else if (d3 >= 8.0D && !target.hasEffect(MobEffects.MOVEMENT_SLOWDOWN)) {
++ potionregistry = Potions.SLOWNESS;
+ } else if (target.getHealth() >= 8.0F && !target.hasEffect(MobEffects.POISON)) {
+- potion = Potions.POISON;
+- } else if (squareRoot <= 3.0 && !target.hasEffect(MobEffects.WEAKNESS) && this.random.nextFloat() < 0.25F) {
+- potion = Potions.WEAKNESS;
++ potionregistry = Potions.POISON;
++ } else if (d3 <= 3.0D && !target.hasEffect(MobEffects.WEAKNESS) && this.random.nextFloat() < 0.25F) {
++ potionregistry = Potions.WEAKNESS;
+ }
+
+- ThrownPotion thrownPotion = new ThrownPotion(this.level(), this);
+- thrownPotion.setItem(PotionUtils.setPotion(new ItemStack(Items.SPLASH_POTION), potion));
+- thrownPotion.setXRot(thrownPotion.getXRot() - -20.0F);
+- thrownPotion.shoot(d, d1 + squareRoot * 0.2, d2, 0.75F, 8.0F);
++ ThrownPotion entitypotion = new ThrownPotion(this.level(), this);
++
++ entitypotion.setItem(PotionUtils.setPotion(new ItemStack(Items.SPLASH_POTION), potionregistry));
++ entitypotion.setXRot(entitypotion.getXRot() - -20.0F);
++ entitypotion.shoot(d0, d1 + d3 * 0.2D, d2, 0.75F, 8.0F);
+ if (!this.isSilent()) {
+- this.level()
+- .playSound(
+- null,
+- this.getX(),
+- this.getY(),
+- this.getZ(),
+- SoundEvents.WITCH_THROW,
+- this.getSoundSource(),
+- 1.0F,
+- 0.8F + this.random.nextFloat() * 0.4F
+- );
++ this.level().playSound((Player) null, this.getX(), this.getY(), this.getZ(), SoundEvents.WITCH_THROW, this.getSoundSource(), 1.0F, 0.8F + this.random.nextFloat() * 0.4F);
+ }
+
+- this.level().addFreshEntity(thrownPotion);
++ this.level().addFreshEntity(entitypotion);
+ }
+ }
+
+ @Override
+- protected float getStandingEyeHeight(Pose pose, EntityDimensions size) {
++ protected float getStandingEyeHeight(EntityPose pose, EntityDimensions size) {
+ return 1.62F;
+ }
+
+ @Override
+- protected Vector3f getPassengerAttachmentPoint(Entity entity, EntityDimensions entityDimensions, float f) {
+- return new Vector3f(0.0F, entityDimensions.height + 0.3125F * f, 0.0F);
++ protected Vector3f getPassengerAttachmentPoint(Entity entity, EntityDimensions entitysize, float f) {
++ return new Vector3f(0.0F, entitysize.height + 0.3125F * f, 0.0F);
+ }
+
+ @Override
+- public void applyRaidBuffs(int wave, boolean unusedFalse) {
+- }
++ public void applyRaidBuffs(int wave, boolean unusedFalse) {}
+
+ @Override
+ public boolean canBeLeader() {