Interface IBuildingExtension
- All Superinterfaces:
IModuleContainer<IBuildingExtensionModule>
- All Known Implementing Classes:
AbstractBuildingExtension,FarmField,PlantationField
Interface for building extension instances.
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic final recordUnique extension id. -
Method Summary
Modifier and TypeMethodDescriptionvoiddeserialize(@NotNull net.minecraft.network.RegistryFriendlyByteBuf buf) Deserialize a building extension from a buffer.voiddeserializeNBT(net.minecraft.core.HolderLookup.Provider provider, @NotNull net.minecraft.nbt.CompoundTag compound) Reconstruct the building extension from the given NBT data.booleanEquals implementation for this building extension.Return the building extension type for this building extension.@Nullable net.minecraft.core.BlockPosGetter for the owning building of the building extension.getId()Get the unique extension id.@NotNull net.minecraft.core.BlockPosGets the position of the building extension.intgetSqDistance(IBuildingView building) Get the distance to a building.inthashCode()Hashcode implementation for this building extension.booleanisTaken()Has the building extension been taken.booleanisValidPlacement(IColony colony) Condition to check whether this building extension instance is currently properly placed down.voidregisterModule(@NotNull IBuildingExtensionModule module) Register a specific module to the object.voidResets the ownership of the building extension.voidserialize(@NotNull net.minecraft.network.RegistryFriendlyByteBuf buf) Serialize a building extension to a buffer.@NotNull net.minecraft.nbt.CompoundTagserializeNBT(net.minecraft.core.HolderLookup.Provider provider) Stores the NBT data of the building extension.voidsetBuilding(net.minecraft.core.BlockPos buildingId) Sets the owning building of the building extension.Methods inherited from interface com.minecolonies.api.colony.modules.IModuleContainer
getClassType, getFirstModuleOccurance, getModule, getModule, getModule, getModuleMatching, getModules, getModules, getModules, getModules, getModulesByType, hasModule, hasModule, hasModule
-
Method Details
-
getBuildingExtensionType
Return the building extension type for this building extension.- Returns:
- the building extension registry entry.
-
getPosition
@NotNull @NotNull net.minecraft.core.BlockPos getPosition()Gets the position of the building extension.- Returns:
- central location of the building extension.
-
getBuildingId
@Nullable @Nullable net.minecraft.core.BlockPos getBuildingId()Getter for the owning building of the building extension.- Returns:
- the id or null.
-
setBuilding
void setBuilding(net.minecraft.core.BlockPos buildingId) Sets the owning building of the building extension.- Parameters:
buildingId- id of the building.
-
resetOwningBuilding
void resetOwningBuilding()Resets the ownership of the building extension. -
isTaken
boolean isTaken()Has the building extension been taken.- Returns:
- true if the building extension is not free to use, false after releasing it.
-
getSqDistance
Get the distance to a building.- Parameters:
building- the building to get the distance to.- Returns:
- the distance
-
serializeNBT
@NotNull @NotNull net.minecraft.nbt.CompoundTag serializeNBT(@NotNull net.minecraft.core.HolderLookup.Provider provider) Stores the NBT data of the building extension. -
deserializeNBT
void deserializeNBT(@NotNull net.minecraft.core.HolderLookup.Provider provider, @NotNull @NotNull net.minecraft.nbt.CompoundTag compound) Reconstruct the building extension from the given NBT data.- Parameters:
compound- the compound to read from.
-
serialize
void serialize(@NotNull @NotNull net.minecraft.network.RegistryFriendlyByteBuf buf) Serialize a building extension to a buffer.- Parameters:
buf- the buffer to write the building extension data to.
-
deserialize
void deserialize(@NotNull @NotNull net.minecraft.network.RegistryFriendlyByteBuf buf) Deserialize a building extension from a buffer.- Parameters:
buf- the buffer to read the building extension data from.
-
isValidPlacement
Condition to check whether this building extension instance is currently properly placed down.- Parameters:
colony- the colony this building extension is in.- Returns:
- true if the building extension is correctly placed at the current position.
-
hashCode
int hashCode()Hashcode implementation for this building extension. -
equals
Equals implementation for this building extension. -
getId
IBuildingExtension.ExtensionId getId()Get the unique extension id.- Returns:
- the unique id.
-
registerModule
Register a specific module to the object.- Parameters:
module- the module to register.
-