Revert step height attribute (#8604)

This commit is contained in:
ChampionAsh5357 authored and GitHub committed 2022-05-05 14:07:07 +01:00
1 parent f938051373
commit e7a8da4d0b
9 files changed
+2 -108

No files matched your search

@@ -93,7 +93,6 @@ public class ForgeMod
public static final RegistryObject<Attribute> ENTITY_GRAVITY = ATTRIBUTES.register("entity_gravity", () -> new RangedAttribute("forge.entity_gravity", 0.08D, -8.0D, 8.0D).setSyncable(true));
public static final RegistryObject<Attribute> REACH_DISTANCE = ATTRIBUTES.register("reach_distance", () -> new RangedAttribute("generic.reachDistance", 5.0D, 0.0D, 1024.0D).setSyncable(true));
public static final RegistryObject<Attribute> 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<Fluid> MILK = RegistryObject.create(new ResourceLocation("milk"), ForgeRegistries.FLUIDS);
@@ -191,22 +191,4 @@ public interface IForgeEntity extends ICapabilitySerializable<CompoundTag>
{
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;
}
}
}