Mirror von
https://github.com/IntellectualSites/FastAsyncWorldEdit.git
synchronisiert 2024-11-20 09:50:06 +01:00
Use new language features
Dieser Commit ist enthalten in:
Ursprung
0d79d084a5
Commit
e2a1721a5c
@ -66,8 +66,8 @@ public class PaperweightLazyCompoundTag extends LazyCompoundTag {
|
|||||||
|
|
||||||
public double asDouble(String key) {
|
public double asDouble(String key) {
|
||||||
net.minecraft.nbt.Tag tag = compoundTagSupplier.get().get(key);
|
net.minecraft.nbt.Tag tag = compoundTagSupplier.get().get(key);
|
||||||
if (tag instanceof NumericTag) {
|
if (tag instanceof NumericTag numTag) {
|
||||||
return ((NumericTag) tag).getAsDouble();
|
return numTag.getAsDouble();
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -86,20 +86,19 @@ public class PaperweightLazyCompoundTag extends LazyCompoundTag {
|
|||||||
|
|
||||||
public int asInt(String key) {
|
public int asInt(String key) {
|
||||||
net.minecraft.nbt.Tag tag = compoundTagSupplier.get().get(key);
|
net.minecraft.nbt.Tag tag = compoundTagSupplier.get().get(key);
|
||||||
if (tag instanceof NumericTag) {
|
if (tag instanceof NumericTag numTag) {
|
||||||
return ((NumericTag) tag).getAsInt();
|
return numTag.getAsInt();
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<Tag> getList(String key) {
|
public List<Tag> getList(String key) {
|
||||||
net.minecraft.nbt.Tag tag = compoundTagSupplier.get().get(key);
|
net.minecraft.nbt.Tag tag = compoundTagSupplier.get().get(key);
|
||||||
if (tag instanceof net.minecraft.nbt.ListTag) {
|
if (tag instanceof net.minecraft.nbt.ListTag nbtList) {
|
||||||
ArrayList<Tag> list = new ArrayList<>();
|
ArrayList<Tag> list = new ArrayList<>();
|
||||||
net.minecraft.nbt.ListTag nbtList = (net.minecraft.nbt.ListTag) tag;
|
|
||||||
for (net.minecraft.nbt.Tag elem : nbtList) {
|
for (net.minecraft.nbt.Tag elem : nbtList) {
|
||||||
if (elem instanceof net.minecraft.nbt.CompoundTag) {
|
if (elem instanceof net.minecraft.nbt.CompoundTag compoundTag) {
|
||||||
list.add(new PaperweightLazyCompoundTag((net.minecraft.nbt.CompoundTag) elem));
|
list.add(new PaperweightLazyCompoundTag(compoundTag));
|
||||||
} else {
|
} else {
|
||||||
list.add(WorldEditPlugin.getInstance().getBukkitImplAdapter().toNative(elem));
|
list.add(WorldEditPlugin.getInstance().getBukkitImplAdapter().toNative(elem));
|
||||||
}
|
}
|
||||||
@ -137,8 +136,8 @@ public class PaperweightLazyCompoundTag extends LazyCompoundTag {
|
|||||||
|
|
||||||
public long asLong(String key) {
|
public long asLong(String key) {
|
||||||
net.minecraft.nbt.Tag tag = compoundTagSupplier.get().get(key);
|
net.minecraft.nbt.Tag tag = compoundTagSupplier.get().get(key);
|
||||||
if (tag instanceof NumericTag) {
|
if (tag instanceof NumericTag numTag) {
|
||||||
return ((NumericTag) tag).getAsLong();
|
return numTag.getAsLong();
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -414,15 +414,11 @@ public class PaperweightRegen extends Regenerator<ChunkAccess, ProtoChunk, Level
|
|||||||
}
|
}
|
||||||
|
|
||||||
private ResourceKey<LevelStem> getWorldDimKey(org.bukkit.World.Environment env) {
|
private ResourceKey<LevelStem> getWorldDimKey(org.bukkit.World.Environment env) {
|
||||||
switch (env) {
|
return switch (env) {
|
||||||
case NETHER:
|
case NETHER -> LevelStem.NETHER;
|
||||||
return LevelStem.NETHER;
|
case THE_END -> LevelStem.END;
|
||||||
case THE_END:
|
default -> LevelStem.OVERWORLD;
|
||||||
return LevelStem.END;
|
};
|
||||||
case NORMAL:
|
|
||||||
default:
|
|
||||||
return LevelStem.OVERWORLD;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private BiomeSource fastOverworldBiomeSource(BiomeSource biomeSource) throws Exception {
|
private BiomeSource fastOverworldBiomeSource(BiomeSource biomeSource) throws Exception {
|
||||||
|
@ -66,8 +66,8 @@ public class PaperweightLazyCompoundTag extends LazyCompoundTag {
|
|||||||
|
|
||||||
public double asDouble(String key) {
|
public double asDouble(String key) {
|
||||||
net.minecraft.nbt.Tag tag = compoundTagSupplier.get().get(key);
|
net.minecraft.nbt.Tag tag = compoundTagSupplier.get().get(key);
|
||||||
if (tag instanceof NumericTag) {
|
if (tag instanceof NumericTag numTag) {
|
||||||
return ((NumericTag) tag).getAsDouble();
|
return numTag.getAsDouble();
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -86,20 +86,19 @@ public class PaperweightLazyCompoundTag extends LazyCompoundTag {
|
|||||||
|
|
||||||
public int asInt(String key) {
|
public int asInt(String key) {
|
||||||
net.minecraft.nbt.Tag tag = compoundTagSupplier.get().get(key);
|
net.minecraft.nbt.Tag tag = compoundTagSupplier.get().get(key);
|
||||||
if (tag instanceof NumericTag) {
|
if (tag instanceof NumericTag numTag) {
|
||||||
return ((NumericTag) tag).getAsInt();
|
return numTag.getAsInt();
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<Tag> getList(String key) {
|
public List<Tag> getList(String key) {
|
||||||
net.minecraft.nbt.Tag tag = compoundTagSupplier.get().get(key);
|
net.minecraft.nbt.Tag tag = compoundTagSupplier.get().get(key);
|
||||||
if (tag instanceof net.minecraft.nbt.ListTag) {
|
if (tag instanceof net.minecraft.nbt.ListTag nbtList) {
|
||||||
ArrayList<Tag> list = new ArrayList<>();
|
ArrayList<Tag> list = new ArrayList<>();
|
||||||
net.minecraft.nbt.ListTag nbtList = (net.minecraft.nbt.ListTag) tag;
|
|
||||||
for (net.minecraft.nbt.Tag elem : nbtList) {
|
for (net.minecraft.nbt.Tag elem : nbtList) {
|
||||||
if (elem instanceof net.minecraft.nbt.CompoundTag) {
|
if (elem instanceof net.minecraft.nbt.CompoundTag compoundTag) {
|
||||||
list.add(new PaperweightLazyCompoundTag((net.minecraft.nbt.CompoundTag) elem));
|
list.add(new PaperweightLazyCompoundTag(compoundTag));
|
||||||
} else {
|
} else {
|
||||||
list.add(WorldEditPlugin.getInstance().getBukkitImplAdapter().toNative(elem));
|
list.add(WorldEditPlugin.getInstance().getBukkitImplAdapter().toNative(elem));
|
||||||
}
|
}
|
||||||
@ -138,8 +137,8 @@ public class PaperweightLazyCompoundTag extends LazyCompoundTag {
|
|||||||
|
|
||||||
public long asLong(String key) {
|
public long asLong(String key) {
|
||||||
net.minecraft.nbt.Tag tag = compoundTagSupplier.get().get(key);
|
net.minecraft.nbt.Tag tag = compoundTagSupplier.get().get(key);
|
||||||
if (tag instanceof NumericTag) {
|
if (tag instanceof NumericTag numTag) {
|
||||||
return ((NumericTag) tag).getAsLong();
|
return numTag.getAsLong();
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -397,15 +397,11 @@ public class PaperweightRegen extends Regenerator<ChunkAccess, ProtoChunk, Level
|
|||||||
}
|
}
|
||||||
|
|
||||||
private ResourceKey<LevelStem> getWorldDimKey(org.bukkit.World.Environment env) {
|
private ResourceKey<LevelStem> getWorldDimKey(org.bukkit.World.Environment env) {
|
||||||
switch (env) {
|
return switch (env) {
|
||||||
case NETHER:
|
case NETHER -> LevelStem.NETHER;
|
||||||
return LevelStem.NETHER;
|
case THE_END -> LevelStem.END;
|
||||||
case THE_END:
|
default -> LevelStem.OVERWORLD;
|
||||||
return LevelStem.END;
|
};
|
||||||
case NORMAL:
|
|
||||||
default:
|
|
||||||
return LevelStem.OVERWORLD;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static class RegenNoOpWorldLoadListener implements ChunkProgressListener {
|
private static class RegenNoOpWorldLoadListener implements ChunkProgressListener {
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren