Pos3 pos3 = Pos3.from(location);
BukkitCustomCropsPlugin.getInstance().getWorldManager().getWorld(Bukkit.getWorld("world"));
CustomCropsWorld<?> world = ...;
world.getBlockState(pos3);
world.removeBlockState(pos3);
CropBlock cropBlock = (CropBlock) BuiltInBlockMechanics.CROP.mechanic();
CustomCropsBlockState blockState = cropBlock.createBlockState();
cropBlock.id(blockState, "tomato");
cropBlock.point(blockState, 0);
world.addBlockState(pos3, blockState);
Set/Remove/Get Custom Data in Blockstate
SynchronizedCompoundMap compoundMap = blockState.compoundMap();
compoundMap.remove("key");
compoundMap.put("key", new StringTag("key", "test"));
compoundMap.get("key");
Get the block type from blockstate
CustomCropsBlock block = blockState.type();
if (block instanceof CropBlock cropBlock) {
CropConfig cropConfig = cropBlock.config(blockState);
}
Get built-in block/item type from Registry
PotBlock potBlock = (PotBlock) BuiltInBlockMechanics.POT.mechanic();
SeedItem seedItem = (SeedItem) BuiltInItemMechanics.SEED.mechanic();
Place/Remove blocks on Bukkit Worlds
ItemManager itemManager = BukkitCustomCropsPlugin.getInstance().getItemManager();
itemManager.placeFurniture(location, "id", FurnitureRotation.NONE);
itemManager.placeBlock(location, "id");
itemManager.removeFurniture(location);
itemManager.removeBlock(location);
ItemManager itemManager = BukkitCustomCropsPlugin.getInstance().getItemManager();
String blockID = itemManager.blockID(block);
String furnitureID = itemManager.furnitureID(entity);
String itemID = itemManager.id(itemStack);
Get configs of the built-in items
CropConfig cropConfig = Registries.CROP.get("tomato");
SprinklerConfig sprinklerConfig = Registries.SPRINKLER.get("sprinkler");
PotConfig potConfig = Registries.POT.get("default");
WateringCanConfig wateringCanConfig = Registries.WATERING_CAN.get("watering_can_1");
FertilizerConfig fertilizerConfig = Registries.FERTILIZER.get("quality_1");