Skip to content

Instantly share code, notes, and snippets.

@Shadows-of-Fire
Last active August 25, 2019 08:51
Show Gist options
  • Save Shadows-of-Fire/9c1699d061754bb97056ec7a0a65b00f to your computer and use it in GitHub Desktop.
Save Shadows-of-Fire/9c1699d061754bb97056ec7a0a65b00f to your computer and use it in GitHub Desktop.
Plants
-Block Methods
--getPlantTypes() @Nullable Set<PlantType>, null type represents not a plant.
--canBePlanted(IBlockReader, BlockPos) boolean, Plant's authority on if it can be placed here. Equal authority with canPlantOn
--canHarvest(IBlockReader, BlockPos, @Nullable PlayerEntity) boolean, if the plant can be harvested
--harvest(IWorld, BlockPos, @Nullable PlayerEntity) List<ItemStack>, harvests the plant into a List<ItemStacK>. Updates the state in the world.
--placePlant(IWorld, BlockPos, @Nullable PlayerEntity, ItemStack) boolean, places the plant into the world. Returns true for success.
--getSeed() Item, returns the seed for this plant.
--getGrowthProgress(BlockState) float, returns [0, 1] for plant growth.
-Growing
--Handled by IGrowable.
--IGrowable needs an ItemStack context for what the fertilizer is.
Soils
-Block Methods
--canPlantHere(Block plant, IBlockReader world, BlockPos pos) boolean, Soil's authority on if a plant can be planted here. Equal authority with canBePlanted
--getSupportedPlantTypes() Set<PlantType>, less contextul method that gets what types this plant should supports.
Seeds
-Item Methods
--canBePlanted(IBlockReader, BlockPos), delegates to Block
--placePlant(IWorld, BlockPos, @Nullable PlayerEntity, ItemStack), delegates to Block
--getPlantState(IBlockReader, BlockPos, @Nullable PlayerEntity, ItemStack) BlockState, gets the state this plant will place. Not always accurate due to doubleplants etc.
--getPlant() Block, returns the Plant associated with this Seed
@temp1011
Copy link

--getPlantTypes() @Nullable Set<PlantType>, null type represents not a plant.
It would be better if things that aren't plants just return an empty set.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment