Contents
- Description
- Field Summary
- Constructor Summary
- Method Summary
- Field Details
- Constructor Details
- Method Details
- getComponentType()
- isEmpty()
- getHealth(int, int, int)
- getHealth(int)
- isDamaged(int)
- isFragile(int, int, int)
- isFragile(int)
- getFragilitySeconds(int)
- damage(int, int, int, float, Instant)
- damage(int, float, Instant)
- clearHealth(int)
- makeFragile(int, int, int, float)
- makeFragile(int, float)
- clearFragility(int)
- tickFragility(float)
- tickRegeneration(Instant, float, long, float)
- clone()
Class BlockHealthSection
java.lang.Object
com.hypixel.hytale.server.core.modules.blockhealth.BlockHealthSection
- All Implemented Interfaces:
Component<ChunkStore>, Cloneable
Block damage and placement fragility for one chunk section, keyed by the section block index.
Every section carries this component. The maps are allocated on first use and released when they empty, so an undamaged section costs no more than the component object itself. Mutations never mark the section for saving. The caller that owns the change does that.
Each change records the accumulated health delta for its block index. The replication system drains those deltas once per tick and sends one packet per section. A block whose entry was destroyed or cleared sends nothing, because the block change that follows resets the client state.
Not thread safe.
-
Field Summary
FieldsFields inherited from interface Component
EMPTY_ARRAY -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclearFragility(int index) booleanclearHealth(int index) Drops the health entry of the block atindex, if any.clone()floatRemovesamountfrom the health of the block atindexand returns what is left.floatstatic ComponentType<ChunkStore, BlockHealthSection> floatgetFragilitySeconds(int index) floatgetHealth(int index) floatgetHealth(int x, int y, int z) booleanisDamaged(int index) booleanisEmpty()booleanisFragile(int index) booleanisFragile(int x, int y, int z) voidmakeFragile(int index, float seconds) voidmakeFragile(int x, int y, int z, float seconds) booleantickFragility(float deltaSeconds) Counts down every fragile block.booleantickRegeneration(Instant now, float deltaSeconds, long secondsUntilRegeneration, float healingPerSecond) Regenerates every block whose last hit is at leastsecondsUntilRegenerationold.Methods inherited from class Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface Component
cloneSerializable
-
Field Details
-
VERSION
public static final int VERSION- See Also:
-
CODEC
-
-
Constructor Details
-
BlockHealthSection
public BlockHealthSection()
-
-
Method Details
-
getComponentType
-
isEmpty
public boolean isEmpty() -
getHealth
public float getHealth(int x, int y, int z) -
getHealth
public float getHealth(int index) -
isDamaged
public boolean isDamaged(int index) -
isFragile
public boolean isFragile(int x, int y, int z) -
isFragile
public boolean isFragile(int index) -
getFragilitySeconds
public float getFragilitySeconds(int index) -
damage
-
damage
Removesamountfrom the health of the block atindexand returns what is left.A block that reaches zero, or that ends at full health, drops its entry. Only a block that stays damaged records a delta for replication.
-
clearHealth
public boolean clearHealth(int index) Drops the health entry of the block atindex, if any. Nothing is replicated: the caller replaces the block, and that change resets the client state on its own. -
makeFragile
public void makeFragile(int x, int y, int z, float seconds) -
makeFragile
public void makeFragile(int index, float seconds) -
clearFragility
public void clearFragility(int index) -
tickFragility
public boolean tickFragility(float deltaSeconds) Counts down every fragile block.- Returns:
trueif a block stopped being fragile and dropped its entry.
-
tickRegeneration
public boolean tickRegeneration(@Nonnull Instant now, float deltaSeconds, long secondsUntilRegeneration, float healingPerSecond) Regenerates every block whose last hit is at leastsecondsUntilRegenerationold.- Returns:
trueif a block reached full health and dropped its entry.
-
clone
- Specified by:
clonein interfaceComponent<ChunkStore>- Returns:
- a clone instance of the original component instance.
-