From e7a8da4d0bf92feec8ad17555bf9d3f300280451 Mon Sep 17 00:00:00 2001 From: ChampionAsh5357 Date: Thu, 5 May 2022 09:07:07 -0400 Subject: [PATCH] Revert step height attribute (#8604) --- .../minecraft/world/entity/Entity.java.patch | 23 ------------- .../world/entity/LivingEntity.java.patch | 2 +- .../entity/ai/control/MoveControl.java.patch | 11 ------ .../world/entity/player/Player.java.patch | 34 +------------------ .../AmphibiousNodeEvaluator.java.patch | 11 ------ .../pathfinder/WalkNodeEvaluator.java.patch | 9 ----- .../net/minecraftforge/common/ForgeMod.java | 1 - .../common/extensions/IForgeEntity.java | 18 ---------- .../resources/assets/forge/lang/en_us.json | 1 - 9 files changed, 2 insertions(+), 108 deletions(-) delete mode 100644 patches/minecraft/net/minecraft/world/entity/ai/control/MoveControl.java.patch delete mode 100644 patches/minecraft/net/minecraft/world/level/pathfinder/AmphibiousNodeEvaluator.java.patch diff --git a/patches/minecraft/net/minecraft/world/entity/Entity.java.patch b/patches/minecraft/net/minecraft/world/entity/Entity.java.patch index bea9c25238..08d5b9bf37 100644 --- a/patches/minecraft/net/minecraft/world/entity/Entity.java.patch +++ b/patches/minecraft/net/minecraft/world/entity/Entity.java.patch @@ -17,14 +17,6 @@ private final EntityType f_19847_; private int f_19848_ = f_19843_.incrementAndGet(); public boolean f_19850_; -@@ -175,6 +_,7 @@ - public double f_19790_; - public double f_19791_; - public double f_19792_; -+ @Deprecated // Forge - see IForgeEntity#getStepHeight - public float f_19793_; - public boolean f_19794_; - protected final Random f_19796_ = new Random(); @@ -229,6 +_,7 @@ private BlockState f_185934_ = null; @@ -116,21 +108,6 @@ return blockpos1; } } -@@ -791,10 +_,10 @@ - boolean flag1 = p_20273_.f_82480_ != vec3.f_82480_; - boolean flag2 = p_20273_.f_82481_ != vec3.f_82481_; - boolean flag3 = this.f_19861_ || flag1 && p_20273_.f_82480_ < 0.0D; -- if (this.f_19793_ > 0.0F && flag3 && (flag || flag2)) { -- Vec3 vec31 = m_198894_(this, new Vec3(p_20273_.f_82479_, (double)this.f_19793_, p_20273_.f_82481_), aabb, this.f_19853_, list); -- Vec3 vec32 = m_198894_(this, new Vec3(0.0D, (double)this.f_19793_, 0.0D), aabb.m_82363_(p_20273_.f_82479_, 0.0D, p_20273_.f_82481_), this.f_19853_, list); -- if (vec32.f_82480_ < (double)this.f_19793_) { -+ if (this.getStepHeight() > 0.0F && flag3 && (flag || flag2)) { -+ Vec3 vec31 = m_198894_(this, new Vec3(p_20273_.f_82479_, (double)this.getStepHeight(), p_20273_.f_82481_), aabb, this.f_19853_, list); -+ Vec3 vec32 = m_198894_(this, new Vec3(0.0D, (double)this.getStepHeight(), 0.0D), aabb.m_82363_(p_20273_.f_82479_, 0.0D, p_20273_.f_82481_), this.f_19853_, list); -+ if (vec32.f_82480_ < (double)this.getStepHeight()) { - Vec3 vec33 = m_198894_(this, new Vec3(p_20273_.f_82479_, 0.0D, p_20273_.f_82481_), aabb.m_82383_(vec32), this.f_19853_, list).m_82549_(vec32); - if (vec33.m_165925_() > vec31.m_165925_()) { - vec31 = vec33; @@ -929,7 +_,7 @@ protected void m_7355_(BlockPos p_20135_, BlockState p_20136_) { if (!p_20136_.m_60767_().m_76332_()) { diff --git a/patches/minecraft/net/minecraft/world/entity/LivingEntity.java.patch b/patches/minecraft/net/minecraft/world/entity/LivingEntity.java.patch index d443c0da4d..5bb2b035d6 100644 --- a/patches/minecraft/net/minecraft/world/entity/LivingEntity.java.patch +++ b/patches/minecraft/net/minecraft/world/entity/LivingEntity.java.patch @@ -15,7 +15,7 @@ public static AttributeSupplier.Builder m_21183_() { - return AttributeSupplier.m_22244_().m_22266_(Attributes.f_22276_).m_22266_(Attributes.f_22278_).m_22266_(Attributes.f_22279_).m_22266_(Attributes.f_22284_).m_22266_(Attributes.f_22285_); -+ return AttributeSupplier.m_22244_().m_22266_(Attributes.f_22276_).m_22266_(Attributes.f_22278_).m_22266_(Attributes.f_22279_).m_22266_(Attributes.f_22284_).m_22266_(Attributes.f_22285_).m_22266_(net.minecraftforge.common.ForgeMod.SWIM_SPEED.get()).m_22266_(net.minecraftforge.common.ForgeMod.NAMETAG_DISTANCE.get()).m_22266_(net.minecraftforge.common.ForgeMod.ENTITY_GRAVITY.get()).m_22266_(net.minecraftforge.common.ForgeMod.STEP_HEIGHT_ADDITION.get()); ++ return AttributeSupplier.m_22244_().m_22266_(Attributes.f_22276_).m_22266_(Attributes.f_22278_).m_22266_(Attributes.f_22279_).m_22266_(Attributes.f_22284_).m_22266_(Attributes.f_22285_).m_22266_(net.minecraftforge.common.ForgeMod.SWIM_SPEED.get()).m_22266_(net.minecraftforge.common.ForgeMod.NAMETAG_DISTANCE.get()).m_22266_(net.minecraftforge.common.ForgeMod.ENTITY_GRAVITY.get()); } protected void m_7840_(double p_20990_, boolean p_20991_, BlockState p_20992_, BlockPos p_20993_) { diff --git a/patches/minecraft/net/minecraft/world/entity/ai/control/MoveControl.java.patch b/patches/minecraft/net/minecraft/world/entity/ai/control/MoveControl.java.patch deleted file mode 100644 index a2dd305f6f..0000000000 --- a/patches/minecraft/net/minecraft/world/entity/ai/control/MoveControl.java.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- a/net/minecraft/world/entity/ai/control/MoveControl.java -+++ b/net/minecraft/world/entity/ai/control/MoveControl.java -@@ -99,7 +_,7 @@ - BlockPos blockpos = this.f_24974_.m_142538_(); - BlockState blockstate = this.f_24974_.f_19853_.m_8055_(blockpos); - VoxelShape voxelshape = blockstate.m_60812_(this.f_24974_.f_19853_, blockpos); -- if (d2 > (double)this.f_24974_.f_19793_ && d0 * d0 + d1 * d1 < (double)Math.max(1.0F, this.f_24974_.m_20205_()) || !voxelshape.m_83281_() && this.f_24974_.m_20186_() < voxelshape.m_83297_(Direction.Axis.Y) + (double)blockpos.m_123342_() && !blockstate.m_204336_(BlockTags.f_13103_) && !blockstate.m_204336_(BlockTags.f_13039_)) { -+ if (d2 > (double)this.f_24974_.getStepHeight() && d0 * d0 + d1 * d1 < (double)Math.max(1.0F, this.f_24974_.m_20205_()) || !voxelshape.m_83281_() && this.f_24974_.m_20186_() < voxelshape.m_83297_(Direction.Axis.Y) + (double)blockpos.m_123342_() && !blockstate.m_204336_(BlockTags.f_13103_) && !blockstate.m_204336_(BlockTags.f_13039_)) { - this.f_24974_.m_21569_().m_24901_(); - this.f_24981_ = MoveControl.Operation.JUMPING; - } diff --git a/patches/minecraft/net/minecraft/world/entity/player/Player.java.patch b/patches/minecraft/net/minecraft/world/entity/player/Player.java.patch index 4acc6ffd80..ea6a6c3e2c 100644 --- a/patches/minecraft/net/minecraft/world/entity/player/Player.java.patch +++ b/patches/minecraft/net/minecraft/world/entity/player/Player.java.patch @@ -192,39 +192,7 @@ this.m_21008_(p_36159_, ItemStack.f_41583_); } -@@ -992,7 +_,7 @@ - double d1 = p_36201_.f_82481_; - double d2 = 0.05D; - -- while(d0 != 0.0D && this.f_19853_.m_45756_(this, this.m_142469_().m_82386_(d0, (double)(-this.f_19793_), 0.0D))) { -+ while(d0 != 0.0D && this.f_19853_.m_45756_(this, this.m_142469_().m_82386_(d0, (double)(-this.getStepHeight()), 0.0D))) { - if (d0 < 0.05D && d0 >= -0.05D) { - d0 = 0.0D; - } else if (d0 > 0.0D) { -@@ -1002,7 +_,7 @@ - } - } - -- while(d1 != 0.0D && this.f_19853_.m_45756_(this, this.m_142469_().m_82386_(0.0D, (double)(-this.f_19793_), d1))) { -+ while(d1 != 0.0D && this.f_19853_.m_45756_(this, this.m_142469_().m_82386_(0.0D, (double)(-this.getStepHeight()), d1))) { - if (d1 < 0.05D && d1 >= -0.05D) { - d1 = 0.0D; - } else if (d1 > 0.0D) { -@@ -1012,7 +_,7 @@ - } - } - -- while(d0 != 0.0D && d1 != 0.0D && this.f_19853_.m_45756_(this, this.m_142469_().m_82386_(d0, (double)(-this.f_19793_), d1))) { -+ while(d0 != 0.0D && d1 != 0.0D && this.f_19853_.m_45756_(this, this.m_142469_().m_82386_(d0, (double)(-this.getStepHeight()), d1))) { - if (d0 < 0.05D && d0 >= -0.05D) { - d0 = 0.0D; - } else if (d0 > 0.0D) { -@@ -1037,10 +_,11 @@ - } - - private boolean m_36386_() { -- return this.f_19861_ || this.f_19789_ < this.f_19793_ && !this.f_19853_.m_45756_(this, this.m_142469_().m_82386_(0.0D, (double)(this.f_19789_ - this.f_19793_), 0.0D)); -+ return this.f_19861_ || this.f_19789_ < this.getStepHeight() && !this.f_19853_.m_45756_(this, this.m_142469_().m_82386_(0.0D, (double)(this.f_19789_ - this.getStepHeight()), 0.0D)); +@@ -1041,6 +_,7 @@ } public void m_5706_(Entity p_36347_) { diff --git a/patches/minecraft/net/minecraft/world/level/pathfinder/AmphibiousNodeEvaluator.java.patch b/patches/minecraft/net/minecraft/world/level/pathfinder/AmphibiousNodeEvaluator.java.patch deleted file mode 100644 index 5e2274dc3b..0000000000 --- a/patches/minecraft/net/minecraft/world/level/pathfinder/AmphibiousNodeEvaluator.java.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- a/net/minecraft/world/level/pathfinder/AmphibiousNodeEvaluator.java -+++ b/net/minecraft/world/level/pathfinder/AmphibiousNodeEvaluator.java -@@ -45,7 +_,7 @@ - BlockPathTypes blockpathtypes1 = this.m_77567_(this.f_77313_, p_164677_.f_77271_, p_164677_.f_77272_, p_164677_.f_77273_); - int j; - if (this.f_77313_.m_21439_(blockpathtypes) >= 0.0F && blockpathtypes1 != BlockPathTypes.STICKY_HONEY) { -- j = Mth.m_14143_(Math.max(1.0F, this.f_77313_.f_19793_)); -+ j = Mth.m_14143_(Math.max(1.0F, this.f_77313_.getStepHeight())); - } else { - j = 0; - } diff --git a/patches/minecraft/net/minecraft/world/level/pathfinder/WalkNodeEvaluator.java.patch b/patches/minecraft/net/minecraft/world/level/pathfinder/WalkNodeEvaluator.java.patch index 0c0d2e2d10..4bd0f8d3e0 100644 --- a/patches/minecraft/net/minecraft/world/level/pathfinder/WalkNodeEvaluator.java.patch +++ b/patches/minecraft/net/minecraft/world/level/pathfinder/WalkNodeEvaluator.java.patch @@ -1,14 +1,5 @@ --- a/net/minecraft/world/level/pathfinder/WalkNodeEvaluator.java +++ b/net/minecraft/world/level/pathfinder/WalkNodeEvaluator.java -@@ -113,7 +_,7 @@ - BlockPathTypes blockpathtypes = this.m_77567_(this.f_77313_, p_77641_.f_77271_, p_77641_.f_77272_ + 1, p_77641_.f_77273_); - BlockPathTypes blockpathtypes1 = this.m_77567_(this.f_77313_, p_77641_.f_77271_, p_77641_.f_77272_, p_77641_.f_77273_); - if (this.f_77313_.m_21439_(blockpathtypes) >= 0.0F && blockpathtypes1 != BlockPathTypes.STICKY_HONEY) { -- j = Mth.m_14143_(Math.max(1.0F, this.f_77313_.f_19793_)); -+ j = Mth.m_14143_(Math.max(1.0F, this.f_77313_.getStepHeight())); - } - - double d0 = this.m_142213_(new BlockPos(p_77641_.f_77271_, p_77641_.f_77272_, p_77641_.f_77273_)); @@ -476,6 +_,8 @@ protected static BlockPathTypes m_77643_(BlockGetter p_77644_, BlockPos p_77645_) { diff --git a/src/main/java/net/minecraftforge/common/ForgeMod.java b/src/main/java/net/minecraftforge/common/ForgeMod.java index 22b25dd5e1..d3413d6ba7 100644 --- a/src/main/java/net/minecraftforge/common/ForgeMod.java +++ b/src/main/java/net/minecraftforge/common/ForgeMod.java @@ -93,7 +93,6 @@ public class ForgeMod public static final RegistryObject ENTITY_GRAVITY = ATTRIBUTES.register("entity_gravity", () -> new RangedAttribute("forge.entity_gravity", 0.08D, -8.0D, 8.0D).setSyncable(true)); public static final RegistryObject REACH_DISTANCE = ATTRIBUTES.register("reach_distance", () -> new RangedAttribute("generic.reachDistance", 5.0D, 0.0D, 1024.0D).setSyncable(true)); - public static final RegistryObject STEP_HEIGHT_ADDITION = ATTRIBUTES.register("step_height_addition", () -> new RangedAttribute("forge.stepHeight", 0.0D, -512.0D, 512.0D).setSyncable(true)); private static boolean enableMilkFluid = false; public static final RegistryObject MILK = RegistryObject.create(new ResourceLocation("milk"), ForgeRegistries.FLUIDS); diff --git a/src/main/java/net/minecraftforge/common/extensions/IForgeEntity.java b/src/main/java/net/minecraftforge/common/extensions/IForgeEntity.java index 1ed15a2422..27a703428e 100644 --- a/src/main/java/net/minecraftforge/common/extensions/IForgeEntity.java +++ b/src/main/java/net/minecraftforge/common/extensions/IForgeEntity.java @@ -191,22 +191,4 @@ public interface IForgeEntity extends ICapabilitySerializable { return null; } - - /** - * {@return Return the height in blocks the Entity can step up without needing to jump} - * This is the sum of vanilla's {@link Entity#maxUpStep} field and the current value - * of the {@link net.minecraftforge.common.ForgeMod#STEP_HEIGHT_ADDITION} attribute, - * (if this Entity is a {@link LivingEntity}), clamped at 0. - */ - default float getStepHeight() - { - var vanillaStep = self().maxUpStep; - if (self() instanceof LivingEntity living) - { - return (float) Math.max(0, vanillaStep + living.getAttributeValue(ForgeMod.STEP_HEIGHT_ADDITION.get())); - } else - { - return vanillaStep; - } - } } diff --git a/src/main/resources/assets/forge/lang/en_us.json b/src/main/resources/assets/forge/lang/en_us.json index f78893c676..07e5e7de41 100644 --- a/src/main/resources/assets/forge/lang/en_us.json +++ b/src/main/resources/assets/forge/lang/en_us.json @@ -190,7 +190,6 @@ "forge.nameTagDistance": "Nametag Render Distance", "forge.entity_gravity": "Entity Gravity", "generic.reachDistance": "Reach Distance", - "forge.stepHeight": "Step Height", "fluid.minecraft.milk": "Milk", "fluid.minecraft.flowing_milk": "Milk",