Class ColonyEventTypeRegistryEntry

java.lang.Object
com.minecolonies.api.colony.colonyEvents.registry.ColonyEventTypeRegistryEntry

public class ColonyEventTypeRegistryEntry extends Object
This is the colonies event registry entry class, used for registering any colony related events. Takes a function of colony, nbt to create the right event object.
  • Constructor Details

    • ColonyEventTypeRegistryEntry

      public ColonyEventTypeRegistryEntry(@NotNull @NotNull BiFunction<IColony,net.minecraft.nbt.CompoundTag,IColonyEvent> eventCreator, @NotNull @NotNull net.minecraft.resources.ResourceLocation registryID)
      Creates a new registry entry for the given function and registry name
      Parameters:
      eventCreator - the event creator.
      registryID - the registry id.
    • ColonyEventTypeRegistryEntry

      public ColonyEventTypeRegistryEntry(@NotNull @NotNull BiFunction<IColony,net.minecraft.nbt.CompoundTag,IColonyEvent> eventCreator, @NotNull @NotNull net.minecraft.resources.ResourceLocation registryID, boolean isRaidEvent)
      Creates a new registry entry for the given function and registry name
      Parameters:
      eventCreator - the event creator.
      registryID - the registry id.
      isRaidEvent - whether this is a raid event (must extend from IColonyRaidEvent)
  • Method Details

    • deserializeEvent

      public IColonyEvent deserializeEvent(@Nonnull IColony colony, @Nonnull net.minecraft.nbt.CompoundTag compound)
      Deserializes the event from nbt.
      Parameters:
      colony - the colony this event is part of.
      compound - the nbt to deserialize the event from.
      Returns:
      the deserialized event.
    • getRegistryName

      public net.minecraft.resources.ResourceLocation getRegistryName()
      Get the fitting registry name.
      Returns:
      the name.
    • isRaidEvent

      public boolean isRaidEvent()
      Check whether this is a raid event or not.
      Returns:
      true if so.