Class AbstractBuildingEvent

java.lang.Object
com.minecolonies.core.colony.eventhooks.buildingEvents.AbstractBuildingEvent
All Implemented Interfaces:
IBuildingEventDescription, IColonyEventDescription, net.neoforged.neoforge.common.util.INBTSerializable<net.minecraft.nbt.CompoundTag>
Direct Known Subclasses:
BuildingBuiltEvent, BuildingDeconstructedEvent, BuildingRepairedEvent, BuildingUpgradedEvent

public abstract class AbstractBuildingEvent extends Object implements IBuildingEventDescription
The abstract event handling building/upgrading huts.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Creates a new building event.
    AbstractBuildingEvent(net.minecraft.core.BlockPos eventPos, String buildingName, int buildingLevel)
    Creates a new building event.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    deserialize(net.minecraft.network.RegistryFriendlyByteBuf buf)
    Deserializes this event from the given RegistryFriendlyByteBuf.
    void
    deserializeNBT(net.minecraft.core.HolderLookup.Provider provider, net.minecraft.nbt.CompoundTag compound)
     
    Gets the name of the building type involved in this event.
    net.minecraft.core.BlockPos
    Returns the position at which this event occurred.
    int
    Gets the level of the building after the event.
    void
    serialize(net.minecraft.network.RegistryFriendlyByteBuf buf)
    Serializes this event to the given RegistryFriendlyByteBuf.
    net.minecraft.nbt.CompoundTag
    serializeNBT(net.minecraft.core.HolderLookup.Provider provider)
     
    void
    setBuildingName(String buildingName)
    Sets the building type for this event.
    void
    setEventPos(net.minecraft.core.BlockPos pos)
    Sets the position this event happened at.
    void
    setLevel(int lvl)
    Sets the level of the building after the event.
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait

    Methods inherited from interface com.minecolonies.api.colony.colonyEvents.descriptions.IBuildingEventDescription

    toDisplayString

    Methods inherited from interface com.minecolonies.api.colony.colonyEvents.descriptions.IColonyEventDescription

    getEventTypeId, getName
  • Constructor Details

    • AbstractBuildingEvent

      public AbstractBuildingEvent()
      Creates a new building event.
    • AbstractBuildingEvent

      public AbstractBuildingEvent(net.minecraft.core.BlockPos eventPos, String buildingName, int buildingLevel)
      Creates a new building event.
      Parameters:
      eventPos - the position of the hut block of the building.
      buildingName - the name of the building.
      buildingLevel - the level of the building after this event.
  • Method Details

    • getEventPos

      public net.minecraft.core.BlockPos getEventPos()
      Description copied from interface: IColonyEventDescription
      Returns the position at which this event occurred.
      Specified by:
      getEventPos in interface IColonyEventDescription
      Returns:
      the position at which this event occurred.
    • setEventPos

      public void setEventPos(net.minecraft.core.BlockPos pos)
      Description copied from interface: IColonyEventDescription
      Sets the position this event happened at.
      Specified by:
      setEventPos in interface IColonyEventDescription
      Parameters:
      pos - the position this event happened at.
    • serializeNBT

      public net.minecraft.nbt.CompoundTag serializeNBT(@NotNull net.minecraft.core.HolderLookup.Provider provider)
      Specified by:
      serializeNBT in interface net.neoforged.neoforge.common.util.INBTSerializable<net.minecraft.nbt.CompoundTag>
    • deserializeNBT

      public void deserializeNBT(@NotNull net.minecraft.core.HolderLookup.Provider provider, net.minecraft.nbt.CompoundTag compound)
      Specified by:
      deserializeNBT in interface net.neoforged.neoforge.common.util.INBTSerializable<net.minecraft.nbt.CompoundTag>
    • serialize

      public void serialize(net.minecraft.network.RegistryFriendlyByteBuf buf)
      Description copied from interface: IColonyEventDescription
      Serializes this event to the given RegistryFriendlyByteBuf.
      Specified by:
      serialize in interface IColonyEventDescription
      Parameters:
      buf - the RegistryFriendlyByteBuf to serialize to.
    • deserialize

      public void deserialize(net.minecraft.network.RegistryFriendlyByteBuf buf)
      Description copied from interface: IColonyEventDescription
      Deserializes this event from the given RegistryFriendlyByteBuf.
      Specified by:
      deserialize in interface IColonyEventDescription
      Parameters:
      buf - the RegistryFriendlyByteBuf to deserialize from.
    • getBuildingName

      public String getBuildingName()
      Description copied from interface: IBuildingEventDescription
      Gets the name of the building type involved in this event.
      Specified by:
      getBuildingName in interface IBuildingEventDescription
      Returns:
      the name of the building type involved in this event.
    • setBuildingName

      public void setBuildingName(String buildingName)
      Description copied from interface: IBuildingEventDescription
      Sets the building type for this event.
      Specified by:
      setBuildingName in interface IBuildingEventDescription
      Parameters:
      buildingName - the building type for this event.
    • getLevel

      public int getLevel()
      Description copied from interface: IBuildingEventDescription
      Gets the level of the building after the event.
      Specified by:
      getLevel in interface IBuildingEventDescription
      Returns:
      the level of the building after the event.
    • setLevel

      public void setLevel(int lvl)
      Description copied from interface: IBuildingEventDescription
      Sets the level of the building after the event.
      Specified by:
      setLevel in interface IBuildingEventDescription
      Parameters:
      lvl - the level of the building after the event.
    • toString

      public String toString()
      Overrides:
      toString in class Object