Class EnchanterStationsModule
java.lang.Object
com.minecolonies.api.colony.buildings.modules.AbstractBuildingModule
com.minecolonies.core.colony.buildings.modules.EnchanterStationsModule
- All Implemented Interfaces:
IBuildingEventsModule,IBuildingModule,IPersistentModule,IHasDirty
public class EnchanterStationsModule
extends AbstractBuildingModule
implements IBuildingModule, IPersistentModule, IBuildingEventsModule
The enchanters station selection module.
-
Field Summary
Fields inherited from class com.minecolonies.api.colony.buildings.modules.AbstractBuildingModule
building, isDirty -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddWorker(net.minecraft.core.BlockPos blockPos) Add a new worker to gather xp from.voiddeserializeNBT(net.minecraft.core.HolderLookup.Provider provider, net.minecraft.nbt.CompoundTag compound) Deserialize the module.Set<net.minecraft.core.BlockPos> Return the set of the buildings to gather from.@Nullable net.minecraft.core.BlockPosGet a random worker building id to gather xp from.voidonWakeUp()Specific wakeup hook in modules.voidremoveWorker(net.minecraft.core.BlockPos blockPos) Remove a worker to stop gathering from.voidserializeNBT(net.minecraft.core.HolderLookup.Provider provider, net.minecraft.nbt.CompoundTag compound) Serialize the module from a compound.voidserializeToView(@NotNull net.minecraft.network.RegistryFriendlyByteBuf buf) Serialization method to send the module data to the client side.voidsetAsGathered(net.minecraft.core.BlockPos pos) Set the building as gathered.Methods inherited from class com.minecolonies.api.colony.buildings.modules.AbstractBuildingModule
checkDirty, clearDirty, getBuilding, getProducer, markDirty, setBuilding, setProducerMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.minecolonies.api.colony.buildings.modules.IBuildingEventsModule
onDestroyed, onPlayerEnterBuilding, onUpgradeCompleteMethods inherited from interface com.minecolonies.api.colony.buildings.modules.IBuildingModule
getBuilding, getProducer, serializeToView, setBuilding, setProducerMethods inherited from interface com.minecolonies.api.util.IHasDirty
checkDirty, clearDirty, markDirty
-
Constructor Details
-
EnchanterStationsModule
public EnchanterStationsModule()
-
-
Method Details
-
deserializeNBT
public void deserializeNBT(@NotNull net.minecraft.core.HolderLookup.Provider provider, net.minecraft.nbt.CompoundTag compound) Description copied from interface:IPersistentModuleDeserialize the module.- Specified by:
deserializeNBTin interfaceIPersistentModule- Parameters:
compound- the nbt compound.
-
serializeNBT
public void serializeNBT(@NotNull net.minecraft.core.HolderLookup.Provider provider, net.minecraft.nbt.CompoundTag compound) Description copied from interface:IPersistentModuleSerialize the module from a compound.- Specified by:
serializeNBTin interfaceIPersistentModule- Parameters:
compound- the compound.
-
serializeToView
public void serializeToView(@NotNull @NotNull net.minecraft.network.RegistryFriendlyByteBuf buf) Description copied from interface:IBuildingModuleSerialization method to send the module data to the client side.- Specified by:
serializeToViewin interfaceIBuildingModule- Parameters:
buf- the buffer to write it to.
-
getBuildingsToGatherFrom
Return the set of the buildings to gather from.- Returns:
- a copy of th eset.
-
getRandomBuildingToDrainFrom
@Nullable public @Nullable net.minecraft.core.BlockPos getRandomBuildingToDrainFrom()Get a random worker building id to gather xp from.- Returns:
- the unique pos id of it.
-
setAsGathered
public void setAsGathered(net.minecraft.core.BlockPos pos) Set the building as gathered.- Parameters:
pos- the pos of the building.
-
addWorker
public void addWorker(net.minecraft.core.BlockPos blockPos) Add a new worker to gather xp from.- Parameters:
blockPos- the pos of the building.
-
removeWorker
public void removeWorker(net.minecraft.core.BlockPos blockPos) Remove a worker to stop gathering from.- Parameters:
blockPos- the pos of that worker.
-
onWakeUp
public void onWakeUp()Description copied from interface:IBuildingEventsModuleSpecific wakeup hook in modules.- Specified by:
onWakeUpin interfaceIBuildingEventsModule
-