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
The abstract event handling building/upgrading huts.
-
Constructor Summary
ConstructorsConstructorDescriptionCreates a new building event.AbstractBuildingEvent(net.minecraft.core.BlockPos eventPos, String buildingName, int buildingLevel) Creates a new building event. -
Method Summary
Modifier and TypeMethodDescriptionvoiddeserialize(net.minecraft.network.RegistryFriendlyByteBuf buf) Deserializes this event from the givenRegistryFriendlyByteBuf.voiddeserializeNBT(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.BlockPosReturns the position at which this event occurred.intgetLevel()Gets the level of the building after the event.voidserialize(net.minecraft.network.RegistryFriendlyByteBuf buf) Serializes this event to the givenRegistryFriendlyByteBuf.net.minecraft.nbt.CompoundTagserializeNBT(net.minecraft.core.HolderLookup.Provider provider) voidsetBuildingName(String buildingName) Sets the building type for this event.voidsetEventPos(net.minecraft.core.BlockPos pos) Sets the position this event happened at.voidsetLevel(int lvl) Sets the level of the building after the event.toString()Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface com.minecolonies.api.colony.colonyEvents.descriptions.IBuildingEventDescription
toDisplayStringMethods 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:IColonyEventDescriptionReturns the position at which this event occurred.- Specified by:
getEventPosin interfaceIColonyEventDescription- Returns:
- the position at which this event occurred.
-
setEventPos
public void setEventPos(net.minecraft.core.BlockPos pos) Description copied from interface:IColonyEventDescriptionSets the position this event happened at.- Specified by:
setEventPosin interfaceIColonyEventDescription- Parameters:
pos- the position this event happened at.
-
serializeNBT
public net.minecraft.nbt.CompoundTag serializeNBT(@NotNull net.minecraft.core.HolderLookup.Provider provider) - Specified by:
serializeNBTin interfacenet.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:
deserializeNBTin interfacenet.neoforged.neoforge.common.util.INBTSerializable<net.minecraft.nbt.CompoundTag>
-
serialize
public void serialize(net.minecraft.network.RegistryFriendlyByteBuf buf) Description copied from interface:IColonyEventDescriptionSerializes this event to the givenRegistryFriendlyByteBuf.- Specified by:
serializein interfaceIColonyEventDescription- Parameters:
buf- theRegistryFriendlyByteBufto serialize to.
-
deserialize
public void deserialize(net.minecraft.network.RegistryFriendlyByteBuf buf) Description copied from interface:IColonyEventDescriptionDeserializes this event from the givenRegistryFriendlyByteBuf.- Specified by:
deserializein interfaceIColonyEventDescription- Parameters:
buf- theRegistryFriendlyByteBufto deserialize from.
-
getBuildingName
Description copied from interface:IBuildingEventDescriptionGets the name of the building type involved in this event.- Specified by:
getBuildingNamein interfaceIBuildingEventDescription- Returns:
- the name of the building type involved in this event.
-
setBuildingName
Description copied from interface:IBuildingEventDescriptionSets the building type for this event.- Specified by:
setBuildingNamein interfaceIBuildingEventDescription- Parameters:
buildingName- the building type for this event.
-
getLevel
public int getLevel()Description copied from interface:IBuildingEventDescriptionGets the level of the building after the event.- Specified by:
getLevelin interfaceIBuildingEventDescription- Returns:
- the level of the building after the event.
-
setLevel
public void setLevel(int lvl) Description copied from interface:IBuildingEventDescriptionSets the level of the building after the event.- Specified by:
setLevelin interfaceIBuildingEventDescription- Parameters:
lvl- the level of the building after the event.
-
toString
-