Interface ICompatibilityManager
- All Known Implementing Classes:
CompatibilityManager
public interface ICompatibilityManager
Interface for all compatabilityManagers. The compatability manager retrieves certain blocks from oreData and stores them.
-
Method Summary
Modifier and TypeMethodDescriptionvoidconnectLeafToSapling(net.minecraft.world.level.block.Block block, net.minecraft.world.item.ItemStack stack) Connect a certain block as leave to an ItemStack as sapling.voiddeserialize(@NotNull net.minecraft.network.RegistryFriendlyByteBuf buf, net.minecraft.client.multiplayer.ClientLevel level) Receive and update lists based on incoming server discovery data.voiddiscover(@NotNull net.minecraft.world.item.crafting.RecipeManager recipeManager, net.minecraft.world.level.Level level) Method called to instantiate internal data.com.google.common.collect.ImmutableSet<net.minecraft.resources.ResourceLocation> Get the set of all monsters.Just the possible composting inputs, for item filters.Map<net.minecraft.world.item.Item, net.minecraft.world.item.crafting.RecipeHolder<CompostRecipe>> Get a copy of the list of compost recipes.Get a copy of the list of plantables.Get a copy of the list of saplings.net.minecraft.world.item.CreativeModeTabgetCreativeTab(ItemStorage checkItem) Get the creative tab for a stack.intgetCreativeTabKey(ItemStorage checkItem) Get the creative tab key as int associated.Optional<net.minecraft.world.item.DyeColor> getDyeColor(net.minecraft.world.item.ItemStack stack) Try to work out what dye needs to be used to produce the given color.getEdibles(int minNutrition) Get a set of all edibles for citizens.getFood()Get a set of all food items.getFuel()Get a set of all fuel items.Gets the furnace recipe storageGet a copy of the list of flowers.List<net.minecraft.world.item.ItemStack> Get a list of all items.List<net.minecraft.world.item.ItemStack> getListOfMatchingItems(Predicate<net.minecraft.world.item.ItemStack> predicate) Get a list of all matching items.intGet number of detected saplings.@Nullable net.minecraft.world.item.ItemStackgetSaplingForLeaf(net.minecraft.world.level.block.Block block) Gets the sapling matching a leaf.Get a set of all items (marked to ignore damage but not NBT).Get a set of all smeltable ores.booleanisBreakableOre(@NotNull net.minecraft.world.item.ItemStack stack) Check if a stack belongs to a breakable ore.booleanisLuckyBlock(net.minecraft.world.level.block.Block block) If a block is a lucky block which can result in an extra ore drop.booleanisMineableOre(@NotNull net.minecraft.world.item.ItemStack stack) Check if a stack belongs to a minable ore.booleanisOre(net.minecraft.world.item.ItemStack stack) Test if an itemStack is an ore.booleanisOre(net.minecraft.world.level.block.state.BlockState block) Checks if a certain Block is an ore.booleanisPlantable(net.minecraft.world.item.ItemStack itemStack) Test if an itemStack is plantable for the florist.voidread(net.minecraft.core.HolderLookup.Provider provider, @NotNull net.minecraft.nbt.CompoundTag compound) Read Colonies from saved NBT data.voidserialize(@NotNull net.minecraft.network.RegistryFriendlyByteBuf buf) Transfer server-discovered item lists to client, to avoid double-handling (and potentially getting different answers).voidwrite(net.minecraft.core.HolderLookup.Provider provider, @NotNull net.minecraft.nbt.CompoundTag compound) Write colonies to NBT data for saving.
-
Method Details
-
discover
void discover(@NotNull @NotNull net.minecraft.world.item.crafting.RecipeManager recipeManager, net.minecraft.world.level.Level level) Method called to instantiate internal data.- Parameters:
recipeManager- The vanilla recipe manager.
-
serialize
void serialize(@NotNull @NotNull net.minecraft.network.RegistryFriendlyByteBuf buf) Transfer server-discovered item lists to client, to avoid double-handling (and potentially getting different answers).- Parameters:
buf- serialization buffer
-
deserialize
void deserialize(@NotNull @NotNull net.minecraft.network.RegistryFriendlyByteBuf buf, net.minecraft.client.multiplayer.ClientLevel level) Receive and update lists based on incoming server discovery data. Note: anything based purely on the registries and configs can be safely recalculated here. But anything based on tags or recipes must be updated purely via the packet, because this can be called before the client has the latest tags/recipes.- Parameters:
buf- deserialization buffer
-
getSaplingForLeaf
@Nullable @Nullable net.minecraft.world.item.ItemStack getSaplingForLeaf(net.minecraft.world.level.block.Block block) Gets the sapling matching a leaf.- Parameters:
block- the leaves.- Returns:
- the sapling stack or null.
-
getCopyOfSaplings
Set<ItemStorage> getCopyOfSaplings()Get a copy of the list of saplings.- Returns:
- the list of saplings.
-
getFuel
Set<ItemStorage> getFuel()Get a set of all fuel items.- Returns:
- an immutable set.
-
getFood
Set<ItemStorage> getFood()Get a set of all food items.- Returns:
- an immutable set.
-
getEdibles
Get a set of all edibles for citizens.- Parameters:
minNutrition- the min nutrition of the food.- Returns:
- list of edible food.
-
getSmeltableOres
Set<ItemStorage> getSmeltableOres()Get a set of all smeltable ores.- Returns:
- an immutable set.
-
isMineableOre
boolean isMineableOre(@NotNull @NotNull net.minecraft.world.item.ItemStack stack) Check if a stack belongs to a minable ore.- Parameters:
stack- the stack to test.- Returns:
- true if so.
-
isBreakableOre
boolean isBreakableOre(@NotNull @NotNull net.minecraft.world.item.ItemStack stack) Check if a stack belongs to a breakable ore.- Parameters:
stack- the stack to test.- Returns:
- true if so.
-
getCopyOfCompostRecipes
Map<net.minecraft.world.item.Item,net.minecraft.world.item.crafting.RecipeHolder<CompostRecipe>> getCopyOfCompostRecipes()Get a copy of the list of compost recipes.- Returns:
- the list of compost recipes, indexed by input item.
-
getCompostInputs
Set<ItemStorage> getCompostInputs()Just the possible composting inputs, for item filters.- Returns:
- the set of compost input items.
-
getCopyOfPlantables
Set<ItemStorage> getCopyOfPlantables()Get a copy of the list of plantables.- Returns:
- the list of plantables.
-
getImmutableFlowers
Set<ItemStorage> getImmutableFlowers()Get a copy of the list of flowers.- Returns:
- the list of flowers.
-
getAllMonsters
com.google.common.collect.ImmutableSet<net.minecraft.resources.ResourceLocation> getAllMonsters()Get the set of all monsters.- Returns:
- the set.
-
isOre
boolean isOre(net.minecraft.world.level.block.state.BlockState block) Checks if a certain Block is an ore.- Parameters:
block- the block to check.- Returns:
- boolean if so.
-
isOre
boolean isOre(net.minecraft.world.item.ItemStack stack) Test if an itemStack is an ore.- Parameters:
stack- the stack to test.- Returns:
- true if so.
-
getListOfAllItems
List<net.minecraft.world.item.ItemStack> getListOfAllItems()Get a list of all items.- Returns:
- the immutable list.
-
getListOfMatchingItems
List<net.minecraft.world.item.ItemStack> getListOfMatchingItems(Predicate<net.minecraft.world.item.ItemStack> predicate) Get a list of all matching items.- Returns:
- the immutable list.
-
getSetOfAllItems
Set<ItemStorage> getSetOfAllItems()Get a set of all items (marked to ignore damage but not NBT).- Returns:
- the immutable set.
-
write
void write(@NotNull net.minecraft.core.HolderLookup.Provider provider, @NotNull @NotNull net.minecraft.nbt.CompoundTag compound) Write colonies to NBT data for saving.- Parameters:
compound- NBT-Tag.
-
read
void read(@NotNull net.minecraft.core.HolderLookup.Provider provider, @NotNull @NotNull net.minecraft.nbt.CompoundTag compound) Read Colonies from saved NBT data.- Parameters:
compound- NBT Tag.
-
connectLeafToSapling
void connectLeafToSapling(net.minecraft.world.level.block.Block block, net.minecraft.world.item.ItemStack stack) Connect a certain block as leave to an ItemStack as sapling.- Parameters:
block- the block to connect the sapling to.stack- the sapling.
-
isPlantable
boolean isPlantable(net.minecraft.world.item.ItemStack itemStack) Test if an itemStack is plantable for the florist.- Parameters:
itemStack- the stack to check.- Returns:
- true if so.
-
isLuckyBlock
boolean isLuckyBlock(net.minecraft.world.level.block.Block block) If a block is a lucky block which can result in an extra ore drop.- Parameters:
block- the block to check.- Returns:
- true if so.
-
getCreativeTab
Get the creative tab for a stack.- Parameters:
checkItem- the storage wrapper.
-
getCreativeTabKey
Get the creative tab key as int associated.- Parameters:
checkItem- the item to check.- Returns:
- the number or default.
-
getFurnaceRecipes
FurnaceRecipes getFurnaceRecipes()Gets the furnace recipe storage- Returns:
- furnace recipes
-
getNumberOfSaplings
int getNumberOfSaplings()Get number of detected saplings.- Returns:
- the number of saplings.
-
getDyeColor
Try to work out what dye needs to be used to produce the given color.- Parameters:
stack- the already-dyed stack.- Returns:
- the dye color required, or empty if there is no such dye.
-