Record Class AttackRange
java.lang.Object
java.lang.Record
net.minecraft.world.item.component.AttackRange
public record AttackRange(float minReach, float maxReach, float minCreativeReach, float maxCreativeReach, float hitboxMargin, float mobFactor)
extends Record
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final com.mojang.serialization.Codec<AttackRange> private final floatThe field for thehitboxMarginrecord component.private final floatThe field for themaxCreativeReachrecord component.private final floatThe field for themaxReachrecord component.private final floatThe field for theminCreativeReachrecord component.private final floatThe field for theminReachrecord component.private final floatThe field for themobFactorrecord component.static final StreamCodec<io.netty.buffer.ByteBuf, AttackRange> -
Constructor Summary
ConstructorsConstructorDescriptionAttackRange(float minReach, float maxReach, float minCreativeReach, float maxCreativeReach, float hitboxMargin, float mobFactor) Creates an instance of aAttackRangerecord class. -
Method Summary
Modifier and TypeMethodDescriptionstatic AttackRangedefaultFor(LivingEntity livingEntity) floateffectiveMaxRange(Entity entity) floateffectiveMinRange(Entity entity) final booleanIndicates whether some other object is "equal to" this one.getClosesetHit(Entity attacker, float partial, Predicate<Entity> matching) final inthashCode()Returns a hash code value for this object.floatReturns the value of thehitboxMarginrecord component.private booleanisInRange(LivingEntity attacker, ToDoubleFunction<Vec3> distanceFunction, double extraBuffer) booleanisInRange(LivingEntity attacker, AABB boundingBox, double extraBuffer) booleanisInRange(LivingEntity attacker, Vec3 location) floatReturns the value of themaxCreativeReachrecord component.floatmaxReach()Returns the value of themaxReachrecord component.floatReturns the value of theminCreativeReachrecord component.floatminReach()Returns the value of theminReachrecord component.floatReturns the value of themobFactorrecord component.final StringtoString()Returns a string representation of this record class.
-
Field Details
-
minReach
private final float minReachThe field for theminReachrecord component. -
maxReach
private final float maxReachThe field for themaxReachrecord component. -
minCreativeReach
private final float minCreativeReachThe field for theminCreativeReachrecord component. -
maxCreativeReach
private final float maxCreativeReachThe field for themaxCreativeReachrecord component. -
hitboxMargin
private final float hitboxMarginThe field for thehitboxMarginrecord component. -
mobFactor
private final float mobFactorThe field for themobFactorrecord component. -
CODEC
-
STREAM_CODEC
-
-
Constructor Details
-
AttackRange
public AttackRange(float minReach, float maxReach, float minCreativeReach, float maxCreativeReach, float hitboxMargin, float mobFactor) Creates an instance of aAttackRangerecord class.- Parameters:
minReach- the value for theminReachrecord componentmaxReach- the value for themaxReachrecord componentminCreativeReach- the value for theminCreativeReachrecord componentmaxCreativeReach- the value for themaxCreativeReachrecord componenthitboxMargin- the value for thehitboxMarginrecord componentmobFactor- the value for themobFactorrecord component
-
-
Method Details
-
defaultFor
-
getClosesetHit
-
effectiveMinRange
-
effectiveMaxRange
-
isInRange
-
isInRange
-
isInRange
private boolean isInRange(LivingEntity attacker, ToDoubleFunction<Vec3> distanceFunction, double extraBuffer) -
toString
-
hashCode
-
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared with thecomparemethod from their corresponding wrapper classes. -
minReach
public float minReach()Returns the value of theminReachrecord component.- Returns:
- the value of the
minReachrecord component
-
maxReach
public float maxReach()Returns the value of themaxReachrecord component.- Returns:
- the value of the
maxReachrecord component
-
minCreativeReach
public float minCreativeReach()Returns the value of theminCreativeReachrecord component.- Returns:
- the value of the
minCreativeReachrecord component
-
maxCreativeReach
public float maxCreativeReach()Returns the value of themaxCreativeReachrecord component.- Returns:
- the value of the
maxCreativeReachrecord component
-
hitboxMargin
public float hitboxMargin()Returns the value of thehitboxMarginrecord component.- Returns:
- the value of the
hitboxMarginrecord component
-
mobFactor
public float mobFactor()Returns the value of themobFactorrecord component.- Returns:
- the value of the
mobFactorrecord component
-