Class EntityListModule
java.lang.Object
com.minecolonies.api.colony.buildings.modules.AbstractBuildingModule
com.minecolonies.core.colony.buildings.modules.EntityListModule
- All Implemented Interfaces:
IBuildingModule,IEntityListModule,IPersistentModule,IHasDirty
public class EntityListModule
extends AbstractBuildingModule
implements IEntityListModule, IPersistentModule
Class for all buildings that need a list of mobs to toggle for various reasons.
-
Field Summary
Fields inherited from class com.minecolonies.api.colony.buildings.modules.AbstractBuildingModule
building, isDirty -
Constructor Summary
ConstructorsConstructorDescriptionConstruct a new grouped itemlist module with the unique list identifier. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddEntity(net.minecraft.resources.ResourceLocation item) Add an entity to the list.voiddeserializeNBT(net.minecraft.core.HolderLookup.Provider provider, net.minecraft.nbt.CompoundTag compound) Deserialize the module.getId()Get the unique id of this module.com.google.common.collect.ImmutableList<net.minecraft.resources.ResourceLocation> getList()Get a specific entitylist.Get the string identifier of the list.booleanisEntityInList(net.minecraft.resources.ResourceLocation entity) Check if the entity is an allowed item.voidremoveEntity(net.minecraft.resources.ResourceLocation item) Remove an entity from the list.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.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.IBuildingModule
getBuilding, getProducer, serializeToView, setBuilding, setProducerMethods inherited from interface com.minecolonies.api.util.IHasDirty
checkDirty, clearDirty, markDirty
-
Constructor Details
-
EntityListModule
Construct a new grouped itemlist module with the unique list identifier.- Parameters:
id- the list id.
-
-
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.
-
addEntity
public void addEntity(net.minecraft.resources.ResourceLocation item) Description copied from interface:IEntityListModuleAdd an entity to the list.- Specified by:
addEntityin interfaceIEntityListModule- Parameters:
item- the entity to add.
-
isEntityInList
public boolean isEntityInList(net.minecraft.resources.ResourceLocation entity) Description copied from interface:IEntityListModuleCheck if the entity is an allowed item.- Specified by:
isEntityInListin interfaceIEntityListModule- Parameters:
entity- the entity to check.- Returns:
- true if so.
-
removeEntity
public void removeEntity(net.minecraft.resources.ResourceLocation item) Description copied from interface:IEntityListModuleRemove an entity from the list.- Specified by:
removeEntityin interfaceIEntityListModule- Parameters:
item- the item to remove.
-
getList
public com.google.common.collect.ImmutableList<net.minecraft.resources.ResourceLocation> getList()Description copied from interface:IEntityListModuleGet a specific entitylist.- Specified by:
getListin interfaceIEntityListModule- Returns:
- a copy of the list at ID, or an empty list.
-
getListIdentifier
Description copied from interface:IEntityListModuleGet the string identifier of the list.- Specified by:
getListIdentifierin interfaceIEntityListModule- Returns:
- the string.
-
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.
-
getId
Description copied from interface:IEntityListModuleGet the unique id of this module.- Specified by:
getIdin interfaceIEntityListModule- Returns:
- the id.
-