aboutsummaryrefslogtreecommitdiffhomepage
path: root/patch-remap/mache-vineflower/net/minecraft/world/entity/monster/Vex.java.patch
diff options
context:
space:
mode:
Diffstat (limited to 'patch-remap/mache-vineflower/net/minecraft/world/entity/monster/Vex.java.patch')
-rw-r--r--patch-remap/mache-vineflower/net/minecraft/world/entity/monster/Vex.java.patch402
1 files changed, 402 insertions, 0 deletions
diff --git a/patch-remap/mache-vineflower/net/minecraft/world/entity/monster/Vex.java.patch b/patch-remap/mache-vineflower/net/minecraft/world/entity/monster/Vex.java.patch
new file mode 100644
index 0000000000..07677de98b
--- /dev/null
+++ b/patch-remap/mache-vineflower/net/minecraft/world/entity/monster/Vex.java.patch
@@ -0,0 +1,402 @@
+--- a/net/minecraft/world/entity/monster/Vex.java
++++ b/net/minecraft/world/entity/monster/Vex.java
+@@ -15,15 +15,15 @@
+ 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.EntityType;
++import net.minecraft.world.entity.EnumMobSpawn;
++import net.minecraft.world.entity.EnumMoveType;
+ import net.minecraft.world.entity.EquipmentSlot;
++import net.minecraft.world.entity.GroupDataEntity;
+ import net.minecraft.world.entity.LivingEntity;
+ import net.minecraft.world.entity.Mob;
+-import net.minecraft.world.entity.MobSpawnType;
+-import net.minecraft.world.entity.MoverType;
+ import net.minecraft.world.entity.PathfinderMob;
+-import net.minecraft.world.entity.Pose;
+-import net.minecraft.world.entity.SpawnGroupData;
+ import net.minecraft.world.entity.TraceableEntity;
+ import net.minecraft.world.entity.ai.attributes.AttributeSupplier;
+ import net.minecraft.world.entity.ai.attributes.Attributes;
+@@ -45,16 +45,17 @@
+ import org.joml.Vector3f;
+
+ public class Vex extends Monster implements TraceableEntity {
++
+ public static final float FLAP_DEGREES_PER_TICK = 45.836624F;
+- public static final int TICKS_PER_FLAP = Mth.ceil((float) (Math.PI * 5.0 / 4.0));
++ public static final int TICKS_PER_FLAP = Mth.ceil(3.9269907F);
+ protected static final EntityDataAccessor<Byte> DATA_FLAGS_ID = SynchedEntityData.defineId(Vex.class, EntityDataSerializers.BYTE);
+ private static final int FLAG_IS_CHARGING = 1;
+ @Nullable
+ Mob owner;
+ @Nullable
+ private BlockPos boundOrigin;
+- private boolean hasLimitedLife;
+- private int limitedLifeTicks;
++ public boolean hasLimitedLife;
++ public int limitedLifeTicks;
+
+ public Vex(EntityType<? extends Vex> entityType, Level level) {
+ super(entityType, level);
+@@ -63,17 +64,17 @@
+ }
+
+ @Override
+- protected float getStandingEyeHeight(Pose pose, EntityDimensions dimensions) {
++ protected float getStandingEyeHeight(EntityPose pose, EntityDimensions dimensions) {
+ return dimensions.height - 0.28125F;
+ }
+
+ @Override
+ public boolean isFlapping() {
+- return this.tickCount % TICKS_PER_FLAP == 0;
++ return this.tickCount % Vex.TICKS_PER_FLAP == 0;
+ }
+
+ @Override
+- public void move(MoverType type, Vec3 pos) {
++ public void move(EnumMoveType type, Vec3 pos) {
+ super.move(type, pos);
+ this.checkInsideBlocks();
+ }
+@@ -88,6 +89,7 @@
+ this.limitedLifeTicks = 20;
+ this.hurt(this.damageSources().starve(), 1.0F);
+ }
++
+ }
+
+ @Override
+@@ -98,19 +100,19 @@
+ this.goalSelector.addGoal(8, new Vex.VexRandomMoveGoal());
+ this.goalSelector.addGoal(9, new LookAtPlayerGoal(this, Player.class, 3.0F, 1.0F));
+ this.goalSelector.addGoal(10, new LookAtPlayerGoal(this, Mob.class, 8.0F));
+- this.targetSelector.addGoal(1, new HurtByTargetGoal(this, Raider.class).setAlertOthers());
++ this.targetSelector.addGoal(1, (new HurtByTargetGoal(this, new Class[]{Raider.class})).setAlertOthers());
+ this.targetSelector.addGoal(2, new Vex.VexCopyOwnerTargetGoal(this));
+ this.targetSelector.addGoal(3, new NearestAttackableTargetGoal<>(this, Player.class, true));
+ }
+
+ public static AttributeSupplier.Builder createAttributes() {
+- return Monster.createMonsterAttributes().add(Attributes.MAX_HEALTH, 14.0).add(Attributes.ATTACK_DAMAGE, 4.0);
++ return Monster.createMonsterAttributes().add(Attributes.MAX_HEALTH, 14.0D).add(Attributes.ATTACK_DAMAGE, 4.0D);
+ }
+
+ @Override
+ protected void defineSynchedData() {
+ super.defineSynchedData();
+- this.entityData.define(DATA_FLAGS_ID, (byte)0);
++ this.entityData.define(Vex.DATA_FLAGS_ID, (byte) 0);
+ }
+
+ @Override
+@@ -123,14 +125,18 @@
+ if (compound.contains("LifeTicks")) {
+ this.setLimitedLife(compound.getInt("LifeTicks"));
+ }
++
+ }
+
+ @Override
+ public void restoreFrom(Entity entity) {
+ super.restoreFrom(entity);
+- if (entity instanceof Vex vex) {
+- this.owner = vex.getOwner();
++ if (entity instanceof Vex) {
++ Vex entityvex = (Vex) entity;
++
++ this.owner = entityvex.getOwner();
+ }
++
+ }
+
+ @Override
+@@ -145,6 +151,7 @@
+ if (this.hasLimitedLife) {
+ compound.putInt("LifeTicks", this.limitedLifeTicks);
+ }
++
+ }
+
+ @Nullable
+@@ -163,19 +170,22 @@
+ }
+
+ private boolean getVexFlag(int mask) {
+- int i = this.entityData.get(DATA_FLAGS_ID);
+- return (i & mask) != 0;
++ byte b0 = (Byte) this.entityData.get(Vex.DATA_FLAGS_ID);
++
++ return (b0 & mask) != 0;
+ }
+
+ private void setVexFlag(int mask, boolean value) {
+- int i = this.entityData.get(DATA_FLAGS_ID);
++ byte b0 = (Byte) this.entityData.get(Vex.DATA_FLAGS_ID);
++ int j;
++
+ if (value) {
+- i |= mask;
++ j = b0 | mask;
+ } else {
+- i &= ~mask;
++ j = b0 & ~mask;
+ }
+
+- this.entityData.set(DATA_FLAGS_ID, (byte)(i & 0xFF));
++ this.entityData.set(Vex.DATA_FLAGS_ID, (byte) (j & 255));
+ }
+
+ public boolean isCharging() {
+@@ -217,12 +227,11 @@
+
+ @Nullable
+ @Override
+- public SpawnGroupData finalizeSpawn(
+- ServerLevelAccessor level, DifficultyInstance difficulty, MobSpawnType reason, @Nullable SpawnGroupData spawnData, @Nullable CompoundTag 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) {
++ RandomSource randomsource = level.getRandom();
++
++ this.populateDefaultEquipmentSlots(randomsource, difficulty);
++ this.populateDefaultEquipmentEnchantments(randomsource, difficulty);
+ return super.finalizeSpawn(level, difficulty, reason, spawnData, dataTag);
+ }
+
+@@ -238,23 +247,56 @@
+ }
+
+ @Override
+- protected Vector3f getPassengerAttachmentPoint(Entity entity, EntityDimensions entityDimensions, float f) {
+- return new Vector3f(0.0F, entityDimensions.height - 0.0625F * f, 0.0F);
++ protected Vector3f getPassengerAttachmentPoint(Entity entity, EntityDimensions entitysize, float f) {
++ return new Vector3f(0.0F, entitysize.height - 0.0625F * f, 0.0F);
+ }
+
+- class VexChargeAttackGoal extends Goal {
++ private class VexMoveControl extends MoveControl {
++
++ public VexMoveControl(Vex entityvex) {
++ super(entityvex);
++ }
++
++ @Override
++ public void tick() {
++ if (this.operation == MoveControl.Operation.MOVE_TO) {
++ Vec3 vec3d = new Vec3(this.wantedX - Vex.this.getX(), this.wantedY - Vex.this.getY(), this.wantedZ - Vex.this.getZ());
++ double d0 = vec3d.length();
++
++ if (d0 < Vex.this.getBoundingBox().getSize()) {
++ this.operation = MoveControl.Operation.WAIT;
++ Vex.this.setDeltaMovement(Vex.this.getDeltaMovement().scale(0.5D));
++ } else {
++ Vex.this.setDeltaMovement(Vex.this.getDeltaMovement().add(vec3d.scale(this.speedModifier * 0.05D / d0)));
++ if (Vex.this.getTarget() == null) {
++ Vec3 vec3d1 = Vex.this.getDeltaMovement();
++
++ Vex.this.setYRot(-((float) Mth.atan2(vec3d1.x, vec3d1.z)) * 57.295776F);
++ Vex.this.yBodyRot = Vex.this.getYRot();
++ } else {
++ double d1 = Vex.this.getTarget().getX() - Vex.this.getX();
++ double d2 = Vex.this.getTarget().getZ() - Vex.this.getZ();
++
++ Vex.this.setYRot(-((float) Mth.atan2(d1, d2)) * 57.295776F);
++ Vex.this.yBodyRot = Vex.this.getYRot();
++ }
++ }
++
++ }
++ }
++ }
++
++ private class VexChargeAttackGoal extends Goal {
++
+ public VexChargeAttackGoal() {
+- this.setFlags(EnumSet.of(Goal.Flag.MOVE));
++ this.setFlags(EnumSet.of(Goal.Type.MOVE));
+ }
+
+ @Override
+ public boolean canUse() {
+- LivingEntity target = Vex.this.getTarget();
+- return target != null
+- && target.isAlive()
+- && !Vex.this.getMoveControl().hasWanted()
+- && Vex.this.random.nextInt(reducedTickDelay(7)) == 0
+- && Vex.this.distanceToSqr(target) > 4.0;
++ LivingEntity entityliving = Vex.this.getTarget();
++
++ return entityliving != null && entityliving.isAlive() && !Vex.this.getMoveControl().hasWanted() && Vex.this.random.nextInt(reducedTickDelay(7)) == 0 ? Vex.this.distanceToSqr((Entity) entityliving) > 4.0D : false;
+ }
+
+ @Override
+@@ -264,10 +306,12 @@
+
+ @Override
+ public void start() {
+- LivingEntity target = Vex.this.getTarget();
+- if (target != null) {
+- Vec3 eyePosition = target.getEyePosition();
+- Vex.this.moveControl.setWantedPosition(eyePosition.x, eyePosition.y, eyePosition.z, 1.0);
++ LivingEntity entityliving = Vex.this.getTarget();
++
++ if (entityliving != null) {
++ Vec3 vec3d = entityliving.getEyePosition();
++
++ Vex.this.moveControl.setWantedPosition(vec3d.x, vec3d.y, vec3d.z, 1.0D);
+ }
+
+ Vex.this.setIsCharging(true);
+@@ -286,104 +330,82 @@
+
+ @Override
+ public void tick() {
+- LivingEntity target = Vex.this.getTarget();
+- if (target != null) {
+- if (Vex.this.getBoundingBox().intersects(target.getBoundingBox())) {
+- Vex.this.doHurtTarget(target);
++ LivingEntity entityliving = Vex.this.getTarget();
++
++ if (entityliving != null) {
++ if (Vex.this.getBoundingBox().intersects(entityliving.getBoundingBox())) {
++ Vex.this.doHurtTarget(entityliving);
+ Vex.this.setIsCharging(false);
+ } else {
+- double d = Vex.this.distanceToSqr(target);
+- if (d < 9.0) {
+- Vec3 eyePosition = target.getEyePosition();
+- Vex.this.moveControl.setWantedPosition(eyePosition.x, eyePosition.y, eyePosition.z, 1.0);
++ double d0 = Vex.this.distanceToSqr((Entity) entityliving);
++
++ if (d0 < 9.0D) {
++ Vec3 vec3d = entityliving.getEyePosition();
++
++ Vex.this.moveControl.setWantedPosition(vec3d.x, vec3d.y, vec3d.z, 1.0D);
+ }
+ }
++
+ }
+ }
+ }
+
+- class VexCopyOwnerTargetGoal extends TargetGoal {
+- private final TargetingConditions copyOwnerTargeting = TargetingConditions.forNonCombat().ignoreLineOfSight().ignoreInvisibilityTesting();
++ private class VexRandomMoveGoal extends Goal {
+
+- public VexCopyOwnerTargetGoal(PathfinderMob mob) {
+- super(mob, false);
++ public VexRandomMoveGoal() {
++ this.setFlags(EnumSet.of(Goal.Type.MOVE));
+ }
+
+ @Override
+ public boolean canUse() {
+- return Vex.this.owner != null && Vex.this.owner.getTarget() != null && this.canAttack(Vex.this.owner.getTarget(), this.copyOwnerTargeting);
++ return !Vex.this.getMoveControl().hasWanted() && Vex.this.random.nextInt(reducedTickDelay(7)) == 0;
+ }
+
+ @Override
+- public void start() {
+- Vex.this.setTarget(Vex.this.owner.getTarget());
+- super.start();
++ public boolean canContinueToUse() {
++ return false;
+ }
+- }
+
+- class VexMoveControl extends MoveControl {
+- public VexMoveControl(Vex mob) {
+- super(mob);
+- }
+-
+ @Override
+ public void tick() {
+- if (this.operation == MoveControl.Operation.MOVE_TO) {
+- Vec3 vec3 = new Vec3(this.wantedX - Vex.this.getX(), this.wantedY - Vex.this.getY(), this.wantedZ - Vex.this.getZ());
+- double len = vec3.length();
+- if (len < Vex.this.getBoundingBox().getSize()) {
+- this.operation = MoveControl.Operation.WAIT;
+- Vex.this.setDeltaMovement(Vex.this.getDeltaMovement().scale(0.5));
+- } else {
+- Vex.this.setDeltaMovement(Vex.this.getDeltaMovement().add(vec3.scale(this.speedModifier * 0.05 / len)));
++ BlockPos blockposition = Vex.this.getBoundOrigin();
++
++ if (blockposition == null) {
++ blockposition = Vex.this.blockPosition();
++ }
++
++ for (int i = 0; i < 3; ++i) {
++ BlockPos blockposition1 = blockposition.offset(Vex.this.random.nextInt(15) - 7, Vex.this.random.nextInt(11) - 5, Vex.this.random.nextInt(15) - 7);
++
++ if (Vex.this.level().isEmptyBlock(blockposition1)) {
++ Vex.this.moveControl.setWantedPosition((double) blockposition1.getX() + 0.5D, (double) blockposition1.getY() + 0.5D, (double) blockposition1.getZ() + 0.5D, 0.25D);
+ if (Vex.this.getTarget() == null) {
+- Vec3 deltaMovement = Vex.this.getDeltaMovement();
+- Vex.this.setYRot(-((float)Mth.atan2(deltaMovement.x, deltaMovement.z)) * (180.0F / (float)Math.PI));
+- Vex.this.yBodyRot = Vex.this.getYRot();
+- } else {
+- double d = Vex.this.getTarget().getX() - Vex.this.getX();
+- double d1 = Vex.this.getTarget().getZ() - Vex.this.getZ();
+- Vex.this.setYRot(-((float)Mth.atan2(d, d1)) * (180.0F / (float)Math.PI));
+- Vex.this.yBodyRot = Vex.this.getYRot();
++ Vex.this.getLookControl().setLookAt((double) blockposition1.getX() + 0.5D, (double) blockposition1.getY() + 0.5D, (double) blockposition1.getZ() + 0.5D, 180.0F, 20.0F);
+ }
++ break;
+ }
+ }
++
+ }
+ }
+
+- class VexRandomMoveGoal extends Goal {
+- public VexRandomMoveGoal() {
+- this.setFlags(EnumSet.of(Goal.Flag.MOVE));
++ private class VexCopyOwnerTargetGoal extends TargetGoal {
++
++ private final TargetingConditions copyOwnerTargeting = TargetingConditions.forNonCombat().ignoreLineOfSight().ignoreInvisibilityTesting();
++
++ public VexCopyOwnerTargetGoal(PathfinderMob entitycreature) {
++ super(entitycreature, false);
+ }
+
+ @Override
+ public boolean canUse() {
+- return !Vex.this.getMoveControl().hasWanted() && Vex.this.random.nextInt(reducedTickDelay(7)) == 0;
++ return Vex.this.owner != null && Vex.this.owner.getTarget() != null && this.canAttack(Vex.this.owner.getTarget(), this.copyOwnerTargeting);
+ }
+
+ @Override
+- public boolean canContinueToUse() {
+- return false;
++ public void start() {
++ Vex.this.setTarget(Vex.this.owner.getTarget(), org.bukkit.event.entity.EntityTargetEvent.TargetReason.OWNER_ATTACKED_TARGET, true); // CraftBukkit
++ super.start();
+ }
+-
+- @Override
+- public void tick() {
+- BlockPos boundOrigin = Vex.this.getBoundOrigin();
+- if (boundOrigin == null) {
+- boundOrigin = Vex.this.blockPosition();
+- }
+-
+- for (int i = 0; i < 3; i++) {
+- BlockPos blockPos = boundOrigin.offset(Vex.this.random.nextInt(15) - 7, Vex.this.random.nextInt(11) - 5, Vex.this.random.nextInt(15) - 7);
+- if (Vex.this.level().isEmptyBlock(blockPos)) {
+- Vex.this.moveControl.setWantedPosition((double)blockPos.getX() + 0.5, (double)blockPos.getY() + 0.5, (double)blockPos.getZ() + 0.5, 0.25);
+- if (Vex.this.getTarget() == null) {
+- Vex.this.getLookControl()
+- .setLookAt((double)blockPos.getX() + 0.5, (double)blockPos.getY() + 0.5, (double)blockPos.getZ() + 0.5, 180.0F, 20.0F);
+- }
+- break;
+- }
+- }
+- }
+ }
+ }