mirror of
https://github.com/Xiao-MoMi/craft-engine.git
synced 2025-12-19 15:09:15 +00:00
添加指定特定方块作为bukkit material的选项
This commit is contained in:
@@ -417,9 +417,20 @@ public final class BukkitBlockManager extends AbstractBlockManager {
|
||||
@SuppressWarnings("unchecked")
|
||||
private void deceiveBukkitRegistry() {
|
||||
try {
|
||||
Material material;
|
||||
try {
|
||||
material = Material.valueOf(Config.deceiveBukkitMaterial().value().toUpperCase(Locale.ROOT));
|
||||
} catch (IllegalArgumentException e) {
|
||||
this.plugin.logger().warn(Config.deceiveBukkitMaterial() + " is not a valid material", e);
|
||||
material = Material.STONE;
|
||||
}
|
||||
if (!material.isBlock()) {
|
||||
this.plugin.logger().warn(Config.deceiveBukkitMaterial() + " is not a valid bukkit block material");
|
||||
material = Material.STONE;
|
||||
}
|
||||
Map<Object, Material> magicMap = (Map<Object, Material>) CraftBukkitReflections.field$CraftMagicNumbers$BLOCK_MATERIAL.get(null);
|
||||
for (DelegatingBlock customBlock : this.customBlocks) {
|
||||
magicMap.put(customBlock, Material.STONE);
|
||||
magicMap.put(customBlock, material);
|
||||
}
|
||||
} catch (ReflectiveOperationException e) {
|
||||
this.plugin.logger().warn("Failed to deceive bukkit magic blocks", e);
|
||||
|
||||
@@ -233,6 +233,9 @@ block:
|
||||
enable: false
|
||||
interval: 10
|
||||
extended-interaction-range: 0.5
|
||||
# Defines the value returned by Bukkit block.getMaterial()
|
||||
# If another plugin causes incompatibility due to its reliance on this method, try changing this option to a different vanilla block.
|
||||
deceive-bukkit-material: stone
|
||||
|
||||
furniture:
|
||||
# Hide technical entities used for storing furniture metadata.
|
||||
|
||||
@@ -125,6 +125,7 @@ public class Config {
|
||||
protected int block$predict_breaking_interval;
|
||||
protected double block$extended_interaction_range;
|
||||
protected boolean block$chunk_relighter;
|
||||
protected Key block$deceive_bukkit_material;
|
||||
protected int block$serverside_blocks = -1;
|
||||
|
||||
protected boolean recipe$enable;
|
||||
@@ -436,6 +437,7 @@ public class Config {
|
||||
block$predict_breaking_interval = Math.max(config.getInt("block.predict-breaking.interval", 10), 1);
|
||||
block$extended_interaction_range = Math.max(config.getDouble("block.predict-breaking.extended-interaction-range", 0.5), 0.0);
|
||||
block$chunk_relighter = config.getBoolean("block.chunk-relighter", true);
|
||||
block$deceive_bukkit_material = Key.of(config.getString("block.deceive-bukkit-material", "stone"));
|
||||
if (firstTime) {
|
||||
block$serverside_blocks = Math.min(config.getInt("block.serverside-blocks", 2000), 10_0000);
|
||||
if (block$serverside_blocks < 0) block$serverside_blocks = 0;
|
||||
@@ -770,6 +772,10 @@ public class Config {
|
||||
return instance.resource_pack$protection$obfuscation$resource_location$bypass_equipments;
|
||||
}
|
||||
|
||||
public static Key deceiveBukkitMaterial() {
|
||||
return instance.block$deceive_bukkit_material;
|
||||
}
|
||||
|
||||
public static boolean generateModAssets() {
|
||||
return instance.resource_pack$generate_mod_assets;
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@ org.gradle.jvmargs=-Xmx1G
|
||||
# Project settings
|
||||
# Rule: [major update].[feature update].[bug fix]
|
||||
project_version=0.0.64.7
|
||||
config_version=48
|
||||
config_version=49
|
||||
lang_version=34
|
||||
project_group=net.momirealms
|
||||
latest_supported_version=1.21.10
|
||||
|
||||
Reference in New Issue
Block a user