mirror of
https://github.com/plexusorg/Plex-FAWE.git
synced 2024-11-16 17:16:11 +00:00
WIP merge (i'll finish this later)
This commit is contained in:
parent
1beea3cd22
commit
33f5322fda
@ -14,6 +14,7 @@ dependencies {
|
|||||||
compile 'net.milkbowl.vault:VaultAPI:1.7'
|
compile 'net.milkbowl.vault:VaultAPI:1.7'
|
||||||
compile 'com.sk89q:dummypermscompat:1.10'
|
compile 'com.sk89q:dummypermscompat:1.10'
|
||||||
compile 'com.destroystokyo.paper:paper-api:1.13.2-R0.1-SNAPSHOT'
|
compile 'com.destroystokyo.paper:paper-api:1.13.2-R0.1-SNAPSHOT'
|
||||||
|
compile 'org.spigotmc:spigot:1.13.2-R0.1-SNAPSHOT'
|
||||||
compile 'org.slf4j:slf4j-jdk14:1.7.26'
|
compile 'org.slf4j:slf4j-jdk14:1.7.26'
|
||||||
testCompile 'org.mockito:mockito-core:1.9.0-rc1'
|
testCompile 'org.mockito:mockito-core:1.9.0-rc1'
|
||||||
compile 'com.massivecraft:factions:2.8.0'
|
compile 'com.massivecraft:factions:2.8.0'
|
||||||
|
@ -33,6 +33,7 @@ import com.sk89q.worldedit.internal.Constants;
|
|||||||
import com.sk89q.worldedit.math.BlockVector3;
|
import com.sk89q.worldedit.math.BlockVector3;
|
||||||
import com.sk89q.worldedit.registry.state.*;
|
import com.sk89q.worldedit.registry.state.*;
|
||||||
import com.sk89q.worldedit.util.Direction;
|
import com.sk89q.worldedit.util.Direction;
|
||||||
|
import com.sk89q.worldedit.world.biome.BiomeType;
|
||||||
import com.sk89q.worldedit.world.block.BlockState;
|
import com.sk89q.worldedit.world.block.BlockState;
|
||||||
import com.sk89q.worldedit.world.block.*;
|
import com.sk89q.worldedit.world.block.*;
|
||||||
import com.sk89q.worldedit.world.registry.BlockMaterial;
|
import com.sk89q.worldedit.world.registry.BlockMaterial;
|
||||||
@ -188,18 +189,6 @@ public final class Spigot_v1_13_R2 extends CachedBukkitAdapter implements Bukkit
|
|||||||
// Code that is less likely to break
|
// Code that is less likely to break
|
||||||
// ------------------------------------------------------------------------
|
// ------------------------------------------------------------------------
|
||||||
|
|
||||||
@Override
|
|
||||||
public BiomeType getBiomeId(Biome biome) {
|
|
||||||
BiomeBase mcBiome = CraftBlock.biomeToBiomeBase(biome);
|
|
||||||
return mcBiome != null ? IRegistry.BIOME.a(mcBiome) : 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Biome getBiome(int id) {
|
|
||||||
BiomeBase mcBiome = IRegistry.BIOME.fromId(id);
|
|
||||||
return CraftBlock.biomeBaseToBiome(mcBiome); // Defaults to ocean if it's an invalid ID
|
|
||||||
}
|
|
||||||
|
|
||||||
@SuppressWarnings("deprecation")
|
@SuppressWarnings("deprecation")
|
||||||
@Override
|
@Override
|
||||||
public BaseBlock getBlock(Location location) {
|
public BaseBlock getBlock(Location location) {
|
||||||
|
@ -23,6 +23,7 @@ import java.util.Set;
|
|||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
import com.sk89q.worldedit.entity.Player;
|
import com.sk89q.worldedit.entity.Player;
|
||||||
|
import com.sk89q.worldedit.world.biome.BiomeType;
|
||||||
import com.sk89q.worldedit.world.block.BaseBlock;
|
import com.sk89q.worldedit.world.block.BaseBlock;
|
||||||
import com.sk89q.worldedit.world.block.BlockStateHolder;
|
import com.sk89q.worldedit.world.block.BlockStateHolder;
|
||||||
import com.sk89q.worldedit.world.block.BlockType;
|
import com.sk89q.worldedit.world.block.BlockType;
|
||||||
@ -170,17 +171,16 @@ public class BukkitChunk_All extends IntFaweChunk<Chunk, BukkitQueue_All> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Biomes
|
// Biomes
|
||||||
final byte[] biomes = getBiomeArray();
|
final BiomeType[] biomes = getBiomeArray();
|
||||||
if (biomes != null) {
|
if (biomes != null) {
|
||||||
int index = 0;
|
int index = 0;
|
||||||
for (int z = 0; z < 16; z++) {
|
for (int z = 0; z < 16; z++) {
|
||||||
int zz = bz + z;
|
int zz = bz + z;
|
||||||
for (int x = 0; x < 16; x++, index++) {
|
for (int x = 0; x < 16; x++, index++) {
|
||||||
int xx = bx + x;
|
int xx = bx + x;
|
||||||
int biome = biomes[index] & 0xFF;
|
BiomeType biome = biomes[index];
|
||||||
if (biome == 0) continue;
|
if (biome == null) continue;
|
||||||
if (biome == 255) biome = 0;
|
Biome bukkitBiome = adapter.adapt(biome);
|
||||||
Biome bukkitBiome = adapter.getBiome(biome);
|
|
||||||
if (bukkitBiome != null) {
|
if (bukkitBiome != null) {
|
||||||
world.setBiome(xx, zz, bukkitBiome);
|
world.setBiome(xx, zz, bukkitBiome);
|
||||||
}
|
}
|
||||||
|
@ -9,6 +9,7 @@ import java.util.Collection;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import com.sk89q.worldedit.bukkit.BukkitAdapter;
|
import com.sk89q.worldedit.bukkit.BukkitAdapter;
|
||||||
|
import com.sk89q.worldedit.world.biome.BiomeType;
|
||||||
import com.sk89q.worldedit.world.block.BlockType;
|
import com.sk89q.worldedit.world.block.BlockType;
|
||||||
import com.sk89q.worldedit.world.block.BlockTypes;
|
import com.sk89q.worldedit.world.block.BlockTypes;
|
||||||
|
|
||||||
@ -232,13 +233,13 @@ public class AsyncBlock implements Block {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Biome getBiome() {
|
public Biome getBiome() {
|
||||||
return world.getAdapter().getBiome(queue.getBiomeType(x, z));
|
return world.getAdapter().adapt(queue.getBiomeType(x, z));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setBiome(Biome bio) {
|
public void setBiome(Biome bio) {
|
||||||
int id = world.getAdapter().getBiomeId(bio);
|
BiomeType biome = world.getAdapter().adapt(bio);
|
||||||
queue.setBiome(x, z, FaweCache.getBiome(id));
|
queue.setBiome(x, z, biome);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -858,13 +858,13 @@ public class AsyncWorld extends DelegateFaweQueue implements World, HasFaweQueue
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Biome getBiome(int x, int z) {
|
public Biome getBiome(int x, int z) {
|
||||||
return adapter.getBiome(queue.getBiomeType(x, z));
|
return adapter.adapt(queue.getBiomeType(x, z));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setBiome(int x, int z, Biome bio) {
|
public void setBiome(int x, int z, Biome bio) {
|
||||||
int id = adapter.getBiomeId(bio);
|
BiomeType biome = adapter.adapt(bio);
|
||||||
queue.setBiome(x, z, new BiomeType(id));
|
queue.setBiome(x, z, biome);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -144,7 +144,7 @@ public enum BukkitAdapter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static Biome adapt(BiomeType biomeType) {
|
public static Biome adapt(BiomeType biomeType) {
|
||||||
getAdapter().adapt(biomeType);
|
return getAdapter().adapt(biomeType);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -23,7 +23,9 @@ import com.sk89q.worldedit.world.registry.BiomeRegistry;
|
|||||||
import com.sk89q.worldedit.world.registry.BlockCategoryRegistry;
|
import com.sk89q.worldedit.world.registry.BlockCategoryRegistry;
|
||||||
import com.sk89q.worldedit.world.registry.BlockRegistry;
|
import com.sk89q.worldedit.world.registry.BlockRegistry;
|
||||||
import com.sk89q.worldedit.world.registry.BundledRegistries;
|
import com.sk89q.worldedit.world.registry.BundledRegistries;
|
||||||
|
import com.sk89q.worldedit.world.registry.EntityRegistry;
|
||||||
import com.sk89q.worldedit.world.registry.ItemCategoryRegistry;
|
import com.sk89q.worldedit.world.registry.ItemCategoryRegistry;
|
||||||
|
import com.sk89q.worldedit.world.registry.ItemRegistry;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* World data for the Bukkit platform.
|
* World data for the Bukkit platform.
|
||||||
|
@ -19,8 +19,6 @@
|
|||||||
|
|
||||||
package com.sk89q.worldedit.bukkit;
|
package com.sk89q.worldedit.bukkit;
|
||||||
|
|
||||||
import com.bekvon.bukkit.residence.commands.message;
|
|
||||||
import com.bekvon.bukkit.residence.containers.cmd;
|
|
||||||
import com.boydti.fawe.Fawe;
|
import com.boydti.fawe.Fawe;
|
||||||
import com.boydti.fawe.bukkit.FaweBukkit;
|
import com.boydti.fawe.bukkit.FaweBukkit;
|
||||||
import com.boydti.fawe.bukkit.adapter.v1_13_1.Spigot_v1_13_R2;
|
import com.boydti.fawe.bukkit.adapter.v1_13_1.Spigot_v1_13_R2;
|
||||||
@ -36,28 +34,17 @@ import com.sk89q.worldedit.bukkit.adapter.BukkitImplAdapter;
|
|||||||
import com.sk89q.worldedit.bukkit.adapter.BukkitImplLoader;
|
import com.sk89q.worldedit.bukkit.adapter.BukkitImplLoader;
|
||||||
import com.sk89q.worldedit.event.platform.CommandEvent;
|
import com.sk89q.worldedit.event.platform.CommandEvent;
|
||||||
import com.sk89q.worldedit.event.platform.PlatformReadyEvent;
|
import com.sk89q.worldedit.event.platform.PlatformReadyEvent;
|
||||||
import com.sk89q.worldedit.extension.input.InputParseException;
|
|
||||||
import com.sk89q.worldedit.extension.input.ParserContext;
|
|
||||||
import com.sk89q.worldedit.extension.platform.Actor;
|
import com.sk89q.worldedit.extension.platform.Actor;
|
||||||
import com.sk89q.worldedit.extension.platform.Capability;
|
import com.sk89q.worldedit.extension.platform.Capability;
|
||||||
import com.sk89q.worldedit.extension.platform.NoCapablePlatformException;
|
import com.sk89q.worldedit.extension.platform.NoCapablePlatformException;
|
||||||
import com.sk89q.worldedit.extension.platform.Platform;
|
import com.sk89q.worldedit.extension.platform.Platform;
|
||||||
import com.sk89q.worldedit.extent.inventory.BlockBag;
|
import com.sk89q.worldedit.extent.inventory.BlockBag;
|
||||||
import com.sk89q.worldedit.registry.state.Property;
|
|
||||||
import com.sk89q.worldedit.world.biome.BiomeType;
|
|
||||||
import com.sk89q.worldedit.world.block.BlockCategory;
|
import com.sk89q.worldedit.world.block.BlockCategory;
|
||||||
import com.sk89q.worldedit.world.block.BlockState;
|
|
||||||
import com.sk89q.worldedit.world.block.BlockType;
|
|
||||||
import com.sk89q.worldedit.world.block.FuzzyBlockState;
|
|
||||||
import com.sk89q.worldedit.world.entity.EntityType;
|
|
||||||
import com.sk89q.worldedit.world.item.ItemCategory;
|
import com.sk89q.worldedit.world.item.ItemCategory;
|
||||||
import com.sk89q.worldedit.world.item.ItemType;
|
|
||||||
import com.sk89q.worldedit.world.registry.LegacyMapper;
|
import com.sk89q.worldedit.world.registry.LegacyMapper;
|
||||||
import org.bstats.bukkit.Metrics;
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.Tag;
|
import org.bukkit.Tag;
|
||||||
import org.bukkit.block.Biome;
|
|
||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
@ -74,9 +61,11 @@ import java.io.FileOutputStream;
|
|||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.lang.reflect.Field;
|
import java.lang.reflect.Field;
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
import java.util.jar.JarFile;
|
import java.util.jar.JarFile;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
import java.util.zip.ZipEntry;
|
import java.util.zip.ZipEntry;
|
||||||
@ -98,42 +87,42 @@ public class WorldEditPlugin extends JavaPlugin //implements TabCompleter
|
|||||||
private BukkitConfiguration config;
|
private BukkitConfiguration config;
|
||||||
|
|
||||||
private static Map<String, Plugin> lookupNames;
|
private static Map<String, Plugin> lookupNames;
|
||||||
// static {
|
static {
|
||||||
// { // Disable AWE as otherwise both fail to load
|
{ // Disable AWE as otherwise both fail to load
|
||||||
// PluginManager manager = Bukkit.getPluginManager();
|
PluginManager manager = Bukkit.getPluginManager();
|
||||||
// try {
|
try {
|
||||||
// Field pluginsField = manager.getClass().getDeclaredField("plugins");
|
Field pluginsField = manager.getClass().getDeclaredField("plugins");
|
||||||
// Field lookupNamesField = manager.getClass().getDeclaredField("lookupNames");
|
Field lookupNamesField = manager.getClass().getDeclaredField("lookupNames");
|
||||||
// pluginsField.setAccessible(true);
|
pluginsField.setAccessible(true);
|
||||||
// lookupNamesField.setAccessible(true);
|
lookupNamesField.setAccessible(true);
|
||||||
// List<Plugin> plugins = (List<Plugin>) pluginsField.get(manager);
|
List<Plugin> plugins = (List<Plugin>) pluginsField.get(manager);
|
||||||
// lookupNames = (Map<String, Plugin>) lookupNamesField.get(manager);
|
lookupNames = (Map<String, Plugin>) lookupNamesField.get(manager);
|
||||||
// pluginsField.set(manager, plugins = new ArrayList<Plugin>(plugins) {
|
pluginsField.set(manager, plugins = new ArrayList<Plugin>(plugins) {
|
||||||
// @Override
|
@Override
|
||||||
// public boolean add(Plugin plugin) {
|
public boolean add(Plugin plugin) {
|
||||||
// if (plugin.getName().startsWith("AsyncWorldEdit")) {
|
if (plugin.getName().startsWith("AsyncWorldEdit")) {
|
||||||
// Fawe.debug("Disabling `" + plugin.getName() + "` as it is incompatible");
|
Fawe.debug("Disabling `" + plugin.getName() + "` as it is incompatible");
|
||||||
// } else if (plugin.getName().startsWith("BetterShutdown")) {
|
} else if (plugin.getName().startsWith("BetterShutdown")) {
|
||||||
// Fawe.debug("Disabling `" + plugin.getName() + "` as it is incompatible (Improperly shaded classes from com.sk89q.minecraft.util.commands)");
|
Fawe.debug("Disabling `" + plugin.getName() + "` as it is incompatible (Improperly shaded classes from com.sk89q.minecraft.util.commands)");
|
||||||
// } else {
|
} else {
|
||||||
// return super.add(plugin);
|
return super.add(plugin);
|
||||||
// }
|
}
|
||||||
// return false;
|
return false;
|
||||||
// }
|
}
|
||||||
// });
|
});
|
||||||
// lookupNamesField.set(manager, lookupNames = new ConcurrentHashMap<String, Plugin>(lookupNames) {
|
lookupNamesField.set(manager, lookupNames = new ConcurrentHashMap<String, Plugin>(lookupNames) {
|
||||||
// @Override
|
@Override
|
||||||
// public Plugin put(String key, Plugin plugin) {
|
public Plugin put(String key, Plugin plugin) {
|
||||||
// if (plugin.getName().startsWith("AsyncWorldEdit") || plugin.getName().startsWith("BetterShutdown")) {
|
if (plugin.getName().startsWith("AsyncWorldEdit") || plugin.getName().startsWith("BetterShutdown")) {
|
||||||
// return null;
|
return null;
|
||||||
// }
|
}
|
||||||
// return super.put(key, plugin);
|
return super.put(key, plugin);
|
||||||
// }
|
}
|
||||||
// });
|
});
|
||||||
// } catch (Throwable ignore) {}
|
} catch (Throwable ignore) {}
|
||||||
// }
|
}
|
||||||
// }
|
}
|
||||||
//
|
|
||||||
public WorldEditPlugin() {
|
public WorldEditPlugin() {
|
||||||
init();
|
init();
|
||||||
}
|
}
|
||||||
|
@ -20,6 +20,7 @@
|
|||||||
package com.sk89q.worldedit.bukkit.adapter;
|
package com.sk89q.worldedit.bukkit.adapter;
|
||||||
|
|
||||||
import com.sk89q.jnbt.CompoundTag;
|
import com.sk89q.jnbt.CompoundTag;
|
||||||
|
import com.sk89q.jnbt.Tag;
|
||||||
import com.sk89q.worldedit.entity.BaseEntity;
|
import com.sk89q.worldedit.entity.BaseEntity;
|
||||||
import com.sk89q.worldedit.math.BlockVector3;
|
import com.sk89q.worldedit.math.BlockVector3;
|
||||||
import com.sk89q.worldedit.registry.state.Property;
|
import com.sk89q.worldedit.registry.state.Property;
|
||||||
|
@ -8,6 +8,8 @@ import com.sk89q.worldedit.math.BlockVector3;
|
|||||||
import com.sk89q.worldedit.math.Vector3;
|
import com.sk89q.worldedit.math.Vector3;
|
||||||
import com.sk89q.worldedit.util.Location;
|
import com.sk89q.worldedit.util.Location;
|
||||||
import com.sk89q.worldedit.world.World;
|
import com.sk89q.worldedit.world.World;
|
||||||
|
import com.sk89q.worldedit.world.biome.BiomeType;
|
||||||
|
import com.sk89q.worldedit.world.biome.BiomeTypes;
|
||||||
import com.sk89q.worldedit.world.block.BlockState;
|
import com.sk89q.worldedit.world.block.BlockState;
|
||||||
import com.sk89q.worldedit.world.block.BlockStateHolder;
|
import com.sk89q.worldedit.world.block.BlockStateHolder;
|
||||||
import com.sk89q.worldedit.world.block.BlockType;
|
import com.sk89q.worldedit.world.block.BlockType;
|
||||||
@ -19,6 +21,7 @@ import com.sk89q.worldedit.world.gamemode.GameModes;
|
|||||||
import com.sk89q.worldedit.world.item.ItemType;
|
import com.sk89q.worldedit.world.item.ItemType;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
|
import org.bukkit.block.Biome;
|
||||||
import org.bukkit.block.data.BlockData;
|
import org.bukkit.block.data.BlockData;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
@ -354,4 +357,19 @@ public interface IBukkitAdapter {
|
|||||||
default Player adapt(com.sk89q.worldedit.entity.Player player) {
|
default Player adapt(com.sk89q.worldedit.entity.Player player) {
|
||||||
return ((BukkitPlayer) player).getPlayer();
|
return ((BukkitPlayer) player).getPlayer();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
default Biome adapt(BiomeType biomeType) {
|
||||||
|
if (!biomeType.getId().startsWith("minecraft:")) {
|
||||||
|
throw new IllegalArgumentException("Bukkit only supports vanilla biomes");
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
return Biome.valueOf(biomeType.getId().substring(10).toUpperCase());
|
||||||
|
} catch (IllegalArgumentException e) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
default BiomeType adapt(Biome biome) {
|
||||||
|
return BiomeTypes.get(biome.name().toLowerCase());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -31,7 +31,7 @@ public class OffsetFaweClipboard extends AbstractDelegateFaweClipboard {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean setBiome(int x, int z, int biome) {
|
public boolean setBiome(int x, int z, BiomeType biome) {
|
||||||
return super.setBiome(ox + x, oz + z, biome);
|
return super.setBiome(ox + x, oz + z, biome);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -13,8 +13,6 @@ import java.util.Collections;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import jdk.internal.reflect.ConstructorAccessor;
|
|
||||||
import jdk.internal.reflect.FieldAccessor;
|
|
||||||
import sun.reflect.ConstructorAccessor;
|
import sun.reflect.ConstructorAccessor;
|
||||||
import sun.reflect.FieldAccessor;
|
import sun.reflect.FieldAccessor;
|
||||||
import sun.reflect.ReflectionFactory;
|
import sun.reflect.ReflectionFactory;
|
||||||
|
@ -46,20 +46,15 @@ import com.sk89q.worldedit.extent.inventory.BlockBag;
|
|||||||
import com.sk89q.worldedit.extent.inventory.SlottableBlockBag;
|
import com.sk89q.worldedit.extent.inventory.SlottableBlockBag;
|
||||||
import com.sk89q.worldedit.internal.registry.InputParser;
|
import com.sk89q.worldedit.internal.registry.InputParser;
|
||||||
import com.sk89q.worldedit.math.BlockVector3;
|
import com.sk89q.worldedit.math.BlockVector3;
|
||||||
import com.sk89q.worldedit.registry.state.Property;
|
|
||||||
import com.sk89q.worldedit.util.HandSide;
|
import com.sk89q.worldedit.util.HandSide;
|
||||||
import com.sk89q.worldedit.world.World;
|
import com.sk89q.worldedit.world.World;
|
||||||
import com.sk89q.worldedit.world.block.BaseBlock;
|
import com.sk89q.worldedit.world.block.BaseBlock;
|
||||||
import com.sk89q.worldedit.world.block.BlockState;
|
import com.sk89q.worldedit.world.block.BlockState;
|
||||||
import com.sk89q.worldedit.world.block.BlockType;
|
import com.sk89q.worldedit.world.block.BlockType;
|
||||||
import com.sk89q.worldedit.world.block.BlockTypes;
|
import com.sk89q.worldedit.world.block.BlockTypes;
|
||||||
import com.sk89q.worldedit.world.block.FuzzyBlockState;
|
|
||||||
import com.sk89q.worldedit.world.registry.LegacyMapper;
|
import com.sk89q.worldedit.world.registry.LegacyMapper;
|
||||||
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
|
||||||
import java.util.function.Predicate;
|
|
||||||
import java.util.function.Supplier;
|
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
import java.util.stream.Stream;
|
import java.util.stream.Stream;
|
||||||
|
|
||||||
|
@ -24,10 +24,8 @@ import com.sk89q.worldedit.extension.input.InputParseException;
|
|||||||
import com.sk89q.worldedit.extension.input.ParserContext;
|
import com.sk89q.worldedit.extension.input.ParserContext;
|
||||||
import com.sk89q.worldedit.function.pattern.BlockPattern;
|
import com.sk89q.worldedit.function.pattern.BlockPattern;
|
||||||
import com.sk89q.worldedit.function.pattern.Pattern;
|
import com.sk89q.worldedit.function.pattern.Pattern;
|
||||||
import com.sk89q.worldedit.function.pattern.RandomStatePattern;
|
|
||||||
import com.sk89q.worldedit.internal.registry.InputParser;
|
import com.sk89q.worldedit.internal.registry.InputParser;
|
||||||
import com.sk89q.worldedit.world.block.BaseBlock;
|
import com.sk89q.worldedit.world.block.BaseBlock;
|
||||||
import com.sk89q.worldedit.world.block.FuzzyBlockState;
|
|
||||||
|
|
||||||
public class RandomStatePatternParser extends InputParser<Pattern> {
|
public class RandomStatePatternParser extends InputParser<Pattern> {
|
||||||
public RandomStatePatternParser(WorldEdit worldEdit) {
|
public RandomStatePatternParser(WorldEdit worldEdit) {
|
||||||
@ -47,8 +45,6 @@ public class RandomStatePatternParser extends InputParser<Pattern> {
|
|||||||
if (block.getStates().size() == block.getBlockType().getPropertyMap().size()) {
|
if (block.getStates().size() == block.getBlockType().getPropertyMap().size()) {
|
||||||
// they requested random with *, but didn't leave any states empty - simplify
|
// they requested random with *, but didn't leave any states empty - simplify
|
||||||
return new BlockPattern(block);
|
return new BlockPattern(block);
|
||||||
} else if (block.toImmutableState() instanceof FuzzyBlockState) {
|
|
||||||
return new RandomStatePattern((FuzzyBlockState) block.toImmutableState());
|
|
||||||
} else {
|
} else {
|
||||||
return null; // only should happen if parseLogic changes
|
return null; // only should happen if parseLogic changes
|
||||||
}
|
}
|
||||||
|
@ -1,45 +0,0 @@
|
|||||||
/*
|
|
||||||
* WorldEdit, a Minecraft world manipulation toolkit
|
|
||||||
* Copyright (C) sk89q <http://www.sk89q.com>
|
|
||||||
* Copyright (C) WorldEdit team and contributors
|
|
||||||
*
|
|
||||||
* This program is free software: you can redistribute it and/or modify it
|
|
||||||
* under the terms of the GNU Lesser General Public License as published by the
|
|
||||||
* Free Software Foundation, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
|
||||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
||||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
|
|
||||||
* for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU Lesser General Public License
|
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package com.sk89q.worldedit.function.pattern;
|
|
||||||
|
|
||||||
import com.sk89q.worldedit.math.BlockVector3;
|
|
||||||
import com.sk89q.worldedit.world.block.BaseBlock;
|
|
||||||
import com.sk89q.worldedit.world.block.BlockState;
|
|
||||||
import com.sk89q.worldedit.world.block.FuzzyBlockState;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Random;
|
|
||||||
import java.util.stream.Collectors;
|
|
||||||
|
|
||||||
public class RandomStatePattern implements Pattern {
|
|
||||||
|
|
||||||
private final Random rand = new Random();
|
|
||||||
private final List<BaseBlock> blocks;
|
|
||||||
|
|
||||||
public RandomStatePattern(FuzzyBlockState state) {
|
|
||||||
blocks = state.getBlockType().getAllStates().stream().filter(state::equalsFuzzy)
|
|
||||||
.map(BlockState::toBaseBlock).collect(Collectors.toList());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public BaseBlock apply(BlockVector3 position) {
|
|
||||||
return blocks.get(rand.nextInt(blocks.size()));
|
|
||||||
}
|
|
||||||
}
|
|
@ -20,6 +20,8 @@
|
|||||||
package com.sk89q.worldedit.world.biome;
|
package com.sk89q.worldedit.world.biome;
|
||||||
|
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
@ -105,11 +107,13 @@ public class BiomeTypes {
|
|||||||
private BiomeTypes() {
|
private BiomeTypes() {
|
||||||
}
|
}
|
||||||
|
|
||||||
private static int index = 0;
|
private static List<BiomeType> biomes = new ArrayList<>();
|
||||||
|
private static List<BiomeType> biomesLocked = Collections.unmodifiableList(biomes);
|
||||||
|
|
||||||
private static BiomeType register(final String id) {
|
private static BiomeType register(final String id) {
|
||||||
// TODO implement registry
|
BiomeType biome = new BiomeType(id, biomes.size());
|
||||||
return register(new BiomeType(id, index++));
|
biomes.add(biome);
|
||||||
|
return register(biome);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static BiomeType register(final BiomeType biome) {
|
public static BiomeType register(final BiomeType biome) {
|
||||||
@ -120,11 +124,11 @@ public class BiomeTypes {
|
|||||||
return BiomeType.REGISTRY.get(id);
|
return BiomeType.REGISTRY.get(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static BiomeType get(int parseInt) {
|
public static BiomeType get(int internalId) {
|
||||||
// TODO
|
return biomes.get(internalId);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static List<BiomeType> values() {
|
public static List<BiomeType> values() {
|
||||||
|
return biomesLocked;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,604 @@
|
|||||||
|
package com.sk89q.worldedit.world.block;
|
||||||
|
|
||||||
|
public class BlockID {
|
||||||
|
// Used for switch statements on blocks
|
||||||
|
public static final int __RESERVED__ = 0;
|
||||||
|
public static final int ACACIA_BUTTON = 1;
|
||||||
|
public static final int ACACIA_DOOR = 2;
|
||||||
|
public static final int ACACIA_FENCE = 3;
|
||||||
|
public static final int ACACIA_FENCE_GATE = 4;
|
||||||
|
public static final int ACACIA_LEAVES = 5;
|
||||||
|
public static final int ACACIA_LOG = 6;
|
||||||
|
public static final int ACACIA_PLANKS = 7;
|
||||||
|
public static final int ACACIA_PRESSURE_PLATE = 8;
|
||||||
|
public static final int ACACIA_SAPLING = 9;
|
||||||
|
public static final int ACACIA_SLAB = 10;
|
||||||
|
public static final int ACACIA_STAIRS = 11;
|
||||||
|
public static final int ACACIA_TRAPDOOR = 12;
|
||||||
|
public static final int ACACIA_WOOD = 13;
|
||||||
|
public static final int ACTIVATOR_RAIL = 14;
|
||||||
|
public static final int AIR = 15;
|
||||||
|
public static final int ALLIUM = 16;
|
||||||
|
public static final int ANDESITE = 17;
|
||||||
|
public static final int ANVIL = 18;
|
||||||
|
public static final int ATTACHED_MELON_STEM = 19;
|
||||||
|
public static final int ATTACHED_PUMPKIN_STEM = 20;
|
||||||
|
public static final int AZURE_BLUET = 21;
|
||||||
|
public static final int BARRIER = 22;
|
||||||
|
public static final int BEACON = 23;
|
||||||
|
public static final int BEDROCK = 24;
|
||||||
|
public static final int BEETROOTS = 25;
|
||||||
|
public static final int BIRCH_BUTTON = 26;
|
||||||
|
public static final int BIRCH_DOOR = 27;
|
||||||
|
public static final int BIRCH_FENCE = 28;
|
||||||
|
public static final int BIRCH_FENCE_GATE = 29;
|
||||||
|
public static final int BIRCH_LEAVES = 30;
|
||||||
|
public static final int BIRCH_LOG = 31;
|
||||||
|
public static final int BIRCH_PLANKS = 32;
|
||||||
|
public static final int BIRCH_PRESSURE_PLATE = 33;
|
||||||
|
public static final int BIRCH_SAPLING = 34;
|
||||||
|
public static final int BIRCH_SLAB = 35;
|
||||||
|
public static final int BIRCH_STAIRS = 36;
|
||||||
|
public static final int BIRCH_TRAPDOOR = 37;
|
||||||
|
public static final int BIRCH_WOOD = 38;
|
||||||
|
public static final int BLACK_BANNER = 39;
|
||||||
|
public static final int BLACK_BED = 40;
|
||||||
|
public static final int BLACK_CARPET = 41;
|
||||||
|
public static final int BLACK_CONCRETE = 42;
|
||||||
|
public static final int BLACK_CONCRETE_POWDER = 43;
|
||||||
|
public static final int BLACK_GLAZED_TERRACOTTA = 44;
|
||||||
|
public static final int BLACK_SHULKER_BOX = 45;
|
||||||
|
public static final int BLACK_STAINED_GLASS = 46;
|
||||||
|
public static final int BLACK_STAINED_GLASS_PANE = 47;
|
||||||
|
public static final int BLACK_TERRACOTTA = 48;
|
||||||
|
public static final int BLACK_WALL_BANNER = 49;
|
||||||
|
public static final int BLACK_WOOL = 50;
|
||||||
|
public static final int BLUE_BANNER = 51;
|
||||||
|
public static final int BLUE_BED = 52;
|
||||||
|
public static final int BLUE_CARPET = 53;
|
||||||
|
public static final int BLUE_CONCRETE = 54;
|
||||||
|
public static final int BLUE_CONCRETE_POWDER = 55;
|
||||||
|
public static final int BLUE_GLAZED_TERRACOTTA = 56;
|
||||||
|
public static final int BLUE_ICE = 57;
|
||||||
|
public static final int BLUE_ORCHID = 58;
|
||||||
|
public static final int BLUE_SHULKER_BOX = 59;
|
||||||
|
public static final int BLUE_STAINED_GLASS = 60;
|
||||||
|
public static final int BLUE_STAINED_GLASS_PANE = 61;
|
||||||
|
public static final int BLUE_TERRACOTTA = 62;
|
||||||
|
public static final int BLUE_WALL_BANNER = 63;
|
||||||
|
public static final int BLUE_WOOL = 64;
|
||||||
|
public static final int BONE_BLOCK = 65;
|
||||||
|
public static final int BOOKSHELF = 66;
|
||||||
|
public static final int BRAIN_CORAL = 67;
|
||||||
|
public static final int BRAIN_CORAL_BLOCK = 68;
|
||||||
|
public static final int BRAIN_CORAL_FAN = 69;
|
||||||
|
public static final int BRAIN_CORAL_WALL_FAN = 70;
|
||||||
|
public static final int BREWING_STAND = 71;
|
||||||
|
public static final int BRICK_SLAB = 72;
|
||||||
|
public static final int BRICK_STAIRS = 73;
|
||||||
|
public static final int BRICKS = 74;
|
||||||
|
public static final int BROWN_BANNER = 75;
|
||||||
|
public static final int BROWN_BED = 76;
|
||||||
|
public static final int BROWN_CARPET = 77;
|
||||||
|
public static final int BROWN_CONCRETE = 78;
|
||||||
|
public static final int BROWN_CONCRETE_POWDER = 79;
|
||||||
|
public static final int BROWN_GLAZED_TERRACOTTA = 80;
|
||||||
|
public static final int BROWN_MUSHROOM = 81;
|
||||||
|
public static final int BROWN_MUSHROOM_BLOCK = 82;
|
||||||
|
public static final int BROWN_SHULKER_BOX = 83;
|
||||||
|
public static final int BROWN_STAINED_GLASS = 84;
|
||||||
|
public static final int BROWN_STAINED_GLASS_PANE = 85;
|
||||||
|
public static final int BROWN_TERRACOTTA = 86;
|
||||||
|
public static final int BROWN_WALL_BANNER = 87;
|
||||||
|
public static final int BROWN_WOOL = 88;
|
||||||
|
public static final int BUBBLE_COLUMN = 89;
|
||||||
|
public static final int BUBBLE_CORAL = 90;
|
||||||
|
public static final int BUBBLE_CORAL_BLOCK = 91;
|
||||||
|
public static final int BUBBLE_CORAL_FAN = 92;
|
||||||
|
public static final int BUBBLE_CORAL_WALL_FAN = 93;
|
||||||
|
public static final int CACTUS = 94;
|
||||||
|
public static final int CAKE = 95;
|
||||||
|
public static final int CARROTS = 96;
|
||||||
|
public static final int CARVED_PUMPKIN = 97;
|
||||||
|
public static final int CAULDRON = 98;
|
||||||
|
public static final int CAVE_AIR = 99;
|
||||||
|
public static final int CHAIN_COMMAND_BLOCK = 100;
|
||||||
|
public static final int CHEST = 101;
|
||||||
|
public static final int CHIPPED_ANVIL = 102;
|
||||||
|
public static final int CHISELED_QUARTZ_BLOCK = 103;
|
||||||
|
public static final int CHISELED_RED_SANDSTONE = 104;
|
||||||
|
public static final int CHISELED_SANDSTONE = 105;
|
||||||
|
public static final int CHISELED_STONE_BRICKS = 106;
|
||||||
|
public static final int CHORUS_FLOWER = 107;
|
||||||
|
public static final int CHORUS_PLANT = 108;
|
||||||
|
public static final int CLAY = 109;
|
||||||
|
public static final int COAL_BLOCK = 110;
|
||||||
|
public static final int COAL_ORE = 111;
|
||||||
|
public static final int COARSE_DIRT = 112;
|
||||||
|
public static final int COBBLESTONE = 113;
|
||||||
|
public static final int COBBLESTONE_SLAB = 114;
|
||||||
|
public static final int COBBLESTONE_STAIRS = 115;
|
||||||
|
public static final int COBBLESTONE_WALL = 116;
|
||||||
|
public static final int COBWEB = 117;
|
||||||
|
public static final int COCOA = 118;
|
||||||
|
public static final int COMMAND_BLOCK = 119;
|
||||||
|
public static final int COMPARATOR = 120;
|
||||||
|
public static final int CONDUIT = 121;
|
||||||
|
public static final int CRACKED_STONE_BRICKS = 122;
|
||||||
|
public static final int CRAFTING_TABLE = 123;
|
||||||
|
public static final int CREEPER_HEAD = 124;
|
||||||
|
public static final int CREEPER_WALL_HEAD = 125;
|
||||||
|
public static final int CUT_RED_SANDSTONE = 126;
|
||||||
|
public static final int CUT_SANDSTONE = 127;
|
||||||
|
public static final int CYAN_BANNER = 128;
|
||||||
|
public static final int CYAN_BED = 129;
|
||||||
|
public static final int CYAN_CARPET = 130;
|
||||||
|
public static final int CYAN_CONCRETE = 131;
|
||||||
|
public static final int CYAN_CONCRETE_POWDER = 132;
|
||||||
|
public static final int CYAN_GLAZED_TERRACOTTA = 133;
|
||||||
|
public static final int CYAN_SHULKER_BOX = 134;
|
||||||
|
public static final int CYAN_STAINED_GLASS = 135;
|
||||||
|
public static final int CYAN_STAINED_GLASS_PANE = 136;
|
||||||
|
public static final int CYAN_TERRACOTTA = 137;
|
||||||
|
public static final int CYAN_WALL_BANNER = 138;
|
||||||
|
public static final int CYAN_WOOL = 139;
|
||||||
|
public static final int DAMAGED_ANVIL = 140;
|
||||||
|
public static final int DANDELION = 141;
|
||||||
|
public static final int DARK_OAK_BUTTON = 142;
|
||||||
|
public static final int DARK_OAK_DOOR = 143;
|
||||||
|
public static final int DARK_OAK_FENCE = 144;
|
||||||
|
public static final int DARK_OAK_FENCE_GATE = 145;
|
||||||
|
public static final int DARK_OAK_LEAVES = 146;
|
||||||
|
public static final int DARK_OAK_LOG = 147;
|
||||||
|
public static final int DARK_OAK_PLANKS = 148;
|
||||||
|
public static final int DARK_OAK_PRESSURE_PLATE = 149;
|
||||||
|
public static final int DARK_OAK_SAPLING = 150;
|
||||||
|
public static final int DARK_OAK_SLAB = 151;
|
||||||
|
public static final int DARK_OAK_STAIRS = 152;
|
||||||
|
public static final int DARK_OAK_TRAPDOOR = 153;
|
||||||
|
public static final int DARK_OAK_WOOD = 154;
|
||||||
|
public static final int DARK_PRISMARINE = 155;
|
||||||
|
public static final int DARK_PRISMARINE_SLAB = 156;
|
||||||
|
public static final int DARK_PRISMARINE_STAIRS = 157;
|
||||||
|
public static final int DAYLIGHT_DETECTOR = 158;
|
||||||
|
public static final int DEAD_BRAIN_CORAL = 159;
|
||||||
|
public static final int DEAD_BRAIN_CORAL_BLOCK = 160;
|
||||||
|
public static final int DEAD_BRAIN_CORAL_FAN = 161;
|
||||||
|
public static final int DEAD_BRAIN_CORAL_WALL_FAN = 162;
|
||||||
|
public static final int DEAD_BUBBLE_CORAL = 163;
|
||||||
|
public static final int DEAD_BUBBLE_CORAL_BLOCK = 164;
|
||||||
|
public static final int DEAD_BUBBLE_CORAL_FAN = 165;
|
||||||
|
public static final int DEAD_BUBBLE_CORAL_WALL_FAN = 166;
|
||||||
|
public static final int DEAD_BUSH = 167;
|
||||||
|
public static final int DEAD_FIRE_CORAL = 168;
|
||||||
|
public static final int DEAD_FIRE_CORAL_BLOCK = 169;
|
||||||
|
public static final int DEAD_FIRE_CORAL_FAN = 170;
|
||||||
|
public static final int DEAD_FIRE_CORAL_WALL_FAN = 171;
|
||||||
|
public static final int DEAD_HORN_CORAL = 172;
|
||||||
|
public static final int DEAD_HORN_CORAL_BLOCK = 173;
|
||||||
|
public static final int DEAD_HORN_CORAL_FAN = 174;
|
||||||
|
public static final int DEAD_HORN_CORAL_WALL_FAN = 175;
|
||||||
|
public static final int DEAD_TUBE_CORAL = 176;
|
||||||
|
public static final int DEAD_TUBE_CORAL_BLOCK = 177;
|
||||||
|
public static final int DEAD_TUBE_CORAL_FAN = 178;
|
||||||
|
public static final int DEAD_TUBE_CORAL_WALL_FAN = 179;
|
||||||
|
public static final int DETECTOR_RAIL = 180;
|
||||||
|
public static final int DIAMOND_BLOCK = 181;
|
||||||
|
public static final int DIAMOND_ORE = 182;
|
||||||
|
public static final int DIORITE = 183;
|
||||||
|
public static final int DIRT = 184;
|
||||||
|
public static final int DISPENSER = 185;
|
||||||
|
public static final int DRAGON_EGG = 186;
|
||||||
|
public static final int DRAGON_HEAD = 187;
|
||||||
|
public static final int DRAGON_WALL_HEAD = 188;
|
||||||
|
public static final int DRIED_KELP_BLOCK = 189;
|
||||||
|
public static final int DROPPER = 190;
|
||||||
|
public static final int EMERALD_BLOCK = 191;
|
||||||
|
public static final int EMERALD_ORE = 192;
|
||||||
|
public static final int ENCHANTING_TABLE = 193;
|
||||||
|
public static final int END_GATEWAY = 194;
|
||||||
|
public static final int END_PORTAL = 195;
|
||||||
|
public static final int END_PORTAL_FRAME = 196;
|
||||||
|
public static final int END_ROD = 197;
|
||||||
|
public static final int END_STONE = 198;
|
||||||
|
public static final int END_STONE_BRICKS = 199;
|
||||||
|
public static final int ENDER_CHEST = 200;
|
||||||
|
public static final int FARMLAND = 201;
|
||||||
|
public static final int FERN = 202;
|
||||||
|
public static final int FIRE = 203;
|
||||||
|
public static final int FIRE_CORAL = 204;
|
||||||
|
public static final int FIRE_CORAL_BLOCK = 205;
|
||||||
|
public static final int FIRE_CORAL_FAN = 206;
|
||||||
|
public static final int FIRE_CORAL_WALL_FAN = 207;
|
||||||
|
public static final int FLOWER_POT = 208;
|
||||||
|
public static final int FROSTED_ICE = 209;
|
||||||
|
public static final int FURNACE = 210;
|
||||||
|
public static final int GLASS = 211;
|
||||||
|
public static final int GLASS_PANE = 212;
|
||||||
|
public static final int GLOWSTONE = 213;
|
||||||
|
public static final int GOLD_BLOCK = 214;
|
||||||
|
public static final int GOLD_ORE = 215;
|
||||||
|
public static final int GRANITE = 216;
|
||||||
|
public static final int GRASS = 217;
|
||||||
|
public static final int GRASS_BLOCK = 218;
|
||||||
|
public static final int GRASS_PATH = 219;
|
||||||
|
public static final int GRAVEL = 220;
|
||||||
|
public static final int GRAY_BANNER = 221;
|
||||||
|
public static final int GRAY_BED = 222;
|
||||||
|
public static final int GRAY_CARPET = 223;
|
||||||
|
public static final int GRAY_CONCRETE = 224;
|
||||||
|
public static final int GRAY_CONCRETE_POWDER = 225;
|
||||||
|
public static final int GRAY_GLAZED_TERRACOTTA = 226;
|
||||||
|
public static final int GRAY_SHULKER_BOX = 227;
|
||||||
|
public static final int GRAY_STAINED_GLASS = 228;
|
||||||
|
public static final int GRAY_STAINED_GLASS_PANE = 229;
|
||||||
|
public static final int GRAY_TERRACOTTA = 230;
|
||||||
|
public static final int GRAY_WALL_BANNER = 231;
|
||||||
|
public static final int GRAY_WOOL = 232;
|
||||||
|
public static final int GREEN_BANNER = 233;
|
||||||
|
public static final int GREEN_BED = 234;
|
||||||
|
public static final int GREEN_CARPET = 235;
|
||||||
|
public static final int GREEN_CONCRETE = 236;
|
||||||
|
public static final int GREEN_CONCRETE_POWDER = 237;
|
||||||
|
public static final int GREEN_GLAZED_TERRACOTTA = 238;
|
||||||
|
public static final int GREEN_SHULKER_BOX = 239;
|
||||||
|
public static final int GREEN_STAINED_GLASS = 240;
|
||||||
|
public static final int GREEN_STAINED_GLASS_PANE = 241;
|
||||||
|
public static final int GREEN_TERRACOTTA = 242;
|
||||||
|
public static final int GREEN_WALL_BANNER = 243;
|
||||||
|
public static final int GREEN_WOOL = 244;
|
||||||
|
public static final int HAY_BLOCK = 245;
|
||||||
|
public static final int HEAVY_WEIGHTED_PRESSURE_PLATE = 246;
|
||||||
|
public static final int HOPPER = 247;
|
||||||
|
public static final int HORN_CORAL = 248;
|
||||||
|
public static final int HORN_CORAL_BLOCK = 249;
|
||||||
|
public static final int HORN_CORAL_FAN = 250;
|
||||||
|
public static final int HORN_CORAL_WALL_FAN = 251;
|
||||||
|
public static final int ICE = 252;
|
||||||
|
public static final int INFESTED_CHISELED_STONE_BRICKS = 253;
|
||||||
|
public static final int INFESTED_COBBLESTONE = 254;
|
||||||
|
public static final int INFESTED_CRACKED_STONE_BRICKS = 255;
|
||||||
|
public static final int INFESTED_MOSSY_STONE_BRICKS = 256;
|
||||||
|
public static final int INFESTED_STONE = 257;
|
||||||
|
public static final int INFESTED_STONE_BRICKS = 258;
|
||||||
|
public static final int IRON_BARS = 259;
|
||||||
|
public static final int IRON_BLOCK = 260;
|
||||||
|
public static final int IRON_DOOR = 261;
|
||||||
|
public static final int IRON_ORE = 262;
|
||||||
|
public static final int IRON_TRAPDOOR = 263;
|
||||||
|
public static final int JACK_O_LANTERN = 264;
|
||||||
|
public static final int JUKEBOX = 265;
|
||||||
|
public static final int JUNGLE_BUTTON = 266;
|
||||||
|
public static final int JUNGLE_DOOR = 267;
|
||||||
|
public static final int JUNGLE_FENCE = 268;
|
||||||
|
public static final int JUNGLE_FENCE_GATE = 269;
|
||||||
|
public static final int JUNGLE_LEAVES = 270;
|
||||||
|
public static final int JUNGLE_LOG = 271;
|
||||||
|
public static final int JUNGLE_PLANKS = 272;
|
||||||
|
public static final int JUNGLE_PRESSURE_PLATE = 273;
|
||||||
|
public static final int JUNGLE_SAPLING = 274;
|
||||||
|
public static final int JUNGLE_SLAB = 275;
|
||||||
|
public static final int JUNGLE_STAIRS = 276;
|
||||||
|
public static final int JUNGLE_TRAPDOOR = 277;
|
||||||
|
public static final int JUNGLE_WOOD = 278;
|
||||||
|
public static final int KELP = 279;
|
||||||
|
public static final int KELP_PLANT = 280;
|
||||||
|
public static final int LADDER = 281;
|
||||||
|
public static final int LAPIS_BLOCK = 282;
|
||||||
|
public static final int LAPIS_ORE = 283;
|
||||||
|
public static final int LARGE_FERN = 284;
|
||||||
|
public static final int LAVA = 285;
|
||||||
|
public static final int LEVER = 286;
|
||||||
|
public static final int LIGHT_BLUE_BANNER = 287;
|
||||||
|
public static final int LIGHT_BLUE_BED = 288;
|
||||||
|
public static final int LIGHT_BLUE_CARPET = 289;
|
||||||
|
public static final int LIGHT_BLUE_CONCRETE = 290;
|
||||||
|
public static final int LIGHT_BLUE_CONCRETE_POWDER = 291;
|
||||||
|
public static final int LIGHT_BLUE_GLAZED_TERRACOTTA = 292;
|
||||||
|
public static final int LIGHT_BLUE_SHULKER_BOX = 293;
|
||||||
|
public static final int LIGHT_BLUE_STAINED_GLASS = 294;
|
||||||
|
public static final int LIGHT_BLUE_STAINED_GLASS_PANE = 295;
|
||||||
|
public static final int LIGHT_BLUE_TERRACOTTA = 296;
|
||||||
|
public static final int LIGHT_BLUE_WALL_BANNER = 297;
|
||||||
|
public static final int LIGHT_BLUE_WOOL = 298;
|
||||||
|
public static final int LIGHT_GRAY_BANNER = 299;
|
||||||
|
public static final int LIGHT_GRAY_BED = 300;
|
||||||
|
public static final int LIGHT_GRAY_CARPET = 301;
|
||||||
|
public static final int LIGHT_GRAY_CONCRETE = 302;
|
||||||
|
public static final int LIGHT_GRAY_CONCRETE_POWDER = 303;
|
||||||
|
public static final int LIGHT_GRAY_GLAZED_TERRACOTTA = 304;
|
||||||
|
public static final int LIGHT_GRAY_SHULKER_BOX = 305;
|
||||||
|
public static final int LIGHT_GRAY_STAINED_GLASS = 306;
|
||||||
|
public static final int LIGHT_GRAY_STAINED_GLASS_PANE = 307;
|
||||||
|
public static final int LIGHT_GRAY_TERRACOTTA = 308;
|
||||||
|
public static final int LIGHT_GRAY_WALL_BANNER = 309;
|
||||||
|
public static final int LIGHT_GRAY_WOOL = 310;
|
||||||
|
public static final int LIGHT_WEIGHTED_PRESSURE_PLATE = 311;
|
||||||
|
public static final int LILAC = 312;
|
||||||
|
public static final int LILY_PAD = 313;
|
||||||
|
public static final int LIME_BANNER = 314;
|
||||||
|
public static final int LIME_BED = 315;
|
||||||
|
public static final int LIME_CARPET = 316;
|
||||||
|
public static final int LIME_CONCRETE = 317;
|
||||||
|
public static final int LIME_CONCRETE_POWDER = 318;
|
||||||
|
public static final int LIME_GLAZED_TERRACOTTA = 319;
|
||||||
|
public static final int LIME_SHULKER_BOX = 320;
|
||||||
|
public static final int LIME_STAINED_GLASS = 321;
|
||||||
|
public static final int LIME_STAINED_GLASS_PANE = 322;
|
||||||
|
public static final int LIME_TERRACOTTA = 323;
|
||||||
|
public static final int LIME_WALL_BANNER = 324;
|
||||||
|
public static final int LIME_WOOL = 325;
|
||||||
|
public static final int MAGENTA_BANNER = 326;
|
||||||
|
public static final int MAGENTA_BED = 327;
|
||||||
|
public static final int MAGENTA_CARPET = 328;
|
||||||
|
public static final int MAGENTA_CONCRETE = 329;
|
||||||
|
public static final int MAGENTA_CONCRETE_POWDER = 330;
|
||||||
|
public static final int MAGENTA_GLAZED_TERRACOTTA = 331;
|
||||||
|
public static final int MAGENTA_SHULKER_BOX = 332;
|
||||||
|
public static final int MAGENTA_STAINED_GLASS = 333;
|
||||||
|
public static final int MAGENTA_STAINED_GLASS_PANE = 334;
|
||||||
|
public static final int MAGENTA_TERRACOTTA = 335;
|
||||||
|
public static final int MAGENTA_WALL_BANNER = 336;
|
||||||
|
public static final int MAGENTA_WOOL = 337;
|
||||||
|
public static final int MAGMA_BLOCK = 338;
|
||||||
|
public static final int MELON = 339;
|
||||||
|
public static final int MELON_STEM = 340;
|
||||||
|
public static final int MOSSY_COBBLESTONE = 341;
|
||||||
|
public static final int MOSSY_COBBLESTONE_WALL = 342;
|
||||||
|
public static final int MOSSY_STONE_BRICKS = 343;
|
||||||
|
public static final int MOVING_PISTON = 344;
|
||||||
|
public static final int MUSHROOM_STEM = 345;
|
||||||
|
public static final int MYCELIUM = 346;
|
||||||
|
public static final int NETHER_BRICK_FENCE = 347;
|
||||||
|
public static final int NETHER_BRICK_SLAB = 348;
|
||||||
|
public static final int NETHER_BRICK_STAIRS = 349;
|
||||||
|
public static final int NETHER_BRICKS = 350;
|
||||||
|
public static final int NETHER_PORTAL = 351;
|
||||||
|
public static final int NETHER_QUARTZ_ORE = 352;
|
||||||
|
public static final int NETHER_WART = 353;
|
||||||
|
public static final int NETHER_WART_BLOCK = 354;
|
||||||
|
public static final int NETHERRACK = 355;
|
||||||
|
public static final int NOTE_BLOCK = 356;
|
||||||
|
public static final int OAK_BUTTON = 357;
|
||||||
|
public static final int OAK_DOOR = 358;
|
||||||
|
public static final int OAK_FENCE = 359;
|
||||||
|
public static final int OAK_FENCE_GATE = 360;
|
||||||
|
public static final int OAK_LEAVES = 361;
|
||||||
|
public static final int OAK_LOG = 362;
|
||||||
|
public static final int OAK_PLANKS = 363;
|
||||||
|
public static final int OAK_PRESSURE_PLATE = 364;
|
||||||
|
public static final int OAK_SAPLING = 365;
|
||||||
|
public static final int OAK_SLAB = 366;
|
||||||
|
public static final int OAK_STAIRS = 367;
|
||||||
|
public static final int OAK_TRAPDOOR = 368;
|
||||||
|
public static final int OAK_WOOD = 369;
|
||||||
|
public static final int OBSERVER = 370;
|
||||||
|
public static final int OBSIDIAN = 371;
|
||||||
|
public static final int ORANGE_BANNER = 372;
|
||||||
|
public static final int ORANGE_BED = 373;
|
||||||
|
public static final int ORANGE_CARPET = 374;
|
||||||
|
public static final int ORANGE_CONCRETE = 375;
|
||||||
|
public static final int ORANGE_CONCRETE_POWDER = 376;
|
||||||
|
public static final int ORANGE_GLAZED_TERRACOTTA = 377;
|
||||||
|
public static final int ORANGE_SHULKER_BOX = 378;
|
||||||
|
public static final int ORANGE_STAINED_GLASS = 379;
|
||||||
|
public static final int ORANGE_STAINED_GLASS_PANE = 380;
|
||||||
|
public static final int ORANGE_TERRACOTTA = 381;
|
||||||
|
public static final int ORANGE_TULIP = 382;
|
||||||
|
public static final int ORANGE_WALL_BANNER = 383;
|
||||||
|
public static final int ORANGE_WOOL = 384;
|
||||||
|
public static final int OXEYE_DAISY = 385;
|
||||||
|
public static final int PACKED_ICE = 386;
|
||||||
|
public static final int PEONY = 387;
|
||||||
|
public static final int PETRIFIED_OAK_SLAB = 388;
|
||||||
|
public static final int PINK_BANNER = 389;
|
||||||
|
public static final int PINK_BED = 390;
|
||||||
|
public static final int PINK_CARPET = 391;
|
||||||
|
public static final int PINK_CONCRETE = 392;
|
||||||
|
public static final int PINK_CONCRETE_POWDER = 393;
|
||||||
|
public static final int PINK_GLAZED_TERRACOTTA = 394;
|
||||||
|
public static final int PINK_SHULKER_BOX = 395;
|
||||||
|
public static final int PINK_STAINED_GLASS = 396;
|
||||||
|
public static final int PINK_STAINED_GLASS_PANE = 397;
|
||||||
|
public static final int PINK_TERRACOTTA = 398;
|
||||||
|
public static final int PINK_TULIP = 399;
|
||||||
|
public static final int PINK_WALL_BANNER = 400;
|
||||||
|
public static final int PINK_WOOL = 401;
|
||||||
|
public static final int PISTON = 402;
|
||||||
|
public static final int PISTON_HEAD = 403;
|
||||||
|
public static final int PLAYER_HEAD = 404;
|
||||||
|
public static final int PLAYER_WALL_HEAD = 405;
|
||||||
|
public static final int PODZOL = 406;
|
||||||
|
public static final int POLISHED_ANDESITE = 407;
|
||||||
|
public static final int POLISHED_DIORITE = 408;
|
||||||
|
public static final int POLISHED_GRANITE = 409;
|
||||||
|
public static final int POPPY = 410;
|
||||||
|
public static final int POTATOES = 411;
|
||||||
|
public static final int POTTED_ACACIA_SAPLING = 412;
|
||||||
|
public static final int POTTED_ALLIUM = 413;
|
||||||
|
public static final int POTTED_AZURE_BLUET = 414;
|
||||||
|
public static final int POTTED_BIRCH_SAPLING = 415;
|
||||||
|
public static final int POTTED_BLUE_ORCHID = 416;
|
||||||
|
public static final int POTTED_BROWN_MUSHROOM = 417;
|
||||||
|
public static final int POTTED_CACTUS = 418;
|
||||||
|
public static final int POTTED_DANDELION = 419;
|
||||||
|
public static final int POTTED_DARK_OAK_SAPLING = 420;
|
||||||
|
public static final int POTTED_DEAD_BUSH = 421;
|
||||||
|
public static final int POTTED_FERN = 422;
|
||||||
|
public static final int POTTED_JUNGLE_SAPLING = 423;
|
||||||
|
public static final int POTTED_OAK_SAPLING = 424;
|
||||||
|
public static final int POTTED_ORANGE_TULIP = 425;
|
||||||
|
public static final int POTTED_OXEYE_DAISY = 426;
|
||||||
|
public static final int POTTED_PINK_TULIP = 427;
|
||||||
|
public static final int POTTED_POPPY = 428;
|
||||||
|
public static final int POTTED_RED_MUSHROOM = 429;
|
||||||
|
public static final int POTTED_RED_TULIP = 430;
|
||||||
|
public static final int POTTED_SPRUCE_SAPLING = 431;
|
||||||
|
public static final int POTTED_WHITE_TULIP = 432;
|
||||||
|
public static final int POWERED_RAIL = 433;
|
||||||
|
public static final int PRISMARINE = 434;
|
||||||
|
public static final int PRISMARINE_BRICK_SLAB = 435;
|
||||||
|
public static final int PRISMARINE_BRICK_STAIRS = 436;
|
||||||
|
public static final int PRISMARINE_BRICKS = 437;
|
||||||
|
public static final int PRISMARINE_SLAB = 438;
|
||||||
|
public static final int PRISMARINE_STAIRS = 439;
|
||||||
|
public static final int PUMPKIN = 440;
|
||||||
|
public static final int PUMPKIN_STEM = 441;
|
||||||
|
public static final int PURPLE_BANNER = 442;
|
||||||
|
public static final int PURPLE_BED = 443;
|
||||||
|
public static final int PURPLE_CARPET = 444;
|
||||||
|
public static final int PURPLE_CONCRETE = 445;
|
||||||
|
public static final int PURPLE_CONCRETE_POWDER = 446;
|
||||||
|
public static final int PURPLE_GLAZED_TERRACOTTA = 447;
|
||||||
|
public static final int PURPLE_SHULKER_BOX = 448;
|
||||||
|
public static final int PURPLE_STAINED_GLASS = 449;
|
||||||
|
public static final int PURPLE_STAINED_GLASS_PANE = 450;
|
||||||
|
public static final int PURPLE_TERRACOTTA = 451;
|
||||||
|
public static final int PURPLE_WALL_BANNER = 452;
|
||||||
|
public static final int PURPLE_WOOL = 453;
|
||||||
|
public static final int PURPUR_BLOCK = 454;
|
||||||
|
public static final int PURPUR_PILLAR = 455;
|
||||||
|
public static final int PURPUR_SLAB = 456;
|
||||||
|
public static final int PURPUR_STAIRS = 457;
|
||||||
|
public static final int QUARTZ_BLOCK = 458;
|
||||||
|
public static final int QUARTZ_PILLAR = 459;
|
||||||
|
public static final int QUARTZ_SLAB = 460;
|
||||||
|
public static final int QUARTZ_STAIRS = 461;
|
||||||
|
public static final int RAIL = 462;
|
||||||
|
public static final int RED_BANNER = 463;
|
||||||
|
public static final int RED_BED = 464;
|
||||||
|
public static final int RED_CARPET = 465;
|
||||||
|
public static final int RED_CONCRETE = 466;
|
||||||
|
public static final int RED_CONCRETE_POWDER = 467;
|
||||||
|
public static final int RED_GLAZED_TERRACOTTA = 468;
|
||||||
|
public static final int RED_MUSHROOM = 469;
|
||||||
|
public static final int RED_MUSHROOM_BLOCK = 470;
|
||||||
|
public static final int RED_NETHER_BRICKS = 471;
|
||||||
|
public static final int RED_SAND = 472;
|
||||||
|
public static final int RED_SANDSTONE = 473;
|
||||||
|
public static final int RED_SANDSTONE_SLAB = 474;
|
||||||
|
public static final int RED_SANDSTONE_STAIRS = 475;
|
||||||
|
public static final int RED_SHULKER_BOX = 476;
|
||||||
|
public static final int RED_STAINED_GLASS = 477;
|
||||||
|
public static final int RED_STAINED_GLASS_PANE = 478;
|
||||||
|
public static final int RED_TERRACOTTA = 479;
|
||||||
|
public static final int RED_TULIP = 480;
|
||||||
|
public static final int RED_WALL_BANNER = 481;
|
||||||
|
public static final int RED_WOOL = 482;
|
||||||
|
public static final int REDSTONE_BLOCK = 483;
|
||||||
|
public static final int REDSTONE_LAMP = 484;
|
||||||
|
public static final int REDSTONE_ORE = 485;
|
||||||
|
public static final int REDSTONE_TORCH = 486;
|
||||||
|
public static final int REDSTONE_WALL_TORCH = 487;
|
||||||
|
public static final int REDSTONE_WIRE = 488;
|
||||||
|
public static final int REPEATER = 489;
|
||||||
|
public static final int REPEATING_COMMAND_BLOCK = 490;
|
||||||
|
public static final int ROSE_BUSH = 491;
|
||||||
|
public static final int SAND = 492;
|
||||||
|
public static final int SANDSTONE = 493;
|
||||||
|
public static final int SANDSTONE_SLAB = 494;
|
||||||
|
public static final int SANDSTONE_STAIRS = 495;
|
||||||
|
public static final int SEA_LANTERN = 496;
|
||||||
|
public static final int SEA_PICKLE = 497;
|
||||||
|
public static final int SEAGRASS = 498;
|
||||||
|
public static final int SHULKER_BOX = 499;
|
||||||
|
public static final int SIGN = 500;
|
||||||
|
public static final int SKELETON_SKULL = 501;
|
||||||
|
public static final int SKELETON_WALL_SKULL = 502;
|
||||||
|
public static final int SLIME_BLOCK = 503;
|
||||||
|
public static final int SMOOTH_QUARTZ = 504;
|
||||||
|
public static final int SMOOTH_RED_SANDSTONE = 505;
|
||||||
|
public static final int SMOOTH_SANDSTONE = 506;
|
||||||
|
public static final int SMOOTH_STONE = 507;
|
||||||
|
public static final int SNOW = 508;
|
||||||
|
public static final int SNOW_BLOCK = 509;
|
||||||
|
public static final int SOUL_SAND = 510;
|
||||||
|
public static final int SPAWNER = 511;
|
||||||
|
public static final int SPONGE = 512;
|
||||||
|
public static final int SPRUCE_BUTTON = 513;
|
||||||
|
public static final int SPRUCE_DOOR = 514;
|
||||||
|
public static final int SPRUCE_FENCE = 515;
|
||||||
|
public static final int SPRUCE_FENCE_GATE = 516;
|
||||||
|
public static final int SPRUCE_LEAVES = 517;
|
||||||
|
public static final int SPRUCE_LOG = 518;
|
||||||
|
public static final int SPRUCE_PLANKS = 519;
|
||||||
|
public static final int SPRUCE_PRESSURE_PLATE = 520;
|
||||||
|
public static final int SPRUCE_SAPLING = 521;
|
||||||
|
public static final int SPRUCE_SLAB = 522;
|
||||||
|
public static final int SPRUCE_STAIRS = 523;
|
||||||
|
public static final int SPRUCE_TRAPDOOR = 524;
|
||||||
|
public static final int SPRUCE_WOOD = 525;
|
||||||
|
public static final int STICKY_PISTON = 526;
|
||||||
|
public static final int STONE = 527;
|
||||||
|
public static final int STONE_BRICK_SLAB = 528;
|
||||||
|
public static final int STONE_BRICK_STAIRS = 529;
|
||||||
|
public static final int STONE_BRICKS = 530;
|
||||||
|
public static final int STONE_BUTTON = 531;
|
||||||
|
public static final int STONE_PRESSURE_PLATE = 532;
|
||||||
|
public static final int STONE_SLAB = 533;
|
||||||
|
public static final int STRIPPED_ACACIA_LOG = 534;
|
||||||
|
public static final int STRIPPED_ACACIA_WOOD = 535;
|
||||||
|
public static final int STRIPPED_BIRCH_LOG = 536;
|
||||||
|
public static final int STRIPPED_BIRCH_WOOD = 537;
|
||||||
|
public static final int STRIPPED_DARK_OAK_LOG = 538;
|
||||||
|
public static final int STRIPPED_DARK_OAK_WOOD = 539;
|
||||||
|
public static final int STRIPPED_JUNGLE_LOG = 540;
|
||||||
|
public static final int STRIPPED_JUNGLE_WOOD = 541;
|
||||||
|
public static final int STRIPPED_OAK_LOG = 542;
|
||||||
|
public static final int STRIPPED_OAK_WOOD = 543;
|
||||||
|
public static final int STRIPPED_SPRUCE_LOG = 544;
|
||||||
|
public static final int STRIPPED_SPRUCE_WOOD = 545;
|
||||||
|
public static final int STRUCTURE_BLOCK = 546;
|
||||||
|
public static final int STRUCTURE_VOID = 547;
|
||||||
|
public static final int SUGAR_CANE = 548;
|
||||||
|
public static final int SUNFLOWER = 549;
|
||||||
|
public static final int TALL_GRASS = 550;
|
||||||
|
public static final int TALL_SEAGRASS = 551;
|
||||||
|
public static final int TERRACOTTA = 552;
|
||||||
|
public static final int TNT = 553;
|
||||||
|
public static final int TORCH = 554;
|
||||||
|
public static final int TRAPPED_CHEST = 555;
|
||||||
|
public static final int TRIPWIRE = 556;
|
||||||
|
public static final int TRIPWIRE_HOOK = 557;
|
||||||
|
public static final int TUBE_CORAL = 558;
|
||||||
|
public static final int TUBE_CORAL_BLOCK = 559;
|
||||||
|
public static final int TUBE_CORAL_FAN = 560;
|
||||||
|
public static final int TUBE_CORAL_WALL_FAN = 561;
|
||||||
|
public static final int TURTLE_EGG = 562;
|
||||||
|
public static final int VINE = 563;
|
||||||
|
public static final int VOID_AIR = 564;
|
||||||
|
public static final int WALL_SIGN = 565;
|
||||||
|
public static final int WALL_TORCH = 566;
|
||||||
|
public static final int WATER = 567;
|
||||||
|
public static final int WET_SPONGE = 568;
|
||||||
|
public static final int WHEAT = 569;
|
||||||
|
public static final int WHITE_BANNER = 570;
|
||||||
|
public static final int WHITE_BED = 571;
|
||||||
|
public static final int WHITE_CARPET = 572;
|
||||||
|
public static final int WHITE_CONCRETE = 573;
|
||||||
|
public static final int WHITE_CONCRETE_POWDER = 574;
|
||||||
|
public static final int WHITE_GLAZED_TERRACOTTA = 575;
|
||||||
|
public static final int WHITE_SHULKER_BOX = 576;
|
||||||
|
public static final int WHITE_STAINED_GLASS = 577;
|
||||||
|
public static final int WHITE_STAINED_GLASS_PANE = 578;
|
||||||
|
public static final int WHITE_TERRACOTTA = 579;
|
||||||
|
public static final int WHITE_TULIP = 580;
|
||||||
|
public static final int WHITE_WALL_BANNER = 581;
|
||||||
|
public static final int WHITE_WOOL = 582;
|
||||||
|
public static final int WITHER_SKELETON_SKULL = 583;
|
||||||
|
public static final int WITHER_SKELETON_WALL_SKULL = 584;
|
||||||
|
public static final int YELLOW_BANNER = 585;
|
||||||
|
public static final int YELLOW_BED = 586;
|
||||||
|
public static final int YELLOW_CARPET = 587;
|
||||||
|
public static final int YELLOW_CONCRETE = 588;
|
||||||
|
public static final int YELLOW_CONCRETE_POWDER = 589;
|
||||||
|
public static final int YELLOW_GLAZED_TERRACOTTA = 590;
|
||||||
|
public static final int YELLOW_SHULKER_BOX = 591;
|
||||||
|
public static final int YELLOW_STAINED_GLASS = 592;
|
||||||
|
public static final int YELLOW_STAINED_GLASS_PANE = 593;
|
||||||
|
public static final int YELLOW_TERRACOTTA = 594;
|
||||||
|
public static final int YELLOW_WALL_BANNER = 595;
|
||||||
|
public static final int YELLOW_WOOL = 596;
|
||||||
|
public static final int ZOMBIE_HEAD = 597;
|
||||||
|
public static final int ZOMBIE_WALL_HEAD = 598;
|
||||||
|
}
|
@ -22,9 +22,7 @@ package com.sk89q.worldedit.world.block;
|
|||||||
import com.boydti.fawe.command.SuggestInputParseException;
|
import com.boydti.fawe.command.SuggestInputParseException;
|
||||||
import com.boydti.fawe.object.string.MutableCharSequence;
|
import com.boydti.fawe.object.string.MutableCharSequence;
|
||||||
import com.google.common.base.Function;
|
import com.google.common.base.Function;
|
||||||
import com.google.common.collect.Lists;
|
|
||||||
import com.google.common.collect.Maps;
|
import com.google.common.collect.Maps;
|
||||||
import com.google.common.collect.Table;
|
|
||||||
import com.sk89q.jnbt.CompoundTag;
|
import com.sk89q.jnbt.CompoundTag;
|
||||||
import com.sk89q.worldedit.WorldEdit;
|
import com.sk89q.worldedit.WorldEdit;
|
||||||
import com.sk89q.worldedit.WorldEditException;
|
import com.sk89q.worldedit.WorldEditException;
|
||||||
@ -39,29 +37,28 @@ import com.sk89q.worldedit.registry.state.PropertyKey;
|
|||||||
import com.sk89q.worldedit.world.registry.BlockMaterial;
|
import com.sk89q.worldedit.world.registry.BlockMaterial;
|
||||||
|
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
import java.util.*;
|
import java.util.Arrays;
|
||||||
import java.util.stream.Collectors;
|
|
||||||
import java.util.stream.Stream;
|
|
||||||
import java.util.HashSet;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Objects;
|
import java.util.stream.Collectors;
|
||||||
import java.util.Set;
|
import java.util.stream.Stream;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* An immutable class that represents the state a block can be in.
|
* An immutable class that represents the state a block can be in.
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
public class BlockState implements BlockStateHolder<BlockState>, FawePattern {
|
public class BlockState implements BlockStateHolder<BlockState>, FawePattern {
|
||||||
|
private final int internalId;
|
||||||
|
private final int ordinal;
|
||||||
|
private final BlockType blockType;
|
||||||
private BlockMaterial material;
|
private BlockMaterial material;
|
||||||
private BlockType blockType;
|
|
||||||
private int internalId, ordinal;
|
|
||||||
private BaseBlock emptyBaseBlock;
|
private BaseBlock emptyBaseBlock;
|
||||||
|
|
||||||
BlockState(BlockType blockType, int internalId, int ordinal) {
|
protected BlockState(BlockType blockType, int internalId, int ordinal) {
|
||||||
this.blockType = blockType;
|
this.blockType = blockType;
|
||||||
this.internalId = internalId;
|
this.internalId = internalId;
|
||||||
this.ordinal = ordinal;
|
this.ordinal = ordinal;
|
||||||
|
this.emptyBaseBlock = new BaseBlock(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -307,36 +304,7 @@ public class BlockState implements BlockStateHolder<BlockState>, FawePattern {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean equalsFuzzy(BlockStateHolder<?> o) {
|
public boolean equalsFuzzy(BlockStateHolder<?> o) {
|
||||||
if (this == o) {
|
return o.getOrdinal() == this.getOrdinal();
|
||||||
// Added a reference equality check for speediness
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
if (!getBlockType().equals(o.getBlockType())) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
Set<Property<?>> differingProperties = new HashSet<>();
|
|
||||||
for (Object state : o.getStates().keySet()) {
|
|
||||||
if (getState((Property<?>) state) == null) {
|
|
||||||
differingProperties.add((Property<?>) state);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
for (Property<?> property : getStates().keySet()) {
|
|
||||||
if (o.getState(property) == null) {
|
|
||||||
differingProperties.add(property);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
for (Property<?> property : getStates().keySet()) {
|
|
||||||
if (differingProperties.contains(property)) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
if (!Objects.equals(getState(property), o.getState(property))) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -367,20 +335,6 @@ public class BlockState implements BlockStateHolder<BlockState>, FawePattern {
|
|||||||
return this.ordinal;
|
return this.ordinal;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Internal method used for creating the initial BlockState.
|
|
||||||
*
|
|
||||||
* Sets a value. DO NOT USE THIS.
|
|
||||||
*
|
|
||||||
* @param property The state
|
|
||||||
* @param value The value
|
|
||||||
* @return The blockstate, for chaining
|
|
||||||
*/
|
|
||||||
BlockState setState(final Property<?> property, final Object value) {
|
|
||||||
this.values.put(property, value);
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return getAsString();
|
return getAsString();
|
||||||
|
@ -1,55 +0,0 @@
|
|||||||
package com.sk89q.worldedit.world.block;
|
|
||||||
|
|
||||||
import com.sk89q.worldedit.WorldEdit;
|
|
||||||
import com.sk89q.worldedit.extension.platform.Capability;
|
|
||||||
import com.sk89q.worldedit.world.registry.BlockMaterial;
|
|
||||||
|
|
||||||
public class BlockStateImpl extends BlockState {
|
|
||||||
private final int internalId;
|
|
||||||
private final int ordinal;
|
|
||||||
private final BlockType type;
|
|
||||||
private BlockMaterial material;
|
|
||||||
private BaseBlock baseBlock;
|
|
||||||
|
|
||||||
protected BlockStateImpl(BlockType type, int internalId, int ordinal) {
|
|
||||||
super(type);
|
|
||||||
this.type = type;
|
|
||||||
this.internalId = internalId;
|
|
||||||
this.ordinal = ordinal;
|
|
||||||
this.baseBlock = new BaseBlock(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
public BlockMaterial getMaterial() {
|
|
||||||
if (this.material == null) {
|
|
||||||
if (type == BlockTypes.__RESERVED__) {
|
|
||||||
return this.material = type.getMaterial();
|
|
||||||
}
|
|
||||||
synchronized (this) {
|
|
||||||
if (this.material == null) {
|
|
||||||
this.material = WorldEdit.getInstance().getPlatformManager().queryCapability(Capability.GAME_HOOKS).getRegistries().getBlockRegistry().getMaterial(this);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return material;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Deprecated
|
|
||||||
public int getInternalId() {
|
|
||||||
return this.internalId;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getOrdinal() {
|
|
||||||
return ordinal;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public final BlockType getBlockType() {
|
|
||||||
return type;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public BaseBlock toBaseBlock() {
|
|
||||||
return this.baseBlock;
|
|
||||||
}
|
|
||||||
}
|
|
@ -45,60 +45,13 @@ import java.util.stream.Collectors;
|
|||||||
import java.util.stream.IntStream;
|
import java.util.stream.IntStream;
|
||||||
|
|
||||||
public class BlockType implements FawePattern {
|
public class BlockType implements FawePattern {
|
||||||
|
private final String id;
|
||||||
|
private final BlockTypes.Settings settings;
|
||||||
|
|
||||||
public static final NamespacedRegistry<BlockType> REGISTRY = new NamespacedRegistry<>("block type");
|
protected BlockType(String id, int internalId, List<BlockState> states) {
|
||||||
|
this.settings = new BlockTypes.Settings(this, id, internalId, states);
|
||||||
private final @Nonnull String id;
|
int i = id.indexOf("[");
|
||||||
private final BlockTypeEnum typeEnum;
|
this.id = i == -1 ? id : id.substring(0, i);
|
||||||
private BlockTypes.Settings settings;
|
|
||||||
|
|
||||||
// private ArrayList<BlockState> states;
|
|
||||||
// public final Function<BlockState, BlockState> defaultValue;
|
|
||||||
//
|
|
||||||
// private BlockMaterial material;
|
|
||||||
|
|
||||||
public BlockType(@Nonnull BlockTypeEnum typeEnum) {
|
|
||||||
this.typeEnum = typeEnum;
|
|
||||||
}
|
|
||||||
|
|
||||||
public BlockTypeEnum getTypeEnum() {
|
|
||||||
return typeEnum;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void init(String id, int internalId, List<BlockState> states) {
|
|
||||||
try {
|
|
||||||
if (getId() == null) {
|
|
||||||
String name = (name().indexOf(':') == -1 ? "minecraft:" : "") + name().toLowerCase();
|
|
||||||
ReflectionUtils.setFailsafeFieldValue(BlockTypes.class.getDeclaredField("id"), this, name);
|
|
||||||
}
|
|
||||||
Settings settings = new Settings(this, id, internalId, states);
|
|
||||||
ReflectionUtils.setFailsafeFieldValue(BlockTypes.class.getDeclaredField("settings"), this, settings);
|
|
||||||
} catch (Throwable e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
throw new RuntimeException(e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public void setStates(ArrayList<BlockState> states) { //
|
|
||||||
this.states = states;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setSettings(BlockTypes.Settings settings) { //
|
|
||||||
this.settings = settings;
|
|
||||||
}
|
|
||||||
|
|
||||||
public BlockTypes.Settings getSettings(){ //
|
|
||||||
return settings;
|
|
||||||
}
|
|
||||||
|
|
||||||
public ArrayList<BlockState> updateStates(){ //
|
|
||||||
if(settings != null) {
|
|
||||||
return settings.localStates = new ArrayList<>(settings.localStates.stream()
|
|
||||||
.map(state -> new BlockStateImpl(this, state.getInternalId(), state.getOrdinal())).collect(Collectors.toList()));
|
|
||||||
}else {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Deprecated
|
@Deprecated
|
||||||
@ -226,13 +179,13 @@ public class BlockType implements FawePattern {
|
|||||||
return this.settings.defaultState;
|
return this.settings.defaultState;
|
||||||
}
|
}
|
||||||
|
|
||||||
public FuzzyBlockState getFuzzyMatcher() { //
|
// public FuzzyBlockState getFuzzyMatcher() { //
|
||||||
return new FuzzyBlockState(this);
|
// return new FuzzyBlockState(this);
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
public FuzzyBlockState getFuzzyMatcher() { //
|
// public FuzzyBlockState getFuzzyMatcher() { //
|
||||||
return updateField(emptyFuzzy, () -> new FuzzyBlockState(this));
|
// return updateField(emptyFuzzy, () -> new FuzzyBlockState(this));
|
||||||
}
|
// }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Slow
|
* Slow
|
||||||
|
@ -48,6 +48,7 @@ import com.sk89q.worldedit.world.registry.LegacyMapper;
|
|||||||
import it.unimi.dsi.fastutil.ints.IntCollections;
|
import it.unimi.dsi.fastutil.ints.IntCollections;
|
||||||
|
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
|
import java.lang.reflect.Field;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.function.Function;
|
import java.util.function.Function;
|
||||||
import java.util.function.IntPredicate;
|
import java.util.function.IntPredicate;
|
||||||
@ -59,8 +60,8 @@ import java.util.stream.Stream;
|
|||||||
* Stores a list of common Block String IDs.
|
* Stores a list of common Block String IDs.
|
||||||
*/
|
*/
|
||||||
public final class BlockTypes {
|
public final class BlockTypes {
|
||||||
|
// Doesn't really matter what the hardcoded values are, as FAWE will update it on load
|
||||||
@Nullable public static final BlockType __RESERVED__ = get("minecraft:__reserved__");
|
@Nullable public static final BlockType __RESERVED__ = null;
|
||||||
@Nullable public static final BlockType ACACIA_BUTTON = get("minecraft:acacia_button");
|
@Nullable public static final BlockType ACACIA_BUTTON = get("minecraft:acacia_button");
|
||||||
@Nullable public static final BlockType ACACIA_DOOR = get("minecraft:acacia_door");
|
@Nullable public static final BlockType ACACIA_DOOR = get("minecraft:acacia_door");
|
||||||
@Nullable public static final BlockType ACACIA_FENCE = get("minecraft:acacia_fence");
|
@Nullable public static final BlockType ACACIA_FENCE = get("minecraft:acacia_fence");
|
||||||
@ -660,64 +661,15 @@ public final class BlockTypes {
|
|||||||
@Nullable public static final BlockType ZOMBIE_HEAD = get("minecraft:zombie_head");
|
@Nullable public static final BlockType ZOMBIE_HEAD = get("minecraft:zombie_head");
|
||||||
@Nullable public static final BlockType ZOMBIE_WALL_HEAD = get("minecraft:zombie_wall_head");
|
@Nullable public static final BlockType ZOMBIE_WALL_HEAD = get("minecraft:zombie_wall_head");
|
||||||
|
|
||||||
|
|
||||||
private static BlockType get(String id) {
|
|
||||||
return register(new BlockType(id));
|
|
||||||
}
|
|
||||||
|
|
||||||
private static BlockType get(String id, Function<BlockState, BlockState> values) {
|
|
||||||
return register(new BlockType(id, values));
|
|
||||||
}
|
|
||||||
|
|
||||||
public static BlockType get(BlockType type) {
|
|
||||||
if(sortedRegistry == null) {
|
|
||||||
sortedRegistry = new ArrayList<>();
|
|
||||||
stateList = new ArrayList<>();
|
|
||||||
$NAMESPACES = new LinkedHashSet<>();
|
|
||||||
BIT_OFFSET = MathMan.log2nlz(WorldEdit.getInstance().getPlatformManager().queryCapability(Capability.GAME_HOOKS).getRegistries().getBlockRegistry().registerBlocks().size());
|
|
||||||
BIT_MASK = ((1 << BIT_OFFSET) - 1);
|
|
||||||
}
|
|
||||||
if(!sortedRegistry.contains(type))sortedRegistry.add(type);
|
|
||||||
return internalRegister(type, sortedRegistry.indexOf(type));
|
|
||||||
}
|
|
||||||
|
|
||||||
private static ArrayList<BlockType> sortedRegistry;
|
|
||||||
private static ArrayList<BlockState> stateList;
|
|
||||||
public static BlockType[] values;
|
|
||||||
public static BlockState[] states;
|
|
||||||
private static Set<String> $NAMESPACES;
|
|
||||||
@Deprecated public static int BIT_OFFSET; // Used internally
|
|
||||||
@Deprecated public static int BIT_MASK; // Used internally
|
|
||||||
|
|
||||||
private static BlockType internalRegister(BlockType blockType, final int internalId) {
|
|
||||||
init(blockType, blockType.getId(), internalId, stateList);
|
|
||||||
if(BlockType.REGISTRY.get(blockType.getId()) == null) BlockType.REGISTRY.register(blockType.getId(), blockType);
|
|
||||||
$NAMESPACES.add(blockType.getNamespace());
|
|
||||||
values = sortedRegistry.toArray(new BlockType[sortedRegistry.size()]);
|
|
||||||
states = stateList.toArray(new BlockState[stateList.size()]);
|
|
||||||
return blockType;
|
|
||||||
}
|
|
||||||
|
|
||||||
private static void init(BlockType type, String id, int internalId, ArrayList<BlockState> states) {
|
|
||||||
try {
|
|
||||||
type.setSettings(new Settings(type, id, internalId, states));
|
|
||||||
states.addAll(type.updateStates());
|
|
||||||
type.setStates(states);
|
|
||||||
} catch (Throwable e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
throw new RuntimeException(e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
-----------------------------------------------------
|
-----------------------------------------------------
|
||||||
Settings
|
Settings
|
||||||
-----------------------------------------------------
|
-----------------------------------------------------
|
||||||
*/
|
*/
|
||||||
public final static class Settings {
|
protected final static class Settings {
|
||||||
protected final int internalId;
|
protected final int internalId;
|
||||||
protected final ItemType itemType;
|
protected final ItemType itemType;
|
||||||
protected BlockState defaultState;
|
protected final BlockState defaultState;
|
||||||
protected final AbstractProperty<?>[] propertiesMapArr;
|
protected final AbstractProperty<?>[] propertiesMapArr;
|
||||||
protected final AbstractProperty<?>[] propertiesArr;
|
protected final AbstractProperty<?>[] propertiesArr;
|
||||||
protected final List<AbstractProperty<?>> propertiesList;
|
protected final List<AbstractProperty<?>> propertiesList;
|
||||||
@ -726,10 +678,14 @@ public final class BlockTypes {
|
|||||||
protected final BlockMaterial blockMaterial;
|
protected final BlockMaterial blockMaterial;
|
||||||
protected final int permutations;
|
protected final int permutations;
|
||||||
protected int[] stateOrdinals;
|
protected int[] stateOrdinals;
|
||||||
protected ArrayList<BlockState> localStates;
|
|
||||||
|
|
||||||
Settings(BlockType type, String id, int internalId, List<BlockState> states) {
|
Settings(BlockType type, String id, int internalId, List<BlockState> states) {
|
||||||
this.internalId = internalId;
|
this.internalId = internalId;
|
||||||
|
String propertyString = null;
|
||||||
|
int propI = id.indexOf('[');
|
||||||
|
if (propI != -1) {
|
||||||
|
propertyString = id.substring(propI + 1, id.length() - 1);
|
||||||
|
}
|
||||||
|
|
||||||
int maxInternalStateId = 0;
|
int maxInternalStateId = 0;
|
||||||
Map<String, ? extends Property<?>> properties = WorldEdit.getInstance().getPlatformManager().queryCapability(Capability.GAME_HOOKS).getRegistries().getBlockRegistry().getProperties(type);
|
Map<String, ? extends Property<?>> properties = WorldEdit.getInstance().getPlatformManager().queryCapability(Capability.GAME_HOOKS).getRegistries().getBlockRegistry().getProperties(type);
|
||||||
@ -747,7 +703,7 @@ public final class BlockTypes {
|
|||||||
int bitOffset = 0;
|
int bitOffset = 0;
|
||||||
for (Map.Entry<String, ? extends Property<?>> entry : properties.entrySet()) {
|
for (Map.Entry<String, ? extends Property<?>> entry : properties.entrySet()) {
|
||||||
PropertyKey key = PropertyKey.getOrCreate(entry.getKey());
|
PropertyKey key = PropertyKey.getOrCreate(entry.getKey());
|
||||||
AbstractProperty<?> property = ((AbstractProperty<?>) entry.getValue()).withOffset(bitOffset);
|
AbstractProperty<?> property = ((AbstractProperty) entry.getValue()).withOffset(bitOffset);
|
||||||
this.propertiesMapArr[key.ordinal()] = property;
|
this.propertiesMapArr[key.ordinal()] = property;
|
||||||
this.propertiesArr[prop_arr_i++] = property;
|
this.propertiesArr[prop_arr_i++] = property;
|
||||||
propMap.put(entry.getKey(), property);
|
propMap.put(entry.getKey(), property);
|
||||||
@ -766,7 +722,6 @@ public final class BlockTypes {
|
|||||||
this.propertiesSet = Collections.emptySet();
|
this.propertiesSet = Collections.emptySet();
|
||||||
}
|
}
|
||||||
this.permutations = maxInternalStateId;
|
this.permutations = maxInternalStateId;
|
||||||
this.localStates = new ArrayList<>();
|
|
||||||
|
|
||||||
this.blockMaterial = WorldEdit.getInstance().getPlatformManager().queryCapability(Capability.GAME_HOOKS).getRegistries().getBlockRegistry().getMaterial(type);
|
this.blockMaterial = WorldEdit.getInstance().getPlatformManager().queryCapability(Capability.GAME_HOOKS).getRegistries().getBlockRegistry().getMaterial(type);
|
||||||
this.itemType = ItemTypes.get(type);
|
this.itemType = ItemTypes.get(type);
|
||||||
@ -777,18 +732,31 @@ public final class BlockTypes {
|
|||||||
int ordinal = this.stateOrdinals[propId];
|
int ordinal = this.stateOrdinals[propId];
|
||||||
if (ordinal != -1) {
|
if (ordinal != -1) {
|
||||||
int stateId = internalId + (propId << BlockTypes.BIT_OFFSET);
|
int stateId = internalId + (propId << BlockTypes.BIT_OFFSET);
|
||||||
this.localStates.add(new BlockStateImpl(type, stateId, ordinal));
|
states.add(new BlockState(type, stateId, ordinal));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
int defaultPropId = parseProperties(propertyString, propertiesMap) >> BlockTypes.BIT_OFFSET;
|
||||||
|
this.defaultState = states.get(this.stateOrdinals[defaultPropId]);
|
||||||
|
} else {
|
||||||
|
this.defaultState = new BlockState(type, internalId, states.size());
|
||||||
|
states.add(this.defaultState);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
this.defaultState = this.localStates.get(this.stateOrdinals[internalId >> BlockTypes.BIT_OFFSET] - states.size());
|
private int parseProperties(String properties, Map<String, AbstractProperty<?>> propertyMap) {
|
||||||
} else {
|
int id = internalId;
|
||||||
this.defaultState = new BlockStateImpl(id.contains("minecraft:__reserved__") ? new BlockType("minecraft:air") : type, internalId, states.size());
|
for (String keyPair : properties.split(",")) {
|
||||||
this.localStates.add(this.defaultState);
|
String[] split = keyPair.split("=");
|
||||||
}
|
String name = split[0];
|
||||||
|
String value = split[1];
|
||||||
|
AbstractProperty btp = propertyMap.get(name);
|
||||||
|
id = btp.modify(id, btp.getValueFor(value));
|
||||||
|
}
|
||||||
|
return id;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private static int[] generateStateOrdinals(int internalId, int ordinal, int maxStateId, List<AbstractProperty<?>> props) {
|
private static int[] generateStateOrdinals(int internalId, int ordinal, int maxStateId, List<AbstractProperty<?>> props) {
|
||||||
if (props.isEmpty()) return null;
|
if (props.isEmpty()) return null;
|
||||||
int[] result = new int[maxStateId + 1];
|
int[] result = new int[maxStateId + 1];
|
||||||
@ -819,12 +787,105 @@ public final class BlockTypes {
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
-----------------------------------------------------
|
||||||
|
Static Initializer
|
||||||
|
-----------------------------------------------------
|
||||||
|
*/
|
||||||
|
|
||||||
|
public static final int BIT_OFFSET; // Used internally
|
||||||
|
public static final int BIT_MASK; // Used internally
|
||||||
|
|
||||||
|
private static final Map<String, BlockType> $REGISTRY = new HashMap<>();
|
||||||
|
|
||||||
|
public static final BlockType[] values;
|
||||||
|
public static final BlockState[] states;
|
||||||
|
|
||||||
|
private static final Set<String> $NAMESPACES = new LinkedHashSet<String>();
|
||||||
|
|
||||||
|
static {
|
||||||
|
try {
|
||||||
|
ArrayList<BlockState> stateList = new ArrayList<>();
|
||||||
|
|
||||||
|
Collection<String> blocks = WorldEdit.getInstance().getPlatformManager().queryCapability(Capability.GAME_HOOKS).getRegistries().getBlockRegistry().registerBlocks();
|
||||||
|
Map<String, String> blockMap = blocks.stream().collect(Collectors.toMap(item -> item.charAt(item.length() - 1) == ']' ? item.substring(0, item.indexOf('[')) : item, item -> item));
|
||||||
|
|
||||||
|
int size = blockMap.size();
|
||||||
|
for (Field field : BlockID.class.getDeclaredFields()) size = Math.max(field.getInt(null) + 1, size);
|
||||||
|
BIT_OFFSET = MathMan.log2nlz(size);
|
||||||
|
BIT_MASK = ((1 << BIT_OFFSET) - 1);
|
||||||
|
values = new BlockType[size];
|
||||||
|
|
||||||
|
// Register the statically declared ones first
|
||||||
|
Field[] oldFields = BlockID.class.getDeclaredFields();
|
||||||
|
for (Field field : oldFields) {
|
||||||
|
if (field.getType() == int.class) {
|
||||||
|
String id = field.getName().toLowerCase();
|
||||||
|
String defaultState = blockMap.get(id);
|
||||||
|
if (defaultState == null) {
|
||||||
|
System.out.println("Ignoring invalid block " + id);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
int internalId = field.getInt(null);
|
||||||
|
if (values[internalId] == null) {
|
||||||
|
throw new IllegalStateException("Invalid duplicate id for " + field.getName());
|
||||||
|
}
|
||||||
|
BlockType type = register(defaultState, internalId, stateList);
|
||||||
|
// Note: Throws IndexOutOfBoundsError if nothing is registered and blocksMap is empty
|
||||||
|
values[internalId] = type;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
{ // Register new blocks
|
||||||
|
int internalId = 1;
|
||||||
|
for (Map.Entry<String, String> entry : blockMap.entrySet()) {
|
||||||
|
String id = entry.getKey();
|
||||||
|
String defaultState = entry.getValue();
|
||||||
|
// Skip already registered ids
|
||||||
|
for (; values[internalId] != null; internalId++);
|
||||||
|
BlockType type = register(defaultState, internalId, stateList);
|
||||||
|
values[internalId] = type;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Add to $Registry
|
||||||
|
for (BlockType type : values) {
|
||||||
|
$REGISTRY.put(type.getId().toLowerCase(), type);
|
||||||
|
}
|
||||||
|
states = stateList.toArray(new BlockState[stateList.size()]);
|
||||||
|
} catch (Throwable e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static BlockType register(final String id, int internalId, List<BlockState> states) {
|
||||||
|
// Get the enum name (remove namespace if minecraft:)
|
||||||
|
int propStart = id.indexOf('[');
|
||||||
|
String typeName = id.substring(0, propStart == -1 ? id.length() : propStart);
|
||||||
|
String enumName = (typeName.startsWith("minecraft:") ? typeName.substring(10) : typeName).toUpperCase();
|
||||||
|
BlockType existing = new BlockType(id, internalId, states);
|
||||||
|
// register states
|
||||||
|
if (typeName.startsWith("minecraft:")) $REGISTRY.put(typeName.substring(10), existing);
|
||||||
|
$REGISTRY.put(typeName, existing);
|
||||||
|
String nameSpace = typeName.substring(0, typeName.indexOf(':'));
|
||||||
|
$NAMESPACES.add(nameSpace);
|
||||||
|
return existing;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
-----------------------------------------------------
|
||||||
|
Parsing
|
||||||
|
-----------------------------------------------------
|
||||||
|
*/
|
||||||
|
|
||||||
public static BlockType parse(final String type) throws InputParseException {
|
public static BlockType parse(final String type) throws InputParseException {
|
||||||
final String inputLower = type.toLowerCase();
|
final String inputLower = type.toLowerCase();
|
||||||
String input = inputLower;
|
String input = inputLower;
|
||||||
|
|
||||||
if (!input.split("\\[", 2)[0].contains(":")) input = "minecraft:" + input;
|
if (!input.split("\\[", 2)[0].contains(":")) input = "minecraft:" + input;
|
||||||
BlockType result = BlockType.REGISTRY.get(input);
|
BlockType result = $REGISTRY.get(input);
|
||||||
if (result != null) return result;
|
if (result != null) return result;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@ -845,11 +906,11 @@ public final class BlockTypes {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static final @Nullable BlockType get(final String id) {
|
public static final @Nullable BlockType get(final String id) {
|
||||||
return BlockType.REGISTRY.get(id.toLowerCase());
|
return $REGISTRY.get(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static final @Nullable BlockType get(final CharSequence id) {
|
public static final @Nullable BlockType get(final CharSequence id) {
|
||||||
return BlockType.REGISTRY.get(id.toString().toLowerCase());
|
return $REGISTRY.get(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Deprecated
|
@Deprecated
|
||||||
|
@ -1,149 +0,0 @@
|
|||||||
/*
|
|
||||||
* WorldEdit, a Minecraft world manipulation toolkit
|
|
||||||
* Copyright (C) sk89q <http://www.sk89q.com>
|
|
||||||
* Copyright (C) WorldEdit team and contributors
|
|
||||||
*
|
|
||||||
* This program is free software: you can redistribute it and/or modify it
|
|
||||||
* under the terms of the GNU Lesser General Public License as published by the
|
|
||||||
* Free Software Foundation, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
|
||||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
||||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
|
|
||||||
* for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU Lesser General Public License
|
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package com.sk89q.worldedit.world.block;
|
|
||||||
|
|
||||||
import static com.google.common.base.Preconditions.checkNotNull;
|
|
||||||
|
|
||||||
import com.sk89q.worldedit.registry.state.Property;
|
|
||||||
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* A Fuzzy BlockState. Used for partial matching.
|
|
||||||
*
|
|
||||||
* Immutable, construct with {@link FuzzyBlockState.Builder}.
|
|
||||||
*/
|
|
||||||
public class FuzzyBlockState extends BlockState {
|
|
||||||
|
|
||||||
FuzzyBlockState(BlockType blockType) {
|
|
||||||
super(blockType);
|
|
||||||
}
|
|
||||||
|
|
||||||
private FuzzyBlockState(BlockType blockType, Map<Property<?>, Object> values) {
|
|
||||||
this(blockType);
|
|
||||||
for (Map.Entry<Property<?>, Object> entry : values.entrySet()) {
|
|
||||||
setState(entry.getKey(), entry.getValue());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets a full BlockState from this fuzzy one, filling in
|
|
||||||
* properties with default values where necessary.
|
|
||||||
*
|
|
||||||
* @return The full BlockState
|
|
||||||
*/
|
|
||||||
public BlockState getFullState() {
|
|
||||||
BlockState state = getBlockType().getDefaultState();
|
|
||||||
for (Map.Entry<Property<?>, Object> entry : getStates().entrySet()) {
|
|
||||||
@SuppressWarnings("unchecked")
|
|
||||||
Property<Object> objKey = (Property<Object>) entry.getKey();
|
|
||||||
state = state.with(objKey, entry.getValue());
|
|
||||||
}
|
|
||||||
return state;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public BlockState toImmutableState() {
|
|
||||||
return getFullState();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets an instance of a builder.
|
|
||||||
*
|
|
||||||
* @return The builder
|
|
||||||
*/
|
|
||||||
public static Builder builder() {
|
|
||||||
return new Builder();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Builder for FuzzyBlockState
|
|
||||||
*/
|
|
||||||
public static class Builder {
|
|
||||||
private BlockType type;
|
|
||||||
private Map<Property<?>, Object> values = new HashMap<>();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The type of the Fuzzy BlockState
|
|
||||||
*
|
|
||||||
* @param type The type
|
|
||||||
* @return The builder, for chaining
|
|
||||||
*/
|
|
||||||
public Builder type(BlockType type) {
|
|
||||||
checkNotNull(type);
|
|
||||||
this.type = type;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The type of the Fuzzy BlockState
|
|
||||||
*
|
|
||||||
* @param state The state
|
|
||||||
* @return The builder, for chaining
|
|
||||||
*/
|
|
||||||
public Builder type(BlockState state) {
|
|
||||||
checkNotNull(state);
|
|
||||||
this.type = state.getBlockType();
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Adds a property to the fuzzy BlockState
|
|
||||||
*
|
|
||||||
* @param property The property
|
|
||||||
* @param value The value
|
|
||||||
* @param <V> The property type
|
|
||||||
* @return The builder, for chaining
|
|
||||||
*/
|
|
||||||
public <V> Builder withProperty(Property<V> property, V value) {
|
|
||||||
checkNotNull(property);
|
|
||||||
checkNotNull(value);
|
|
||||||
checkNotNull(type, "The type must be set before the properties!");
|
|
||||||
type.getProperty(property.getName()); // Verify the property is valid for this type
|
|
||||||
values.put(property, value);
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Builds a FuzzyBlockState from this builder.
|
|
||||||
*
|
|
||||||
* @return The fuzzy BlockState
|
|
||||||
*/
|
|
||||||
public FuzzyBlockState build() {
|
|
||||||
checkNotNull(type);
|
|
||||||
if (values.isEmpty()) {
|
|
||||||
return type.getFuzzyMatcher();
|
|
||||||
}
|
|
||||||
return new FuzzyBlockState(type, values);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Resets the builder.
|
|
||||||
*
|
|
||||||
* @return The builder, for chaining
|
|
||||||
*/
|
|
||||||
public Builder reset() {
|
|
||||||
this.type = null;
|
|
||||||
this.values.clear();
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -37,7 +37,7 @@ public class ItemType {
|
|||||||
private int internalId;
|
private int internalId;
|
||||||
private BaseItem defaultState;
|
private BaseItem defaultState;
|
||||||
|
|
||||||
public ItemType(String id) {
|
protected ItemType(String id) {
|
||||||
// If it has no namespace, assume minecraft.
|
// If it has no namespace, assume minecraft.
|
||||||
if (!id.contains(":")) {
|
if (!id.contains(":")) {
|
||||||
id = "minecraft:" + id;
|
id = "minecraft:" + id;
|
||||||
|
@ -873,7 +873,7 @@ public final class ItemTypes {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static final @Nullable ItemType get(String id) {
|
public static final @Nullable ItemType get(String id) {
|
||||||
|
return ItemType.REGISTRY.get(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static final @Nullable ItemType get(BlockType type) {
|
public static final @Nullable ItemType get(BlockType type) {
|
||||||
|
@ -23,13 +23,11 @@ import com.sk89q.worldedit.registry.state.Property;
|
|||||||
import com.sk89q.worldedit.world.block.BlockState;
|
import com.sk89q.worldedit.world.block.BlockState;
|
||||||
import com.sk89q.worldedit.world.block.BlockType;
|
import com.sk89q.worldedit.world.block.BlockType;
|
||||||
|
|
||||||
|
import javax.annotation.Nullable;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import javax.annotation.Nullable;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Provides information on blocks and provides methods to create them.
|
* Provides information on blocks and provides methods to create them.
|
||||||
*/
|
*/
|
||||||
|
Loading…
Reference in New Issue
Block a user