API

You can add CustomCrops as a dependency for you project. Check the github page for API repo.

Here is the guide helping you get familiar with the API

To get a crop's config

Crop crop = CustomCropsPlugin.get().getItemManager().getCropByID("tomato");

To place a crop (This method would only place the block/entity, see the method below to make it grow)

String itemID = crop.getStageItemByPoint(0);
CustomCropsPlugin.get().getItemManager().placeItem(location, crop.getItemCarrier(), itemID);

To make the crop grow

WorldCrop worldCrop = CustomCropsPlugin.get().getWorldManager().createCropData(location, crop, 0);
CustomCropsPlugin.get().getWorldManager().addCropAt(worldCrop, SimpleLocation.of(location));

To remove a crop (This method would only remove the crop's block/entity, see the method below to remove crop's data)

CustomCropsPlugin.get().getItemManager().removeAnythingAt(location);

To remove crop's data

CustomCropsPlugin.get().getWorldManager().removeCropAt(location);

Get crop's config by existing block/entity

CustomCropsPlugin.get().getItemManager().getCropByBlock(block);
CustomCropsPlugin.get().getItemManager().getCropByEntity(entity);

To check if crops reach the limitation of the chunk

CustomCropsPlugin.get().getWorldManager().isReachLimit(location, ItemType.CROP);

To change a world's date/season

CustomCropsPlugin.get().getIntegrationManager().getSeasonInterface().setSeason(world, Season.SPRING);
CustomCropsPlugin.get().getIntegrationManager().getSeasonInterface().setDate(world, 1);

Last updated