9
0
mirror of https://github.com/Xiao-MoMi/Custom-Crops.git synced 2025-12-27 10:59:20 +00:00

add more logs

This commit is contained in:
XiaoMoMi
2024-03-12 19:13:10 +08:00
parent 9706fef822
commit 2900fe9584
3 changed files with 23 additions and 8 deletions

View File

@@ -1842,7 +1842,7 @@ public class ItemManagerImpl implements ItemManager {
boolean enableFertilizedAppearance = section.getBoolean("fertilized-pots.enable", false);
PotConfig pot = new PotConfig(
key, storage, section.getBoolean("absorb-rainwater", true), section.getBoolean("absorb-nearby-water", false),
key, storage, section.getBoolean("absorb-rainwater", false), section.getBoolean("absorb-nearby-water", false),
dryModel, wetModel,
enableFertilizedAppearance,
enableFertilizedAppearance ? ConfigUtils.getFertilizedPotMap(section.getConfigurationSection("fertilized-pots")) : new HashMap<>(),

View File

@@ -20,6 +20,7 @@ package net.momirealms.customcrops.mechanic.item.custom.itemsadder;
import dev.lone.itemsadder.api.CustomBlock;
import dev.lone.itemsadder.api.CustomFurniture;
import dev.lone.itemsadder.api.CustomStack;
import net.momirealms.customcrops.api.util.LogUtils;
import net.momirealms.customcrops.mechanic.item.CustomProvider;
import org.bukkit.Location;
import org.bukkit.Material;
@@ -42,16 +43,25 @@ public class ItemsAdderProvider implements CustomProvider {
@Override
public void placeCustomBlock(Location location, String id) {
CustomBlock.place(id, location);
CustomBlock block = CustomBlock.place(id, location);
if (block == null) {
LogUtils.warn("Detected that custom block(" + id + ") doesn't exist in ItemsAdder configs. Please double check if that block exists.");
}
}
@Override
public Entity placeFurniture(Location location, String id) {
Location center = location.toCenterLocation();
center.setY(center.getBlockY());
CustomFurniture furniture = CustomFurniture.spawnPreciseNonSolid(id, location);
if (furniture == null) return null;
return furniture.getEntity();
try {
Location center = location.toCenterLocation();
center.setY(center.getBlockY());
CustomFurniture furniture = CustomFurniture.spawnPreciseNonSolid(id, location);
if (furniture == null) return null;
return furniture.getEntity();
} catch (RuntimeException e) {
LogUtils.warn("Failed to place ItemsAdder furniture. If this is not a problem caused by furniture not existing, consider increasing max-furniture-vehicles-per-chunk in ItemsAdder config.yml.");
e.printStackTrace();
return null;
}
}
@Override

View File

@@ -23,6 +23,7 @@ import io.th0rgal.oraxen.api.OraxenItems;
import io.th0rgal.oraxen.items.ItemBuilder;
import io.th0rgal.oraxen.mechanics.Mechanic;
import io.th0rgal.oraxen.mechanics.provided.gameplay.furniture.FurnitureMechanic;
import net.momirealms.customcrops.api.util.LogUtils;
import net.momirealms.customcrops.mechanic.item.CustomProvider;
import org.bukkit.Location;
import org.bukkit.Material;
@@ -55,7 +56,11 @@ public class OraxenProvider implements CustomProvider {
public Entity placeFurniture(Location location, String id) {
Location center = location.toCenterLocation();
center.setY(center.getBlockY());
return OraxenFurniture.place(id, location, Rotation.NONE, BlockFace.UP);
Entity entity = OraxenFurniture.place(id, location, Rotation.NONE, BlockFace.UP);
if (entity == null) {
LogUtils.warn("Furniture(" + id +") doesn't exist in Oraxen configs. Please double check if that furniture exists.");
}
return entity;
}
@Override