mirror of
https://github.com/Xiao-MoMi/Custom-Crops.git
synced 2025-12-23 17:09:21 +00:00
Improve vanilla crop check
This commit is contained in:
@@ -34,6 +34,7 @@ dependencies {
|
||||
compileOnly("com.saicone.rtag:rtag:${rootProject.properties["rtag_version"]}")
|
||||
compileOnly("net.objecthunter:exp4j:${rootProject.properties["exp4j_version"]}")
|
||||
compileOnly("com.google.guava:guava:${rootProject.properties["guava_version"]}")
|
||||
compileOnly("io.netty:netty-all:${rootProject.properties["netty_version"]}.Final")
|
||||
}
|
||||
|
||||
java {
|
||||
|
||||
@@ -56,7 +56,6 @@ public abstract class ConfigManager implements ConfigLoader, Reloadable {
|
||||
VANILLA_CROPS = Collections.unmodifiableSet(set);
|
||||
}
|
||||
|
||||
|
||||
private static ConfigManager instance;
|
||||
protected final BukkitCustomCropsPlugin plugin;
|
||||
|
||||
|
||||
@@ -46,6 +46,7 @@ import net.momirealms.customcrops.api.util.LocationUtils;
|
||||
import net.momirealms.customcrops.common.helper.AdventureHelper;
|
||||
import net.momirealms.customcrops.common.item.Item;
|
||||
import net.momirealms.customcrops.common.util.Pair;
|
||||
import net.momirealms.sparrow.heart.SparrowHeart;
|
||||
import org.bukkit.FluidCollisionMode;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
@@ -58,11 +59,16 @@ import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.util.RayTraceResult;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
import java.util.*;
|
||||
|
||||
public class WateringCanItem extends AbstractCustomCropsItem {
|
||||
private static final Set<String> VANILLA_CROP_STATES = new HashSet<>();
|
||||
|
||||
static {
|
||||
for (Material material : ConfigManager.VANILLA_CROPS) {
|
||||
VANILLA_CROP_STATES.addAll(SparrowHeart.getInstance().getAllBlockStates(material));
|
||||
}
|
||||
}
|
||||
|
||||
public WateringCanItem() {
|
||||
super(BuiltInItemMechanics.WATERING_CAN.key());
|
||||
@@ -278,7 +284,7 @@ public class WateringCanItem extends AbstractCustomCropsItem {
|
||||
|
||||
// if the clicked block is a crop, correct the target block
|
||||
List<CropConfig> cropConfigs = Registries.STAGE_TO_CROP_UNSAFE.get(targetBlockID);
|
||||
if (cropConfigs != null || Registries.ITEM_TO_DEAD_CROP.containsKey(targetBlockID)) {
|
||||
if (cropConfigs != null || Registries.ITEM_TO_DEAD_CROP.containsKey(targetBlockID) || VANILLA_CROP_STATES.contains(targetBlockID)) {
|
||||
// is a crop
|
||||
targetLocation = targetLocation.subtract(0,1,0);
|
||||
targetBlockID = BukkitCustomCropsPlugin.getInstance().getItemManager().blockID(targetLocation);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# Project settings
|
||||
# Rule: [major update].[feature update].[bug fix]
|
||||
project_version=3.6.30
|
||||
project_version=3.6.31
|
||||
config_version=42
|
||||
project_group=net.momirealms
|
||||
|
||||
@@ -16,9 +16,9 @@ gson_version=2.11.0
|
||||
asm_version=9.7.1
|
||||
asm_commons_version=9.7.1
|
||||
jar_relocator_version=1.7
|
||||
adventure_bundle_version=4.18.0
|
||||
adventure_bundle_version=4.19.0
|
||||
adventure_platform_version=4.3.4
|
||||
sparrow_heart_version=0.49
|
||||
sparrow_heart_version=0.51
|
||||
cloud_core_version=2.0.0
|
||||
cloud_services_version=2.0.0
|
||||
cloud_brigadier_version=2.0.0-beta.10
|
||||
@@ -38,6 +38,7 @@ zstd_version=1.5.6-9
|
||||
flow_nbt_version=2.0.2
|
||||
guava_version=33.3.1-jre
|
||||
vault_version=1.7
|
||||
netty_version=4.1.117
|
||||
|
||||
# Proxy settings
|
||||
#systemProp.socks.proxyHost=127.0.0.1
|
||||
|
||||
@@ -45,6 +45,7 @@ tasks {
|
||||
from(project(":compatibility-oraxen-r2").tasks.jar.get().archiveFile)
|
||||
from(project(":compatibility-itemsadder-r1").tasks.jar.get().archiveFile)
|
||||
from(project(":compatibility-crucible-r1").tasks.jar.get().archiveFile)
|
||||
from(project(":compatibility-craftengine-r1").tasks.jar.get().archiveFile)
|
||||
archiveFileName = "CustomCrops-${rootProject.properties["project_version"]}.jar"
|
||||
destinationDirectory.set(file("$rootDir/target"))
|
||||
relocate("net.kyori", "net.momirealms.customcrops.libraries")
|
||||
|
||||
@@ -45,7 +45,7 @@ public abstract class BukkitItemFactory extends ItemFactory<CustomCropsPlugin, R
|
||||
return new UniversalItemFactory(plugin);
|
||||
}
|
||||
case "1.20.5", "1.20.6",
|
||||
"1.21", "1.21.1", "1.21.2", "1.21.3", "1.21.4" -> {
|
||||
"1.21", "1.21.1", "1.21.2", "1.21.3", "1.21.4", "1.21.5" -> {
|
||||
return new ComponentItemFactory(plugin);
|
||||
}
|
||||
default -> throw new IllegalStateException("Unsupported server version: " + plugin.getServerVersion());
|
||||
|
||||
Reference in New Issue
Block a user