Record Class AttackRange
java.lang.Object
java.lang.Record
net.minecraft.world.item.component.AttackRange
public record AttackRange(float minRange, float maxRange, float minCreativeRange, float maxCreativeRange, 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 themaxCreativeRangerecord component.private final floatThe field for themaxRangerecord component.private final floatThe field for theminCreativeRangerecord component.private final floatThe field for theminRangerecord component.private final floatThe field for themobFactorrecord component.static final StreamCodec<io.netty.buffer.ByteBuf, AttackRange> -
Constructor Summary
ConstructorsConstructorDescriptionAttackRange(float minRange, float maxRange, float minCreativeRange, float maxCreativeRange, float hitboxMargin, float mobFactor) Creates an instance of aAttackRangerecord class. -
Method Summary
Modifier and TypeMethodDescriptionstatic AttackRangedefaultFor(LivingEntity pEntity) floateffectiveMaxRange(Entity pEntity) floateffectiveMinRange(Entity pEntity) final booleanIndicates whether some other object is "equal to" this one.getClosesetHit(Entity pEntity, float pPartialTick, Predicate<Entity> pPredicate) final inthashCode()Returns a hash code value for this object.floatReturns the value of thehitboxMarginrecord component.private booleanisInRange(LivingEntity pEntity, ToDoubleFunction<Vec3> pDistanceSqrGetter, double pRange) booleanisInRange(LivingEntity pEntity, AABB pBox, double pRange) booleanisInRange(LivingEntity pEntity, Vec3 pPos) floatReturns the value of themaxCreativeRangerecord component.floatmaxRange()Returns the value of themaxRangerecord component.floatReturns the value of theminCreativeRangerecord component.floatminRange()Returns the value of theminRangerecord component.floatReturns the value of themobFactorrecord component.final StringtoString()Returns a string representation of this record class.
-
Field Details
-
minRange
private final float minRangeThe field for theminRangerecord component. -
maxRange
private final float maxRangeThe field for themaxRangerecord component. -
minCreativeRange
private final float minCreativeRangeThe field for theminCreativeRangerecord component. -
maxCreativeRange
private final float maxCreativeRangeThe field for themaxCreativeRangerecord 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 minRange, float maxRange, float minCreativeRange, float maxCreativeRange, float hitboxMargin, float mobFactor) Creates an instance of aAttackRangerecord class.- Parameters:
minRange- the value for theminRangerecord componentmaxRange- the value for themaxRangerecord componentminCreativeRange- the value for theminCreativeRangerecord componentmaxCreativeRange- the value for themaxCreativeRangerecord componenthitboxMargin- the value for thehitboxMarginrecord componentmobFactor- the value for themobFactorrecord component
-
-
Method Details
-
defaultFor
-
getClosesetHit
-
effectiveMinRange
-
effectiveMaxRange
-
isInRange
-
isInRange
-
isInRange
private boolean isInRange(LivingEntity pEntity, ToDoubleFunction<Vec3> pDistanceSqrGetter, double pRange) -
toString
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. -
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
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 '=='. -
minRange
public float minRange()Returns the value of theminRangerecord component.- Returns:
- the value of the
minRangerecord component
-
maxRange
public float maxRange()Returns the value of themaxRangerecord component.- Returns:
- the value of the
maxRangerecord component
-
minCreativeRange
public float minCreativeRange()Returns the value of theminCreativeRangerecord component.- Returns:
- the value of the
minCreativeRangerecord component
-
maxCreativeRange
public float maxCreativeRange()Returns the value of themaxCreativeRangerecord component.- Returns:
- the value of the
maxCreativeRangerecord 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
-