mirror of
https://github.com/Xiao-MoMi/craft-engine.git
synced 2025-12-25 01:49:30 +00:00
一些改进
This commit is contained in:
@@ -64,7 +64,8 @@ public class LegacyNetworkItemHandler implements NetworkItemHandler<ItemStack> {
|
||||
return new OtherItem(wrapped, false).process();
|
||||
} else {
|
||||
BukkitCustomItem customItem = (BukkitCustomItem) optionalCustomItem.get();
|
||||
boolean hasDifferentMaterial = FastNMS.INSTANCE.method$ItemStack$getItem(wrapped.getLiteralObject()) != customItem.clientItem();
|
||||
Object serverItem = FastNMS.INSTANCE.method$ItemStack$getItem(wrapped.getLiteralObject());
|
||||
boolean hasDifferentMaterial = serverItem == customItem.item() && serverItem != customItem.clientItem();
|
||||
if (hasDifferentMaterial) {
|
||||
wrapped = wrapped.unsafeTransmuteCopy(customItem.clientItem(), wrapped.count());
|
||||
}
|
||||
|
||||
@@ -66,7 +66,8 @@ public final class ModernNetworkItemHandler implements NetworkItemHandler<ItemSt
|
||||
return new OtherItem(wrapped, false).process();
|
||||
} else {
|
||||
BukkitCustomItem customItem = (BukkitCustomItem) optionalCustomItem.get();
|
||||
boolean hasDifferentMaterial = FastNMS.INSTANCE.method$ItemStack$getItem(wrapped.getLiteralObject()) != customItem.clientItem();
|
||||
Object serverItem = FastNMS.INSTANCE.method$ItemStack$getItem(wrapped.getLiteralObject());
|
||||
boolean hasDifferentMaterial = serverItem == customItem.item() && serverItem != customItem.clientItem();
|
||||
if (hasDifferentMaterial) {
|
||||
wrapped = wrapped.unsafeTransmuteCopy(customItem.clientItem(), wrapped.count());
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@ import it.unimi.dsi.fastutil.objects.ObjectArrayList;
|
||||
import net.momirealms.craftengine.core.pack.ResourceLocation;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.nio.file.FileVisitOption;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.util.Comparator;
|
||||
@@ -35,7 +36,7 @@ public class FileUtils {
|
||||
|
||||
public static void deleteDirectory(Path folder) throws IOException {
|
||||
if (!Files.exists(folder)) return;
|
||||
try (Stream<Path> walk = Files.walk(folder)) {
|
||||
try (Stream<Path> walk = Files.walk(folder, FileVisitOption.FOLLOW_LINKS)) {
|
||||
walk.sorted(Comparator.reverseOrder())
|
||||
.forEach(path -> {
|
||||
try {
|
||||
@@ -51,7 +52,7 @@ public class FileUtils {
|
||||
if (!Files.exists(configFolder)) {
|
||||
return List.of();
|
||||
}
|
||||
try (Stream<Path> stream = Files.walk(configFolder)) {
|
||||
try (Stream<Path> stream = Files.walk(configFolder, FileVisitOption.FOLLOW_LINKS)) {
|
||||
return stream.parallel()
|
||||
.filter(Files::isRegularFile)
|
||||
.filter(path -> path.toString().endsWith(".yml"))
|
||||
|
||||
@@ -41,7 +41,7 @@ commons_io_version=2.18.0
|
||||
commons_imaging_version=1.0.0-alpha6
|
||||
commons_lang3_version=3.17.0
|
||||
sparrow_nbt_version=0.9.1
|
||||
sparrow_util_version=0.49.1
|
||||
sparrow_util_version=0.49.2
|
||||
fastutil_version=8.5.15
|
||||
netty_version=4.1.121.Final
|
||||
joml_version=1.10.8
|
||||
|
||||
Reference in New Issue
Block a user