mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2026-10-25 21:40:05 +00:00
addons
This commit is contained in:
1 parent
01d98d2141
commit
d20b3af9b9
57 files changed
+4778
-321
No files matched your search
@@ -90,12 +90,9 @@ import java.lang.reflect.Method;
|
||||
import java.lang.reflect.Modifier;
|
||||
import java.util.*;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.CountDownLatch;
|
||||
import java.util.concurrent.Executor;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
import ca.spottedleaf.moonrise.patches.chunk_system.io.MoonriseRegionFileIO;
|
||||
|
||||
public class NMSBinding implements INMSBinding {
|
||||
private final KMap<Biome, Object> baseBiomeCache = new KMap<>();
|
||||
@@ -453,11 +450,6 @@ public class NMSBinding implements INMSBinding {
|
||||
return keys;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isBukkit() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getBiomeId(Biome biome) {
|
||||
for (World i : Bukkit.getWorlds()) {
|
||||
@@ -596,42 +588,6 @@ public class NMSBinding implements INMSBinding {
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean purgeChunk(World world, int x, int z) {
|
||||
ServerLevel level = ((CraftWorld) world).getHandle();
|
||||
try {
|
||||
CountDownLatch latch = new CountDownLatch(1);
|
||||
Runnable unload = () -> {
|
||||
try {
|
||||
if (world.isChunkLoaded(x, z)) {
|
||||
world.unloadChunk(x, z, false);
|
||||
}
|
||||
} finally {
|
||||
latch.countDown();
|
||||
}
|
||||
};
|
||||
if (!J.runRegion(world, x, z, unload)) {
|
||||
return false;
|
||||
}
|
||||
if (!latch.await(15, TimeUnit.SECONDS)) {
|
||||
Iris.warn("Chunk purge timed out waiting to unload " + x + "," + z + " in " + world.getName() + ".");
|
||||
return false;
|
||||
}
|
||||
|
||||
for (MoonriseRegionFileIO.RegionFileType type : MoonriseRegionFileIO.RegionFileType.values()) {
|
||||
MoonriseRegionFileIO.scheduleSave(level, x, z, null, type);
|
||||
}
|
||||
MoonriseRegionFileIO.flush(level);
|
||||
return true;
|
||||
} catch (InterruptedException e) {
|
||||
Thread.currentThread().interrupt();
|
||||
return false;
|
||||
} catch (Throwable e) {
|
||||
Iris.reportError(e);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public ItemStack applyCustomNbt(ItemStack itemStack, KMap<String, Object> customNbt) throws IllegalArgumentException {
|
||||
if (customNbt != null && !customNbt.isEmpty()) {
|
||||
net.minecraft.world.item.ItemStack s = CraftItemStack.asNMSCopy(itemStack);
|
||||
|
||||
@@ -97,12 +97,9 @@ import java.lang.reflect.Method;
|
||||
import java.lang.reflect.Modifier;
|
||||
import java.util.*;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.CountDownLatch;
|
||||
import java.util.concurrent.Executor;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
import ca.spottedleaf.moonrise.patches.chunk_system.io.MoonriseRegionFileIO;
|
||||
|
||||
public class NMSBinding implements INMSBinding {
|
||||
private final KMap<Biome, Object> baseBiomeCache = new KMap<>();
|
||||
@@ -583,11 +580,6 @@ public class NMSBinding implements INMSBinding {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isBukkit() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getBiomeId(Biome biome) {
|
||||
for (World i : Bukkit.getWorlds()) {
|
||||
@@ -726,42 +718,6 @@ public class NMSBinding implements INMSBinding {
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean purgeChunk(World world, int x, int z) {
|
||||
ServerLevel level = ((CraftWorld) world).getHandle();
|
||||
try {
|
||||
CountDownLatch latch = new CountDownLatch(1);
|
||||
Runnable unload = () -> {
|
||||
try {
|
||||
if (world.isChunkLoaded(x, z)) {
|
||||
world.unloadChunk(x, z, false);
|
||||
}
|
||||
} finally {
|
||||
latch.countDown();
|
||||
}
|
||||
};
|
||||
if (!J.runRegion(world, x, z, unload)) {
|
||||
return false;
|
||||
}
|
||||
if (!latch.await(15, TimeUnit.SECONDS)) {
|
||||
Iris.warn("Chunk purge timed out waiting to unload " + x + "," + z + " in " + world.getName() + ".");
|
||||
return false;
|
||||
}
|
||||
|
||||
for (MoonriseRegionFileIO.RegionFileType type : MoonriseRegionFileIO.RegionFileType.values()) {
|
||||
MoonriseRegionFileIO.scheduleSave(level, x, z, null, type);
|
||||
}
|
||||
MoonriseRegionFileIO.flush(level);
|
||||
return true;
|
||||
} catch (InterruptedException e) {
|
||||
Thread.currentThread().interrupt();
|
||||
return false;
|
||||
} catch (Throwable e) {
|
||||
Iris.reportError(e);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public ItemStack applyCustomNbt(ItemStack itemStack, KMap<String, Object> customNbt) throws IllegalArgumentException {
|
||||
if (customNbt != null && !customNbt.isEmpty()) {
|
||||
net.minecraft.world.item.ItemStack s = CraftItemStack.asNMSCopy(itemStack);
|
||||
|
||||
Reference in new issue
Block a user