Skip to content

MinecartComponent

Package: com.hypixel.hytale.builtin.mounts.minecart

public class MinecartComponent implements Component<EntityStore>

An EntityStore ECS component representing a minecart entity’s state. Tracks the number of hits received (for destruction after 3 hits), the timestamp of the last hit (with a 10-second reset window), and the source item ID used to drop an item when destroyed in survival mode.

Serialized with codec key "Minecart" and a BuilderCodec that persists the SourceItem field.

public static ComponentType<EntityStore, MinecartComponent> getComponentType()

Delegates to MountPlugin.getInstance().getMinecartComponentType().

public static final BuilderCodec<MinecartComponent> CODEC

Serializes/deserializes the SourceItem field as a string. Defaults to "Rail_Kart".

private MinecartComponent()

Default constructor for codec deserialization.

public MinecartComponent(String sourceItem)

Creates a minecart component with the specified source item ID.

MethodReturnsDescription
getNumberOfHits()intCurrent hit count (resets after 10 seconds of no hits).
setNumberOfHits(int numberOfHits)voidSets the hit count.
getLastHit()@Nullable InstantTimestamp of the last hit, or null if never hit.
setLastHit(@Nullable Instant lastHit)voidSets the last hit timestamp.
getSourceItem()StringThe item ID to drop when destroyed (default: "Rail_Kart").
setSourceItem(String sourceItem)voidSets the source item ID.
@Override
public Component<EntityStore> clone()

Returns a new MinecartComponent with the same source item. Hit count and last hit are not copied.

Hydex is an independent community resource. Hytale is a trademark of Hypixel Studios. Hydex is not affiliated with or endorsed by Hypixel Studios.