9
0
mirror of https://github.com/Xiao-MoMi/Custom-Crops.git synced 2025-12-27 19:09:09 +00:00
This commit is contained in:
XiaoMoMi
2025-01-21 23:36:04 +08:00
parent 153ae36d25
commit c13d2bbcf9
6 changed files with 34 additions and 5 deletions

View File

@@ -31,6 +31,7 @@ import net.momirealms.customcrops.api.core.world.Pos3;
import net.momirealms.customcrops.api.event.DropItemActionEvent;
import net.momirealms.customcrops.api.misc.value.MathValue;
import net.momirealms.customcrops.api.util.EventUtils;
import net.momirealms.customcrops.api.util.LocationUtils;
import net.momirealms.customcrops.api.util.PlayerUtils;
import net.momirealms.customcrops.common.util.RandomUtils;
import org.bukkit.Location;
@@ -87,7 +88,7 @@ public class ActionDropItem<T> extends AbstractBuiltInAction<T> {
if (toInv && player != null) {
PlayerUtils.giveItem(player, itemToDrop, itemToDrop.getAmount());
} else {
location.getWorld().dropItemNaturally(location, itemToDrop);
location.getWorld().dropItemNaturally(LocationUtils.toBlockCenterLocation(location), itemToDrop);
}
}
}, location);

View File

@@ -32,6 +32,7 @@ import net.momirealms.customcrops.api.core.world.Pos3;
import net.momirealms.customcrops.api.event.QualityCropActionEvent;
import net.momirealms.customcrops.api.misc.value.MathValue;
import net.momirealms.customcrops.api.util.EventUtils;
import net.momirealms.customcrops.api.util.LocationUtils;
import net.momirealms.customcrops.api.util.PlayerUtils;
import net.momirealms.customcrops.common.util.RandomUtils;
import org.bukkit.Location;
@@ -94,7 +95,7 @@ public class ActionQualityCrops<T> extends AbstractBuiltInAction<T> {
if (toInv && player != null) {
PlayerUtils.giveItem(player, itemStack, itemStack.getAmount());
} else {
location.getWorld().dropItemNaturally(location, itemStack);
location.getWorld().dropItemNaturally(LocationUtils.toBlockCenterLocation(location), itemStack);
}
}
}, location);

View File

@@ -55,6 +55,14 @@ public interface WorldManager extends Reloadable {
*/
int getDate(World world);
/**
* Loads a CustomCrops world
*
* @param world The CustomCrops world
* @return The loaded CustomCropsWorld instance, it might be another instance if it's already loaded
*/
CustomCropsWorld<?> loadWorld(CustomCropsWorld<?> world);
/**
* Loads a CustomCrops world based on the specified Bukkit world.
*