Class TaggedSoilGenerator

java.lang.Object
net.darkhax.botanypots.common.impl.command.generator.TaggedSoilGenerator
All Implemented Interfaces:
SoilGenerator

public class TaggedSoilGenerator extends Object implements SoilGenerator
This soil generator will create soils that map items in a tag to a single display output.
  • Constructor Summary

    Constructors
    Constructor
    Description
    TaggedSoilGenerator(String tag, com.google.gson.JsonObject display)
     
    TaggedSoilGenerator(net.minecraft.tags.TagKey<net.minecraft.world.item.Item> tag, com.google.gson.JsonObject display)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    canGenerateSoil(net.minecraft.server.level.ServerLevel level, net.minecraft.world.item.ItemStack stack)
    Determines if the generator can generate a soil for a specific item.
    com.google.gson.JsonObject
    generateData(net.minecraft.server.level.ServerLevel level, net.minecraft.world.item.ItemStack stack)
    Generates the JSON data for the soil.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • TaggedSoilGenerator

      public TaggedSoilGenerator(String tag, com.google.gson.JsonObject display)
    • TaggedSoilGenerator

      public TaggedSoilGenerator(net.minecraft.tags.TagKey<net.minecraft.world.item.Item> tag, com.google.gson.JsonObject display)
  • Method Details

    • canGenerateSoil

      public boolean canGenerateSoil(net.minecraft.server.level.ServerLevel level, net.minecraft.world.item.ItemStack stack)
      Description copied from interface: SoilGenerator
      Determines if the generator can generate a soil for a specific item. If a generator returns true the item will be considered claimed by the generator and other generators will not be given the chance to generate a soil for the item.
      Specified by:
      canGenerateSoil in interface SoilGenerator
      Parameters:
      level - The current world level. Used to provide context like registry access and the recipe manager.
      stack - The item to test.
      Returns:
      If the generator can generate a soil for the provided item.
    • generateData

      public com.google.gson.JsonObject generateData(net.minecraft.server.level.ServerLevel level, net.minecraft.world.item.ItemStack stack)
      Description copied from interface: SoilGenerator
      Generates the JSON data for the soil.
      Specified by:
      generateData in interface SoilGenerator
      Parameters:
      level - The current world level. Used to provide context like registry access and the recipe manager.
      stack - The item to test.
      Returns:
      The JSON representation of the soil. The produced data must be a valid JSON representation that can be parsed by a registered recipe serializer.