From 1b078467466533226bc15709d965c91a5da1d599 Mon Sep 17 00:00:00 2001 From: Jesse Boyd Date: Tue, 19 Nov 2019 04:40:40 +0000 Subject: [PATCH] some adapter refactoring --- .../fawe/bukkit/adapter/MapChunkUtil.java | 53 + .../fawe/bukkit/adapter/NMSAdapter.java | 93 + .../adapter/mc1_14/BukkitAdapter_1_14.java | 143 +- .../adapter/mc1_14/BukkitGetBlocks_1_14.java | 5 +- .../mc1_14/DataConverters_1_14_R4.java | 2730 ----------------- .../adapter/mc1_14/FAWE_Spigot_v1_14_R4.java | 346 +++ .../adapter/mc1_14/FakePlayer_v1_14_R4.java | 80 - .../adapter/mc1_14/MapChunkUtil_1_14.java | 141 +- .../adapter/mc1_14/Spigot_v1_14_R4.java | 757 ----- .../mc1_14/test/TestChunkPacketSend.java | 34 - .../fawe/bukkit/wrapper/AsyncBlock.java | 2 +- .../sk89q/worldedit/bukkit/BukkitAdapter.java | 4 - .../worldedit/bukkit/BukkitBlockRegistry.java | 2 +- .../worldedit/bukkit/BukkitItemRegistry.java | 16 + .../worldedit/bukkit/BukkitRegistries.java | 6 + .../worldedit/bukkit/WorldEditPlugin.java | 12 +- .../bukkit/adapter/BukkitImplAdapter.java | 73 +- .../bukkit/adapter/BukkitImplLoader.java | 2 + .../bukkit/adapter/CachedBukkitAdapter.java | 4 +- .../bukkit/adapter/IBukkitAdapter.java | 17 +- .../adapter/IDelegateBukkitImplAdapter.java | 278 ++ .../bukkit/adapter/SimpleBukkitAdapter.java | 2 +- .../clipboard/io/SpongeSchematicReader.java | 1 + .../worldedit/world/block/BlockState.java | 3 +- .../worldedit/world/block/BlockTypes.java | 1 + .../world/block/BlockTypesCache.java | 2 +- .../worldedit/world/block/ItemTypesCache.java | 22 + .../sk89q/worldedit/world/item/ItemTypes.java | 1795 +++++------ .../world/registry/BlockRegistry.java | 2 +- .../world/registry/ItemRegistry.java | 8 + 30 files changed, 1855 insertions(+), 4779 deletions(-) create mode 100644 worldedit-bukkit/src/main/java/com/boydti/fawe/bukkit/adapter/MapChunkUtil.java create mode 100644 worldedit-bukkit/src/main/java/com/boydti/fawe/bukkit/adapter/NMSAdapter.java delete mode 100644 worldedit-bukkit/src/main/java/com/boydti/fawe/bukkit/adapter/mc1_14/DataConverters_1_14_R4.java create mode 100644 worldedit-bukkit/src/main/java/com/boydti/fawe/bukkit/adapter/mc1_14/FAWE_Spigot_v1_14_R4.java delete mode 100644 worldedit-bukkit/src/main/java/com/boydti/fawe/bukkit/adapter/mc1_14/FakePlayer_v1_14_R4.java delete mode 100644 worldedit-bukkit/src/main/java/com/boydti/fawe/bukkit/adapter/mc1_14/Spigot_v1_14_R4.java delete mode 100644 worldedit-bukkit/src/main/java/com/boydti/fawe/bukkit/adapter/mc1_14/test/TestChunkPacketSend.java create mode 100644 worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/adapter/IDelegateBukkitImplAdapter.java create mode 100644 worldedit-core/src/main/java/com/sk89q/worldedit/world/block/ItemTypesCache.java diff --git a/worldedit-bukkit/src/main/java/com/boydti/fawe/bukkit/adapter/MapChunkUtil.java b/worldedit-bukkit/src/main/java/com/boydti/fawe/bukkit/adapter/MapChunkUtil.java new file mode 100644 index 000000000..bd76c3012 --- /dev/null +++ b/worldedit-bukkit/src/main/java/com/boydti/fawe/bukkit/adapter/MapChunkUtil.java @@ -0,0 +1,53 @@ +package com.boydti.fawe.bukkit.adapter; + +import com.boydti.fawe.beta.IBlocks; +import com.boydti.fawe.beta.implementation.packet.ChunkPacket; +import com.sk89q.jnbt.CompoundTag; +import com.sk89q.worldedit.bukkit.adapter.BukkitImplAdapter; +import com.sk89q.worldedit.math.BlockVector3; +import net.minecraft.server.v1_14_R1.WorldServer; + +import java.lang.reflect.Field; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.Map; + +public abstract class MapChunkUtil { + protected Field fieldX; + protected Field fieldZ; + protected Field fieldHeightMap; + protected Field fieldBitMask; + protected Field fieldChunkData; + protected Field fieldBlockEntities; + protected Field fieldFull; + + public abstract T createPacket(); + + public T create(BukkitImplAdapter adapter, ChunkPacket packet) { + try { + T nmsPacket; + int bitMask = packet.getChunk().getBitMask(); + nmsPacket = createPacket(); + fieldX.setInt(nmsPacket, packet.getChunkX()); + fieldZ.setInt(nmsPacket, packet.getChunkZ()); + fieldBitMask.set(nmsPacket, packet.getChunk().getBitMask()); + Object heightMap = adapter.fromNative(packet.getHeightMap()); + fieldHeightMap.set(nmsPacket, heightMap); + + fieldChunkData.set(nmsPacket, packet.getSectionBytes()); + + Map tiles = packet.getChunk().getTiles(); + ArrayList nmsTiles = new ArrayList<>(tiles.size()); + for (Map.Entry entry : tiles.entrySet()) { + Object nmsTag = adapter.fromNative(entry.getValue()); + nmsTiles.add(nmsTag); + } + fieldBlockEntities.set(nmsPacket, nmsTiles); + fieldFull.set(nmsPacket, packet.isFull()); + return nmsPacket; + } catch (Exception e) { + e.printStackTrace(); + return null; + } + } +} diff --git a/worldedit-bukkit/src/main/java/com/boydti/fawe/bukkit/adapter/NMSAdapter.java b/worldedit-bukkit/src/main/java/com/boydti/fawe/bukkit/adapter/NMSAdapter.java new file mode 100644 index 000000000..c1baffbeb --- /dev/null +++ b/worldedit-bukkit/src/main/java/com/boydti/fawe/bukkit/adapter/NMSAdapter.java @@ -0,0 +1,93 @@ +package com.boydti.fawe.bukkit.adapter; + +import com.sk89q.worldedit.world.block.BlockID; +import net.minecraft.server.v1_14_R1.ChunkSection; + +import java.util.function.Function; + +public class NMSAdapter { + public static int createPalette(int[] blockToPalette, int[] paletteToBlock, int[] blocksCopy, int[] num_palette_buffer, char[] set) { + int air = 0; + int num_palette = 0; + for (int i = 0; i < 4096; i++) { + char ordinal = set[i]; + switch (ordinal) { + case 0: + ordinal = BlockID.AIR; + case BlockID.AIR: + case BlockID.CAVE_AIR: + case BlockID.VOID_AIR: + air++; + } + int palette = blockToPalette[ordinal]; + if (palette == Integer.MAX_VALUE) { + blockToPalette[ordinal] = palette = num_palette; + paletteToBlock[num_palette] = ordinal; + num_palette++; + } + blocksCopy[i] = palette; + } + num_palette_buffer[0] = num_palette; + return air; + } + + public static int createPalette(int layer, int[] blockToPalette, int[] paletteToBlock, int[] blocksCopy, int[] num_palette_buffer, Function get, char[] set) { + int air = 0; + int num_palette = 0; + int i = 0; + outer: + for (; i < 4096; i++) { + char ordinal = set[i]; + switch (ordinal) { + case BlockID.__RESERVED__: + break outer; + case BlockID.AIR: + case BlockID.CAVE_AIR: + case BlockID.VOID_AIR: + air++; + } + int palette = blockToPalette[ordinal]; + if (palette == Integer.MAX_VALUE) { + blockToPalette[ordinal] = palette = num_palette; + paletteToBlock[num_palette] = ordinal; + num_palette++; + } + blocksCopy[i] = palette; + } + if (i != 4096) { + char[] getArr = get.apply(layer); + for (; i < 4096; i++) { + char ordinal = set[i]; + switch (ordinal) { + case BlockID.__RESERVED__: + ordinal = getArr[i]; + switch (ordinal) { + case BlockID.__RESERVED__: + ordinal = BlockID.AIR; + case BlockID.AIR: + case BlockID.CAVE_AIR: + case BlockID.VOID_AIR: + air++; + default: + set[i] = ordinal; + } + break; + case BlockID.AIR: + case BlockID.CAVE_AIR: + case BlockID.VOID_AIR: + air++; + } + int palette = blockToPalette[ordinal]; + if (palette == Integer.MAX_VALUE) { + blockToPalette[ordinal] = palette = num_palette; + paletteToBlock[num_palette] = ordinal; + num_palette++; + } + blocksCopy[i] = palette; + } + } + + num_palette_buffer[0] = num_palette; + return air; + } +} diff --git a/worldedit-bukkit/src/main/java/com/boydti/fawe/bukkit/adapter/mc1_14/BukkitAdapter_1_14.java b/worldedit-bukkit/src/main/java/com/boydti/fawe/bukkit/adapter/mc1_14/BukkitAdapter_1_14.java index a58068458..5a845f498 100644 --- a/worldedit-bukkit/src/main/java/com/boydti/fawe/bukkit/adapter/mc1_14/BukkitAdapter_1_14.java +++ b/worldedit-bukkit/src/main/java/com/boydti/fawe/bukkit/adapter/mc1_14/BukkitAdapter_1_14.java @@ -2,15 +2,13 @@ package com.boydti.fawe.bukkit.adapter.mc1_14; import com.boydti.fawe.Fawe; import com.boydti.fawe.FaweCache; -import com.boydti.fawe.bukkit.FaweBukkit; +import com.boydti.fawe.bukkit.adapter.NMSAdapter; import com.boydti.fawe.bukkit.adapter.DelegateLock; import com.boydti.fawe.config.Settings; import com.boydti.fawe.object.collection.BitArray4096; import com.boydti.fawe.util.MathMan; import com.boydti.fawe.util.TaskManager; -import com.sk89q.worldedit.world.block.BlockID; import com.sk89q.worldedit.world.block.BlockState; -import com.sk89q.worldedit.world.block.BlockTypes; import com.sk89q.worldedit.world.block.BlockTypesCache; import io.papermc.lib.PaperLib; import net.jpountz.util.UnsafeUtils; @@ -24,7 +22,6 @@ import net.minecraft.server.v1_14_R1.DataPaletteBlock; import net.minecraft.server.v1_14_R1.DataPaletteLinear; import net.minecraft.server.v1_14_R1.GameProfileSerializer; import net.minecraft.server.v1_14_R1.IBlockData; -import net.minecraft.server.v1_14_R1.PacketPlayOutMapChunk; import net.minecraft.server.v1_14_R1.PlayerChunk; import net.minecraft.server.v1_14_R1.PlayerChunkMap; import org.bukkit.craftbukkit.v1_14_R1.CraftChunk; @@ -35,16 +32,13 @@ import java.lang.reflect.Field; import java.lang.reflect.Modifier; import java.util.Arrays; import java.util.concurrent.CompletableFuture; -import java.util.concurrent.ExecutionException; import java.util.concurrent.locks.Lock; import java.util.function.Function; -import java.util.function.Supplier; - -public final class BukkitAdapter_1_14 { +public final class BukkitAdapter_1_14 extends NMSAdapter { /* - NMS fields - */ + NMS fields + */ public final static Field fieldBits; public final static Field fieldPalette; public final static Field fieldSize; @@ -152,10 +146,6 @@ public final class BukkitAdapter_1_14 { try { CraftChunk chunk = (CraftChunk) future.get(); return chunk.getHandle(); - } catch (InterruptedException e) { - e.printStackTrace(); - } catch (ExecutionException e) { - e.printStackTrace(); } catch (Throwable e) { e.printStackTrace(); } @@ -178,34 +168,25 @@ public final class BukkitAdapter_1_14 { if (playerChunk == null) { return; } -// ChunkSection[] sections = nmsChunk.getSections(); -// for (int layer = 0; layer < 16; layer++) { -// if (sections[layer] == null && (mask & (1 << layer)) != 0) { -// sections[layer] = new ChunkSection(layer << 4); -// } -// } if (playerChunk.hasBeenLoaded()) { - TaskManager.IMP.sync(new Supplier() { - @Override - public Object get() { - try { - int dirtyBits = fieldDirtyBits.getInt(playerChunk); - if (dirtyBits == 0) { - nmsWorld.getChunkProvider().playerChunkMap.a(playerChunk); - } - if (mask == 0) { - dirtyBits = 65535; - } else { - dirtyBits |= mask; - } - - fieldDirtyBits.set(playerChunk, dirtyBits); - fieldDirtyCount.set(playerChunk, 64); - } catch (IllegalAccessException e) { - e.printStackTrace(); + TaskManager.IMP.sync(() -> { + try { + int dirtyBits = fieldDirtyBits.getInt(playerChunk); + if (dirtyBits == 0) { + nmsWorld.getChunkProvider().playerChunkMap.a(playerChunk); } - return null; + if (mask == 0) { + dirtyBits = 65535; + } else { + dirtyBits |= mask; + } + + fieldDirtyBits.set(playerChunk, dirtyBits); + fieldDirtyCount.set(playerChunk, 64); + } catch (IllegalAccessException e) { + e.printStackTrace(); } + return null; }); return; } @@ -219,90 +200,6 @@ public final class BukkitAdapter_1_14 { return newChunkSection(layer, null, blocks); } - private static int createPalette(int layer, int[] blockToPalette, int[] paletteToBlock, int[] blocksCopy, int[] num_palette_buffer, Function get, char[] set) { - int air = 0; - int num_palette = 0; - int i = 0; - outer: - for (; i < 4096; i++) { - char ordinal = set[i]; - switch (ordinal) { - case BlockID.__RESERVED__: - break outer; - case BlockID.AIR: - case BlockID.CAVE_AIR: - case BlockID.VOID_AIR: - air++; - } - int palette = blockToPalette[ordinal]; - if (palette == Integer.MAX_VALUE) { - blockToPalette[ordinal] = palette = num_palette; - paletteToBlock[num_palette] = ordinal; - num_palette++; - } - blocksCopy[i] = palette; - } - if (i != 4096) { - char[] getArr = get.apply(layer); - for (; i < 4096; i++) { - char ordinal = set[i]; - switch (ordinal) { - case BlockID.__RESERVED__: - ordinal = getArr[i]; - switch (ordinal) { - case BlockID.__RESERVED__: - ordinal = BlockID.AIR; - case BlockID.AIR: - case BlockID.CAVE_AIR: - case BlockID.VOID_AIR: - air++; - default: - set[i] = ordinal; - } - break; - case BlockID.AIR: - case BlockID.CAVE_AIR: - case BlockID.VOID_AIR: - air++; - } - int palette = blockToPalette[ordinal]; - if (palette == Integer.MAX_VALUE) { - blockToPalette[ordinal] = palette = num_palette; - paletteToBlock[num_palette] = ordinal; - num_palette++; - } - blocksCopy[i] = palette; - } - } - - num_palette_buffer[0] = num_palette; - return air; - } - private static int createPalette(int[] blockToPalette, int[] paletteToBlock, int[] blocksCopy, int[] num_palette_buffer, char[] set) { - int air = 0; - int num_palette = 0; - for (int i = 0; i < 4096; i++) { - char ordinal = set[i]; - switch (ordinal) { - case 0: - ordinal = BlockID.AIR; - case BlockID.AIR: - case BlockID.CAVE_AIR: - case BlockID.VOID_AIR: - air++; - } - int palette = blockToPalette[ordinal]; - if (palette == Integer.MAX_VALUE) { - blockToPalette[ordinal] = palette = num_palette; - paletteToBlock[num_palette] = ordinal; - num_palette++; - } - blocksCopy[i] = palette; - } - num_palette_buffer[0] = num_palette; - return air; - } - public static ChunkSection newChunkSection(final int layer, final Function get, char[] set) { if (set == null) { return newChunkSection(layer); diff --git a/worldedit-bukkit/src/main/java/com/boydti/fawe/bukkit/adapter/mc1_14/BukkitGetBlocks_1_14.java b/worldedit-bukkit/src/main/java/com/boydti/fawe/bukkit/adapter/mc1_14/BukkitGetBlocks_1_14.java index f55a25e0f..cfbe4f81e 100644 --- a/worldedit-bukkit/src/main/java/com/boydti/fawe/bukkit/adapter/mc1_14/BukkitGetBlocks_1_14.java +++ b/worldedit-bukkit/src/main/java/com/boydti/fawe/bukkit/adapter/mc1_14/BukkitGetBlocks_1_14.java @@ -39,7 +39,6 @@ import java.util.concurrent.Future; import java.util.function.Function; import javax.annotation.Nullable; import net.minecraft.server.v1_14_R1.BiomeBase; -import net.minecraft.server.v1_14_R1.Block; import net.minecraft.server.v1_14_R1.BlockPosition; import net.minecraft.server.v1_14_R1.Chunk; import net.minecraft.server.v1_14_R1.ChunkSection; @@ -521,7 +520,7 @@ public class BukkitGetBlocks_1_14 extends CharGetBlocks { lock.setModified(false); // Efficiently convert ChunkSection to raw data try { - Spigot_v1_14_R4 adapter = ((Spigot_v1_14_R4) WorldEditPlugin.getInstance().getBukkitImplAdapter()); + FAWE_Spigot_v1_14_R4 adapter = ((FAWE_Spigot_v1_14_R4) WorldEditPlugin.getInstance().getBukkitImplAdapter()); final DataPaletteBlock blocks = section.getBlocks(); final DataBits bits = (DataBits) BukkitAdapter_1_14.fieldBits.get(blocks); @@ -599,7 +598,7 @@ public class BukkitGetBlocks_1_14 extends CharGetBlocks { } } - private final char ordinal(IBlockData ibd, Spigot_v1_14_R4 adapter) { + private final char ordinal(IBlockData ibd, FAWE_Spigot_v1_14_R4 adapter) { if (ibd == null) { return BlockTypes.AIR.getDefaultState().getOrdinalChar(); } else { diff --git a/worldedit-bukkit/src/main/java/com/boydti/fawe/bukkit/adapter/mc1_14/DataConverters_1_14_R4.java b/worldedit-bukkit/src/main/java/com/boydti/fawe/bukkit/adapter/mc1_14/DataConverters_1_14_R4.java deleted file mode 100644 index 0045ec18b..000000000 --- a/worldedit-bukkit/src/main/java/com/boydti/fawe/bukkit/adapter/mc1_14/DataConverters_1_14_R4.java +++ /dev/null @@ -1,2730 +0,0 @@ -/* - * WorldEdit, a Minecraft world manipulation toolkit - * Copyright (C) sk89q - * 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 . - */ - -package com.boydti.fawe.bukkit.adapter.mc1_14; - -import com.google.common.collect.Lists; -import com.google.common.collect.Maps; -import com.google.common.collect.Sets; -import com.google.gson.Gson; -import com.google.gson.GsonBuilder; -import com.google.gson.JsonArray; -import com.google.gson.JsonDeserializationContext; -import com.google.gson.JsonDeserializer; -import com.google.gson.JsonElement; -import com.google.gson.JsonParseException; -import com.mojang.datafixers.DSL.TypeReference; -import com.mojang.datafixers.DataFixer; -import com.mojang.datafixers.DataFixerBuilder; -import com.mojang.datafixers.Dynamic; -import com.mojang.datafixers.schemas.Schema; -import com.sk89q.jnbt.CompoundTag; -import net.minecraft.server.v1_14_R1.ChatComponentText; -import net.minecraft.server.v1_14_R1.ChatDeserializer; -import net.minecraft.server.v1_14_R1.DataConverterRegistry; -import net.minecraft.server.v1_14_R1.DataConverterTypes; -import net.minecraft.server.v1_14_R1.DataFixTypes; -import net.minecraft.server.v1_14_R1.DynamicOpsNBT; -import net.minecraft.server.v1_14_R1.EnumColor; -import net.minecraft.server.v1_14_R1.EnumDirection; -import net.minecraft.server.v1_14_R1.IChatBaseComponent; -import net.minecraft.server.v1_14_R1.MinecraftKey; -import net.minecraft.server.v1_14_R1.NBTBase; -import net.minecraft.server.v1_14_R1.NBTTagCompound; -import net.minecraft.server.v1_14_R1.NBTTagFloat; -import net.minecraft.server.v1_14_R1.NBTTagList; -import net.minecraft.server.v1_14_R1.NBTTagString; -import net.minecraft.server.v1_14_R1.UtilColor; -import org.apache.logging.log4j.LogManager; -import org.apache.logging.log4j.Logger; - -import javax.annotation.Nullable; -import java.lang.reflect.Type; -import java.util.ArrayList; -import java.util.EnumMap; -import java.util.HashMap; -import java.util.Iterator; -import java.util.List; -import java.util.Locale; -import java.util.Map; -import java.util.Random; -import java.util.Set; -import java.util.UUID; -import java.util.concurrent.Executor; -import java.util.stream.Collectors; - -/** - * Handles converting all Pre 1.13.2 data using the Legacy DataFix System (ported to 1.13.2) - * - * We register a DFU Fixer per Legacy Data Version and apply the fixes using legacy strategy - * which is safer, faster and cleaner code. - * - * The pre DFU code did not fail when the Source version was unknown. - * - * This class also provides util methods for converting compounds to wrap the update call to - * receive the source version in the compound - * - */ -@SuppressWarnings("UnnecessarilyQualifiedStaticUsage") -public class DataConverters_1_14_R4 extends DataFixerBuilder implements com.sk89q.worldedit.world.DataFixer { - - @SuppressWarnings("unchecked") - @Override - public T fixUp(FixType type, T original, int srcVer) { - if (type == FixTypes.CHUNK) { - return (T) fixChunk((CompoundTag) original, srcVer); - } else if (type == FixTypes.BLOCK_ENTITY) { - return (T) fixBlockEntity((CompoundTag) original, srcVer); - } else if (type == FixTypes.ENTITY) { - return (T) fixEntity((CompoundTag) original, srcVer); - } else if (type == FixTypes.BLOCK_STATE) { - return (T) fixBlockState((String) original, srcVer); - } else if (type == FixTypes.ITEM_TYPE) { - return (T) fixItemType((String) original, srcVer); - } else if (type == FixTypes.BIOME) { - return (T) fixBiome((String) original, srcVer); - } - return original; - } - - private CompoundTag fixChunk(CompoundTag originalChunk, int srcVer) { - NBTTagCompound tag = (NBTTagCompound) adapter.fromNative(originalChunk); - NBTTagCompound fixed = convert(LegacyType.CHUNK, tag, srcVer); - return (CompoundTag) adapter.toNative(fixed); - } - - private CompoundTag fixBlockEntity(CompoundTag origTileEnt, int srcVer) { - NBTTagCompound tag = (NBTTagCompound) adapter.fromNative(origTileEnt); - NBTTagCompound fixed = convert(LegacyType.BLOCK_ENTITY, tag, srcVer); - return (CompoundTag) adapter.toNative(fixed); - } - - private CompoundTag fixEntity(CompoundTag origEnt, int srcVer) { - NBTTagCompound tag = (NBTTagCompound) adapter.fromNative(origEnt); - NBTTagCompound fixed = convert(LegacyType.ENTITY, tag, srcVer); - return (CompoundTag) adapter.toNative(fixed); - } - - private String fixBlockState(String blockState, int srcVer) { - NBTTagCompound stateNBT = stateToNBT(blockState); - Dynamic dynamic = new Dynamic<>(OPS_NBT, stateNBT); - NBTTagCompound fixed = (NBTTagCompound) INSTANCE.fixer.update(DataConverterTypes.m, dynamic, srcVer, DATA_VERSION).getValue(); - return nbtToState(fixed); - } - - private String nbtToState(NBTTagCompound tagCompound) { - StringBuilder sb = new StringBuilder(); - sb.append(tagCompound.getString("Name")); - if (tagCompound.hasKeyOfType("Properties", 10)) { - sb.append('['); - NBTTagCompound props = tagCompound.getCompound("Properties"); - sb.append(props.getKeys().stream().map(k -> k + "=" + props.getString(k).replace("\"", "")).collect(Collectors.joining(","))); - sb.append(']'); - } - return sb.toString(); - } - - private static NBTTagCompound stateToNBT(String blockState) { - int propIdx = blockState.indexOf('['); - NBTTagCompound tag = new NBTTagCompound(); - if (propIdx < 0) { - tag.setString("Name", blockState); - } else { - tag.setString("Name", blockState.substring(0, propIdx)); - NBTTagCompound propTag = new NBTTagCompound(); - String props = blockState.substring(propIdx + 1, blockState.length() - 1); - String[] propArr = props.split(","); - for (String pair : propArr) { - final String[] split = pair.split("="); - propTag.setString(split[0], split[1]); - } - tag.set("Properties", propTag); - } - return tag; - } - - private String fixBiome(String key, int srcVer) { - return fixName(key, srcVer, DataConverterTypes.x); // "biome" - } - - private String fixItemType(String key, int srcVer) { - return fixName(key, srcVer, DataConverterTypes.r); // "item_name" - } - - private static String fixName(String key, int srcVer, TypeReference type) { - return INSTANCE.fixer.update(type, new Dynamic<>(OPS_NBT, new NBTTagString(key)), srcVer, DATA_VERSION) - .getValue().asString(); - } - - private final Spigot_v1_14_R4 adapter; - - private static final DynamicOpsNBT OPS_NBT = DynamicOpsNBT.a; - private static final int LEGACY_VERSION = 1343; - private static int DATA_VERSION; - static DataConverters_1_14_R4 INSTANCE; - - private final Map> converters = new EnumMap<>(LegacyType.class); - private final Map> inspectors = new EnumMap<>(LegacyType.class); - - // Set on build - private DataFixer fixer; - private static final Map DFU_TO_LEGACY = new HashMap<>(); - - public enum LegacyType { - LEVEL(DataFixTypes.LEVEL.a()), - PLAYER(DataFixTypes.PLAYER.a()), - CHUNK(DataFixTypes.CHUNK.a()), - BLOCK_ENTITY(DataConverterTypes.k), // "block_entity" - ENTITY(DataConverterTypes.ENTITY), - ITEM_INSTANCE(DataConverterTypes.ITEM_STACK), - OPTIONS(DataFixTypes.OPTIONS.a()), - STRUCTURE(DataFixTypes.STRUCTURE.a()); - - private final TypeReference type; - - LegacyType(TypeReference type) { - this.type = type; - DFU_TO_LEGACY.put(type.typeName(), this); - } - - public TypeReference getDFUType() { - return type; - } - } - - DataConverters_1_14_R4(int dataVersion, Spigot_v1_14_R4 adapter) { - super(dataVersion); - DATA_VERSION = dataVersion; - INSTANCE = this; - this.adapter = adapter; - registerConverters(); - registerInspectors(); - } - - - // Called after fixers are built and ready for FIXING - @Override - public DataFixer build(final Executor executor) { - return this.fixer = new WrappedDataFixer(DataConverterRegistry.a()); - } - - private class WrappedDataFixer implements DataFixer { - private final DataFixer realFixer; - - WrappedDataFixer(DataFixer realFixer) { - this.realFixer = realFixer; - } - - @Override - public Dynamic update(TypeReference type, Dynamic dynamic, int sourceVer, int targetVer) { - LegacyType legacyType = DFU_TO_LEGACY.get(type.typeName()); - if (sourceVer < LEGACY_VERSION && legacyType != null) { - NBTTagCompound cmp = (NBTTagCompound) dynamic.getValue(); - int desiredVersion = Math.min(targetVer, LEGACY_VERSION); - - cmp = convert(legacyType, cmp, sourceVer, desiredVersion); - sourceVer = desiredVersion; - dynamic = new Dynamic(OPS_NBT, cmp); - } - return realFixer.update(type, dynamic, sourceVer, targetVer); - } - - private NBTTagCompound convert(LegacyType type, NBTTagCompound cmp, int sourceVer, int desiredVersion) { - List converters = DataConverters_1_14_R4.this.converters.get(type); - if (converters != null && !converters.isEmpty()) { - for (DataConverter converter : converters) { - int dataVersion = converter.getDataVersion(); - if (dataVersion > sourceVer && dataVersion <= desiredVersion) { - cmp = converter.convert(cmp); - } - } - } - - List inspectors = DataConverters_1_14_R4.this.inspectors.get(type); - if (inspectors != null && !inspectors.isEmpty()) { - for (DataInspector inspector : inspectors) { - cmp = inspector.inspect(cmp, sourceVer, desiredVersion); - } - } - - return cmp; - } - - @Override - public Schema getSchema(int i) { - return realFixer.getSchema(i); - } - } - - public static NBTTagCompound convert(LegacyType type, NBTTagCompound cmp) { - return convert(type.getDFUType(), cmp); - } - - public static NBTTagCompound convert(LegacyType type, NBTTagCompound cmp, int sourceVer) { - return convert(type.getDFUType(), cmp, sourceVer); - } - - public static NBTTagCompound convert(LegacyType type, NBTTagCompound cmp, int sourceVer, int targetVer) { - return convert(type.getDFUType(), cmp, sourceVer, targetVer); - } - - public static NBTTagCompound convert(TypeReference type, NBTTagCompound cmp) { - int i = cmp.hasKeyOfType("DataVersion", 99) ? cmp.getInt("DataVersion") : -1; - return convert(type, cmp, i); - } - - public static NBTTagCompound convert(TypeReference type, NBTTagCompound cmp, int sourceVer) { - return convert(type, cmp, sourceVer, DATA_VERSION); - } - - public static NBTTagCompound convert(TypeReference type, NBTTagCompound cmp, int sourceVer, int targetVer) { - if (sourceVer >= targetVer) { - return cmp; - } - return (NBTTagCompound) INSTANCE.fixer.update(type, new Dynamic<>(OPS_NBT, cmp), sourceVer, targetVer).getValue(); - } - - - public interface DataInspector { - NBTTagCompound inspect(NBTTagCompound cmp, int sourceVer, int targetVer); - } - - public interface DataConverter { - - int getDataVersion(); - - NBTTagCompound convert(NBTTagCompound cmp); - } - - - private void registerInspector(LegacyType type, DataInspector inspector) { - this.inspectors.computeIfAbsent(type, k -> new ArrayList<>()).add(inspector); - } - - private void registerConverter(LegacyType type, DataConverter converter) { - int version = converter.getDataVersion(); - - List list = this.converters.computeIfAbsent(type, k -> new ArrayList<>()); - if (!list.isEmpty() && list.get(list.size() - 1).getDataVersion() > version) { - for (int j = 0; j < list.size(); ++j) { - if (list.get(j).getDataVersion() > version) { - list.add(j, converter); - break; - } - } - } else { - list.add(converter); - } - } - - private void registerInspectors() { - registerEntityItemList("EntityHorseDonkey", "SaddleItem", "Items"); - registerEntityItemList("EntityHorseMule", "Items"); - registerEntityItemList("EntityMinecartChest", "Items"); - registerEntityItemList("EntityMinecartHopper", "Items"); - registerEntityItemList("EntityVillager", "Inventory"); - registerEntityItemListEquipment("EntityArmorStand"); - registerEntityItemListEquipment("EntityBat"); - registerEntityItemListEquipment("EntityBlaze"); - registerEntityItemListEquipment("EntityCaveSpider"); - registerEntityItemListEquipment("EntityChicken"); - registerEntityItemListEquipment("EntityCow"); - registerEntityItemListEquipment("EntityCreeper"); - registerEntityItemListEquipment("EntityEnderDragon"); - registerEntityItemListEquipment("EntityEnderman"); - registerEntityItemListEquipment("EntityEndermite"); - registerEntityItemListEquipment("EntityEvoker"); - registerEntityItemListEquipment("EntityGhast"); - registerEntityItemListEquipment("EntityGiantZombie"); - registerEntityItemListEquipment("EntityGuardian"); - registerEntityItemListEquipment("EntityGuardianElder"); - registerEntityItemListEquipment("EntityHorse"); - registerEntityItemListEquipment("EntityHorseDonkey"); - registerEntityItemListEquipment("EntityHorseMule"); - registerEntityItemListEquipment("EntityHorseSkeleton"); - registerEntityItemListEquipment("EntityHorseZombie"); - registerEntityItemListEquipment("EntityIronGolem"); - registerEntityItemListEquipment("EntityMagmaCube"); - registerEntityItemListEquipment("EntityMushroomCow"); - registerEntityItemListEquipment("EntityOcelot"); - registerEntityItemListEquipment("EntityPig"); - registerEntityItemListEquipment("EntityPigZombie"); - registerEntityItemListEquipment("EntityRabbit"); - registerEntityItemListEquipment("EntitySheep"); - registerEntityItemListEquipment("EntityShulker"); - registerEntityItemListEquipment("EntitySilverfish"); - registerEntityItemListEquipment("EntitySkeleton"); - registerEntityItemListEquipment("EntitySkeletonStray"); - registerEntityItemListEquipment("EntitySkeletonWither"); - registerEntityItemListEquipment("EntitySlime"); - registerEntityItemListEquipment("EntitySnowman"); - registerEntityItemListEquipment("EntitySpider"); - registerEntityItemListEquipment("EntitySquid"); - registerEntityItemListEquipment("EntityVex"); - registerEntityItemListEquipment("EntityVillager"); - registerEntityItemListEquipment("EntityVindicator"); - registerEntityItemListEquipment("EntityWitch"); - registerEntityItemListEquipment("EntityWither"); - registerEntityItemListEquipment("EntityWolf"); - registerEntityItemListEquipment("EntityZombie"); - registerEntityItemListEquipment("EntityZombieHusk"); - registerEntityItemListEquipment("EntityZombieVillager"); - registerEntityItemSingle("EntityFireworks", "FireworksItem"); - registerEntityItemSingle("EntityHorse", "ArmorItem"); - registerEntityItemSingle("EntityHorse", "SaddleItem"); - registerEntityItemSingle("EntityHorseMule", "SaddleItem"); - registerEntityItemSingle("EntityHorseSkeleton", "SaddleItem"); - registerEntityItemSingle("EntityHorseZombie", "SaddleItem"); - registerEntityItemSingle("EntityItem", "Item"); - registerEntityItemSingle("EntityItemFrame", "Item"); - registerEntityItemSingle("EntityPotion", "Potion"); - - registerInspector(LegacyType.BLOCK_ENTITY, new DataInspectorItem("TileEntityRecordPlayer", "RecordItem")); - registerInspector(LegacyType.BLOCK_ENTITY, new DataInspectorItemList("TileEntityBrewingStand", "Items")); - registerInspector(LegacyType.BLOCK_ENTITY, new DataInspectorItemList("TileEntityChest", "Items")); - registerInspector(LegacyType.BLOCK_ENTITY, new DataInspectorItemList("TileEntityDispenser", "Items")); - registerInspector(LegacyType.BLOCK_ENTITY, new DataInspectorItemList("TileEntityDropper", "Items")); - registerInspector(LegacyType.BLOCK_ENTITY, new DataInspectorItemList("TileEntityFurnace", "Items")); - registerInspector(LegacyType.BLOCK_ENTITY, new DataInspectorItemList("TileEntityHopper", "Items")); - registerInspector(LegacyType.BLOCK_ENTITY, new DataInspectorItemList("TileEntityShulkerBox", "Items")); - registerInspector(LegacyType.BLOCK_ENTITY, new DataInspectorMobSpawnerMobs()); - registerInspector(LegacyType.CHUNK, new DataInspectorChunks()); - registerInspector(LegacyType.ENTITY, new DataInspectorCommandBlock()); - registerInspector(LegacyType.ENTITY, new DataInspectorEntityPassengers()); - registerInspector(LegacyType.ENTITY, new DataInspectorMobSpawnerMinecart()); - registerInspector(LegacyType.ENTITY, new DataInspectorVillagers()); - registerInspector(LegacyType.ITEM_INSTANCE, new DataInspectorBlockEntity()); - registerInspector(LegacyType.ITEM_INSTANCE, new DataInspectorEntity()); - registerInspector(LegacyType.LEVEL, new DataInspectorLevelPlayer()); - registerInspector(LegacyType.PLAYER, new DataInspectorPlayer()); - registerInspector(LegacyType.PLAYER, new DataInspectorPlayerVehicle()); - registerInspector(LegacyType.STRUCTURE, new DataInspectorStructure()); - } - - private void registerConverters() { - registerConverter(LegacyType.ENTITY, new DataConverterEquipment()); - registerConverter(LegacyType.BLOCK_ENTITY, new DataConverterSignText()); - registerConverter(LegacyType.ITEM_INSTANCE, new DataConverterMaterialId()); - registerConverter(LegacyType.ITEM_INSTANCE, new DataConverterPotionId()); - registerConverter(LegacyType.ITEM_INSTANCE, new DataConverterSpawnEgg()); - registerConverter(LegacyType.ENTITY, new DataConverterMinecart()); - registerConverter(LegacyType.BLOCK_ENTITY, new DataConverterMobSpawner()); - registerConverter(LegacyType.ENTITY, new DataConverterUUID()); - registerConverter(LegacyType.ENTITY, new DataConverterHealth()); - registerConverter(LegacyType.ENTITY, new DataConverterSaddle()); - registerConverter(LegacyType.ENTITY, new DataConverterHanging()); - registerConverter(LegacyType.ENTITY, new DataConverterDropChances()); - registerConverter(LegacyType.ENTITY, new DataConverterRiding()); - registerConverter(LegacyType.ENTITY, new DataConverterArmorStand()); - registerConverter(LegacyType.ITEM_INSTANCE, new DataConverterBook()); - registerConverter(LegacyType.ITEM_INSTANCE, new DataConverterCookedFish()); - registerConverter(LegacyType.ENTITY, new DataConverterZombie()); - registerConverter(LegacyType.OPTIONS, new DataConverterVBO()); - registerConverter(LegacyType.ENTITY, new DataConverterGuardian()); - registerConverter(LegacyType.ENTITY, new DataConverterSkeleton()); - registerConverter(LegacyType.ENTITY, new DataConverterZombieType()); - registerConverter(LegacyType.ENTITY, new DataConverterHorse()); - registerConverter(LegacyType.BLOCK_ENTITY, new DataConverterTileEntity()); - registerConverter(LegacyType.ENTITY, new DataConverterEntity()); - registerConverter(LegacyType.ITEM_INSTANCE, new DataConverterBanner()); - registerConverter(LegacyType.ITEM_INSTANCE, new DataConverterPotionWater()); - registerConverter(LegacyType.ENTITY, new DataConverterShulker()); - registerConverter(LegacyType.ITEM_INSTANCE, new DataConverterShulkerBoxItem()); - registerConverter(LegacyType.BLOCK_ENTITY, new DataConverterShulkerBoxBlock()); - registerConverter(LegacyType.OPTIONS, new DataConverterLang()); - registerConverter(LegacyType.ITEM_INSTANCE, new DataConverterTotem()); - registerConverter(LegacyType.CHUNK, new DataConverterBedBlock()); - registerConverter(LegacyType.ITEM_INSTANCE, new DataConverterBedItem()); - } - - private void registerEntityItemList(String type, String... keys) { - registerInspector(LegacyType.ENTITY, new DataInspectorItemList(type, keys)); - } - - private void registerEntityItemSingle(String type, String key) { - registerInspector(LegacyType.ENTITY, new DataInspectorItem(type, key)); - } - - private void registerEntityItemListEquipment(String type) { - registerEntityItemList(type, "ArmorItems", "HandItems"); - } - private static final Map OLD_ID_TO_KEY_MAP = new HashMap<>(); - - static { - final Map map = OLD_ID_TO_KEY_MAP; - map.put("EntityItem", new MinecraftKey("item")); - map.put("EntityExperienceOrb", new MinecraftKey("xp_orb")); - map.put("EntityAreaEffectCloud", new MinecraftKey("area_effect_cloud")); - map.put("EntityGuardianElder", new MinecraftKey("elder_guardian")); - map.put("EntitySkeletonWither", new MinecraftKey("wither_skeleton")); - map.put("EntitySkeletonStray", new MinecraftKey("stray")); - map.put("EntityEgg", new MinecraftKey("egg")); - map.put("EntityLeash", new MinecraftKey("leash_knot")); - map.put("EntityPainting", new MinecraftKey("painting")); - map.put("EntityTippedArrow", new MinecraftKey("arrow")); - map.put("EntitySnowball", new MinecraftKey("snowball")); - map.put("EntityLargeFireball", new MinecraftKey("fireball")); - map.put("EntitySmallFireball", new MinecraftKey("small_fireball")); - map.put("EntityEnderPearl", new MinecraftKey("ender_pearl")); - map.put("EntityEnderSignal", new MinecraftKey("eye_of_ender_signal")); - map.put("EntityPotion", new MinecraftKey("potion")); - map.put("EntityThrownExpBottle", new MinecraftKey("xp_bottle")); - map.put("EntityItemFrame", new MinecraftKey("item_frame")); - map.put("EntityWitherSkull", new MinecraftKey("wither_skull")); - map.put("EntityTNTPrimed", new MinecraftKey("tnt")); - map.put("EntityFallingBlock", new MinecraftKey("falling_block")); - map.put("EntityFireworks", new MinecraftKey("fireworks_rocket")); - map.put("EntityZombieHusk", new MinecraftKey("husk")); - map.put("EntitySpectralArrow", new MinecraftKey("spectral_arrow")); - map.put("EntityShulkerBullet", new MinecraftKey("shulker_bullet")); - map.put("EntityDragonFireball", new MinecraftKey("dragon_fireball")); - map.put("EntityZombieVillager", new MinecraftKey("zombie_villager")); - map.put("EntityHorseSkeleton", new MinecraftKey("skeleton_horse")); - map.put("EntityHorseZombie", new MinecraftKey("zombie_horse")); - map.put("EntityArmorStand", new MinecraftKey("armor_stand")); - map.put("EntityHorseDonkey", new MinecraftKey("donkey")); - map.put("EntityHorseMule", new MinecraftKey("mule")); - map.put("EntityEvokerFangs", new MinecraftKey("evocation_fangs")); - map.put("EntityEvoker", new MinecraftKey("evocation_illager")); - map.put("EntityVex", new MinecraftKey("vex")); - map.put("EntityVindicator", new MinecraftKey("vindication_illager")); - map.put("EntityIllagerIllusioner", new MinecraftKey("illusion_illager")); - map.put("EntityMinecartCommandBlock", new MinecraftKey("commandblock_minecart")); - map.put("EntityBoat", new MinecraftKey("boat")); - map.put("EntityMinecartRideable", new MinecraftKey("minecart")); - map.put("EntityMinecartChest", new MinecraftKey("chest_minecart")); - map.put("EntityMinecartFurnace", new MinecraftKey("furnace_minecart")); - map.put("EntityMinecartTNT", new MinecraftKey("tnt_minecart")); - map.put("EntityMinecartHopper", new MinecraftKey("hopper_minecart")); - map.put("EntityMinecartMobSpawner", new MinecraftKey("spawner_minecart")); - map.put("EntityCreeper", new MinecraftKey("creeper")); - map.put("EntitySkeleton", new MinecraftKey("skeleton")); - map.put("EntitySpider", new MinecraftKey("spider")); - map.put("EntityGiantZombie", new MinecraftKey("giant")); - map.put("EntityZombie", new MinecraftKey("zombie")); - map.put("EntitySlime", new MinecraftKey("slime")); - map.put("EntityGhast", new MinecraftKey("ghast")); - map.put("EntityPigZombie", new MinecraftKey("zombie_pigman")); - map.put("EntityEnderman", new MinecraftKey("enderman")); - map.put("EntityCaveSpider", new MinecraftKey("cave_spider")); - map.put("EntitySilverfish", new MinecraftKey("silverfish")); - map.put("EntityBlaze", new MinecraftKey("blaze")); - map.put("EntityMagmaCube", new MinecraftKey("magma_cube")); - map.put("EntityEnderDragon", new MinecraftKey("ender_dragon")); - map.put("EntityWither", new MinecraftKey("wither")); - map.put("EntityBat", new MinecraftKey("bat")); - map.put("EntityWitch", new MinecraftKey("witch")); - map.put("EntityEndermite", new MinecraftKey("endermite")); - map.put("EntityGuardian", new MinecraftKey("guardian")); - map.put("EntityShulker", new MinecraftKey("shulker")); - map.put("EntityPig", new MinecraftKey("pig")); - map.put("EntitySheep", new MinecraftKey("sheep")); - map.put("EntityCow", new MinecraftKey("cow")); - map.put("EntityChicken", new MinecraftKey("chicken")); - map.put("EntitySquid", new MinecraftKey("squid")); - map.put("EntityWolf", new MinecraftKey("wolf")); - map.put("EntityMushroomCow", new MinecraftKey("mooshroom")); - map.put("EntitySnowman", new MinecraftKey("snowman")); - map.put("EntityOcelot", new MinecraftKey("ocelot")); - map.put("EntityIronGolem", new MinecraftKey("villager_golem")); - map.put("EntityHorse", new MinecraftKey("horse")); - map.put("EntityRabbit", new MinecraftKey("rabbit")); - map.put("EntityPolarBear", new MinecraftKey("polar_bear")); - map.put("EntityLlama", new MinecraftKey("llama")); - map.put("EntityLlamaSpit", new MinecraftKey("llama_spit")); - map.put("EntityParrot", new MinecraftKey("parrot")); - map.put("EntityVillager", new MinecraftKey("villager")); - map.put("EntityEnderCrystal", new MinecraftKey("ender_crystal")); - map.put("TileEntityFurnace", new MinecraftKey("furnace")); - map.put("TileEntityChest", new MinecraftKey("chest")); - map.put("TileEntityEnderChest", new MinecraftKey("ender_chest")); - map.put("TileEntityRecordPlayer", new MinecraftKey("jukebox")); - map.put("TileEntityDispenser", new MinecraftKey("dispenser")); - map.put("TileEntityDropper", new MinecraftKey("dropper")); - map.put("TileEntitySign", new MinecraftKey("sign")); - map.put("TileEntityMobSpawner", new MinecraftKey("mob_spawner")); - map.put("TileEntityNote", new MinecraftKey("noteblock")); - map.put("TileEntityPiston", new MinecraftKey("piston")); - map.put("TileEntityBrewingStand", new MinecraftKey("brewing_stand")); - map.put("TileEntityEnchantTable", new MinecraftKey("enchanting_table")); - map.put("TileEntityEnderPortal", new MinecraftKey("end_portal")); - map.put("TileEntityBeacon", new MinecraftKey("beacon")); - map.put("TileEntitySkull", new MinecraftKey("skull")); - map.put("TileEntityLightDetector", new MinecraftKey("daylight_detector")); - map.put("TileEntityHopper", new MinecraftKey("hopper")); - map.put("TileEntityComparator", new MinecraftKey("comparator")); - map.put("TileEntityFlowerPot", new MinecraftKey("flower_pot")); - map.put("TileEntityBanner", new MinecraftKey("banner")); - map.put("TileEntityStructure", new MinecraftKey("structure_block")); - map.put("TileEntityEndGateway", new MinecraftKey("end_gateway")); - map.put("TileEntityCommand", new MinecraftKey("command_block")); - map.put("TileEntityShulkerBox", new MinecraftKey("shulker_box")); - map.put("TileEntityBed", new MinecraftKey("bed")); - } - - private static MinecraftKey getKey(String type) { - final MinecraftKey key = OLD_ID_TO_KEY_MAP.get(type); - if (key == null) { - throw new IllegalArgumentException("Unknown mapping for " + type); - } - return key; - } - - private static void convertCompound(LegacyType type, NBTTagCompound cmp, String key, int sourceVer, int targetVer) { - cmp.set(key, convert(type, cmp.getCompound(key), sourceVer, targetVer)); - } - - private static void convertItem(NBTTagCompound nbttagcompound, String key, int sourceVer, int targetVer) { - if (nbttagcompound.hasKeyOfType(key, 10)) { - convertCompound(LegacyType.ITEM_INSTANCE, nbttagcompound, key, sourceVer, targetVer); - } - } - - private static void convertItems(NBTTagCompound nbttagcompound, String key, int sourceVer, int targetVer) { - if (nbttagcompound.hasKeyOfType(key, 9)) { - NBTTagList nbttaglist = nbttagcompound.getList(key, 10); - - for (int j = 0; j < nbttaglist.size(); ++j) { - nbttaglist.set(j, convert(LegacyType.ITEM_INSTANCE, nbttaglist.getCompound(j), sourceVer, targetVer)); - } - } - - } - - private static class DataConverterEquipment implements DataConverter { - - DataConverterEquipment() {} - - public int getDataVersion() { - return 100; - } - - public NBTTagCompound convert(NBTTagCompound cmp) { - NBTTagList nbttaglist = cmp.getList("Equipment", 10); - NBTTagList nbttaglist1; - - if (!nbttaglist.isEmpty() && !cmp.hasKeyOfType("HandItems", 10)) { - nbttaglist1 = new NBTTagList(); - nbttaglist1.add(nbttaglist.get(0)); - nbttaglist1.add(new NBTTagCompound()); - cmp.set("HandItems", nbttaglist1); - } - - if (nbttaglist.size() > 1 && !cmp.hasKeyOfType("ArmorItem", 10)) { - nbttaglist1 = new NBTTagList(); - nbttaglist1.add(nbttaglist.get(1)); - nbttaglist1.add(nbttaglist.get(2)); - nbttaglist1.add(nbttaglist.get(3)); - nbttaglist1.add(nbttaglist.get(4)); - cmp.set("ArmorItems", nbttaglist1); - } - - cmp.remove("Equipment"); - if (cmp.hasKeyOfType("DropChances", 9)) { - nbttaglist1 = cmp.getList("DropChances", 5); - NBTTagList nbttaglist2; - - if (!cmp.hasKeyOfType("HandDropChances", 10)) { - nbttaglist2 = new NBTTagList(); - nbttaglist2.add(new NBTTagFloat(nbttaglist1.i(0))); - nbttaglist2.add(new NBTTagFloat(0.0F)); - cmp.set("HandDropChances", nbttaglist2); - } - - if (!cmp.hasKeyOfType("ArmorDropChances", 10)) { - nbttaglist2 = new NBTTagList(); - nbttaglist2.add(new NBTTagFloat(nbttaglist1.i(1))); - nbttaglist2.add(new NBTTagFloat(nbttaglist1.i(2))); - nbttaglist2.add(new NBTTagFloat(nbttaglist1.i(3))); - nbttaglist2.add(new NBTTagFloat(nbttaglist1.i(4))); - cmp.set("ArmorDropChances", nbttaglist2); - } - - cmp.remove("DropChances"); - } - - return cmp; - } - } - - private static class DataInspectorBlockEntity implements DataInspector { - - private static final Map b = Maps.newHashMap(); - private static final Map c = Maps.newHashMap(); - - DataInspectorBlockEntity() {} - - @Nullable - private static String convertEntityId(int i, String s) { - String key = new MinecraftKey(s).toString(); - if (i < 515 && DataInspectorBlockEntity.b.containsKey(key)) { - return DataInspectorBlockEntity.b.get(key); - } else { - return DataInspectorBlockEntity.c.get(key); - } - } - - public NBTTagCompound inspect(NBTTagCompound cmp, int sourceVer, int targetVer) { - if (!cmp.hasKeyOfType("tag", 10)) { - return cmp; - } else { - NBTTagCompound nbttagcompound1 = cmp.getCompound("tag"); - - if (nbttagcompound1.hasKeyOfType("BlockEntityTag", 10)) { - NBTTagCompound nbttagcompound2 = nbttagcompound1.getCompound("BlockEntityTag"); - String s = cmp.getString("id"); - String s1 = convertEntityId(sourceVer, s); - boolean flag; - - if (s1 == null) { - // CraftBukkit - Remove unnecessary warning (occurs when deserializing a Shulker Box item) - // DataInspectorBlockEntity.a.warn("Unable to resolve BlockEntity for ItemInstance: {}", s); - flag = false; - } else { - flag = !nbttagcompound2.hasKey("id"); - nbttagcompound2.setString("id", s1); - } - - convert(LegacyType.BLOCK_ENTITY, nbttagcompound2, sourceVer, targetVer); - if (flag) { - nbttagcompound2.remove("id"); - } - } - - return cmp; - } - } - - static { - Map map = DataInspectorBlockEntity.b; - - map.put("minecraft:furnace", "Furnace"); - map.put("minecraft:lit_furnace", "Furnace"); - map.put("minecraft:chest", "Chest"); - map.put("minecraft:trapped_chest", "Chest"); - map.put("minecraft:ender_chest", "EnderChest"); - map.put("minecraft:jukebox", "RecordPlayer"); - map.put("minecraft:dispenser", "Trap"); - map.put("minecraft:dropper", "Dropper"); - map.put("minecraft:sign", "Sign"); - map.put("minecraft:mob_spawner", "MobSpawner"); - map.put("minecraft:noteblock", "Music"); - map.put("minecraft:brewing_stand", "Cauldron"); - map.put("minecraft:enhanting_table", "EnchantTable"); - map.put("minecraft:command_block", "CommandBlock"); - map.put("minecraft:beacon", "Beacon"); - map.put("minecraft:skull", "Skull"); - map.put("minecraft:daylight_detector", "DLDetector"); - map.put("minecraft:hopper", "Hopper"); - map.put("minecraft:banner", "Banner"); - map.put("minecraft:flower_pot", "FlowerPot"); - map.put("minecraft:repeating_command_block", "CommandBlock"); - map.put("minecraft:chain_command_block", "CommandBlock"); - map.put("minecraft:standing_sign", "Sign"); - map.put("minecraft:wall_sign", "Sign"); - map.put("minecraft:piston_head", "Piston"); - map.put("minecraft:daylight_detector_inverted", "DLDetector"); - map.put("minecraft:unpowered_comparator", "Comparator"); - map.put("minecraft:powered_comparator", "Comparator"); - map.put("minecraft:wall_banner", "Banner"); - map.put("minecraft:standing_banner", "Banner"); - map.put("minecraft:structure_block", "Structure"); - map.put("minecraft:end_portal", "Airportal"); - map.put("minecraft:end_gateway", "EndGateway"); - map.put("minecraft:shield", "Shield"); - map = DataInspectorBlockEntity.c; - map.put("minecraft:furnace", "minecraft:furnace"); - map.put("minecraft:lit_furnace", "minecraft:furnace"); - map.put("minecraft:chest", "minecraft:chest"); - map.put("minecraft:trapped_chest", "minecraft:chest"); - map.put("minecraft:ender_chest", "minecraft:enderchest"); - map.put("minecraft:jukebox", "minecraft:jukebox"); - map.put("minecraft:dispenser", "minecraft:dispenser"); - map.put("minecraft:dropper", "minecraft:dropper"); - map.put("minecraft:sign", "minecraft:sign"); - map.put("minecraft:mob_spawner", "minecraft:mob_spawner"); - map.put("minecraft:noteblock", "minecraft:noteblock"); - map.put("minecraft:brewing_stand", "minecraft:brewing_stand"); - map.put("minecraft:enhanting_table", "minecraft:enchanting_table"); - map.put("minecraft:command_block", "minecraft:command_block"); - map.put("minecraft:beacon", "minecraft:beacon"); - map.put("minecraft:skull", "minecraft:skull"); - map.put("minecraft:daylight_detector", "minecraft:daylight_detector"); - map.put("minecraft:hopper", "minecraft:hopper"); - map.put("minecraft:banner", "minecraft:banner"); - map.put("minecraft:flower_pot", "minecraft:flower_pot"); - map.put("minecraft:repeating_command_block", "minecraft:command_block"); - map.put("minecraft:chain_command_block", "minecraft:command_block"); - map.put("minecraft:shulker_box", "minecraft:shulker_box"); - map.put("minecraft:white_shulker_box", "minecraft:shulker_box"); - map.put("minecraft:orange_shulker_box", "minecraft:shulker_box"); - map.put("minecraft:magenta_shulker_box", "minecraft:shulker_box"); - map.put("minecraft:light_blue_shulker_box", "minecraft:shulker_box"); - map.put("minecraft:yellow_shulker_box", "minecraft:shulker_box"); - map.put("minecraft:lime_shulker_box", "minecraft:shulker_box"); - map.put("minecraft:pink_shulker_box", "minecraft:shulker_box"); - map.put("minecraft:gray_shulker_box", "minecraft:shulker_box"); - map.put("minecraft:silver_shulker_box", "minecraft:shulker_box"); - map.put("minecraft:cyan_shulker_box", "minecraft:shulker_box"); - map.put("minecraft:purple_shulker_box", "minecraft:shulker_box"); - map.put("minecraft:blue_shulker_box", "minecraft:shulker_box"); - map.put("minecraft:brown_shulker_box", "minecraft:shulker_box"); - map.put("minecraft:green_shulker_box", "minecraft:shulker_box"); - map.put("minecraft:red_shulker_box", "minecraft:shulker_box"); - map.put("minecraft:black_shulker_box", "minecraft:shulker_box"); - map.put("minecraft:bed", "minecraft:bed"); - map.put("minecraft:standing_sign", "minecraft:sign"); - map.put("minecraft:wall_sign", "minecraft:sign"); - map.put("minecraft:piston_head", "minecraft:piston"); - map.put("minecraft:daylight_detector_inverted", "minecraft:daylight_detector"); - map.put("minecraft:unpowered_comparator", "minecraft:comparator"); - map.put("minecraft:powered_comparator", "minecraft:comparator"); - map.put("minecraft:wall_banner", "minecraft:banner"); - map.put("minecraft:standing_banner", "minecraft:banner"); - map.put("minecraft:structure_block", "minecraft:structure_block"); - map.put("minecraft:end_portal", "minecraft:end_portal"); - map.put("minecraft:end_gateway", "minecraft:end_gateway"); - map.put("minecraft:shield", "minecraft:shield"); - } - } - - private static class DataInspectorEntity implements DataInspector { - - private static final Logger a = LogManager.getLogger(DataConverters_1_14_R4.class); - - DataInspectorEntity() {} - - public NBTTagCompound inspect(NBTTagCompound cmp, int sourceVer, int targetVer) { - NBTTagCompound nbttagcompound1 = cmp.getCompound("tag"); - - if (nbttagcompound1.hasKeyOfType("EntityTag", 10)) { - NBTTagCompound nbttagcompound2 = nbttagcompound1.getCompound("EntityTag"); - String s = cmp.getString("id"); - String s1; - - if ("minecraft:armor_stand".equals(s)) { - s1 = sourceVer < 515 ? "ArmorStand" : "minecraft:armor_stand"; - } else { - if (!"minecraft:spawn_egg".equals(s)) { - return cmp; - } - - s1 = nbttagcompound2.getString("id"); - } - - boolean flag; - - if (s1 == null) { - DataInspectorEntity.a.warn("Unable to resolve Entity for ItemInstance: {}", s); - flag = false; - } else { - flag = !nbttagcompound2.hasKeyOfType("id", 8); - nbttagcompound2.setString("id", s1); - } - - convert(LegacyType.ENTITY, nbttagcompound2, sourceVer, targetVer); - if (flag) { - nbttagcompound2.remove("id"); - } - } - - return cmp; - } - } - - - private abstract static class DataInspectorTagged implements DataInspector { - - private final MinecraftKey key; - - DataInspectorTagged(String type) { - this.key = getKey(type); - } - - public NBTTagCompound inspect(NBTTagCompound cmp, int sourceVer, int targetVer) { - if (this.key.equals(new MinecraftKey(cmp.getString("id")))) { - cmp = this.inspectChecked(cmp, sourceVer, targetVer); - } - - return cmp; - } - - abstract NBTTagCompound inspectChecked(NBTTagCompound nbttagcompound, int sourceVer, int targetVer); - } - - private static class DataInspectorItemList extends DataInspectorTagged { - - private final String[] keys; - - DataInspectorItemList(String oclass, String... astring) { - super(oclass); - this.keys = astring; - } - - NBTTagCompound inspectChecked(NBTTagCompound nbttagcompound, int sourceVer, int targetVer) { - for (String s : this.keys) { - DataConverters_1_14_R4.convertItems(nbttagcompound, s, sourceVer, targetVer); - } - - return nbttagcompound; - } - } - private static class DataInspectorItem extends DataInspectorTagged { - - private final String[] keys; - - DataInspectorItem(String oclass, String... astring) { - super(oclass); - this.keys = astring; - } - - NBTTagCompound inspectChecked(NBTTagCompound nbttagcompound, int sourceVer, int targetVer) { - for (String key : this.keys) { - DataConverters_1_14_R4.convertItem(nbttagcompound, key, sourceVer, targetVer); - } - - return nbttagcompound; - } - } - - private static class DataConverterMaterialId implements DataConverter { - - private static final String[] materials = new String[2268]; - - DataConverterMaterialId() {} - - public int getDataVersion() { - return 102; - } - - public NBTTagCompound convert(NBTTagCompound cmp) { - if (cmp.hasKeyOfType("id", 99)) { - short short0 = cmp.getShort("id"); - - if (short0 > 0 && short0 < materials.length && materials[short0] != null) { - cmp.setString("id", materials[short0]); - } - } - - return cmp; - } - - static { - materials[1] = "minecraft:stone"; - materials[2] = "minecraft:grass"; - materials[3] = "minecraft:dirt"; - materials[4] = "minecraft:cobblestone"; - materials[5] = "minecraft:planks"; - materials[6] = "minecraft:sapling"; - materials[7] = "minecraft:bedrock"; - materials[8] = "minecraft:flowing_water"; - materials[9] = "minecraft:water"; - materials[10] = "minecraft:flowing_lava"; - materials[11] = "minecraft:lava"; - materials[12] = "minecraft:sand"; - materials[13] = "minecraft:gravel"; - materials[14] = "minecraft:gold_ore"; - materials[15] = "minecraft:iron_ore"; - materials[16] = "minecraft:coal_ore"; - materials[17] = "minecraft:log"; - materials[18] = "minecraft:leaves"; - materials[19] = "minecraft:sponge"; - materials[20] = "minecraft:glass"; - materials[21] = "minecraft:lapis_ore"; - materials[22] = "minecraft:lapis_block"; - materials[23] = "minecraft:dispenser"; - materials[24] = "minecraft:sandstone"; - materials[25] = "minecraft:noteblock"; - materials[27] = "minecraft:golden_rail"; - materials[28] = "minecraft:detector_rail"; - materials[29] = "minecraft:sticky_piston"; - materials[30] = "minecraft:web"; - materials[31] = "minecraft:tallgrass"; - materials[32] = "minecraft:deadbush"; - materials[33] = "minecraft:piston"; - materials[35] = "minecraft:wool"; - materials[37] = "minecraft:yellow_flower"; - materials[38] = "minecraft:red_flower"; - materials[39] = "minecraft:brown_mushroom"; - materials[40] = "minecraft:red_mushroom"; - materials[41] = "minecraft:gold_block"; - materials[42] = "minecraft:iron_block"; - materials[43] = "minecraft:double_stone_slab"; - materials[44] = "minecraft:stone_slab"; - materials[45] = "minecraft:brick_block"; - materials[46] = "minecraft:tnt"; - materials[47] = "minecraft:bookshelf"; - materials[48] = "minecraft:mossy_cobblestone"; - materials[49] = "minecraft:obsidian"; - materials[50] = "minecraft:torch"; - materials[51] = "minecraft:fire"; - materials[52] = "minecraft:mob_spawner"; - materials[53] = "minecraft:oak_stairs"; - materials[54] = "minecraft:chest"; - materials[56] = "minecraft:diamond_ore"; - materials[57] = "minecraft:diamond_block"; - materials[58] = "minecraft:crafting_table"; - materials[60] = "minecraft:farmland"; - materials[61] = "minecraft:furnace"; - materials[62] = "minecraft:lit_furnace"; - materials[65] = "minecraft:ladder"; - materials[66] = "minecraft:rail"; - materials[67] = "minecraft:stone_stairs"; - materials[69] = "minecraft:lever"; - materials[70] = "minecraft:stone_pressure_plate"; - materials[72] = "minecraft:wooden_pressure_plate"; - materials[73] = "minecraft:redstone_ore"; - materials[76] = "minecraft:redstone_torch"; - materials[77] = "minecraft:stone_button"; - materials[78] = "minecraft:snow_layer"; - materials[79] = "minecraft:ice"; - materials[80] = "minecraft:snow"; - materials[81] = "minecraft:cactus"; - materials[82] = "minecraft:clay"; - materials[84] = "minecraft:jukebox"; - materials[85] = "minecraft:fence"; - materials[86] = "minecraft:pumpkin"; - materials[87] = "minecraft:netherrack"; - materials[88] = "minecraft:soul_sand"; - materials[89] = "minecraft:glowstone"; - materials[90] = "minecraft:portal"; - materials[91] = "minecraft:lit_pumpkin"; - materials[95] = "minecraft:stained_glass"; - materials[96] = "minecraft:trapdoor"; - materials[97] = "minecraft:monster_egg"; - materials[98] = "minecraft:stonebrick"; - materials[99] = "minecraft:brown_mushroom_block"; - materials[100] = "minecraft:red_mushroom_block"; - materials[101] = "minecraft:iron_bars"; - materials[102] = "minecraft:glass_pane"; - materials[103] = "minecraft:melon_block"; - materials[106] = "minecraft:vine"; - materials[107] = "minecraft:fence_gate"; - materials[108] = "minecraft:brick_stairs"; - materials[109] = "minecraft:stone_brick_stairs"; - materials[110] = "minecraft:mycelium"; - materials[111] = "minecraft:waterlily"; - materials[112] = "minecraft:nether_brick"; - materials[113] = "minecraft:nether_brick_fence"; - materials[114] = "minecraft:nether_brick_stairs"; - materials[116] = "minecraft:enchanting_table"; - materials[119] = "minecraft:end_portal"; - materials[120] = "minecraft:end_portal_frame"; - materials[121] = "minecraft:end_stone"; - materials[122] = "minecraft:dragon_egg"; - materials[123] = "minecraft:redstone_lamp"; - materials[125] = "minecraft:double_wooden_slab"; - materials[126] = "minecraft:wooden_slab"; - materials[127] = "minecraft:cocoa"; - materials[128] = "minecraft:sandstone_stairs"; - materials[129] = "minecraft:emerald_ore"; - materials[130] = "minecraft:ender_chest"; - materials[131] = "minecraft:tripwire_hook"; - materials[133] = "minecraft:emerald_block"; - materials[134] = "minecraft:spruce_stairs"; - materials[135] = "minecraft:birch_stairs"; - materials[136] = "minecraft:jungle_stairs"; - materials[137] = "minecraft:command_block"; - materials[138] = "minecraft:beacon"; - materials[139] = "minecraft:cobblestone_wall"; - materials[141] = "minecraft:carrots"; - materials[142] = "minecraft:potatoes"; - materials[143] = "minecraft:wooden_button"; - materials[145] = "minecraft:anvil"; - materials[146] = "minecraft:trapped_chest"; - materials[147] = "minecraft:light_weighted_pressure_plate"; - materials[148] = "minecraft:heavy_weighted_pressure_plate"; - materials[151] = "minecraft:daylight_detector"; - materials[152] = "minecraft:redstone_block"; - materials[153] = "minecraft:quartz_ore"; - materials[154] = "minecraft:hopper"; - materials[155] = "minecraft:quartz_block"; - materials[156] = "minecraft:quartz_stairs"; - materials[157] = "minecraft:activator_rail"; - materials[158] = "minecraft:dropper"; - materials[159] = "minecraft:stained_hardened_clay"; - materials[160] = "minecraft:stained_glass_pane"; - materials[161] = "minecraft:leaves2"; - materials[162] = "minecraft:log2"; - materials[163] = "minecraft:acacia_stairs"; - materials[164] = "minecraft:dark_oak_stairs"; - materials[170] = "minecraft:hay_block"; - materials[171] = "minecraft:carpet"; - materials[172] = "minecraft:hardened_clay"; - materials[173] = "minecraft:coal_block"; - materials[174] = "minecraft:packed_ice"; - materials[175] = "minecraft:double_plant"; - materials[256] = "minecraft:iron_shovel"; - materials[257] = "minecraft:iron_pickaxe"; - materials[258] = "minecraft:iron_axe"; - materials[259] = "minecraft:flint_and_steel"; - materials[260] = "minecraft:apple"; - materials[261] = "minecraft:bow"; - materials[262] = "minecraft:arrow"; - materials[263] = "minecraft:coal"; - materials[264] = "minecraft:diamond"; - materials[265] = "minecraft:iron_ingot"; - materials[266] = "minecraft:gold_ingot"; - materials[267] = "minecraft:iron_sword"; - materials[268] = "minecraft:wooden_sword"; - materials[269] = "minecraft:wooden_shovel"; - materials[270] = "minecraft:wooden_pickaxe"; - materials[271] = "minecraft:wooden_axe"; - materials[272] = "minecraft:stone_sword"; - materials[273] = "minecraft:stone_shovel"; - materials[274] = "minecraft:stone_pickaxe"; - materials[275] = "minecraft:stone_axe"; - materials[276] = "minecraft:diamond_sword"; - materials[277] = "minecraft:diamond_shovel"; - materials[278] = "minecraft:diamond_pickaxe"; - materials[279] = "minecraft:diamond_axe"; - materials[280] = "minecraft:stick"; - materials[281] = "minecraft:bowl"; - materials[282] = "minecraft:mushroom_stew"; - materials[283] = "minecraft:golden_sword"; - materials[284] = "minecraft:golden_shovel"; - materials[285] = "minecraft:golden_pickaxe"; - materials[286] = "minecraft:golden_axe"; - materials[287] = "minecraft:string"; - materials[288] = "minecraft:feather"; - materials[289] = "minecraft:gunpowder"; - materials[290] = "minecraft:wooden_hoe"; - materials[291] = "minecraft:stone_hoe"; - materials[292] = "minecraft:iron_hoe"; - materials[293] = "minecraft:diamond_hoe"; - materials[294] = "minecraft:golden_hoe"; - materials[295] = "minecraft:wheat_seeds"; - materials[296] = "minecraft:wheat"; - materials[297] = "minecraft:bread"; - materials[298] = "minecraft:leather_helmet"; - materials[299] = "minecraft:leather_chestplate"; - materials[300] = "minecraft:leather_leggings"; - materials[301] = "minecraft:leather_boots"; - materials[302] = "minecraft:chainmail_helmet"; - materials[303] = "minecraft:chainmail_chestplate"; - materials[304] = "minecraft:chainmail_leggings"; - materials[305] = "minecraft:chainmail_boots"; - materials[306] = "minecraft:iron_helmet"; - materials[307] = "minecraft:iron_chestplate"; - materials[308] = "minecraft:iron_leggings"; - materials[309] = "minecraft:iron_boots"; - materials[310] = "minecraft:diamond_helmet"; - materials[311] = "minecraft:diamond_chestplate"; - materials[312] = "minecraft:diamond_leggings"; - materials[313] = "minecraft:diamond_boots"; - materials[314] = "minecraft:golden_helmet"; - materials[315] = "minecraft:golden_chestplate"; - materials[316] = "minecraft:golden_leggings"; - materials[317] = "minecraft:golden_boots"; - materials[318] = "minecraft:flint"; - materials[319] = "minecraft:porkchop"; - materials[320] = "minecraft:cooked_porkchop"; - materials[321] = "minecraft:painting"; - materials[322] = "minecraft:golden_apple"; - materials[323] = "minecraft:sign"; - materials[324] = "minecraft:wooden_door"; - materials[325] = "minecraft:bucket"; - materials[326] = "minecraft:water_bucket"; - materials[327] = "minecraft:lava_bucket"; - materials[328] = "minecraft:minecart"; - materials[329] = "minecraft:saddle"; - materials[330] = "minecraft:iron_door"; - materials[331] = "minecraft:redstone"; - materials[332] = "minecraft:snowball"; - materials[333] = "minecraft:boat"; - materials[334] = "minecraft:leather"; - materials[335] = "minecraft:milk_bucket"; - materials[336] = "minecraft:brick"; - materials[337] = "minecraft:clay_ball"; - materials[338] = "minecraft:reeds"; - materials[339] = "minecraft:paper"; - materials[340] = "minecraft:book"; - materials[341] = "minecraft:slime_ball"; - materials[342] = "minecraft:chest_minecart"; - materials[343] = "minecraft:furnace_minecart"; - materials[344] = "minecraft:egg"; - materials[345] = "minecraft:compass"; - materials[346] = "minecraft:fishing_rod"; - materials[347] = "minecraft:clock"; - materials[348] = "minecraft:glowstone_dust"; - materials[349] = "minecraft:fish"; - materials[350] = "minecraft:cooked_fish"; // Paper - cooked_fished -> cooked_fish - materials[351] = "minecraft:dye"; - materials[352] = "minecraft:bone"; - materials[353] = "minecraft:sugar"; - materials[354] = "minecraft:cake"; - materials[355] = "minecraft:bed"; - materials[356] = "minecraft:repeater"; - materials[357] = "minecraft:cookie"; - materials[358] = "minecraft:filled_map"; - materials[359] = "minecraft:shears"; - materials[360] = "minecraft:melon"; - materials[361] = "minecraft:pumpkin_seeds"; - materials[362] = "minecraft:melon_seeds"; - materials[363] = "minecraft:beef"; - materials[364] = "minecraft:cooked_beef"; - materials[365] = "minecraft:chicken"; - materials[366] = "minecraft:cooked_chicken"; - materials[367] = "minecraft:rotten_flesh"; - materials[368] = "minecraft:ender_pearl"; - materials[369] = "minecraft:blaze_rod"; - materials[370] = "minecraft:ghast_tear"; - materials[371] = "minecraft:gold_nugget"; - materials[372] = "minecraft:nether_wart"; - materials[373] = "minecraft:potion"; - materials[374] = "minecraft:glass_bottle"; - materials[375] = "minecraft:spider_eye"; - materials[376] = "minecraft:fermented_spider_eye"; - materials[377] = "minecraft:blaze_powder"; - materials[378] = "minecraft:magma_cream"; - materials[379] = "minecraft:brewing_stand"; - materials[380] = "minecraft:cauldron"; - materials[381] = "minecraft:ender_eye"; - materials[382] = "minecraft:speckled_melon"; - materials[383] = "minecraft:spawn_egg"; - materials[384] = "minecraft:experience_bottle"; - materials[385] = "minecraft:fire_charge"; - materials[386] = "minecraft:writable_book"; - materials[387] = "minecraft:written_book"; - materials[388] = "minecraft:emerald"; - materials[389] = "minecraft:item_frame"; - materials[390] = "minecraft:flower_pot"; - materials[391] = "minecraft:carrot"; - materials[392] = "minecraft:potato"; - materials[393] = "minecraft:baked_potato"; - materials[394] = "minecraft:poisonous_potato"; - materials[395] = "minecraft:map"; - materials[396] = "minecraft:golden_carrot"; - materials[397] = "minecraft:skull"; - materials[398] = "minecraft:carrot_on_a_stick"; - materials[399] = "minecraft:nether_star"; - materials[400] = "minecraft:pumpkin_pie"; - materials[401] = "minecraft:fireworks"; - materials[402] = "minecraft:firework_charge"; - materials[403] = "minecraft:enchanted_book"; - materials[404] = "minecraft:comparator"; - materials[405] = "minecraft:netherbrick"; - materials[406] = "minecraft:quartz"; - materials[407] = "minecraft:tnt_minecart"; - materials[408] = "minecraft:hopper_minecart"; - materials[417] = "minecraft:iron_horse_armor"; - materials[418] = "minecraft:golden_horse_armor"; - materials[419] = "minecraft:diamond_horse_armor"; - materials[420] = "minecraft:lead"; - materials[421] = "minecraft:name_tag"; - materials[422] = "minecraft:command_block_minecart"; - materials[2256] = "minecraft:record_13"; - materials[2257] = "minecraft:record_cat"; - materials[2258] = "minecraft:record_blocks"; - materials[2259] = "minecraft:record_chirp"; - materials[2260] = "minecraft:record_far"; - materials[2261] = "minecraft:record_mall"; - materials[2262] = "minecraft:record_mellohi"; - materials[2263] = "minecraft:record_stal"; - materials[2264] = "minecraft:record_strad"; - materials[2265] = "minecraft:record_ward"; - materials[2266] = "minecraft:record_11"; - materials[2267] = "minecraft:record_wait"; - } - } - - private static class DataConverterArmorStand implements DataConverter { - - DataConverterArmorStand() {} - - public int getDataVersion() { - return 147; - } - - public NBTTagCompound convert(NBTTagCompound cmp) { - if ("ArmorStand".equals(cmp.getString("id")) && cmp.getBoolean("Silent") && !cmp.getBoolean("Marker")) { - cmp.remove("Silent"); - } - - return cmp; - } - } - - private static class DataConverterBanner implements DataConverter { - - DataConverterBanner() {} - - public int getDataVersion() { - return 804; - } - - public NBTTagCompound convert(NBTTagCompound cmp) { - if ("minecraft:banner".equals(cmp.getString("id")) && cmp.hasKeyOfType("tag", 10)) { - NBTTagCompound nbttagcompound1 = cmp.getCompound("tag"); - - if (nbttagcompound1.hasKeyOfType("BlockEntityTag", 10)) { - NBTTagCompound nbttagcompound2 = nbttagcompound1.getCompound("BlockEntityTag"); - - if (nbttagcompound2.hasKeyOfType("Base", 99)) { - cmp.setShort("Damage", (short) (nbttagcompound2.getShort("Base") & 15)); - if (nbttagcompound1.hasKeyOfType("display", 10)) { - NBTTagCompound nbttagcompound3 = nbttagcompound1.getCompound("display"); - - if (nbttagcompound3.hasKeyOfType("Lore", 9)) { - NBTTagList nbttaglist = nbttagcompound3.getList("Lore", 8); - - if (nbttaglist.size() == 1 && "(+NBT)".equals(nbttaglist.getString(0))) { - return cmp; - } - } - } - - nbttagcompound2.remove("Base"); - if (nbttagcompound2.isEmpty()) { - nbttagcompound1.remove("BlockEntityTag"); - } - - if (nbttagcompound1.isEmpty()) { - cmp.remove("tag"); - } - } - } - } - - return cmp; - } - } - - private static class DataConverterPotionId implements DataConverter { - - private static final String[] potions = new String[128]; - - DataConverterPotionId() {} - - public int getDataVersion() { - return 102; - } - - public NBTTagCompound convert(NBTTagCompound cmp) { - if ("minecraft:potion".equals(cmp.getString("id"))) { - NBTTagCompound nbttagcompound1 = cmp.getCompound("tag"); - short short0 = cmp.getShort("Damage"); - - if (!nbttagcompound1.hasKeyOfType("Potion", 8)) { - String s = DataConverterPotionId.potions[short0 & 127]; - - nbttagcompound1.setString("Potion", s == null ? "minecraft:water" : s); - cmp.set("tag", nbttagcompound1); - if ((short0 & 16384) == 16384) { - cmp.setString("id", "minecraft:splash_potion"); - } - } - - if (short0 != 0) { - cmp.setShort("Damage", (short) 0); - } - } - - return cmp; - } - - static { - DataConverterPotionId.potions[0] = "minecraft:water"; - DataConverterPotionId.potions[1] = "minecraft:regeneration"; - DataConverterPotionId.potions[2] = "minecraft:swiftness"; - DataConverterPotionId.potions[3] = "minecraft:fire_resistance"; - DataConverterPotionId.potions[4] = "minecraft:poison"; - DataConverterPotionId.potions[5] = "minecraft:healing"; - DataConverterPotionId.potions[6] = "minecraft:night_vision"; - DataConverterPotionId.potions[7] = null; - DataConverterPotionId.potions[8] = "minecraft:weakness"; - DataConverterPotionId.potions[9] = "minecraft:strength"; - DataConverterPotionId.potions[10] = "minecraft:slowness"; - DataConverterPotionId.potions[11] = "minecraft:leaping"; - DataConverterPotionId.potions[12] = "minecraft:harming"; - DataConverterPotionId.potions[13] = "minecraft:water_breathing"; - DataConverterPotionId.potions[14] = "minecraft:invisibility"; - DataConverterPotionId.potions[15] = null; - DataConverterPotionId.potions[16] = "minecraft:awkward"; - DataConverterPotionId.potions[17] = "minecraft:regeneration"; - DataConverterPotionId.potions[18] = "minecraft:swiftness"; - DataConverterPotionId.potions[19] = "minecraft:fire_resistance"; - DataConverterPotionId.potions[20] = "minecraft:poison"; - DataConverterPotionId.potions[21] = "minecraft:healing"; - DataConverterPotionId.potions[22] = "minecraft:night_vision"; - DataConverterPotionId.potions[23] = null; - DataConverterPotionId.potions[24] = "minecraft:weakness"; - DataConverterPotionId.potions[25] = "minecraft:strength"; - DataConverterPotionId.potions[26] = "minecraft:slowness"; - DataConverterPotionId.potions[27] = "minecraft:leaping"; - DataConverterPotionId.potions[28] = "minecraft:harming"; - DataConverterPotionId.potions[29] = "minecraft:water_breathing"; - DataConverterPotionId.potions[30] = "minecraft:invisibility"; - DataConverterPotionId.potions[31] = null; - DataConverterPotionId.potions[32] = "minecraft:thick"; - DataConverterPotionId.potions[33] = "minecraft:strong_regeneration"; - DataConverterPotionId.potions[34] = "minecraft:strong_swiftness"; - DataConverterPotionId.potions[35] = "minecraft:fire_resistance"; - DataConverterPotionId.potions[36] = "minecraft:strong_poison"; - DataConverterPotionId.potions[37] = "minecraft:strong_healing"; - DataConverterPotionId.potions[38] = "minecraft:night_vision"; - DataConverterPotionId.potions[39] = null; - DataConverterPotionId.potions[40] = "minecraft:weakness"; - DataConverterPotionId.potions[41] = "minecraft:strong_strength"; - DataConverterPotionId.potions[42] = "minecraft:slowness"; - DataConverterPotionId.potions[43] = "minecraft:strong_leaping"; - DataConverterPotionId.potions[44] = "minecraft:strong_harming"; - DataConverterPotionId.potions[45] = "minecraft:water_breathing"; - DataConverterPotionId.potions[46] = "minecraft:invisibility"; - DataConverterPotionId.potions[47] = null; - DataConverterPotionId.potions[48] = null; - DataConverterPotionId.potions[49] = "minecraft:strong_regeneration"; - DataConverterPotionId.potions[50] = "minecraft:strong_swiftness"; - DataConverterPotionId.potions[51] = "minecraft:fire_resistance"; - DataConverterPotionId.potions[52] = "minecraft:strong_poison"; - DataConverterPotionId.potions[53] = "minecraft:strong_healing"; - DataConverterPotionId.potions[54] = "minecraft:night_vision"; - DataConverterPotionId.potions[55] = null; - DataConverterPotionId.potions[56] = "minecraft:weakness"; - DataConverterPotionId.potions[57] = "minecraft:strong_strength"; - DataConverterPotionId.potions[58] = "minecraft:slowness"; - DataConverterPotionId.potions[59] = "minecraft:strong_leaping"; - DataConverterPotionId.potions[60] = "minecraft:strong_harming"; - DataConverterPotionId.potions[61] = "minecraft:water_breathing"; - DataConverterPotionId.potions[62] = "minecraft:invisibility"; - DataConverterPotionId.potions[63] = null; - DataConverterPotionId.potions[64] = "minecraft:mundane"; - DataConverterPotionId.potions[65] = "minecraft:long_regeneration"; - DataConverterPotionId.potions[66] = "minecraft:long_swiftness"; - DataConverterPotionId.potions[67] = "minecraft:long_fire_resistance"; - DataConverterPotionId.potions[68] = "minecraft:long_poison"; - DataConverterPotionId.potions[69] = "minecraft:healing"; - DataConverterPotionId.potions[70] = "minecraft:long_night_vision"; - DataConverterPotionId.potions[71] = null; - DataConverterPotionId.potions[72] = "minecraft:long_weakness"; - DataConverterPotionId.potions[73] = "minecraft:long_strength"; - DataConverterPotionId.potions[74] = "minecraft:long_slowness"; - DataConverterPotionId.potions[75] = "minecraft:long_leaping"; - DataConverterPotionId.potions[76] = "minecraft:harming"; - DataConverterPotionId.potions[77] = "minecraft:long_water_breathing"; - DataConverterPotionId.potions[78] = "minecraft:long_invisibility"; - DataConverterPotionId.potions[79] = null; - DataConverterPotionId.potions[80] = "minecraft:awkward"; - DataConverterPotionId.potions[81] = "minecraft:long_regeneration"; - DataConverterPotionId.potions[82] = "minecraft:long_swiftness"; - DataConverterPotionId.potions[83] = "minecraft:long_fire_resistance"; - DataConverterPotionId.potions[84] = "minecraft:long_poison"; - DataConverterPotionId.potions[85] = "minecraft:healing"; - DataConverterPotionId.potions[86] = "minecraft:long_night_vision"; - DataConverterPotionId.potions[87] = null; - DataConverterPotionId.potions[88] = "minecraft:long_weakness"; - DataConverterPotionId.potions[89] = "minecraft:long_strength"; - DataConverterPotionId.potions[90] = "minecraft:long_slowness"; - DataConverterPotionId.potions[91] = "minecraft:long_leaping"; - DataConverterPotionId.potions[92] = "minecraft:harming"; - DataConverterPotionId.potions[93] = "minecraft:long_water_breathing"; - DataConverterPotionId.potions[94] = "minecraft:long_invisibility"; - DataConverterPotionId.potions[95] = null; - DataConverterPotionId.potions[96] = "minecraft:thick"; - DataConverterPotionId.potions[97] = "minecraft:regeneration"; - DataConverterPotionId.potions[98] = "minecraft:swiftness"; - DataConverterPotionId.potions[99] = "minecraft:long_fire_resistance"; - DataConverterPotionId.potions[100] = "minecraft:poison"; - DataConverterPotionId.potions[101] = "minecraft:strong_healing"; - DataConverterPotionId.potions[102] = "minecraft:long_night_vision"; - DataConverterPotionId.potions[103] = null; - DataConverterPotionId.potions[104] = "minecraft:long_weakness"; - DataConverterPotionId.potions[105] = "minecraft:strength"; - DataConverterPotionId.potions[106] = "minecraft:long_slowness"; - DataConverterPotionId.potions[107] = "minecraft:leaping"; - DataConverterPotionId.potions[108] = "minecraft:strong_harming"; - DataConverterPotionId.potions[109] = "minecraft:long_water_breathing"; - DataConverterPotionId.potions[110] = "minecraft:long_invisibility"; - DataConverterPotionId.potions[111] = null; - DataConverterPotionId.potions[112] = null; - DataConverterPotionId.potions[113] = "minecraft:regeneration"; - DataConverterPotionId.potions[114] = "minecraft:swiftness"; - DataConverterPotionId.potions[115] = "minecraft:long_fire_resistance"; - DataConverterPotionId.potions[116] = "minecraft:poison"; - DataConverterPotionId.potions[117] = "minecraft:strong_healing"; - DataConverterPotionId.potions[118] = "minecraft:long_night_vision"; - DataConverterPotionId.potions[119] = null; - DataConverterPotionId.potions[120] = "minecraft:long_weakness"; - DataConverterPotionId.potions[121] = "minecraft:strength"; - DataConverterPotionId.potions[122] = "minecraft:long_slowness"; - DataConverterPotionId.potions[123] = "minecraft:leaping"; - DataConverterPotionId.potions[124] = "minecraft:strong_harming"; - DataConverterPotionId.potions[125] = "minecraft:long_water_breathing"; - DataConverterPotionId.potions[126] = "minecraft:long_invisibility"; - DataConverterPotionId.potions[127] = null; - } - } - - private static class DataConverterSpawnEgg implements DataConverter { - - private static final String[] eggs = new String[256]; - - DataConverterSpawnEgg() {} - - public int getDataVersion() { - return 105; - } - - public NBTTagCompound convert(NBTTagCompound cmp) { - if ("minecraft:spawn_egg".equals(cmp.getString("id"))) { - NBTTagCompound nbttagcompound1 = cmp.getCompound("tag"); - NBTTagCompound nbttagcompound2 = nbttagcompound1.getCompound("EntityTag"); - short short0 = cmp.getShort("Damage"); - - if (!nbttagcompound2.hasKeyOfType("id", 8)) { - String s = DataConverterSpawnEgg.eggs[short0 & 255]; - - if (s != null) { - nbttagcompound2.setString("id", s); - nbttagcompound1.set("EntityTag", nbttagcompound2); - cmp.set("tag", nbttagcompound1); - } - } - - if (short0 != 0) { - cmp.setShort("Damage", (short) 0); - } - } - - return cmp; - } - - static { - - DataConverterSpawnEgg.eggs[1] = "Item"; - DataConverterSpawnEgg.eggs[2] = "XPOrb"; - DataConverterSpawnEgg.eggs[7] = "ThrownEgg"; - DataConverterSpawnEgg.eggs[8] = "LeashKnot"; - DataConverterSpawnEgg.eggs[9] = "Painting"; - DataConverterSpawnEgg.eggs[10] = "Arrow"; - DataConverterSpawnEgg.eggs[11] = "Snowball"; - DataConverterSpawnEgg.eggs[12] = "Fireball"; - DataConverterSpawnEgg.eggs[13] = "SmallFireball"; - DataConverterSpawnEgg.eggs[14] = "ThrownEnderpearl"; - DataConverterSpawnEgg.eggs[15] = "EyeOfEnderSignal"; - DataConverterSpawnEgg.eggs[16] = "ThrownPotion"; - DataConverterSpawnEgg.eggs[17] = "ThrownExpBottle"; - DataConverterSpawnEgg.eggs[18] = "ItemFrame"; - DataConverterSpawnEgg.eggs[19] = "WitherSkull"; - DataConverterSpawnEgg.eggs[20] = "PrimedTnt"; - DataConverterSpawnEgg.eggs[21] = "FallingSand"; - DataConverterSpawnEgg.eggs[22] = "FireworksRocketEntity"; - DataConverterSpawnEgg.eggs[23] = "TippedArrow"; - DataConverterSpawnEgg.eggs[24] = "SpectralArrow"; - DataConverterSpawnEgg.eggs[25] = "ShulkerBullet"; - DataConverterSpawnEgg.eggs[26] = "DragonFireball"; - DataConverterSpawnEgg.eggs[30] = "ArmorStand"; - DataConverterSpawnEgg.eggs[41] = "Boat"; - DataConverterSpawnEgg.eggs[42] = "MinecartRideable"; - DataConverterSpawnEgg.eggs[43] = "MinecartChest"; - DataConverterSpawnEgg.eggs[44] = "MinecartFurnace"; - DataConverterSpawnEgg.eggs[45] = "MinecartTNT"; - DataConverterSpawnEgg.eggs[46] = "MinecartHopper"; - DataConverterSpawnEgg.eggs[47] = "MinecartSpawner"; - DataConverterSpawnEgg.eggs[40] = "MinecartCommandBlock"; - DataConverterSpawnEgg.eggs[48] = "Mob"; - DataConverterSpawnEgg.eggs[49] = "Monster"; - DataConverterSpawnEgg.eggs[50] = "Creeper"; - DataConverterSpawnEgg.eggs[51] = "Skeleton"; - DataConverterSpawnEgg.eggs[52] = "Spider"; - DataConverterSpawnEgg.eggs[53] = "Giant"; - DataConverterSpawnEgg.eggs[54] = "Zombie"; - DataConverterSpawnEgg.eggs[55] = "Slime"; - DataConverterSpawnEgg.eggs[56] = "Ghast"; - DataConverterSpawnEgg.eggs[57] = "PigZombie"; - DataConverterSpawnEgg.eggs[58] = "Enderman"; - DataConverterSpawnEgg.eggs[59] = "CaveSpider"; - DataConverterSpawnEgg.eggs[60] = "Silverfish"; - DataConverterSpawnEgg.eggs[61] = "Blaze"; - DataConverterSpawnEgg.eggs[62] = "LavaSlime"; - DataConverterSpawnEgg.eggs[63] = "EnderDragon"; - DataConverterSpawnEgg.eggs[64] = "WitherBoss"; - DataConverterSpawnEgg.eggs[65] = "Bat"; - DataConverterSpawnEgg.eggs[66] = "Witch"; - DataConverterSpawnEgg.eggs[67] = "Endermite"; - DataConverterSpawnEgg.eggs[68] = "Guardian"; - DataConverterSpawnEgg.eggs[69] = "Shulker"; - DataConverterSpawnEgg.eggs[90] = "Pig"; - DataConverterSpawnEgg.eggs[91] = "Sheep"; - DataConverterSpawnEgg.eggs[92] = "Cow"; - DataConverterSpawnEgg.eggs[93] = "Chicken"; - DataConverterSpawnEgg.eggs[94] = "Squid"; - DataConverterSpawnEgg.eggs[95] = "Wolf"; - DataConverterSpawnEgg.eggs[96] = "MushroomCow"; - DataConverterSpawnEgg.eggs[97] = "SnowMan"; - DataConverterSpawnEgg.eggs[98] = "Ozelot"; - DataConverterSpawnEgg.eggs[99] = "VillagerGolem"; - DataConverterSpawnEgg.eggs[100] = "EntityHorse"; - DataConverterSpawnEgg.eggs[101] = "Rabbit"; - DataConverterSpawnEgg.eggs[120] = "Villager"; - DataConverterSpawnEgg.eggs[200] = "EnderCrystal"; - } - } - - private static class DataConverterMinecart implements DataConverter { - - private static final List a = Lists.newArrayList(new String[] { "MinecartRideable", "MinecartChest", "MinecartFurnace", "MinecartTNT", "MinecartSpawner", "MinecartHopper", "MinecartCommandBlock"}); - - DataConverterMinecart() {} - - public int getDataVersion() { - return 106; - } - - public NBTTagCompound convert(NBTTagCompound cmp) { - if ("Minecart".equals(cmp.getString("id"))) { - String s = "MinecartRideable"; - int i = cmp.getInt("Type"); - - if (i > 0 && i < DataConverterMinecart.a.size()) { - s = DataConverterMinecart.a.get(i); - } - - cmp.setString("id", s); - cmp.remove("Type"); - } - - return cmp; - } - } - - private static class DataConverterMobSpawner implements DataConverter { - - DataConverterMobSpawner() {} - - public int getDataVersion() { - return 107; - } - - public NBTTagCompound convert(NBTTagCompound cmp) { - if (!"MobSpawner".equals(cmp.getString("id"))) { - return cmp; - } else { - if (cmp.hasKeyOfType("EntityId", 8)) { - String s = cmp.getString("EntityId"); - NBTTagCompound nbttagcompound1 = cmp.getCompound("SpawnData"); - - nbttagcompound1.setString("id", s.isEmpty() ? "Pig" : s); - cmp.set("SpawnData", nbttagcompound1); - cmp.remove("EntityId"); - } - - if (cmp.hasKeyOfType("SpawnPotentials", 9)) { - NBTTagList nbttaglist = cmp.getList("SpawnPotentials", 10); - - for (int i = 0; i < nbttaglist.size(); ++i) { - NBTTagCompound nbttagcompound2 = nbttaglist.getCompound(i); - - if (nbttagcompound2.hasKeyOfType("Type", 8)) { - NBTTagCompound nbttagcompound3 = nbttagcompound2.getCompound("Properties"); - - nbttagcompound3.setString("id", nbttagcompound2.getString("Type")); - nbttagcompound2.set("Entity", nbttagcompound3); - nbttagcompound2.remove("Type"); - nbttagcompound2.remove("Properties"); - } - } - } - - return cmp; - } - } - } - - private static class DataConverterUUID implements DataConverter { - - DataConverterUUID() {} - - public int getDataVersion() { - return 108; - } - - public NBTTagCompound convert(NBTTagCompound cmp) { - if (cmp.hasKeyOfType("UUID", 8)) { - cmp.a("UUID", UUID.fromString(cmp.getString("UUID"))); - } - - return cmp; - } - } - - private static class DataConverterHealth implements DataConverter { - - private static final Set a = Sets.newHashSet(new String[] { "ArmorStand", "Bat", "Blaze", "CaveSpider", "Chicken", "Cow", "Creeper", "EnderDragon", "Enderman", "Endermite", "EntityHorse", "Ghast", "Giant", "Guardian", "LavaSlime", "MushroomCow", "Ozelot", "Pig", "PigZombie", "Rabbit", "Sheep", "Shulker", "Silverfish", "Skeleton", "Slime", "SnowMan", "Spider", "Squid", "Villager", "VillagerGolem", "Witch", "WitherBoss", "Wolf", "Zombie"}); - - DataConverterHealth() {} - - public int getDataVersion() { - return 109; - } - - public NBTTagCompound convert(NBTTagCompound cmp) { - if (DataConverterHealth.a.contains(cmp.getString("id"))) { - float f; - - if (cmp.hasKeyOfType("HealF", 99)) { - f = cmp.getFloat("HealF"); - cmp.remove("HealF"); - } else { - if (!cmp.hasKeyOfType("Health", 99)) { - return cmp; - } - - f = cmp.getFloat("Health"); - } - - cmp.setFloat("Health", f); - } - - return cmp; - } - } - - private static class DataConverterSaddle implements DataConverter { - - DataConverterSaddle() {} - - public int getDataVersion() { - return 110; - } - - public NBTTagCompound convert(NBTTagCompound cmp) { - if ("EntityHorse".equals(cmp.getString("id")) && !cmp.hasKeyOfType("SaddleItem", 10) && cmp.getBoolean("Saddle")) { - NBTTagCompound nbttagcompound1 = new NBTTagCompound(); - - nbttagcompound1.setString("id", "minecraft:saddle"); - nbttagcompound1.setByte("Count", (byte) 1); - nbttagcompound1.setShort("Damage", (short) 0); - cmp.set("SaddleItem", nbttagcompound1); - cmp.remove("Saddle"); - } - - return cmp; - } - } - - private static class DataConverterHanging implements DataConverter { - - DataConverterHanging() {} - - public int getDataVersion() { - return 111; - } - - public NBTTagCompound convert(NBTTagCompound cmp) { - String s = cmp.getString("id"); - boolean flag = "Painting".equals(s); - boolean flag1 = "ItemFrame".equals(s); - - if ((flag || flag1) && !cmp.hasKeyOfType("Facing", 99)) { - EnumDirection enumdirection; - - if (cmp.hasKeyOfType("Direction", 99)) { - enumdirection = EnumDirection.fromType2(cmp.getByte("Direction")); - cmp.setInt("TileX", cmp.getInt("TileX") + enumdirection.getAdjacentX()); - cmp.setInt("TileY", cmp.getInt("TileY") + enumdirection.getAdjacentY()); - cmp.setInt("TileZ", cmp.getInt("TileZ") + enumdirection.getAdjacentZ()); - cmp.remove("Direction"); - if (flag1 && cmp.hasKeyOfType("ItemRotation", 99)) { - cmp.setByte("ItemRotation", (byte) (cmp.getByte("ItemRotation") * 2)); - } - } else { - enumdirection = EnumDirection.fromType2(cmp.getByte("Dir")); - cmp.remove("Dir"); - } - - cmp.setByte("Facing", (byte) enumdirection.get2DRotationValue()); - } - - return cmp; - } - } - - private static class DataConverterDropChances implements DataConverter { - - DataConverterDropChances() {} - - public int getDataVersion() { - return 113; - } - - public NBTTagCompound convert(NBTTagCompound cmp) { - NBTTagList nbttaglist; - - if (cmp.hasKeyOfType("HandDropChances", 9)) { - nbttaglist = cmp.getList("HandDropChances", 5); - if (nbttaglist.size() == 2 && nbttaglist.i(0) == 0.0F && nbttaglist.i(1) == 0.0F) { - cmp.remove("HandDropChances"); - } - } - - if (cmp.hasKeyOfType("ArmorDropChances", 9)) { - nbttaglist = cmp.getList("ArmorDropChances", 5); - if (nbttaglist.size() == 4 && nbttaglist.i(0) == 0.0F && nbttaglist.i(1) == 0.0F && nbttaglist.i(2) == 0.0F && nbttaglist.i(3) == 0.0F) { - cmp.remove("ArmorDropChances"); - } - } - - return cmp; - } - } - - private static class DataConverterRiding implements DataConverter { - - DataConverterRiding() {} - - public int getDataVersion() { - return 135; - } - - public NBTTagCompound convert(NBTTagCompound cmp) { - while (cmp.hasKeyOfType("Riding", 10)) { - NBTTagCompound nbttagcompound1 = this.b(cmp); - - this.convert(cmp, nbttagcompound1); - cmp = nbttagcompound1; - } - - return cmp; - } - - protected void convert(NBTTagCompound nbttagcompound, NBTTagCompound nbttagcompound1) { - NBTTagList nbttaglist = new NBTTagList(); - - nbttaglist.add(nbttagcompound); - nbttagcompound1.set("Passengers", nbttaglist); - } - - protected NBTTagCompound b(NBTTagCompound nbttagcompound) { - NBTTagCompound nbttagcompound1 = nbttagcompound.getCompound("Riding"); - - nbttagcompound.remove("Riding"); - return nbttagcompound1; - } - } - - private static class DataConverterBook implements DataConverter { - - DataConverterBook() {} - - public int getDataVersion() { - return 165; - } - - public NBTTagCompound convert(NBTTagCompound cmp) { - if ("minecraft:written_book".equals(cmp.getString("id"))) { - NBTTagCompound nbttagcompound1 = cmp.getCompound("tag"); - - if (nbttagcompound1.hasKeyOfType("pages", 9)) { - NBTTagList nbttaglist = nbttagcompound1.getList("pages", 8); - - for (int i = 0; i < nbttaglist.size(); ++i) { - String s = nbttaglist.getString(i); - Object object = null; - - if (!"null".equals(s) && !UtilColor.b(s)) { - if ((s.charAt(0) != 34 || s.charAt(s.length() - 1) != 34) && (s.charAt(0) != 123 || s.charAt(s.length() - 1) != 125)) { - object = new ChatComponentText(s); - } else { - try { - object = ChatDeserializer.a(DataConverterSignText.a, s, IChatBaseComponent.class, true); - if (object == null) { - object = new ChatComponentText(""); - } - } catch (JsonParseException jsonparseexception) { - ; - } - - if (object == null) { - try { - object = IChatBaseComponent.ChatSerializer.a(s); - } catch (JsonParseException jsonparseexception1) { - ; - } - } - - if (object == null) { - try { - object = IChatBaseComponent.ChatSerializer.b(s); - } catch (JsonParseException jsonparseexception2) { - ; - } - } - - if (object == null) { - object = new ChatComponentText(s); - } - } - } else { - object = new ChatComponentText(""); - } - - nbttaglist.set(i, new NBTTagString(IChatBaseComponent.ChatSerializer.a((IChatBaseComponent) object))); - } - - nbttagcompound1.set("pages", nbttaglist); - } - } - - return cmp; - } - } - - private static class DataConverterCookedFish implements DataConverter { - - private static final MinecraftKey a = new MinecraftKey("cooked_fished"); - - DataConverterCookedFish() {} - - public int getDataVersion() { - return 502; - } - - public NBTTagCompound convert(NBTTagCompound cmp) { - if (cmp.hasKeyOfType("id", 8) && DataConverterCookedFish.a.equals(new MinecraftKey(cmp.getString("id")))) { - cmp.setString("id", "minecraft:cooked_fish"); - } - - return cmp; - } - } - - private static class DataConverterZombie implements DataConverter { - - private static final Random a = new Random(); - - DataConverterZombie() {} - - public int getDataVersion() { - return 502; - } - - public NBTTagCompound convert(NBTTagCompound cmp) { - if ("Zombie".equals(cmp.getString("id")) && cmp.getBoolean("IsVillager")) { - if (!cmp.hasKeyOfType("ZombieType", 99)) { - int i = -1; - - if (cmp.hasKeyOfType("VillagerProfession", 99)) { - try { - i = this.convert(cmp.getInt("VillagerProfession")); - } catch (RuntimeException runtimeexception) { - ; - } - } - - if (i == -1) { - i = this.convert(DataConverterZombie.a.nextInt(6)); - } - - cmp.setInt("ZombieType", i); - } - - cmp.remove("IsVillager"); - } - - return cmp; - } - - private int convert(int i) { - return i >= 0 && i < 6 ? i : -1; - } - } - - private static class DataConverterVBO implements DataConverter { - - DataConverterVBO() {} - - public int getDataVersion() { - return 505; - } - - public NBTTagCompound convert(NBTTagCompound cmp) { - cmp.setString("useVbo", "true"); - return cmp; - } - } - - private static class DataConverterGuardian implements DataConverter { - - DataConverterGuardian() {} - - public int getDataVersion() { - return 700; - } - - public NBTTagCompound convert(NBTTagCompound cmp) { - if ("Guardian".equals(cmp.getString("id"))) { - if (cmp.getBoolean("Elder")) { - cmp.setString("id", "ElderGuardian"); - } - - cmp.remove("Elder"); - } - - return cmp; - } - } - - private static class DataConverterSkeleton implements DataConverter { - - DataConverterSkeleton() {} - - public int getDataVersion() { - return 701; - } - - public NBTTagCompound convert(NBTTagCompound cmp) { - String s = cmp.getString("id"); - - if ("Skeleton".equals(s)) { - int i = cmp.getInt("SkeletonType"); - - if (i == 1) { - cmp.setString("id", "WitherSkeleton"); - } else if (i == 2) { - cmp.setString("id", "Stray"); - } - - cmp.remove("SkeletonType"); - } - - return cmp; - } - } - - private static class DataConverterZombieType implements DataConverter { - - DataConverterZombieType() {} - - public int getDataVersion() { - return 702; - } - - public NBTTagCompound convert(NBTTagCompound cmp) { - if ("Zombie".equals(cmp.getString("id"))) { - int i = cmp.getInt("ZombieType"); - - switch (i) { - case 0: - default: - break; - - case 1: - case 2: - case 3: - case 4: - case 5: - cmp.setString("id", "ZombieVillager"); - cmp.setInt("Profession", i - 1); - break; - - case 6: - cmp.setString("id", "Husk"); - } - - cmp.remove("ZombieType"); - } - - return cmp; - } - } - - private static class DataConverterHorse implements DataConverter { - - DataConverterHorse() {} - - public int getDataVersion() { - return 703; - } - - public NBTTagCompound convert(NBTTagCompound cmp) { - if ("EntityHorse".equals(cmp.getString("id"))) { - int i = cmp.getInt("Type"); - - switch (i) { - case 0: - default: - cmp.setString("id", "Horse"); - break; - - case 1: - cmp.setString("id", "Donkey"); - break; - - case 2: - cmp.setString("id", "Mule"); - break; - - case 3: - cmp.setString("id", "ZombieHorse"); - break; - - case 4: - cmp.setString("id", "SkeletonHorse"); - } - - cmp.remove("Type"); - } - - return cmp; - } - } - - private static class DataConverterTileEntity implements DataConverter { - - private static final Map a = Maps.newHashMap(); - - DataConverterTileEntity() {} - - public int getDataVersion() { - return 704; - } - - public NBTTagCompound convert(NBTTagCompound cmp) { - String s = DataConverterTileEntity.a.get(cmp.getString("id")); - - if (s != null) { - cmp.setString("id", s); - } - - return cmp; - } - - static { - DataConverterTileEntity.a.put("Airportal", "minecraft:end_portal"); - DataConverterTileEntity.a.put("Banner", "minecraft:banner"); - DataConverterTileEntity.a.put("Beacon", "minecraft:beacon"); - DataConverterTileEntity.a.put("Cauldron", "minecraft:brewing_stand"); - DataConverterTileEntity.a.put("Chest", "minecraft:chest"); - DataConverterTileEntity.a.put("Comparator", "minecraft:comparator"); - DataConverterTileEntity.a.put("Control", "minecraft:command_block"); - DataConverterTileEntity.a.put("DLDetector", "minecraft:daylight_detector"); - DataConverterTileEntity.a.put("Dropper", "minecraft:dropper"); - DataConverterTileEntity.a.put("EnchantTable", "minecraft:enchanting_table"); - DataConverterTileEntity.a.put("EndGateway", "minecraft:end_gateway"); - DataConverterTileEntity.a.put("EnderChest", "minecraft:ender_chest"); - DataConverterTileEntity.a.put("FlowerPot", "minecraft:flower_pot"); - DataConverterTileEntity.a.put("Furnace", "minecraft:furnace"); - DataConverterTileEntity.a.put("Hopper", "minecraft:hopper"); - DataConverterTileEntity.a.put("MobSpawner", "minecraft:mob_spawner"); - DataConverterTileEntity.a.put("Music", "minecraft:noteblock"); - DataConverterTileEntity.a.put("Piston", "minecraft:piston"); - DataConverterTileEntity.a.put("RecordPlayer", "minecraft:jukebox"); - DataConverterTileEntity.a.put("Sign", "minecraft:sign"); - DataConverterTileEntity.a.put("Skull", "minecraft:skull"); - DataConverterTileEntity.a.put("Structure", "minecraft:structure_block"); - DataConverterTileEntity.a.put("Trap", "minecraft:dispenser"); - } - } - - private static class DataConverterEntity implements DataConverter { - - private static final Map a = Maps.newHashMap(); - - DataConverterEntity() {} - - public int getDataVersion() { - return 704; - } - - public NBTTagCompound convert(NBTTagCompound cmp) { - String s = DataConverterEntity.a.get(cmp.getString("id")); - - if (s != null) { - cmp.setString("id", s); - } - - return cmp; - } - - static { - DataConverterEntity.a.put("AreaEffectCloud", "minecraft:area_effect_cloud"); - DataConverterEntity.a.put("ArmorStand", "minecraft:armor_stand"); - DataConverterEntity.a.put("Arrow", "minecraft:arrow"); - DataConverterEntity.a.put("Bat", "minecraft:bat"); - DataConverterEntity.a.put("Blaze", "minecraft:blaze"); - DataConverterEntity.a.put("Boat", "minecraft:boat"); - DataConverterEntity.a.put("CaveSpider", "minecraft:cave_spider"); - DataConverterEntity.a.put("Chicken", "minecraft:chicken"); - DataConverterEntity.a.put("Cow", "minecraft:cow"); - DataConverterEntity.a.put("Creeper", "minecraft:creeper"); - DataConverterEntity.a.put("Donkey", "minecraft:donkey"); - DataConverterEntity.a.put("DragonFireball", "minecraft:dragon_fireball"); - DataConverterEntity.a.put("ElderGuardian", "minecraft:elder_guardian"); - DataConverterEntity.a.put("EnderCrystal", "minecraft:ender_crystal"); - DataConverterEntity.a.put("EnderDragon", "minecraft:ender_dragon"); - DataConverterEntity.a.put("Enderman", "minecraft:enderman"); - DataConverterEntity.a.put("Endermite", "minecraft:endermite"); - DataConverterEntity.a.put("EyeOfEnderSignal", "minecraft:eye_of_ender_signal"); - DataConverterEntity.a.put("FallingSand", "minecraft:falling_block"); - DataConverterEntity.a.put("Fireball", "minecraft:fireball"); - DataConverterEntity.a.put("FireworksRocketEntity", "minecraft:fireworks_rocket"); - DataConverterEntity.a.put("Ghast", "minecraft:ghast"); - DataConverterEntity.a.put("Giant", "minecraft:giant"); - DataConverterEntity.a.put("Guardian", "minecraft:guardian"); - DataConverterEntity.a.put("Horse", "minecraft:horse"); - DataConverterEntity.a.put("Husk", "minecraft:husk"); - DataConverterEntity.a.put("Item", "minecraft:item"); - DataConverterEntity.a.put("ItemFrame", "minecraft:item_frame"); - DataConverterEntity.a.put("LavaSlime", "minecraft:magma_cube"); - DataConverterEntity.a.put("LeashKnot", "minecraft:leash_knot"); - DataConverterEntity.a.put("MinecartChest", "minecraft:chest_minecart"); - DataConverterEntity.a.put("MinecartCommandBlock", "minecraft:commandblock_minecart"); - DataConverterEntity.a.put("MinecartFurnace", "minecraft:furnace_minecart"); - DataConverterEntity.a.put("MinecartHopper", "minecraft:hopper_minecart"); - DataConverterEntity.a.put("MinecartRideable", "minecraft:minecart"); - DataConverterEntity.a.put("MinecartSpawner", "minecraft:spawner_minecart"); - DataConverterEntity.a.put("MinecartTNT", "minecraft:tnt_minecart"); - DataConverterEntity.a.put("Mule", "minecraft:mule"); - DataConverterEntity.a.put("MushroomCow", "minecraft:mooshroom"); - DataConverterEntity.a.put("Ozelot", "minecraft:ocelot"); - DataConverterEntity.a.put("Painting", "minecraft:painting"); - DataConverterEntity.a.put("Pig", "minecraft:pig"); - DataConverterEntity.a.put("PigZombie", "minecraft:zombie_pigman"); - DataConverterEntity.a.put("PolarBear", "minecraft:polar_bear"); - DataConverterEntity.a.put("PrimedTnt", "minecraft:tnt"); - DataConverterEntity.a.put("Rabbit", "minecraft:rabbit"); - DataConverterEntity.a.put("Sheep", "minecraft:sheep"); - DataConverterEntity.a.put("Shulker", "minecraft:shulker"); - DataConverterEntity.a.put("ShulkerBullet", "minecraft:shulker_bullet"); - DataConverterEntity.a.put("Silverfish", "minecraft:silverfish"); - DataConverterEntity.a.put("Skeleton", "minecraft:skeleton"); - DataConverterEntity.a.put("SkeletonHorse", "minecraft:skeleton_horse"); - DataConverterEntity.a.put("Slime", "minecraft:slime"); - DataConverterEntity.a.put("SmallFireball", "minecraft:small_fireball"); - DataConverterEntity.a.put("SnowMan", "minecraft:snowman"); - DataConverterEntity.a.put("Snowball", "minecraft:snowball"); - DataConverterEntity.a.put("SpectralArrow", "minecraft:spectral_arrow"); - DataConverterEntity.a.put("Spider", "minecraft:spider"); - DataConverterEntity.a.put("Squid", "minecraft:squid"); - DataConverterEntity.a.put("Stray", "minecraft:stray"); - DataConverterEntity.a.put("ThrownEgg", "minecraft:egg"); - DataConverterEntity.a.put("ThrownEnderpearl", "minecraft:ender_pearl"); - DataConverterEntity.a.put("ThrownExpBottle", "minecraft:xp_bottle"); - DataConverterEntity.a.put("ThrownPotion", "minecraft:potion"); - DataConverterEntity.a.put("Villager", "minecraft:villager"); - DataConverterEntity.a.put("VillagerGolem", "minecraft:villager_golem"); - DataConverterEntity.a.put("Witch", "minecraft:witch"); - DataConverterEntity.a.put("WitherBoss", "minecraft:wither"); - DataConverterEntity.a.put("WitherSkeleton", "minecraft:wither_skeleton"); - DataConverterEntity.a.put("WitherSkull", "minecraft:wither_skull"); - DataConverterEntity.a.put("Wolf", "minecraft:wolf"); - DataConverterEntity.a.put("XPOrb", "minecraft:xp_orb"); - DataConverterEntity.a.put("Zombie", "minecraft:zombie"); - DataConverterEntity.a.put("ZombieHorse", "minecraft:zombie_horse"); - DataConverterEntity.a.put("ZombieVillager", "minecraft:zombie_villager"); - } - } - - private static class DataConverterPotionWater implements DataConverter { - - DataConverterPotionWater() {} - - public int getDataVersion() { - return 806; - } - - public NBTTagCompound convert(NBTTagCompound cmp) { - String s = cmp.getString("id"); - - if ("minecraft:potion".equals(s) || "minecraft:splash_potion".equals(s) || "minecraft:lingering_potion".equals(s) || "minecraft:tipped_arrow".equals(s)) { - NBTTagCompound nbttagcompound1 = cmp.getCompound("tag"); - - if (!nbttagcompound1.hasKeyOfType("Potion", 8)) { - nbttagcompound1.setString("Potion", "minecraft:water"); - } - - if (!cmp.hasKeyOfType("tag", 10)) { - cmp.set("tag", nbttagcompound1); - } - } - - return cmp; - } - } - - private static class DataConverterShulker implements DataConverter { - - DataConverterShulker() {} - - public int getDataVersion() { - return 808; - } - - public NBTTagCompound convert(NBTTagCompound cmp) { - if ("minecraft:shulker".equals(cmp.getString("id")) && !cmp.hasKeyOfType("Color", 99)) { - cmp.setByte("Color", (byte) 10); - } - - return cmp; - } - } - - private static class DataConverterShulkerBoxItem implements DataConverter { - - public static final String[] a = new String[] { "minecraft:white_shulker_box", "minecraft:orange_shulker_box", "minecraft:magenta_shulker_box", "minecraft:light_blue_shulker_box", "minecraft:yellow_shulker_box", "minecraft:lime_shulker_box", "minecraft:pink_shulker_box", "minecraft:gray_shulker_box", "minecraft:silver_shulker_box", "minecraft:cyan_shulker_box", "minecraft:purple_shulker_box", "minecraft:blue_shulker_box", "minecraft:brown_shulker_box", "minecraft:green_shulker_box", "minecraft:red_shulker_box", "minecraft:black_shulker_box"}; - - DataConverterShulkerBoxItem() {} - - public int getDataVersion() { - return 813; - } - - public NBTTagCompound convert(NBTTagCompound cmp) { - if ("minecraft:shulker_box".equals(cmp.getString("id")) && cmp.hasKeyOfType("tag", 10)) { - NBTTagCompound nbttagcompound1 = cmp.getCompound("tag"); - - if (nbttagcompound1.hasKeyOfType("BlockEntityTag", 10)) { - NBTTagCompound nbttagcompound2 = nbttagcompound1.getCompound("BlockEntityTag"); - - if (nbttagcompound2.getList("Items", 10).isEmpty()) { - nbttagcompound2.remove("Items"); - } - - int i = nbttagcompound2.getInt("Color"); - - nbttagcompound2.remove("Color"); - if (nbttagcompound2.isEmpty()) { - nbttagcompound1.remove("BlockEntityTag"); - } - - if (nbttagcompound1.isEmpty()) { - cmp.remove("tag"); - } - - cmp.setString("id", DataConverterShulkerBoxItem.a[i % 16]); - } - } - - return cmp; - } - } - - private static class DataConverterShulkerBoxBlock implements DataConverter { - - DataConverterShulkerBoxBlock() {} - - public int getDataVersion() { - return 813; - } - - public NBTTagCompound convert(NBTTagCompound cmp) { - if ("minecraft:shulker".equals(cmp.getString("id"))) { - cmp.remove("Color"); - } - - return cmp; - } - } - - private static class DataConverterLang implements DataConverter { - - DataConverterLang() {} - - public int getDataVersion() { - return 816; - } - - public NBTTagCompound convert(NBTTagCompound cmp) { - if (cmp.hasKeyOfType("lang", 8)) { - cmp.setString("lang", cmp.getString("lang").toLowerCase(Locale.ROOT)); - } - - return cmp; - } - } - - private static class DataConverterTotem implements DataConverter { - - DataConverterTotem() {} - - public int getDataVersion() { - return 820; - } - - public NBTTagCompound convert(NBTTagCompound cmp) { - if ("minecraft:totem".equals(cmp.getString("id"))) { - cmp.setString("id", "minecraft:totem_of_undying"); - } - - return cmp; - } - } - - private static class DataConverterBedBlock implements DataConverter { - - private static final Logger a = LogManager.getLogger(DataConverters_1_14_R4.class); - - DataConverterBedBlock() {} - - public int getDataVersion() { - return 1125; - } - - public NBTTagCompound convert(NBTTagCompound cmp) { - boolean flag = true; - - try { - NBTTagCompound nbttagcompound1 = cmp.getCompound("Level"); - int i = nbttagcompound1.getInt("xPos"); - int j = nbttagcompound1.getInt("zPos"); - NBTTagList nbttaglist = nbttagcompound1.getList("TileEntities", 10); - NBTTagList nbttaglist1 = nbttagcompound1.getList("Sections", 10); - - for (int k = 0; k < nbttaglist1.size(); ++k) { - NBTTagCompound nbttagcompound2 = nbttaglist1.getCompound(k); - byte b0 = nbttagcompound2.getByte("Y"); - byte[] abyte = nbttagcompound2.getByteArray("Blocks"); - - for (int l = 0; l < abyte.length; ++l) { - if (416 == (abyte[l] & 255) << 4) { - int i1 = l & 15; - int j1 = l >> 8 & 15; - int k1 = l >> 4 & 15; - NBTTagCompound nbttagcompound3 = new NBTTagCompound(); - - nbttagcompound3.setString("id", "bed"); - nbttagcompound3.setInt("x", i1 + (i << 4)); - nbttagcompound3.setInt("y", j1 + (b0 << 4)); - nbttagcompound3.setInt("z", k1 + (j << 4)); - nbttaglist.add(nbttagcompound3); - } - } - } - } catch (Exception exception) { - DataConverterBedBlock.a.warn("Unable to datafix Bed blocks, level format may be missing tags."); - } - - return cmp; - } - } - - private static class DataConverterBedItem implements DataConverter { - - DataConverterBedItem() {} - - public int getDataVersion() { - return 1125; - } - - public NBTTagCompound convert(NBTTagCompound cmp) { - if ("minecraft:bed".equals(cmp.getString("id")) && cmp.getShort("Damage") == 0) { - cmp.setShort("Damage", (short) EnumColor.RED.getColorIndex()); - } - - return cmp; - } - } - - private static class DataConverterSignText implements DataConverter { - - public static final Gson a = new GsonBuilder().registerTypeAdapter(IChatBaseComponent.class, new JsonDeserializer() { - IChatBaseComponent a(JsonElement jsonelement, Type type, JsonDeserializationContext jsondeserializationcontext) throws JsonParseException { - if (jsonelement.isJsonPrimitive()) { - return new ChatComponentText(jsonelement.getAsString()); - } else if (jsonelement.isJsonArray()) { - JsonArray jsonarray = jsonelement.getAsJsonArray(); - IChatBaseComponent ichatbasecomponent = null; - Iterator iterator = jsonarray.iterator(); - - while (iterator.hasNext()) { - JsonElement jsonelement1 = (JsonElement) iterator.next(); - IChatBaseComponent ichatbasecomponent1 = this.a(jsonelement1, jsonelement1.getClass(), jsondeserializationcontext); - - if (ichatbasecomponent == null) { - ichatbasecomponent = ichatbasecomponent1; - } else { - ichatbasecomponent.addSibling(ichatbasecomponent1); - } - } - - return ichatbasecomponent; - } else { - throw new JsonParseException("Don\'t know how to turn " + jsonelement + " into a Component"); - } - } - - public Object deserialize(JsonElement jsonelement, Type type, JsonDeserializationContext jsondeserializationcontext) throws JsonParseException { - return this.a(jsonelement, type, jsondeserializationcontext); - } - }).create(); - - DataConverterSignText() {} - - public int getDataVersion() { - return 101; - } - - public NBTTagCompound convert(NBTTagCompound cmp) { - if ("Sign".equals(cmp.getString("id"))) { - this.convert(cmp, "Text1"); - this.convert(cmp, "Text2"); - this.convert(cmp, "Text3"); - this.convert(cmp, "Text4"); - } - - return cmp; - } - - private void convert(NBTTagCompound nbttagcompound, String s) { - String s1 = nbttagcompound.getString(s); - Object object = null; - - if (!"null".equals(s1) && !UtilColor.b(s1)) { - if ((s1.charAt(0) != 34 || s1.charAt(s1.length() - 1) != 34) && (s1.charAt(0) != 123 || s1.charAt(s1.length() - 1) != 125)) { - object = new ChatComponentText(s1); - } else { - try { - object = ChatDeserializer.a(DataConverterSignText.a, s1, IChatBaseComponent.class, true); - if (object == null) { - object = new ChatComponentText(""); - } - } catch (JsonParseException jsonparseexception) { - ; - } - - if (object == null) { - try { - object = IChatBaseComponent.ChatSerializer.a(s1); - } catch (JsonParseException jsonparseexception1) { - ; - } - } - - if (object == null) { - try { - object = IChatBaseComponent.ChatSerializer.b(s1); - } catch (JsonParseException jsonparseexception2) { - ; - } - } - - if (object == null) { - object = new ChatComponentText(s1); - } - } - } else { - object = new ChatComponentText(""); - } - - nbttagcompound.setString(s, IChatBaseComponent.ChatSerializer.a((IChatBaseComponent) object)); - } - } - - private static class DataInspectorPlayerVehicle implements DataInspector { - @Override - public NBTTagCompound inspect(NBTTagCompound cmp, int sourceVer, int targetVer) { - if (cmp.hasKeyOfType("RootVehicle", 10)) { - NBTTagCompound nbttagcompound1 = cmp.getCompound("RootVehicle"); - - if (nbttagcompound1.hasKeyOfType("Entity", 10)) { - convertCompound(LegacyType.ENTITY, nbttagcompound1, "Entity", sourceVer, targetVer); - } - } - - return cmp; - } - } - - private static class DataInspectorLevelPlayer implements DataInspector { - @Override - public NBTTagCompound inspect(NBTTagCompound cmp, int sourceVer, int targetVer) { - if (cmp.hasKeyOfType("Player", 10)) { - convertCompound(LegacyType.PLAYER, cmp, "Player", sourceVer, targetVer); - } - - return cmp; - } - } - - private static class DataInspectorStructure implements DataInspector { - @Override - public NBTTagCompound inspect(NBTTagCompound cmp, int sourceVer, int targetVer) { - NBTTagList nbttaglist; - int j; - NBTTagCompound nbttagcompound1; - - if (cmp.hasKeyOfType("entities", 9)) { - nbttaglist = cmp.getList("entities", 10); - - for (j = 0; j < nbttaglist.size(); ++j) { - nbttagcompound1 = (NBTTagCompound) nbttaglist.get(j); - if (nbttagcompound1.hasKeyOfType("nbt", 10)) { - convertCompound(LegacyType.ENTITY, nbttagcompound1, "nbt", sourceVer, targetVer); - } - } - } - - if (cmp.hasKeyOfType("blocks", 9)) { - nbttaglist = cmp.getList("blocks", 10); - - for (j = 0; j < nbttaglist.size(); ++j) { - nbttagcompound1 = (NBTTagCompound) nbttaglist.get(j); - if (nbttagcompound1.hasKeyOfType("nbt", 10)) { - convertCompound(LegacyType.BLOCK_ENTITY, nbttagcompound1, "nbt", sourceVer, targetVer); - } - } - } - - return cmp; - } - } - - private static class DataInspectorChunks implements DataInspector { - @Override - public NBTTagCompound inspect(NBTTagCompound cmp, int sourceVer, int targetVer) { - if (cmp.hasKeyOfType("Level", 10)) { - NBTTagCompound nbttagcompound1 = cmp.getCompound("Level"); - NBTTagList nbttaglist; - int j; - - if (nbttagcompound1.hasKeyOfType("Entities", 9)) { - nbttaglist = nbttagcompound1.getList("Entities", 10); - - for (j = 0; j < nbttaglist.size(); ++j) { - nbttaglist.set(j, convert(LegacyType.ENTITY, (NBTTagCompound) nbttaglist.get(j), sourceVer, targetVer)); - } - } - - if (nbttagcompound1.hasKeyOfType("TileEntities", 9)) { - nbttaglist = nbttagcompound1.getList("TileEntities", 10); - - for (j = 0; j < nbttaglist.size(); ++j) { - nbttaglist.set(j, convert(LegacyType.BLOCK_ENTITY, (NBTTagCompound) nbttaglist.get(j), sourceVer, targetVer)); - } - } - } - - return cmp; - } - } - - private static class DataInspectorEntityPassengers implements DataInspector { - @Override - public NBTTagCompound inspect(NBTTagCompound cmp, int sourceVer, int targetVer) { - if (cmp.hasKeyOfType("Passengers", 9)) { - NBTTagList nbttaglist = cmp.getList("Passengers", 10); - - for (int j = 0; j < nbttaglist.size(); ++j) { - nbttaglist.set(j, convert(LegacyType.ENTITY, nbttaglist.getCompound(j), sourceVer, targetVer)); - } - } - - return cmp; - } - } - - private static class DataInspectorPlayer implements DataInspector { - @Override - public NBTTagCompound inspect(NBTTagCompound cmp, int sourceVer, int targetVer) { - convertItems(cmp, "Inventory", sourceVer, targetVer); - convertItems(cmp, "EnderItems", sourceVer, targetVer); - if (cmp.hasKeyOfType("ShoulderEntityLeft", 10)) { - convertCompound(LegacyType.ENTITY, cmp, "ShoulderEntityLeft", sourceVer, targetVer); - } - - if (cmp.hasKeyOfType("ShoulderEntityRight", 10)) { - convertCompound(LegacyType.ENTITY, cmp, "ShoulderEntityRight", sourceVer, targetVer); - } - - return cmp; - } - } - - private static class DataInspectorVillagers implements DataInspector { - MinecraftKey entityVillager = getKey("EntityVillager"); - - @Override - public NBTTagCompound inspect(NBTTagCompound cmp, int sourceVer, int targetVer) { - if (entityVillager.equals(new MinecraftKey(cmp.getString("id"))) && cmp.hasKeyOfType("Offers", 10)) { - NBTTagCompound nbttagcompound1 = cmp.getCompound("Offers"); - - if (nbttagcompound1.hasKeyOfType("Recipes", 9)) { - NBTTagList nbttaglist = nbttagcompound1.getList("Recipes", 10); - - for (int j = 0; j < nbttaglist.size(); ++j) { - NBTTagCompound nbttagcompound2 = nbttaglist.getCompound(j); - - convertItem(nbttagcompound2, "buy", sourceVer, targetVer); - convertItem(nbttagcompound2, "buyB", sourceVer, targetVer); - convertItem(nbttagcompound2, "sell", sourceVer, targetVer); - nbttaglist.set(j, nbttagcompound2); - } - } - } - - return cmp; - } - } - - private static class DataInspectorMobSpawnerMinecart implements DataInspector { - MinecraftKey entityMinecartMobSpawner = getKey("EntityMinecartMobSpawner"); - MinecraftKey tileEntityMobSpawner = getKey("TileEntityMobSpawner"); - - @Override - public NBTTagCompound inspect(NBTTagCompound cmp, int sourceVer, int targetVer) { - String s = cmp.getString("id"); - if (entityMinecartMobSpawner.equals(new MinecraftKey(s))) { - cmp.setString("id", tileEntityMobSpawner.toString()); - convert(LegacyType.BLOCK_ENTITY, cmp, sourceVer, targetVer); - cmp.setString("id", s); - } - - return cmp; - } - } - - private static class DataInspectorMobSpawnerMobs implements DataInspector { - MinecraftKey tileEntityMobSpawner = getKey("TileEntityMobSpawner"); - - @Override - public NBTTagCompound inspect(NBTTagCompound cmp, int sourceVer, int targetVer) { - if (tileEntityMobSpawner.equals(new MinecraftKey(cmp.getString("id")))) { - if (cmp.hasKeyOfType("SpawnPotentials", 9)) { - NBTTagList nbttaglist = cmp.getList("SpawnPotentials", 10); - - for (int j = 0; j < nbttaglist.size(); ++j) { - NBTTagCompound nbttagcompound1 = nbttaglist.getCompound(j); - - convertCompound(LegacyType.ENTITY, nbttagcompound1, "Entity", sourceVer, targetVer); - } - } - - convertCompound(LegacyType.ENTITY, cmp, "SpawnData", sourceVer, targetVer); - } - - return cmp; - } - } - - private static class DataInspectorCommandBlock implements DataInspector { - MinecraftKey tileEntityCommand = getKey("TileEntityCommand"); - - @Override - public NBTTagCompound inspect(NBTTagCompound cmp, int sourceVer, int targetVer) { - if (tileEntityCommand.equals(new MinecraftKey(cmp.getString("id")))) { - cmp.setString("id", "Control"); - convert(LegacyType.BLOCK_ENTITY, cmp, sourceVer, targetVer); - cmp.setString("id", "MinecartCommandBlock"); - } - - return cmp; - } - } -} diff --git a/worldedit-bukkit/src/main/java/com/boydti/fawe/bukkit/adapter/mc1_14/FAWE_Spigot_v1_14_R4.java b/worldedit-bukkit/src/main/java/com/boydti/fawe/bukkit/adapter/mc1_14/FAWE_Spigot_v1_14_R4.java new file mode 100644 index 000000000..84cb23d8b --- /dev/null +++ b/worldedit-bukkit/src/main/java/com/boydti/fawe/bukkit/adapter/mc1_14/FAWE_Spigot_v1_14_R4.java @@ -0,0 +1,346 @@ +/* + * WorldEdit, a Minecraft world manipulation toolkit + * Copyright (C) sk89q + * 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 . + */ + +package com.boydti.fawe.bukkit.adapter.mc1_14; + +import com.boydti.fawe.FaweCache; +import com.boydti.fawe.beta.implementation.packet.ChunkPacket; +import com.sk89q.jnbt.CompoundTag; +import com.sk89q.worldedit.blocks.BaseItemStack; +import com.sk89q.worldedit.blocks.TileEntityBlock; +import com.sk89q.worldedit.bukkit.BukkitAdapter; +import com.sk89q.worldedit.bukkit.adapter.BukkitImplAdapter; +import com.sk89q.worldedit.bukkit.adapter.CachedBukkitAdapter; +import com.sk89q.worldedit.bukkit.adapter.IDelegateBukkitImplAdapter; +import com.sk89q.worldedit.bukkit.adapter.impl.Spigot_v1_14_R4; +import com.sk89q.worldedit.entity.BaseEntity; +import com.sk89q.worldedit.entity.LazyBaseEntity; +import com.sk89q.worldedit.registry.state.Property; +import com.sk89q.worldedit.world.block.BaseBlock; +import com.sk89q.worldedit.world.block.BlockState; +import com.sk89q.worldedit.world.block.BlockStateHolder; +import com.sk89q.worldedit.world.block.BlockType; +import com.sk89q.worldedit.world.block.BlockTypes; +import com.sk89q.worldedit.world.block.BlockTypesCache; +import com.sk89q.worldedit.world.entity.EntityType; +import com.sk89q.worldedit.world.registry.BlockMaterial; +import net.minecraft.server.v1_14_R1.Block; +import net.minecraft.server.v1_14_R1.BlockPosition; +import net.minecraft.server.v1_14_R1.Chunk; +import net.minecraft.server.v1_14_R1.ChunkCoordIntPair; +import net.minecraft.server.v1_14_R1.ChunkSection; +import net.minecraft.server.v1_14_R1.Entity; +import net.minecraft.server.v1_14_R1.EntityPlayer; +import net.minecraft.server.v1_14_R1.EntityTypes; +import net.minecraft.server.v1_14_R1.IBlockData; +import net.minecraft.server.v1_14_R1.IRegistry; +import net.minecraft.server.v1_14_R1.ItemStack; +import net.minecraft.server.v1_14_R1.MinecraftKey; +import net.minecraft.server.v1_14_R1.NBTBase; +import net.minecraft.server.v1_14_R1.NBTTagCompound; +import net.minecraft.server.v1_14_R1.NBTTagInt; +import net.minecraft.server.v1_14_R1.PacketPlayOutMapChunk; +import net.minecraft.server.v1_14_R1.PlayerChunk; +import net.minecraft.server.v1_14_R1.TileEntity; +import net.minecraft.server.v1_14_R1.World; +import net.minecraft.server.v1_14_R1.WorldServer; +import org.bukkit.Bukkit; +import org.bukkit.Location; +import org.bukkit.block.data.BlockData; +import org.bukkit.craftbukkit.v1_14_R1.CraftChunk; +import org.bukkit.craftbukkit.v1_14_R1.CraftWorld; +import org.bukkit.craftbukkit.v1_14_R1.block.data.CraftBlockData; +import org.bukkit.craftbukkit.v1_14_R1.entity.CraftEntity; +import org.bukkit.craftbukkit.v1_14_R1.entity.CraftPlayer; +import org.bukkit.craftbukkit.v1_14_R1.inventory.CraftItemStack; +import org.bukkit.entity.Player; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import javax.annotation.Nullable; +import java.util.Map; +import java.util.OptionalInt; +import java.util.function.Supplier; +import java.util.stream.Stream; + +import static com.google.common.base.Preconditions.checkNotNull; + +public final class FAWE_Spigot_v1_14_R4 extends CachedBukkitAdapter implements IDelegateBukkitImplAdapter { + private final BukkitImplAdapter parent; + + // ------------------------------------------------------------------------ + // Code that may break between versions of Minecraft + // ------------------------------------------------------------------------ + + public FAWE_Spigot_v1_14_R4() throws NoSuchFieldException, NoSuchMethodException { + this.parent = new Spigot_v1_14_R4(); + } + + @Override + public BukkitImplAdapter getParent() { + return parent; + } + + public char[] idbToStateOrdinal; + + private synchronized boolean init() { + if (idbToStateOrdinal != null) return false; + idbToStateOrdinal = new char[Block.REGISTRY_ID.a()]; // size + for (int i = 0; i < idbToStateOrdinal.length; i++) { + BlockState state = BlockTypesCache.states[i]; + BlockMaterial_1_14 material = (BlockMaterial_1_14) state.getMaterial(); + int id = Block.REGISTRY_ID.getId(material.getState()); + idbToStateOrdinal[id] = state.getOrdinalChar(); + } + return true; + } + + @Override + public BlockMaterial getMaterial(BlockType blockType) { + return new BlockMaterial_1_14(getBlock(blockType)); + } + + @Override + public BlockMaterial getMaterial(BlockState state) { + IBlockData bs = ((CraftBlockData) Bukkit.createBlockData(state.getAsString())).getState(); + return new BlockMaterial_1_14(bs.getBlock(), bs); + } + + public Block getBlock(BlockType blockType) { + return IRegistry.BLOCK.get(new MinecraftKey(blockType.getNamespace(), blockType.getResource())); + } + + @SuppressWarnings("deprecation") + @Override + public BaseBlock getBlock(Location location) { + checkNotNull(location); + + CraftWorld craftWorld = ((CraftWorld) location.getWorld()); + int x = location.getBlockX(); + int y = location.getBlockY(); + int z = location.getBlockZ(); + + org.bukkit.block.Block bukkitBlock = location.getBlock(); + BlockState state = BukkitAdapter.adapt(bukkitBlock.getBlockData()); + if (state.getBlockType().getMaterial().hasContainer()) { + //Read the NBT data + TileEntity te = craftWorld.getHandle().getTileEntity(new BlockPosition(x, y, z)); + if (te != null) { + NBTTagCompound tag = new NBTTagCompound(); + te.save(tag); // readTileEntityIntoTag + return state.toBaseBlock((CompoundTag) toNative(tag)); + } + } + + return state.toBaseBlock(); + } + + @Override + public boolean setBlock(Location location, BlockStateHolder state, boolean notifyAndLight) { + return this.setBlock(location.getChunk(), location.getBlockX(), location.getBlockY(), location.getBlockZ(), state, notifyAndLight); + } + + public boolean setBlock(org.bukkit.Chunk chunk, int x, int y, int z, BlockStateHolder state, boolean update) { + CraftChunk craftChunk = (CraftChunk) chunk; + Chunk nmsChunk = craftChunk.getHandle(); + World nmsWorld = nmsChunk.getWorld(); + + IBlockData blockData = ((BlockMaterial_1_14) state.getMaterial()).getState(); + ChunkSection[] sections = nmsChunk.getSections(); + int y4 = y >> 4; + ChunkSection section = sections[y4]; + + IBlockData existing; + if (section == null) { + existing = ((BlockMaterial_1_14) BlockTypes.AIR.getDefaultState().getMaterial()).getState(); + } else { + existing = section.getType(x & 15, y & 15, z & 15); + } + + BlockPosition pos = new BlockPosition(x, y, z); + + nmsChunk.removeTileEntity(pos); // Force delete the old tile entity + + CompoundTag nativeTag = state instanceof BaseBlock ? ((BaseBlock)state).getNbtData() : null; + if (nativeTag != null || existing instanceof TileEntityBlock) { + nmsWorld.setTypeAndData(pos, blockData, 0); + // remove tile + if (nativeTag != null) { + // We will assume that the tile entity was created for us, + // though we do not do this on the Forge version + TileEntity tileEntity = nmsWorld.getTileEntity(pos); + if (tileEntity != null) { + NBTTagCompound tag = (NBTTagCompound) fromNative(nativeTag); + tag.set("x", new NBTTagInt(x)); + tag.set("y", new NBTTagInt(y)); + tag.set("z", new NBTTagInt(z)); + tileEntity.load(tag); // readTagIntoTileEntity + } + } + } else { + if (existing == blockData) return true; + if (section == null) { + if (blockData.isAir()) return true; + sections[y4] = section = new ChunkSection(y4 << 4); + } + nmsChunk.setType(pos = new BlockPosition(x, y, z), blockData, false); + } + if (update) { + nmsWorld.getMinecraftWorld().notify(pos, existing, blockData, 0); + } + return true; + } + + @Nullable + private static String getEntityId(Entity entity) { + MinecraftKey minecraftkey = EntityTypes.getName(entity.getEntityType()); + return minecraftkey == null ? null : minecraftkey.toString(); + } + + private static void readEntityIntoTag(Entity entity, NBTTagCompound tag) { + entity.save(tag); + } + + @Override + public BaseEntity getEntity(org.bukkit.entity.Entity entity) { + checkNotNull(entity); + + CraftEntity craftEntity = ((CraftEntity) entity); + Entity mcEntity = craftEntity.getHandle(); + + String id = getEntityId(mcEntity); + + if (id != null) { + EntityType type = com.sk89q.worldedit.world.entity.EntityTypes.get(id); + Supplier saveTag = () -> { + NBTTagCompound tag = new NBTTagCompound(); + readEntityIntoTag(mcEntity, tag); + return (CompoundTag) toNative(tag); + }; + return new LazyBaseEntity(type, saveTag); + } else { + return null; + } + } + + @Override + public OptionalInt getInternalBlockStateId(BlockState state) { + BlockMaterial_1_14 material = (BlockMaterial_1_14) state.getMaterial(); + if (material.isAir()) { + return OptionalInt.empty(); + } + IBlockData mcState = material.getCraftBlockData().getState(); + return OptionalInt.of(Block.REGISTRY_ID.getId(mcState)); + } + + @Override + public BlockState adapt(BlockData blockData) { + CraftBlockData cbd = ((CraftBlockData) blockData); + IBlockData ibd = cbd.getState(); + return adapt(ibd); + } + + public BlockState adapt(IBlockData ibd) { + return BlockTypesCache.states[adaptToInt(ibd)]; + } + + public int adaptToInt(IBlockData ibd) { + try { + int id = Block.REGISTRY_ID.getId(ibd); + return idbToStateOrdinal[id]; + } catch (NullPointerException e) { + init(); + return adaptToInt(ibd); + } + } + + public char adaptToChar(IBlockData ibd) { + try { + int id = Block.REGISTRY_ID.getId(ibd); + return idbToStateOrdinal[id]; + } catch (NullPointerException e) { + init(); + return adaptToChar(ibd); + } + } + + @Override + public BlockData adapt(BlockStateHolder state) { + BlockMaterial_1_14 material = (BlockMaterial_1_14) state.getMaterial(); + return material.getCraftBlockData(); + } + + @Override + public void notifyAndLightBlock(Location position, BlockState previousType) { + this.setBlock(position.getChunk(), position.getBlockX(), position.getBlockY(), position.getBlockZ(), previousType, true); + } + + private MapChunkUtil_1_14 mapUtil = new MapChunkUtil_1_14(); + + @Override + public void sendFakeChunk(org.bukkit.World world, Player player, ChunkPacket packet) { + WorldServer nmsWorld = ((CraftWorld) world).getHandle(); + PlayerChunk map = BukkitAdapter_1_14.getPlayerChunk(nmsWorld, packet.getChunkX(), packet.getChunkZ()); + if (map != null && map.hasBeenLoaded()) { + boolean flag = false; + PlayerChunk.d players = map.players; + Stream stream = players.a(new ChunkCoordIntPair(packet.getChunkX(), packet.getChunkZ()), flag); + + EntityPlayer checkPlayer = player == null ? null : ((CraftPlayer) player).getHandle(); + stream.filter(entityPlayer -> checkPlayer == null || entityPlayer == checkPlayer) + .forEach(entityPlayer -> { + synchronized (packet) { + PacketPlayOutMapChunk nmsPacket = (PacketPlayOutMapChunk) packet.getNativePacket(); + if (nmsPacket == null) { + nmsPacket = mapUtil.create( this, packet); + packet.setNativePacket(nmsPacket); + } + try { + FaweCache.IMP.CHUNK_FLAG.get().set(true); + entityPlayer.playerConnection.sendPacket(nmsPacket); + } finally { + FaweCache.IMP.CHUNK_FLAG.get().set(false); + } + } + }); + } + } + + @Override + public Map> getProperties(BlockType blockType) { + Map> result = getParent().getProperties(blockType); + System.out.println("Result " + result); + return result; + } + + @Override + public org.bukkit.inventory.ItemStack adapt(BaseItemStack item) { + ItemStack stack = new ItemStack(IRegistry.ITEM.get(MinecraftKey.a(item.getType().getId())), item.getAmount()); + stack.setTag(((NBTTagCompound) fromNative(item.getNbtData()))); + return CraftItemStack.asCraftMirror(stack); + } + + @Override + public BaseItemStack adapt(org.bukkit.inventory.ItemStack itemStack) { + final ItemStack nmsStack = CraftItemStack.asNMSCopy(itemStack); + final BaseItemStack weStack = new BaseItemStack(BukkitAdapter.asItemType(itemStack.getType()), itemStack.getAmount()); + weStack.setNbtData(((CompoundTag) toNative(nmsStack.getTag()))); + return weStack; + } +} diff --git a/worldedit-bukkit/src/main/java/com/boydti/fawe/bukkit/adapter/mc1_14/FakePlayer_v1_14_R4.java b/worldedit-bukkit/src/main/java/com/boydti/fawe/bukkit/adapter/mc1_14/FakePlayer_v1_14_R4.java deleted file mode 100644 index db01e2165..000000000 --- a/worldedit-bukkit/src/main/java/com/boydti/fawe/bukkit/adapter/mc1_14/FakePlayer_v1_14_R4.java +++ /dev/null @@ -1,80 +0,0 @@ -package com.boydti.fawe.bukkit.adapter.mc1_14; - -import com.mojang.authlib.GameProfile; -import net.minecraft.server.v1_14_R1.DamageSource; -import net.minecraft.server.v1_14_R1.DimensionManager; -import net.minecraft.server.v1_14_R1.Entity; -import net.minecraft.server.v1_14_R1.EntityPlayer; -import net.minecraft.server.v1_14_R1.IChatBaseComponent; -import net.minecraft.server.v1_14_R1.ITileInventory; -import net.minecraft.server.v1_14_R1.PacketPlayInSettings; -import net.minecraft.server.v1_14_R1.PlayerInteractManager; -import net.minecraft.server.v1_14_R1.Statistic; -import net.minecraft.server.v1_14_R1.Vec3D; -import net.minecraft.server.v1_14_R1.WorldServer; -import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause; - -import javax.annotation.Nullable; -import java.util.OptionalInt; -import java.util.UUID; - -class FakePlayer_v1_14_R4 extends EntityPlayer { - private static final GameProfile FAKE_WORLDEDIT_PROFILE = new GameProfile(UUID.nameUUIDFromBytes("worldedit".getBytes()), "[WorldEdit]"); - - FakePlayer_v1_14_R4(WorldServer world) { - super(world.getMinecraftServer(), world, FAKE_WORLDEDIT_PROFILE, new PlayerInteractManager(world)); - } - - @Override - public Vec3D bP() { - return new Vec3D(0, 0, 0); - } - - @Override - public void tick() { - } - - @Override - public void die(DamageSource damagesource) { - } - - @Override - public Entity a(DimensionManager dimensionmanager, TeleportCause cause) { - return this; - } - - @Override - public OptionalInt openContainer(@Nullable ITileInventory itileinventory) { - return OptionalInt.empty(); - } - - @Override - public void a(PacketPlayInSettings packetplayinsettings) { - } - - @Override - public void sendMessage(IChatBaseComponent ichatbasecomponent) { - } - - @Override - public void a(IChatBaseComponent ichatbasecomponent, boolean flag) { - } - - @Override - public void a(Statistic statistic, int i) { - } - - @Override - public void a(Statistic statistic) { - } - - @Override - public boolean isInvulnerable(DamageSource damagesource) { - return true; - } - - @Override - public boolean p(boolean flag) { // canEat, search for foodData usage - return true; - } -} \ No newline at end of file diff --git a/worldedit-bukkit/src/main/java/com/boydti/fawe/bukkit/adapter/mc1_14/MapChunkUtil_1_14.java b/worldedit-bukkit/src/main/java/com/boydti/fawe/bukkit/adapter/mc1_14/MapChunkUtil_1_14.java index ecd88d2c4..bfdde3f3a 100644 --- a/worldedit-bukkit/src/main/java/com/boydti/fawe/bukkit/adapter/mc1_14/MapChunkUtil_1_14.java +++ b/worldedit-bukkit/src/main/java/com/boydti/fawe/bukkit/adapter/mc1_14/MapChunkUtil_1_14.java @@ -1,129 +1,28 @@ package com.boydti.fawe.bukkit.adapter.mc1_14; -import com.boydti.fawe.Fawe; -import com.boydti.fawe.beta.IBlocks; -import com.boydti.fawe.beta.implementation.packet.ChunkPacket; -import com.boydti.fawe.object.FaweInputStream; -import com.boydti.fawe.object.FaweOutputStream; -import com.boydti.fawe.util.TaskManager; -import com.sk89q.jnbt.CompoundTag; -import com.sk89q.jnbt.NBTInputStream; -import com.sk89q.worldedit.bukkit.BukkitAdapter; -import com.sk89q.worldedit.bukkit.adapter.BukkitImplAdapter; -import com.sk89q.worldedit.math.BlockVector3; -import com.sk89q.worldedit.world.biome.BiomeType; -import net.minecraft.server.v1_14_R1.Chunk; -import net.minecraft.server.v1_14_R1.ChunkSection; -import net.minecraft.server.v1_14_R1.IRegistry; -import net.minecraft.server.v1_14_R1.NBTBase; -import net.minecraft.server.v1_14_R1.NBTTagCompound; +import com.boydti.fawe.bukkit.adapter.MapChunkUtil; import net.minecraft.server.v1_14_R1.PacketPlayOutMapChunk; -import net.minecraft.server.v1_14_R1.WorldServer; -import org.bukkit.Bukkit; -import org.bukkit.block.Biome; -import org.bukkit.craftbukkit.v1_14_R1.CraftWorld; -import org.bukkit.craftbukkit.v1_14_R1.block.CraftBlock; -import java.io.ByteArrayInputStream; -import java.io.ByteArrayOutputStream; -import java.io.DataOutputStream; -import java.io.IOException; -import java.lang.reflect.Field; -import java.nio.ByteBuffer; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.Map; -import java.util.concurrent.Callable; -import java.util.function.Supplier; - -public class MapChunkUtil_1_14 { - private static final Field fieldX; - - private static final Field fieldZ; - - private static final Field fieldHeightMap; - - private static final Field fieldBitMask; - - private static final Field fieldChunkData; - - private static final Field fieldBlockEntities; - - private static final Field fieldFull; - - - static { - try { - fieldX = PacketPlayOutMapChunk.class.getDeclaredField("a"); - fieldZ = PacketPlayOutMapChunk.class.getDeclaredField("b"); - fieldBitMask = PacketPlayOutMapChunk.class.getDeclaredField("c"); - fieldHeightMap = PacketPlayOutMapChunk.class.getDeclaredField("d"); - fieldChunkData = PacketPlayOutMapChunk.class.getDeclaredField("e"); - fieldBlockEntities = PacketPlayOutMapChunk.class.getDeclaredField("f"); - fieldFull = PacketPlayOutMapChunk.class.getDeclaredField("g"); - - fieldX.setAccessible(true); - fieldZ.setAccessible(true); - fieldBitMask.setAccessible(true); - fieldHeightMap.setAccessible(true); - fieldChunkData.setAccessible(true); - fieldBlockEntities.setAccessible(true); - fieldFull.setAccessible(true); - } catch (Throwable e) { - e.printStackTrace(); - throw new RuntimeException(e); - } +public class MapChunkUtil_1_14 extends MapChunkUtil { + public MapChunkUtil_1_14() throws NoSuchFieldException { + fieldX = PacketPlayOutMapChunk.class.getDeclaredField("a"); + fieldZ = PacketPlayOutMapChunk.class.getDeclaredField("b"); + fieldBitMask = PacketPlayOutMapChunk.class.getDeclaredField("c"); + fieldHeightMap = PacketPlayOutMapChunk.class.getDeclaredField("d"); + fieldChunkData = PacketPlayOutMapChunk.class.getDeclaredField("e"); + fieldBlockEntities = PacketPlayOutMapChunk.class.getDeclaredField("f"); + fieldFull = PacketPlayOutMapChunk.class.getDeclaredField("g"); + fieldX.setAccessible(true); + fieldZ.setAccessible(true); + fieldBitMask.setAccessible(true); + fieldHeightMap.setAccessible(true); + fieldChunkData.setAccessible(true); + fieldBlockEntities.setAccessible(true); + fieldFull.setAccessible(true); } - - public static PacketPlayOutMapChunk create(WorldServer world, BukkitImplAdapter adapter, ChunkPacket packet) { - IBlocks chunk = packet.getChunk(); - try { - PacketPlayOutMapChunk nmsPacket; - int bitMask = packet.getChunk().getBitMask(); - if (bitMask == 0) { // TODO remove once sending tiles/entities is fixed - nmsPacket = Fawe.get().getQueueHandler().sync((Callable) () -> { - Chunk nmsChunk = world.getChunkAt(packet.getChunkX(), packet.getChunkZ()); - PacketPlayOutMapChunk nmsPacket1 = new PacketPlayOutMapChunk(nmsChunk, 65535); - byte[] data = (byte[]) fieldChunkData.get(nmsPacket1); - int len = data.length; - ByteBuffer buffer = ByteBuffer.wrap(data, len - 256 * 4, 256 * 4); - for (int z = 0; z < 16; z++) { - for (int x = 0; x < 16; x++) { - BiomeType biome = chunk.getBiomeType(x, z); - if (biome != null) { - buffer.putInt(biome.getLegacyId()); - } else { - buffer.getInt(); - } - } - } - - return nmsPacket1; - }).get(); - } else { - nmsPacket = new PacketPlayOutMapChunk(); - fieldX.setInt(nmsPacket, packet.getChunkX()); - fieldZ.setInt(nmsPacket, packet.getChunkZ()); - fieldBitMask.set(nmsPacket, packet.getChunk().getBitMask()); - NBTBase heightMap = adapter.fromNative(/* packet.getHeightMap() */ new CompoundTag(new HashMap<>())); - fieldHeightMap.set(nmsPacket, heightMap); - - fieldChunkData.set(nmsPacket, packet.getSectionBytes()); - - Map tiles = packet.getChunk().getTiles(); - ArrayList nmsTiles = new ArrayList<>(tiles.size()); - for (Map.Entry entry : tiles.entrySet()) { - NBTBase nmsTag = adapter.fromNative(entry.getValue()); - nmsTiles.add((NBTTagCompound) nmsTag); - } - fieldBlockEntities.set(nmsPacket, nmsTiles); - fieldFull.set(nmsPacket, packet.isFull()); - } - return nmsPacket; - } catch (Exception e) { - e.printStackTrace(); - return null; - } + @Override + public PacketPlayOutMapChunk createPacket() { + return new PacketPlayOutMapChunk(); } } diff --git a/worldedit-bukkit/src/main/java/com/boydti/fawe/bukkit/adapter/mc1_14/Spigot_v1_14_R4.java b/worldedit-bukkit/src/main/java/com/boydti/fawe/bukkit/adapter/mc1_14/Spigot_v1_14_R4.java deleted file mode 100644 index dbc653f40..000000000 --- a/worldedit-bukkit/src/main/java/com/boydti/fawe/bukkit/adapter/mc1_14/Spigot_v1_14_R4.java +++ /dev/null @@ -1,757 +0,0 @@ -/* - * WorldEdit, a Minecraft world manipulation toolkit - * Copyright (C) sk89q - * 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 . - */ - -package com.boydti.fawe.bukkit.adapter.mc1_14; - -import static com.google.common.base.Preconditions.checkNotNull; - -import com.boydti.fawe.FaweCache; -import com.boydti.fawe.beta.implementation.packet.ChunkPacket; -import com.google.common.cache.CacheBuilder; -import com.google.common.cache.CacheLoader; -import com.google.common.cache.LoadingCache; -import com.google.common.collect.ImmutableList; -import com.google.common.collect.Maps; -import com.sk89q.jnbt.ByteArrayTag; -import com.sk89q.jnbt.ByteTag; -import com.sk89q.jnbt.CompoundTag; -import com.sk89q.jnbt.DoubleTag; -import com.sk89q.jnbt.EndTag; -import com.sk89q.jnbt.FloatTag; -import com.sk89q.jnbt.IntArrayTag; -import com.sk89q.jnbt.IntTag; -import com.sk89q.jnbt.ListTag; -import com.sk89q.jnbt.LongArrayTag; -import com.sk89q.jnbt.LongTag; -import com.sk89q.jnbt.NBTConstants; -import com.sk89q.jnbt.ShortTag; -import com.sk89q.jnbt.StringTag; -import com.sk89q.jnbt.Tag; -import com.sk89q.worldedit.blocks.BaseItem; -import com.sk89q.worldedit.blocks.BaseItemStack; -import com.sk89q.worldedit.blocks.TileEntityBlock; -import com.sk89q.worldedit.bukkit.BukkitAdapter; -import com.sk89q.worldedit.bukkit.adapter.BukkitImplAdapter; -import com.sk89q.worldedit.bukkit.adapter.CachedBukkitAdapter; -import com.sk89q.worldedit.entity.BaseEntity; -import com.sk89q.worldedit.entity.LazyBaseEntity; -import com.sk89q.worldedit.internal.Constants; -import com.sk89q.worldedit.math.BlockVector3; -import com.sk89q.worldedit.registry.state.BooleanProperty; -import com.sk89q.worldedit.registry.state.DirectionalProperty; -import com.sk89q.worldedit.registry.state.EnumProperty; -import com.sk89q.worldedit.registry.state.IntegerProperty; -import com.sk89q.worldedit.registry.state.Property; -import com.sk89q.worldedit.util.Direction; -import com.sk89q.worldedit.world.DataFixer; -import com.sk89q.worldedit.world.block.BaseBlock; -import com.sk89q.worldedit.world.block.BlockState; -import com.sk89q.worldedit.world.block.BlockStateHolder; -import com.sk89q.worldedit.world.block.BlockType; -import com.sk89q.worldedit.world.block.BlockTypes; -import com.sk89q.worldedit.world.block.BlockTypesCache; -import com.sk89q.worldedit.world.entity.EntityType; -import com.sk89q.worldedit.world.registry.BlockMaterial; -import java.lang.reflect.Field; -import java.lang.reflect.Method; -import java.util.ArrayList; -import java.util.Collections; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.OptionalInt; -import java.util.Set; -import java.util.concurrent.ExecutionException; -import java.util.function.Supplier; -import java.util.stream.Collectors; -import java.util.stream.Stream; -import javax.annotation.Nullable; -import net.minecraft.server.v1_14_R1.Block; -import net.minecraft.server.v1_14_R1.BlockPosition; -import net.minecraft.server.v1_14_R1.BlockStateBoolean; -import net.minecraft.server.v1_14_R1.BlockStateDirection; -import net.minecraft.server.v1_14_R1.BlockStateEnum; -import net.minecraft.server.v1_14_R1.BlockStateInteger; -import net.minecraft.server.v1_14_R1.BlockStateList; -import net.minecraft.server.v1_14_R1.Chunk; -import net.minecraft.server.v1_14_R1.ChunkCoordIntPair; -import net.minecraft.server.v1_14_R1.ChunkSection; -import net.minecraft.server.v1_14_R1.Entity; -import net.minecraft.server.v1_14_R1.EntityPlayer; -import net.minecraft.server.v1_14_R1.EntityTypes; -import net.minecraft.server.v1_14_R1.EnumDirection; -import net.minecraft.server.v1_14_R1.EnumHand; -import net.minecraft.server.v1_14_R1.EnumInteractionResult; -import net.minecraft.server.v1_14_R1.IBlockData; -import net.minecraft.server.v1_14_R1.IBlockState; -import net.minecraft.server.v1_14_R1.INamable; -import net.minecraft.server.v1_14_R1.IRegistry; -import net.minecraft.server.v1_14_R1.ItemActionContext; -import net.minecraft.server.v1_14_R1.ItemStack; -import net.minecraft.server.v1_14_R1.MinecraftKey; -import net.minecraft.server.v1_14_R1.MovingObjectPositionBlock; -import net.minecraft.server.v1_14_R1.NBTBase; -import net.minecraft.server.v1_14_R1.NBTTagByte; -import net.minecraft.server.v1_14_R1.NBTTagByteArray; -import net.minecraft.server.v1_14_R1.NBTTagCompound; -import net.minecraft.server.v1_14_R1.NBTTagDouble; -import net.minecraft.server.v1_14_R1.NBTTagEnd; -import net.minecraft.server.v1_14_R1.NBTTagFloat; -import net.minecraft.server.v1_14_R1.NBTTagInt; -import net.minecraft.server.v1_14_R1.NBTTagIntArray; -import net.minecraft.server.v1_14_R1.NBTTagList; -import net.minecraft.server.v1_14_R1.NBTTagLong; -import net.minecraft.server.v1_14_R1.NBTTagLongArray; -import net.minecraft.server.v1_14_R1.NBTTagShort; -import net.minecraft.server.v1_14_R1.NBTTagString; -import net.minecraft.server.v1_14_R1.PacketPlayOutEntityStatus; -import net.minecraft.server.v1_14_R1.PacketPlayOutMapChunk; -import net.minecraft.server.v1_14_R1.PacketPlayOutTileEntityData; -import net.minecraft.server.v1_14_R1.PlayerChunk; -import net.minecraft.server.v1_14_R1.PlayerChunkMap; -import net.minecraft.server.v1_14_R1.TileEntity; -import net.minecraft.server.v1_14_R1.Vec3D; -import net.minecraft.server.v1_14_R1.World; -import net.minecraft.server.v1_14_R1.WorldServer; -import org.bukkit.Bukkit; -import org.bukkit.Location; -import org.bukkit.block.data.BlockData; -import org.bukkit.craftbukkit.v1_14_R1.CraftChunk; -import org.bukkit.craftbukkit.v1_14_R1.CraftServer; -import org.bukkit.craftbukkit.v1_14_R1.CraftWorld; -import org.bukkit.craftbukkit.v1_14_R1.block.data.CraftBlockData; -import org.bukkit.craftbukkit.v1_14_R1.entity.CraftEntity; -import org.bukkit.craftbukkit.v1_14_R1.entity.CraftPlayer; -import org.bukkit.craftbukkit.v1_14_R1.inventory.CraftItemStack; -import org.bukkit.craftbukkit.v1_14_R1.util.CraftMagicNumbers; -import org.bukkit.entity.Player; -import org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -public final class Spigot_v1_14_R4 extends CachedBukkitAdapter implements BukkitImplAdapter{ - - private final Logger logger = LoggerFactory.getLogger(getClass()); - - private final Field nbtListTagListField; - private final Method nbtCreateTagMethod; - - static { - // A simple test - if (!Bukkit.getServer().getClass().getName().endsWith("DummyServer")) CraftServer.class.cast(Bukkit.getServer()); - } - - // ------------------------------------------------------------------------ - // Code that may break between versions of Minecraft - // ------------------------------------------------------------------------ - - public Spigot_v1_14_R4() throws NoSuchFieldException, NoSuchMethodException { - // The list of tags on an NBTTagList - nbtListTagListField = NBTTagList.class.getDeclaredField("list"); - nbtListTagListField.setAccessible(true); - - // The method to create an NBTBase tag given its type ID - nbtCreateTagMethod = NBTBase.class.getDeclaredMethod("createTag", byte.class); - nbtCreateTagMethod.setAccessible(true); - } - - public char[] idbToStateOrdinal; - - private synchronized boolean init() { - if (idbToStateOrdinal != null) return false; - idbToStateOrdinal = new char[Block.REGISTRY_ID.a()]; // size - for (int i = 0; i < idbToStateOrdinal.length; i++) { - BlockState state = BlockTypesCache.states[i]; - BlockMaterial_1_14 material = (BlockMaterial_1_14) state.getMaterial(); - int id = Block.REGISTRY_ID.getId(material.getState()); - idbToStateOrdinal[id] = state.getOrdinalChar(); - } - return true; - } - - /** - * Read the given NBT data into the given tile entity. - * - * @param tileEntity the tile entity - * @param tag the tag - */ - private static void readTagIntoTileEntity(NBTTagCompound tag, TileEntity tileEntity) { - try { - tileEntity.load(tag); - } catch (Throwable e) { - //Fawe.debug("Invalid tag " + tag + " | " + tileEntity); - } - } - - /** - * Write the tile entity's NBT data to the given tag. - * - * @param tileEntity the tile entity - * @param tag the tag - */ - private static void readTileEntityIntoTag(TileEntity tileEntity, NBTTagCompound tag) { - tileEntity.save(tag); - } - - /** - * Get the ID string of the given entity. - * - * @param entity the entity - * @return the entity ID or null if one is not known - */ - @Nullable - private static String getEntityId(Entity entity) { - MinecraftKey minecraftkey = EntityTypes.getName(entity.getBukkitEntity().getHandle().getEntityType()); - return minecraftkey == null ? null : minecraftkey.toString(); - } - - /** - * Create an entity using the given entity ID. - * - * @param id the entity ID - * @param world the world - * @return an entity or null - */ - @Nullable - private static Entity createEntityFromId(String id, World world) { - return EntityTypes.a(id).get().a(world); - } - - /** - * Write the given NBT data into the given entity. - * - * @param entity the entity - * @param tag the tag - */ - private static void readTagIntoEntity(NBTTagCompound tag, Entity entity) { - entity.f(tag); - } - - /** - * Write the entity's NBT data to the given tag. - * - * @param entity the entity - * @param tag the tag - */ - private static void readEntityIntoTag(Entity entity, NBTTagCompound tag) { - entity.save(tag); - } - - @Override - public BlockMaterial getMaterial(BlockType blockType) { - return new BlockMaterial_1_14(getBlock(blockType)); - } - - @Override - public BlockMaterial getMaterial(BlockState state) { - IBlockData bs = ((CraftBlockData) Bukkit.createBlockData(state.getAsString())).getState(); - return new BlockMaterial_1_14(bs.getBlock(), bs); - } - - public Block getBlock(BlockType blockType) { - return IRegistry.BLOCK.get(new MinecraftKey(blockType.getNamespace(), blockType.getResource())); - } - - // ------------------------------------------------------------------------ - // Code that is less likely to break - // ------------------------------------------------------------------------ - - @Override - public int getDataVersion() { - return CraftMagicNumbers.INSTANCE.getDataVersion(); - } - - @Override - public DataFixer getDataFixer() { - return DataConverters_1_14_R4.INSTANCE; - } - - @SuppressWarnings("deprecation") - @Override - public BaseBlock getBlock(Location location) { - checkNotNull(location); - - CraftWorld craftWorld = ((CraftWorld) location.getWorld()); - int x = location.getBlockX(); - int y = location.getBlockY(); - int z = location.getBlockZ(); - - org.bukkit.block.Block bukkitBlock = location.getBlock(); - BlockState state = BukkitAdapter.adapt(bukkitBlock.getBlockData()); - if (state.getBlockType().getMaterial().hasContainer()) { - //Read the NBT data - TileEntity te = craftWorld.getHandle().getTileEntity(new BlockPosition(x, y, z)); - if (te != null) { - NBTTagCompound tag = new NBTTagCompound(); - readTileEntityIntoTag(te, tag); // Load data - return state.toBaseBlock((CompoundTag) toNative(tag)); - } - } - - return state.toBaseBlock(); - } - - @Override - public boolean isChunkInUse(org.bukkit.Chunk chunk) { - CraftChunk craftChunk = (CraftChunk) chunk; - PlayerChunkMap chunkMap = ((WorldServer) craftChunk.getHandle().getWorld()).getChunkProvider().playerChunkMap; - return chunkMap.visibleChunks.containsKey(ChunkCoordIntPair.pair(chunk.getX(), chunk.getZ())); - } - - @Override - public boolean setBlock(org.bukkit.Chunk chunk, int x, int y, int z, BlockStateHolder state, boolean update) { - CraftChunk craftChunk = (CraftChunk) chunk; - Chunk nmsChunk = craftChunk.getHandle(); - World nmsWorld = nmsChunk.getWorld(); - - IBlockData blockData = ((BlockMaterial_1_14) state.getMaterial()).getState(); - ChunkSection[] sections = nmsChunk.getSections(); - int y4 = y >> 4; - ChunkSection section = sections[y4]; - - IBlockData existing; - if (section == null) { - existing = ((BlockMaterial_1_14) BlockTypes.AIR.getDefaultState().getMaterial()).getState(); - } else { - existing = section.getType(x & 15, y & 15, z & 15); - } - - BlockPosition pos = new BlockPosition(x, y, z); - - nmsChunk.removeTileEntity(pos); // Force delete the old tile entity - - CompoundTag nativeTag = state instanceof BaseBlock ? ((BaseBlock)state).getNbtData() : null; - if (nativeTag != null || existing instanceof TileEntityBlock) { - nmsWorld.setTypeAndData(pos, blockData, 0); - // remove tile - if (nativeTag != null) { - // We will assume that the tile entity was created for us, - // though we do not do this on the Forge version - TileEntity tileEntity = nmsWorld.getTileEntity(pos); - if (tileEntity != null) { - NBTTagCompound tag = (NBTTagCompound) fromNative(nativeTag); - tag.set("x", new NBTTagInt(x)); - tag.set("y", new NBTTagInt(y)); - tag.set("z", new NBTTagInt(z)); - readTagIntoTileEntity(tag, tileEntity); // Load data - } - } - } else { - if (existing == blockData) return true; - if (section == null) { - if (blockData.isAir()) return true; - sections[y4] = section = new ChunkSection(y4 << 4); - } - nmsChunk.setType(pos = new BlockPosition(x, y, z), blockData, false); - } - if (update) { - nmsWorld.getMinecraftWorld().notify(pos, existing, blockData, 0); - } - return true; - } - - @Override - public BaseEntity getEntity(org.bukkit.entity.Entity entity) { - checkNotNull(entity); - - CraftEntity craftEntity = ((CraftEntity) entity); - Entity mcEntity = craftEntity.getHandle(); - - String id = getEntityId(mcEntity); - - if (id != null) { - EntityType type = com.sk89q.worldedit.world.entity.EntityTypes.get(id); - Supplier saveTag = new Supplier() { - @Override - public CompoundTag get() { - NBTTagCompound tag = new NBTTagCompound(); - readEntityIntoTag(mcEntity, tag); - return (CompoundTag) toNative(tag); - } - }; - return new LazyBaseEntity(type, saveTag); - } else { - return null; - } - } - - @Nullable - @Override - public org.bukkit.entity.Entity createEntity(Location location, BaseEntity state) { - checkNotNull(location); - checkNotNull(state); - if (state.getType() == com.sk89q.worldedit.world.entity.EntityTypes.PLAYER) return null; - CraftWorld craftWorld = ((CraftWorld) location.getWorld()); - WorldServer worldServer = craftWorld.getHandle(); - - Entity createdEntity = createEntityFromId(state.getType().getId(), craftWorld.getHandle()); - - if (createdEntity != null) { - CompoundTag nativeTag = state.getNbtData(); - if (nativeTag != null) { - NBTTagCompound tag = (NBTTagCompound) fromNative(nativeTag); - for (String name : Constants.NO_COPY_ENTITY_NBT_FIELDS) { - tag.remove(name); - } - readTagIntoEntity(tag, createdEntity); - } - - createdEntity.setLocation(location.getX(), location.getY(), location.getZ(), location.getYaw(), location.getPitch()); - - worldServer.addEntity(createdEntity, SpawnReason.CUSTOM); - return createdEntity.getBukkitEntity(); - } else { - logger.debug("Invalid entity " + state.getType().getId()); - return null; - } - } - - @SuppressWarnings("unchecked") - @Override - public Map> getProperties(BlockType blockType) { - Block block; - try { - block = IRegistry.BLOCK.get(new MinecraftKey(blockType.getNamespace(), blockType.getResource())); - } catch (Throwable e) { - e.printStackTrace(); - return Collections.emptyMap(); - } - if (block == null) { - logger.warn("Failed to find properties for " + blockType.getId()); - return Collections.emptyMap(); - } - Map> properties = Maps.newLinkedHashMap(); - BlockStateList blockStateList = block.getStates(); - for (IBlockState state : blockStateList.d()) { - Property property; - if (state instanceof BlockStateBoolean) { - property = new BooleanProperty(state.a(), ImmutableList.copyOf(state.getValues())); - } else if (state instanceof BlockStateDirection) { - property = new DirectionalProperty(state.a(), - (List) state.getValues().stream().map(e -> Direction.valueOf(((INamable) e).getName().toUpperCase())).collect(Collectors.toList())); - } else if (state instanceof BlockStateEnum) { - property = new EnumProperty(state.a(), - (List) state.getValues().stream().map(e -> ((INamable) e).getName()).collect(Collectors.toList())); - } else if (state instanceof BlockStateInteger) { - property = new IntegerProperty(state.a(), ImmutableList.copyOf(state.getValues())); - } else { - throw new IllegalArgumentException("WorldEdit needs an update to support " + state.getClass().getSimpleName()); - } - - properties.put(property.getName(), property); - } - return properties; - } - - /** - * Converts from a non-native NMS NBT structure to a native WorldEdit NBT - * structure. - * - * @param foreign non-native NMS NBT structure - * @return native WorldEdit NBT structure - */ - @SuppressWarnings("unchecked") - @Override - public Tag toNative(NBTBase foreign) { - if (foreign == null) { - return null; - } - if (foreign instanceof NBTTagCompound) { - Map values = new HashMap<>(); - Set foreignKeys = ((NBTTagCompound) foreign).getKeys(); // map.keySet - - for (String str : foreignKeys) { - NBTBase base = ((NBTTagCompound) foreign).get(str); - values.put(str, toNative(base)); - } - return new CompoundTag(values); - } else if (foreign instanceof NBTTagByte) { - return new ByteTag(((NBTTagByte) foreign).asByte()); - } else if (foreign instanceof NBTTagByteArray) { - return new ByteArrayTag(((NBTTagByteArray) foreign).getBytes()); // data - } else if (foreign instanceof NBTTagDouble) { - return new DoubleTag(((NBTTagDouble) foreign).asDouble()); // getDouble - } else if (foreign instanceof NBTTagFloat) { - return new FloatTag(((NBTTagFloat) foreign).asFloat()); - } else if (foreign instanceof NBTTagInt) { - return new IntTag(((NBTTagInt) foreign).asInt()); - } else if (foreign instanceof NBTTagIntArray) { - return new IntArrayTag(((NBTTagIntArray) foreign).getInts()); // data - } else if (foreign instanceof NBTTagLongArray) { - return new LongArrayTag(((NBTTagLongArray) foreign).getLongs()); // data - } else if (foreign instanceof NBTTagList) { - try { - return toNativeList((NBTTagList) foreign); - } catch (Throwable e) { - logger.warn("Failed to convert NBTTagList", e); - return new ListTag(ByteTag.class, new ArrayList()); - } - } else if (foreign instanceof NBTTagLong) { - return new LongTag(((NBTTagLong) foreign).asLong()); - } else if (foreign instanceof NBTTagShort) { - return new ShortTag(((NBTTagShort) foreign).asShort()); - } else if (foreign instanceof NBTTagString) { - return new StringTag(foreign.asString()); - } else if (foreign instanceof NBTTagEnd) { - return new EndTag(); - } else { - throw new IllegalArgumentException("Don't know how to make native " + foreign.getClass().getCanonicalName()); - } - } - - /** - * Convert a foreign NBT list tag into a native WorldEdit one. - * - * @param foreign the foreign tag - * @return the converted tag - * @throws NoSuchFieldException on error - * @throws SecurityException on error - * @throws IllegalArgumentException on error - * @throws IllegalAccessException on error - */ - public ListTag toNativeList(NBTTagList foreign) throws NoSuchFieldException, SecurityException, IllegalArgumentException, IllegalAccessException { - List values = new ArrayList<>(); - int type = foreign.getTypeId(); - - List foreignList; - foreignList = (List) nbtListTagListField.get(foreign); - for (int i = 0; i < foreign.size(); i++) { - NBTBase element = (NBTBase) foreignList.get(i); - values.add(toNative(element)); // List elements shouldn't have names - } - - Class cls = NBTConstants.getClassFromType(type); - return new ListTag(cls, values); - } - - /** - * Converts a WorldEdit-native NBT structure to a NMS structure. - * - * @param foreign structure to convert - * @return non-native structure - */ - @Override - public NBTBase fromNative(Tag foreign) { - if (foreign == null) { - return null; - } - if (foreign instanceof CompoundTag) { - NBTTagCompound tag = new NBTTagCompound(); - for (Map.Entry entry : ((CompoundTag) foreign) - .getValue().entrySet()) { - tag.set(entry.getKey(), fromNative(entry.getValue())); - } - return tag; - } else if (foreign instanceof ByteTag) { - return new NBTTagByte(((ByteTag) foreign).getValue()); - } else if (foreign instanceof ByteArrayTag) { - return new NBTTagByteArray(((ByteArrayTag) foreign).getValue()); - } else if (foreign instanceof DoubleTag) { - return new NBTTagDouble(((DoubleTag) foreign).getValue()); - } else if (foreign instanceof FloatTag) { - return new NBTTagFloat(((FloatTag) foreign).getValue()); - } else if (foreign instanceof IntTag) { - return new NBTTagInt(((IntTag) foreign).getValue()); - } else if (foreign instanceof IntArrayTag) { - return new NBTTagIntArray(((IntArrayTag) foreign).getValue()); - } else if (foreign instanceof LongArrayTag) { - return new NBTTagLongArray(((LongArrayTag) foreign).getValue()); - } else if (foreign instanceof ListTag) { - NBTTagList tag = new NBTTagList(); - ListTag foreignList = (ListTag) foreign; - for (Tag t : foreignList.getValue()) { - tag.add(fromNative(t)); - } - return tag; - } else if (foreign instanceof LongTag) { - return new NBTTagLong(((LongTag) foreign).getValue()); - } else if (foreign instanceof ShortTag) { - return new NBTTagShort(((ShortTag) foreign).getValue()); - } else if (foreign instanceof StringTag) { - return new NBTTagString(((StringTag) foreign).getValue()); - } else if (foreign instanceof EndTag) { - try { - return (NBTBase) nbtCreateTagMethod.invoke(null, (byte) 0); - } catch (Exception e) { - return null; - } - } else { - throw new IllegalArgumentException("Don't know how to make NMS " + foreign.getClass().getCanonicalName()); - } - } - - @Override - public OptionalInt getInternalBlockStateId(BlockState state) { - BlockMaterial_1_14 material = (BlockMaterial_1_14) state.getMaterial(); - IBlockData mcState = material.getCraftBlockData().getState(); - return OptionalInt.of(Block.REGISTRY_ID.getId(mcState)); - } - - @Override - public BlockState adapt(BlockData blockData) { - CraftBlockData cbd = ((CraftBlockData) blockData); - IBlockData ibd = cbd.getState(); - return adapt(ibd); - } - - public BlockState adapt(IBlockData ibd) { - return BlockTypesCache.states[adaptToInt(ibd)]; - } - - public int adaptToInt(IBlockData ibd) { - try { - int id = Block.REGISTRY_ID.getId(ibd); - return idbToStateOrdinal[id]; - } catch (NullPointerException e) { - init(); - return adaptToInt(ibd); - } - } - - public char adaptToChar(IBlockData ibd) { - try { - int id = Block.REGISTRY_ID.getId(ibd); - return idbToStateOrdinal[id]; - } catch (NullPointerException e) { - init(); - return adaptToChar(ibd); - } - } - - @Override - public BlockData adapt(BlockStateHolder state) { - BlockMaterial_1_14 material = (BlockMaterial_1_14) state.getMaterial(); - return material.getCraftBlockData(); - } - - @Override - public void sendFakeNBT(Player player, BlockVector3 pos, CompoundTag nbtData) { - ((CraftPlayer) player).getHandle().playerConnection.sendPacket(new PacketPlayOutTileEntityData( - new BlockPosition(pos.getBlockX(), pos.getBlockY(), pos.getBlockZ()), - 7, - (NBTTagCompound) fromNative(nbtData) - )); - } - - @Override - public void notifyAndLightBlock(Location position, BlockState previousType) { - this.setBlock(position.getChunk(), position.getBlockX(), position.getBlockY(), position.getBlockZ(), previousType, true); - } - - @Override - public void sendFakeOP(Player player) { - ((CraftPlayer) player).getHandle().playerConnection.sendPacket(new PacketPlayOutEntityStatus( - ((CraftPlayer) player).getHandle(), (byte) 28 - )); - } - - @Override - public void sendFakeChunk(org.bukkit.World world, Player player, ChunkPacket packet) { - WorldServer nmsWorld = ((CraftWorld) world).getHandle(); - PlayerChunk map = BukkitAdapter_1_14.getPlayerChunk(nmsWorld, packet.getChunkX(), packet.getChunkZ()); - if (map != null && map.hasBeenLoaded()) { - boolean flag = false; - PlayerChunk.d players = map.players; - Stream stream = players.a(new ChunkCoordIntPair(packet.getChunkX(), packet.getChunkZ()), flag); - - EntityPlayer checkPlayer = player == null ? null : ((CraftPlayer) player).getHandle(); - stream.filter(entityPlayer -> checkPlayer == null || entityPlayer == checkPlayer) - .forEach(entityPlayer -> { - synchronized (packet) { - PacketPlayOutMapChunk nmsPacket = (PacketPlayOutMapChunk) packet.getNativePacket(); - if (nmsPacket == null) { - nmsPacket = MapChunkUtil_1_14.create(nmsWorld, this, packet); - packet.setNativePacket(nmsPacket); - } - try { - FaweCache.IMP.CHUNK_FLAG.get().set(true); - entityPlayer.playerConnection.sendPacket(nmsPacket); - } finally { - FaweCache.IMP.CHUNK_FLAG.get().set(false); - } - } - }); - } - } - - private static EnumDirection adapt(Direction face) { - switch (face) { - case NORTH: return EnumDirection.NORTH; - case SOUTH: return EnumDirection.SOUTH; - case WEST: return EnumDirection.WEST; - case EAST: return EnumDirection.EAST; - case DOWN: return EnumDirection.DOWN; - case UP: - default: - return EnumDirection.UP; - } - } - - private LoadingCache fakePlayers = CacheBuilder.newBuilder().weakKeys().softValues().build(CacheLoader.from(FakePlayer_v1_14_R4::new)); - - @Override - public synchronized boolean simulateItemUse(org.bukkit.World world, BlockVector3 position, BaseItem item, Direction face) { - CraftWorld craftWorld = (CraftWorld) world; - WorldServer worldServer = craftWorld.getHandle(); - ItemStack stack = CraftItemStack.asNMSCopy(BukkitAdapter.adapt(item instanceof BaseItemStack - ? ((BaseItemStack) item) : new BaseItemStack(item.getType(), item.getNbtData(), 1))); - stack.setTag((NBTTagCompound) fromNative(item.getNbtData())); - - FakePlayer_v1_14_R4 fakePlayer; - try { - fakePlayer = fakePlayers.get(worldServer); - } catch (ExecutionException ignored) { - return false; - } - fakePlayer.a(EnumHand.MAIN_HAND, stack); - fakePlayer.setLocation(position.getBlockX(), position.getBlockY(), position.getBlockZ(), - (float) face.toVector().toYaw(), (float) face.toVector().toPitch()); - - final BlockPosition blockPos = new BlockPosition(position.getBlockX(), position.getBlockY(), position.getBlockZ()); - final Vec3D blockVec = new Vec3D(blockPos); - final EnumDirection enumFacing = adapt(face); - MovingObjectPositionBlock rayTrace = new MovingObjectPositionBlock(blockVec, enumFacing, blockPos, false); - ItemActionContext context = new ItemActionContext(fakePlayer, EnumHand.MAIN_HAND, rayTrace); - EnumInteractionResult result = stack.placeItem(context, EnumHand.MAIN_HAND); - if (result != EnumInteractionResult.SUCCESS) { - if (worldServer.getType(blockPos).interact(worldServer, fakePlayer, EnumHand.MAIN_HAND, rayTrace)) { - result = EnumInteractionResult.SUCCESS; - } else { - result = stack.getItem().a(worldServer, fakePlayer, EnumHand.MAIN_HAND).a(); - } - } - - return result == EnumInteractionResult.SUCCESS; - } - - @Override - public org.bukkit.inventory.ItemStack adapt(BaseItemStack item) { - ItemStack stack = new ItemStack(IRegistry.ITEM.get(MinecraftKey.a(item.getType().getId())), item.getAmount()); - stack.setTag(((NBTTagCompound) fromNative(item.getNbtData()))); - return CraftItemStack.asCraftMirror(stack); - } - - @Override - public BaseItemStack adapt(org.bukkit.inventory.ItemStack itemStack) { - final ItemStack nmsStack = CraftItemStack.asNMSCopy(itemStack); - final BaseItemStack weStack = new BaseItemStack(BukkitAdapter.asItemType(itemStack.getType()), itemStack.getAmount()); - weStack.setNbtData(((CompoundTag) toNative(nmsStack.getTag()))); - return weStack; - } -} diff --git a/worldedit-bukkit/src/main/java/com/boydti/fawe/bukkit/adapter/mc1_14/test/TestChunkPacketSend.java b/worldedit-bukkit/src/main/java/com/boydti/fawe/bukkit/adapter/mc1_14/test/TestChunkPacketSend.java deleted file mode 100644 index 7d9be59dc..000000000 --- a/worldedit-bukkit/src/main/java/com/boydti/fawe/bukkit/adapter/mc1_14/test/TestChunkPacketSend.java +++ /dev/null @@ -1,34 +0,0 @@ -package com.boydti.fawe.bukkit.adapter.mc1_14.test; - -import com.comphenix.protocol.PacketType; -import com.comphenix.protocol.ProtocolLibrary; -import com.comphenix.protocol.ProtocolManager; -import com.comphenix.protocol.events.ListenerPriority; -import com.comphenix.protocol.events.PacketAdapter; -import com.comphenix.protocol.events.PacketContainer; -import com.comphenix.protocol.events.PacketEvent; -import com.comphenix.protocol.reflect.StructureModifier; -import com.comphenix.protocol.wrappers.WrappedBlockData; -import org.bukkit.plugin.Plugin; - -import java.util.List; - -public class TestChunkPacketSend { - public TestChunkPacketSend(Plugin plugin) { - // Disable all sound effects - ProtocolManager protocolManager = ProtocolLibrary.getProtocolManager(); - protocolManager.addPacketListener( - new PacketAdapter(plugin, ListenerPriority.NORMAL, PacketType.Play.Server.MAP_CHUNK) { - @Override - public void onPacketSending(PacketEvent event) { - if (event.getPacketType() != PacketType.Play.Server.MAP_CHUNK) { - return; - } - PacketContainer packet = event.getPacket(); - StructureModifier bytes = packet.getBytes(); - StructureModifier blockData = packet.getBlockData(); - List values = blockData.getValues(); - } - }); - } -} diff --git a/worldedit-bukkit/src/main/java/com/boydti/fawe/bukkit/wrapper/AsyncBlock.java b/worldedit-bukkit/src/main/java/com/boydti/fawe/bukkit/wrapper/AsyncBlock.java index c492296f2..25806cda6 100644 --- a/worldedit-bukkit/src/main/java/com/boydti/fawe/bukkit/wrapper/AsyncBlock.java +++ b/worldedit-bukkit/src/main/java/com/boydti/fawe/bukkit/wrapper/AsyncBlock.java @@ -192,7 +192,7 @@ public class AsyncBlock implements Block { @Override public void setType(@NotNull Material type) { try { - world.setBlock(x, y, z, BukkitAdapter.adapt(type).getDefaultState()); + world.setBlock(x, y, z, BukkitAdapter.asBlockType(type).getDefaultState()); } catch (WorldEditException e) { throw new RuntimeException(e); } diff --git a/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/BukkitAdapter.java b/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/BukkitAdapter.java index 96cbf1e33..d54a9c986 100644 --- a/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/BukkitAdapter.java +++ b/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/BukkitAdapter.java @@ -353,10 +353,6 @@ public enum BukkitAdapter { public static BlockState adapt(@NotNull BlockData blockData) { return getAdapter().adapt(blockData); } - - public static BlockType adapt(Material material) { - return getAdapter().adapt(material); - } /* private static Map blockDataCache = new HashMap<>(); */ diff --git a/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/BukkitBlockRegistry.java b/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/BukkitBlockRegistry.java index a8463ce59..0736ee066 100644 --- a/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/BukkitBlockRegistry.java +++ b/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/BukkitBlockRegistry.java @@ -127,7 +127,7 @@ public class BukkitBlockRegistry extends BundledBlockRegistry { } @Override - public Collection registerBlocks() { + public Collection values() { ArrayList blocks = new ArrayList<>(); for (Material m : Material.values()) { if (!m.isLegacy() && m.isBlock()) { diff --git a/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/BukkitItemRegistry.java b/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/BukkitItemRegistry.java index d2d2cb1d7..98bc7dc74 100644 --- a/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/BukkitItemRegistry.java +++ b/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/BukkitItemRegistry.java @@ -1,6 +1,22 @@ package com.sk89q.worldedit.bukkit; import com.sk89q.worldedit.world.registry.BundledItemRegistry; +import org.bukkit.Material; +import org.bukkit.block.data.BlockData; + +import java.util.ArrayList; +import java.util.Collection; public class BukkitItemRegistry extends BundledItemRegistry { + @Override + public Collection values() { + ArrayList values = new ArrayList<>(); + for (Material m : Material.values()) { + if (!m.isLegacy() && (m.isBlock() || m.isItem())) { + String id = m.getKey().toString(); + values.add(id); + } + } + return values; + } } diff --git a/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/BukkitRegistries.java b/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/BukkitRegistries.java index 0ac01328d..211b73b68 100644 --- a/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/BukkitRegistries.java +++ b/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/BukkitRegistries.java @@ -22,6 +22,7 @@ package com.sk89q.worldedit.bukkit; import com.sk89q.worldedit.world.registry.BiomeRegistry; import com.sk89q.worldedit.world.registry.BlockCategoryRegistry; import com.sk89q.worldedit.world.registry.BlockRegistry; +import com.sk89q.worldedit.world.registry.BundledItemRegistry; import com.sk89q.worldedit.world.registry.BundledRegistries; import com.sk89q.worldedit.world.registry.EntityRegistry; import com.sk89q.worldedit.world.registry.ItemCategoryRegistry; @@ -34,6 +35,7 @@ class BukkitRegistries extends BundledRegistries { private static final BukkitRegistries INSTANCE = new BukkitRegistries(); private final BlockRegistry blockRegistry = new BukkitBlockRegistry(); + private final ItemRegistry itemRegistry = new BukkitItemRegistry(); private final BiomeRegistry biomeRegistry = new BukkitBiomeRegistry(); private final EntityRegistry entityRegistry = new BukkitEntityRegistry(); private final BlockCategoryRegistry blockCategoryRegistry = new BukkitBlockCategoryRegistry(); @@ -79,4 +81,8 @@ class BukkitRegistries extends BundledRegistries { return INSTANCE; } + @Override + public ItemRegistry getItemRegistry() { + return itemRegistry; + } } diff --git a/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/WorldEditPlugin.java b/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/WorldEditPlugin.java index 8562cf16f..1273e17c0 100644 --- a/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/WorldEditPlugin.java +++ b/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/WorldEditPlugin.java @@ -22,10 +22,9 @@ package com.sk89q.worldedit.bukkit; import static com.google.common.base.Preconditions.checkNotNull; import static com.sk89q.worldedit.internal.anvil.ChunkDeleter.DELCHUNKS_FILE_NAME; -import com.bekvon.bukkit.residence.commands.message; import com.boydti.fawe.Fawe; import com.boydti.fawe.bukkit.FaweBukkit; -import com.boydti.fawe.bukkit.adapter.mc1_14.Spigot_v1_14_R4; +import com.boydti.fawe.bukkit.adapter.mc1_14.FAWE_Spigot_v1_14_R4; import com.boydti.fawe.util.MainUtil; import com.google.common.base.Joiner; import com.sk89q.util.yaml.YAMLProcessor; @@ -50,7 +49,6 @@ import com.sk89q.worldedit.world.block.BlockCategory; import com.sk89q.worldedit.world.entity.EntityType; import com.sk89q.worldedit.world.gamemode.GameModes; import com.sk89q.worldedit.world.item.ItemCategory; -import com.sk89q.worldedit.world.item.ItemType; import com.sk89q.worldedit.world.weather.WeatherTypes; import io.papermc.lib.PaperLib; import java.io.File; @@ -84,7 +82,6 @@ import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; import org.bukkit.event.Listener; -import org.bukkit.event.world.ChunkUnloadEvent; import org.bukkit.event.world.WorldInitEvent; import org.bukkit.metadata.FixedMetadataValue; import org.bukkit.metadata.MetadataValue; @@ -251,9 +248,8 @@ public class WorldEditPlugin extends JavaPlugin { //implements TabCompleter String lowerCaseBiomeName = biome.name().toLowerCase(Locale.ROOT); BiomeType.REGISTRY.register("minecraft:" + lowerCaseBiomeName, new BiomeType("minecraft:" + lowerCaseBiomeName)); } - // Block & Item + /*// Block & Item for (Material material : Material.values()) { -/* if (material.isBlock() && !material.isLegacy()) { BlockType.REGISTRY.register(material.getKey().toString(), new BlockType(material.getKey().toString(), blockState -> { // TODO Use something way less hacky than this. @@ -277,11 +273,11 @@ public class WorldEditPlugin extends JavaPlugin { //implements TabCompleter } })); } -*/ if (material.isItem() && !material.isLegacy()) { ItemType.REGISTRY.register(material.getKey().toString(), new ItemType(material.getKey().toString())); } } + */ // Entity for (org.bukkit.entity.EntityType entityType : org.bukkit.entity.EntityType.values()) { String mcid = entityType.getName(); @@ -371,7 +367,7 @@ public class WorldEditPlugin extends JavaPlugin { //implements TabCompleter // Attempt to load a Bukkit adapter BukkitImplLoader adapterLoader = new BukkitImplLoader(); try { - adapterLoader.addClass(Spigot_v1_14_R4.class); + adapterLoader.addClass(FAWE_Spigot_v1_14_R4.class); } catch (Throwable throwable) { throwable.printStackTrace(); } diff --git a/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/adapter/BukkitImplAdapter.java b/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/adapter/BukkitImplAdapter.java index 079866df3..9006695d2 100644 --- a/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/adapter/BukkitImplAdapter.java +++ b/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/adapter/BukkitImplAdapter.java @@ -26,6 +26,7 @@ import com.sk89q.jnbt.CompoundTag; import com.sk89q.jnbt.Tag; import com.sk89q.worldedit.blocks.BaseItem; import com.sk89q.worldedit.blocks.BaseItemStack; +import com.sk89q.worldedit.bukkit.BukkitAdapter; import com.sk89q.worldedit.entity.BaseEntity; import com.sk89q.worldedit.math.BlockVector3; import com.sk89q.worldedit.registry.state.Property; @@ -36,17 +37,24 @@ import com.sk89q.worldedit.world.block.BlockState; import com.sk89q.worldedit.world.block.BlockStateHolder; import com.sk89q.worldedit.world.block.BlockType; import com.sk89q.worldedit.world.registry.BlockMaterial; -import java.util.Map; -import java.util.OptionalInt; -import javax.annotation.Nullable; -import org.bukkit.Chunk; import org.bukkit.Location; import org.bukkit.World; import org.bukkit.WorldCreator; +import org.bukkit.block.data.BlockData; import org.bukkit.entity.Entity; import org.bukkit.entity.Player; import org.bukkit.inventory.ItemStack; +import java.util.Map; +import java.util.OptionalInt; + +import javax.annotation.Nullable; + +import java.util.Map; +import java.util.OptionalInt; + +import javax.annotation.Nullable; + /** * An interface for adapters of various Bukkit implementations. */ @@ -67,6 +75,19 @@ public interface BukkitImplAdapter extends IBukkitAdapter { @Nullable DataFixer getDataFixer(); + /** + * @return {@code true} if {@link #tickWatchdog()} is implemented + */ + default boolean supportsWatchdog() { + return false; + } + + /** + * Tick the server watchdog, if possible. + */ + default void tickWatchdog() { + } + /** * Get the block at the given location. * @@ -83,11 +104,7 @@ public interface BukkitImplAdapter extends IBukkitAdapter { * @param notifyAndLight notify and light if set * @return true if a block was likely changed */ - default boolean setBlock(Location location, BlockStateHolder state, boolean notifyAndLight) { - return this.setBlock(location.getChunk(), location.getBlockX(), location.getBlockY(), location.getBlockZ(), state, notifyAndLight); - } - - boolean setBlock(Chunk chunk, int x, int y, int z, BlockStateHolder state, boolean update); + boolean setBlock(Location location, BlockStateHolder state, boolean notifyAndLight); /** * Notifies the simulation that the block at the given location has @@ -142,13 +159,6 @@ public interface BukkitImplAdapter extends IBukkitAdapter { */ void sendFakeOP(Player player); - /** - * Send a fake chunk packet to a player - * @param player - * @param packet - */ - void sendFakeChunk(org.bukkit.World world, Player player, ChunkPacket packet); - /** * Simulates a player using an item. * @@ -178,10 +188,24 @@ public interface BukkitImplAdapter extends IBukkitAdapter { */ BaseItemStack adapt(ItemStack itemStack); - boolean isChunkInUse(Chunk chunk); + default OptionalInt getInternalBlockStateId(BlockData data) { + return getInternalBlockStateId(BukkitAdapter.adapt(data)); + } + /** + * Retrieve the internal ID for a given state, if possible. + * + * @param state The block state + * @return the internal ID of the state + */ + default OptionalInt getInternalBlockStateId(BlockState state) { + return OptionalInt.empty(); + } + + + // FAWE ADDITIONS default BlockMaterial getMaterial(BlockType blockType) { - return null; + return getMaterial(blockType.getDefaultState()); } default BlockMaterial getMaterial(BlockState blockState) { @@ -201,12 +225,11 @@ public interface BukkitImplAdapter extends IBukkitAdapter { } /** - * Retrieve the internal ID for a given state, if possible. - * - * @param state The block state - * @return the internal ID of the state + * Send a fake chunk packet to a player + * @param player + * @param packet */ - default OptionalInt getInternalBlockStateId(BlockState state) { - return OptionalInt.empty(); + default void sendFakeChunk(org.bukkit.World world, Player player, ChunkPacket packet) { + throw new UnsupportedOperationException("Cannot send fake chunks"); } -} +} \ No newline at end of file diff --git a/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/adapter/BukkitImplLoader.java b/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/adapter/BukkitImplLoader.java index dd68d75df..7b8aac09a 100644 --- a/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/adapter/BukkitImplLoader.java +++ b/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/adapter/BukkitImplLoader.java @@ -155,6 +155,7 @@ public class BukkitImplLoader { */ public BukkitImplAdapter loadAdapter() throws AdapterLoadException { for (String className : adapterCandidates) { + System.out.println("Try load " + className); try { Class cls = Class.forName(className); if (cls.isSynthetic()) continue; @@ -168,6 +169,7 @@ public class BukkitImplLoader { log.warn("Failed to load the Bukkit adapter class '" + className + "' that is not supposed to be raising this error", e); } catch (Throwable e) { + e.printStackTrace(); if (className.equals(customCandidate)) { log.warn("Failed to load the Bukkit adapter class '" + className + "'", e); } diff --git a/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/adapter/CachedBukkitAdapter.java b/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/adapter/CachedBukkitAdapter.java index c196fcd2c..43beef3b7 100644 --- a/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/adapter/CachedBukkitAdapter.java +++ b/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/adapter/CachedBukkitAdapter.java @@ -57,11 +57,11 @@ public abstract class CachedBukkitAdapter implements IBukkitAdapter { } @Override - public BlockType adapt(Material material) { + public BlockType asBlockType(Material material) { try { return BlockTypesCache.values[blockTypes[material.ordinal()]]; } catch (NullPointerException e) { - if (init()) return adapt(material); + if (init()) return asBlockType(material); throw e; } } diff --git a/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/adapter/IBukkitAdapter.java b/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/adapter/IBukkitAdapter.java index 241ef371a..63a47abe9 100644 --- a/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/adapter/IBukkitAdapter.java +++ b/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/adapter/IBukkitAdapter.java @@ -26,6 +26,8 @@ import com.sk89q.worldedit.world.gamemode.GameMode; import com.sk89q.worldedit.world.gamemode.GameModes; import com.sk89q.worldedit.world.item.ItemType; import java.util.Locale; + +import com.sk89q.worldedit.world.item.ItemTypes; import org.bukkit.Bukkit; import org.bukkit.Material; import org.bukkit.block.Biome; @@ -208,7 +210,9 @@ public interface IBukkitAdapter { * @param material The material * @return The itemtype */ - ItemType asItemType(Material material); + default ItemType asItemType(Material material) { + return ItemTypes.get(material.getKey().toString()); + } /** * Create a WorldEdit BlockStateHolder from a Bukkit BlockData @@ -216,9 +220,10 @@ public interface IBukkitAdapter { * @param blockData The Bukkit BlockData * @return The WorldEdit BlockState */ - BlockState adapt(BlockData blockData); - - BlockType adapt(Material material); + default BlockState adapt(BlockData blockData) { + String id = blockData.getAsString(); + return BlockState.get(id); + } /** * Create a Bukkit BlockData from a WorldEdit BlockStateHolder @@ -226,7 +231,9 @@ public interface IBukkitAdapter { * @param block The WorldEdit BlockStateHolder * @return The Bukkit BlockData */ - BlockData adapt(BlockStateHolder block); + default BlockData adapt(BlockStateHolder block) { + return Bukkit.createBlockData(block.getAsString()); + } /** * Create a WorldEdit BaseItemStack from a Bukkit ItemStack diff --git a/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/adapter/IDelegateBukkitImplAdapter.java b/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/adapter/IDelegateBukkitImplAdapter.java new file mode 100644 index 000000000..b965046c6 --- /dev/null +++ b/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/adapter/IDelegateBukkitImplAdapter.java @@ -0,0 +1,278 @@ +package com.sk89q.worldedit.bukkit.adapter; + +import com.boydti.fawe.beta.implementation.packet.ChunkPacket; +import com.sk89q.jnbt.CompoundTag; +import com.sk89q.jnbt.Tag; +import com.sk89q.worldedit.blocks.BaseItem; +import com.sk89q.worldedit.blocks.BaseItemStack; +import com.sk89q.worldedit.bukkit.BukkitPlayer; +import com.sk89q.worldedit.bukkit.BukkitWorld; +import com.sk89q.worldedit.entity.BaseEntity; +import com.sk89q.worldedit.math.BlockVector3; +import com.sk89q.worldedit.math.Vector3; +import com.sk89q.worldedit.registry.state.Property; +import com.sk89q.worldedit.util.Direction; +import com.sk89q.worldedit.world.DataFixer; +import com.sk89q.worldedit.world.biome.BiomeType; +import com.sk89q.worldedit.world.block.BaseBlock; +import com.sk89q.worldedit.world.block.BlockState; +import com.sk89q.worldedit.world.block.BlockStateHolder; +import com.sk89q.worldedit.world.block.BlockType; +import com.sk89q.worldedit.world.gamemode.GameMode; +import com.sk89q.worldedit.world.item.ItemType; +import com.sk89q.worldedit.world.registry.BlockMaterial; +import org.bukkit.Location; +import org.bukkit.Material; +import org.bukkit.World; +import org.bukkit.WorldCreator; +import org.bukkit.block.Biome; +import org.bukkit.block.data.BlockData; +import org.bukkit.entity.Entity; +import org.bukkit.entity.EntityType; +import org.bukkit.entity.Player; +import org.bukkit.inventory.ItemStack; + +import javax.annotation.Nullable; +import java.util.Map; +import java.util.OptionalInt; + +public interface IDelegateBukkitImplAdapter extends BukkitImplAdapter { + BukkitImplAdapter getParent(); + + @Override + default int getDataVersion() { + return getParent().getDataVersion(); + } + + @Override + @Nullable + default DataFixer getDataFixer() { + return getParent().getDataFixer(); + } + + @Override + default boolean supportsWatchdog() { + return getParent().supportsWatchdog(); + } + + @Override + default void tickWatchdog() { + getParent().tickWatchdog(); + } + + @Override + default BaseBlock getBlock(Location location) { + return getParent().getBlock(location); + } + + default boolean setBlock(Location location, BlockStateHolder state, boolean notifyAndLight) { + return getParent().setBlock(location, state, notifyAndLight); + } + + @Override + default void notifyAndLightBlock(Location position, BlockState previousType) { + getParent().notifyAndLightBlock(position, previousType); + } + + @Override + @Nullable + default BaseEntity getEntity(Entity entity) { + return getParent().getEntity(entity); + } + + @Override + @Nullable + default Entity createEntity(Location location, BaseEntity state) { + return getParent().createEntity(location, state); + } + + @Override + default Map> getProperties(BlockType blockType) { + return getParent().getProperties(blockType); + } + + @Override + default void sendFakeNBT(Player player, BlockVector3 pos, CompoundTag nbtData) { + getParent().sendFakeNBT(player, pos, nbtData); + } + + @Override + default void sendFakeOP(Player player) { + getParent().sendFakeOP(player); + } + + @Override + default boolean simulateItemUse(World world, BlockVector3 position, BaseItem item, Direction face) { + return getParent().simulateItemUse(world, position, item, face); + } + + @Override + default ItemStack adapt(BaseItemStack item) { + return getParent().adapt(item); + } + + @Override + default BaseItemStack adapt(ItemStack itemStack) { + return getParent().adapt(itemStack); + } + + @Override + default OptionalInt getInternalBlockStateId(BlockData data) { + return getParent().getInternalBlockStateId(data); + } + + @Override + default OptionalInt getInternalBlockStateId(BlockState state) { + return getParent().getInternalBlockStateId(state); + } + + @Override + default BlockMaterial getMaterial(BlockType blockType) { + return getParent().getMaterial(blockType); + } + + @Override + default BlockMaterial getMaterial(BlockState blockState) { + return getParent().getMaterial(blockState); + } + + default Tag toNative(T foreign) { + return getParent().toNative(foreign); + } + + @Override + default T fromNative(Tag foreign) { + return getParent().fromNative(foreign); + } + + @Override + @Nullable + default World createWorld(WorldCreator creator) { + return getParent().createWorld(creator); + } + + @Override + default void sendFakeChunk(World world, Player player, ChunkPacket packet) { + getParent().sendFakeChunk(world, player, packet); + } + + @Override + default BukkitWorld asBukkitWorld(com.sk89q.worldedit.world.World world) { + return getParent().asBukkitWorld(world); + } + + @Override + default World adapt(com.sk89q.worldedit.world.World world) { + return getParent().adapt(world); + } + + @Override + default Location adapt(World world, Vector3 position) { + return getParent().adapt(world, position); + } + + @Override + default Location adapt(World world, BlockVector3 position) { + return getParent().adapt(world, position); + } + + @Override + default Location adapt(World world, com.sk89q.worldedit.util.Location location) { + return getParent().adapt(world, location); + } + + @Override + default Vector3 asVector(Location location) { + return getParent().asVector(location); + } + + @Override + default BlockVector3 asBlockVector(Location location) { + return getParent().asBlockVector(location); + } + + @Override + default com.sk89q.worldedit.entity.Entity adapt(Entity entity) { + return getParent().adapt(entity); + } + + @Override + default Material adapt(ItemType itemType) { + return getParent().adapt(itemType); + } + + @Override + default Material adapt(BlockType blockType) { + return getParent().adapt(blockType); + } + + @Override + default EntityType adapt(com.sk89q.worldedit.world.entity.EntityType entityType) { + return getParent().adapt(entityType); + } + + @Override + default BlockType asBlockType(Material material) { + return getParent().asBlockType(material); + } + + @Override + default ItemType asItemType(Material material) { + return getParent().asItemType(material); + } + + @Override + default BlockState adapt(BlockData blockData) { + return getParent().adapt(blockData); + } + + @Override + default BlockData adapt(BlockStateHolder block) { + return getParent().adapt(block); + } + + @Override + default BukkitPlayer adapt(Player player) { + return getParent().adapt(player); + } + + @Override + default Player adapt(com.sk89q.worldedit.entity.Player player) { + return getParent().adapt(player); + } + + @Override + default Biome adapt(BiomeType biomeType) { + return getParent().adapt(biomeType); + } + + @Override + default BiomeType adapt(Biome biome) { + return getParent().adapt(biome); + } + + @Override + default boolean equals(BlockType blockType, Material type) { + return getParent().equals(blockType, type); + } + + @Override + default com.sk89q.worldedit.world.World adapt(World world) { + return getParent().adapt(world); + } + + @Override + default GameMode adapt(org.bukkit.GameMode gameMode) { + return getParent().adapt(gameMode); + } + + @Override + default com.sk89q.worldedit.world.entity.EntityType adapt(EntityType entityType) { + return getParent().adapt(entityType); + } + + @Override + default BlockState asBlockState(ItemStack itemStack) { + return getParent().asBlockState(itemStack); + } +} diff --git a/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/adapter/SimpleBukkitAdapter.java b/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/adapter/SimpleBukkitAdapter.java index 79a9b947e..55bca525c 100644 --- a/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/adapter/SimpleBukkitAdapter.java +++ b/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/adapter/SimpleBukkitAdapter.java @@ -12,7 +12,7 @@ import static com.google.common.base.Preconditions.checkNotNull; public class SimpleBukkitAdapter extends CachedBukkitAdapter { private BlockData[][] blockDataCache; - public boolean init() { + private boolean init() { if (blockDataCache != null) return false; this.blockDataCache = new BlockData[BlockTypes.size()][]; blockDataCache[0] = new BlockData[] {Material.AIR.createBlockData()}; diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/clipboard/io/SpongeSchematicReader.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/clipboard/io/SpongeSchematicReader.java index 1dc22c720..737a2c0be 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/clipboard/io/SpongeSchematicReader.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/clipboard/io/SpongeSchematicReader.java @@ -144,6 +144,7 @@ public class SpongeSchematicReader extends NBTSchematicReader { BlockState state = null; try { String palettePart = fix(entry.getKey()); + System.out.println("Read " + palettePart); state = BlockState.get(palettePart); } catch (InputParseException e) { e.printStackTrace(); diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/world/block/BlockState.java b/worldedit-core/src/main/java/com/sk89q/worldedit/world/block/BlockState.java index b33d956b8..ba10d1e30 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/world/block/BlockState.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/world/block/BlockState.java @@ -179,7 +179,7 @@ public class BlockState implements BlockStateHolder, FawePattern { // Suggest property String input = charSequence.toString(); BlockType finalType = type; - throw new SuggestInputParseException("Invalid property " + charSequence + ":" + input + " for type " + type, input, () -> + throw new SuggestInputParseException("Invalid property " + key + ":" + input + " for type " + type, input, () -> finalType.getProperties().stream() .map(Property::getName) .filter(p -> StringMan.blockStateMatches(input, p)) @@ -196,6 +196,7 @@ public class BlockState implements BlockStateHolder, FawePattern { case '=': { charSequence.setSubstring(last, i); property = (AbstractProperty) type.getPropertyMap().get(charSequence); + if (property == null) System.out.println("No prop " + charSequence + " | " + type.getPropertyMap()); last = i + 1; break; } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/world/block/BlockTypes.java b/worldedit-core/src/main/java/com/sk89q/worldedit/world/block/BlockTypes.java index 2a43e629b..480753779 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/world/block/BlockTypes.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/world/block/BlockTypes.java @@ -741,6 +741,7 @@ public final class BlockTypes { private static Field[] fieldsTmp; private static JoinedCharSequence joined; private static int initIndex = 0; + public static BlockType init() { if (fieldsTmp == null) { fieldsTmp = BlockTypes.class.getDeclaredFields(); diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/world/block/BlockTypesCache.java b/worldedit-core/src/main/java/com/sk89q/worldedit/world/block/BlockTypesCache.java index 52d6216f5..cbfb85fbb 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/world/block/BlockTypesCache.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/world/block/BlockTypesCache.java @@ -176,7 +176,7 @@ public class BlockTypesCache { Platform platform = WorldEdit.getInstance().getPlatformManager().queryCapability(Capability.GAME_HOOKS); Registries registries = platform.getRegistries(); BlockRegistry blockReg = registries.getBlockRegistry(); - Collection blocks = blockReg.registerBlocks(); + Collection blocks = blockReg.values(); Map blockMap = blocks.stream().collect(Collectors.toMap(item -> item.charAt(item.length() - 1) == ']' ? item.substring(0, item.indexOf('[')) : item, item -> item)); int size = blockMap.size(); diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/world/block/ItemTypesCache.java b/worldedit-core/src/main/java/com/sk89q/worldedit/world/block/ItemTypesCache.java new file mode 100644 index 000000000..9c376a761 --- /dev/null +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/world/block/ItemTypesCache.java @@ -0,0 +1,22 @@ +package com.sk89q.worldedit.world.block; + +import com.sk89q.worldedit.WorldEdit; +import com.sk89q.worldedit.extension.platform.Capability; +import com.sk89q.worldedit.extension.platform.Platform; +import com.sk89q.worldedit.world.item.ItemType; +import com.sk89q.worldedit.world.registry.ItemRegistry; +import com.sk89q.worldedit.world.registry.Registries; + +public final class ItemTypesCache { + public static void init() {} + + static { + Platform platform = WorldEdit.getInstance().getPlatformManager().queryCapability(Capability.GAME_HOOKS); + Registries registries = platform.getRegistries(); + ItemRegistry itemReg = registries.getItemRegistry(); + for (String key : itemReg.values()) { + ItemType item = new ItemType(key); + ItemType.REGISTRY.register(key, item); + } + } +} diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/world/item/ItemTypes.java b/worldedit-core/src/main/java/com/sk89q/worldedit/world/item/ItemTypes.java index 5b5f84d5a..40ca7fc86 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/world/item/ItemTypes.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/world/item/ItemTypes.java @@ -19,900 +19,933 @@ package com.sk89q.worldedit.world.item; +import com.boydti.fawe.object.string.JoinedCharSequence; +import com.sk89q.worldedit.world.block.BlockType; +import com.sk89q.worldedit.world.block.BlockTypes; +import com.sk89q.worldedit.world.block.BlockTypesCache; +import com.sk89q.worldedit.world.block.ItemTypesCache; import com.sk89q.worldedit.world.registry.LegacyMapper; import javax.annotation.Nullable; +import java.lang.reflect.Field; import java.util.Collection; import java.util.Optional; import java.util.Locale; public final class ItemTypes { - @Nullable public static final ItemType ACACIA_BOAT = get("minecraft:acacia_boat"); - @Nullable public static final ItemType ACACIA_BUTTON = get("minecraft:acacia_button"); - @Nullable public static final ItemType ACACIA_DOOR = get("minecraft:acacia_door"); - @Nullable public static final ItemType ACACIA_FENCE = get("minecraft:acacia_fence"); - @Nullable public static final ItemType ACACIA_FENCE_GATE = get("minecraft:acacia_fence_gate"); - @Nullable public static final ItemType ACACIA_LEAVES = get("minecraft:acacia_leaves"); - @Nullable public static final ItemType ACACIA_LOG = get("minecraft:acacia_log"); - @Nullable public static final ItemType ACACIA_PLANKS = get("minecraft:acacia_planks"); - @Nullable public static final ItemType ACACIA_PRESSURE_PLATE = get("minecraft:acacia_pressure_plate"); - @Nullable public static final ItemType ACACIA_SAPLING = get("minecraft:acacia_sapling"); - @Nullable public static final ItemType ACACIA_SIGN = get("minecraft:acacia_sign"); - @Nullable public static final ItemType ACACIA_SLAB = get("minecraft:acacia_slab"); - @Nullable public static final ItemType ACACIA_STAIRS = get("minecraft:acacia_stairs"); - @Nullable public static final ItemType ACACIA_TRAPDOOR = get("minecraft:acacia_trapdoor"); - @Nullable public static final ItemType ACACIA_WOOD = get("minecraft:acacia_wood"); - @Nullable public static final ItemType ACTIVATOR_RAIL = get("minecraft:activator_rail"); - @Nullable public static final ItemType AIR = get("minecraft:air"); - @Nullable public static final ItemType ALLIUM = get("minecraft:allium"); - @Nullable public static final ItemType ANDESITE = get("minecraft:andesite"); - @Nullable public static final ItemType ANDESITE_SLAB = get("minecraft:andesite_slab"); - @Nullable public static final ItemType ANDESITE_STAIRS = get("minecraft:andesite_stairs"); - @Nullable public static final ItemType ANDESITE_WALL = get("minecraft:andesite_wall"); - @Nullable public static final ItemType ANVIL = get("minecraft:anvil"); - @Nullable public static final ItemType APPLE = get("minecraft:apple"); - @Nullable public static final ItemType ARMOR_STAND = get("minecraft:armor_stand"); - @Nullable public static final ItemType ARROW = get("minecraft:arrow"); - @Nullable public static final ItemType AZURE_BLUET = get("minecraft:azure_bluet"); - @Nullable public static final ItemType BAKED_POTATO = get("minecraft:baked_potato"); - @Nullable public static final ItemType BAMBOO = get("minecraft:bamboo"); - @Nullable public static final ItemType BARREL = get("minecraft:barrel"); - @Nullable public static final ItemType BARRIER = get("minecraft:barrier"); - @Nullable public static final ItemType BAT_SPAWN_EGG = get("minecraft:bat_spawn_egg"); - @Nullable public static final ItemType BEACON = get("minecraft:beacon"); - @Nullable public static final ItemType BEDROCK = get("minecraft:bedrock"); - @Nullable public static final ItemType BEEF = get("minecraft:beef"); - @Nullable public static final ItemType BEETROOT = get("minecraft:beetroot"); - @Nullable public static final ItemType BEETROOT_SEEDS = get("minecraft:beetroot_seeds"); - @Nullable public static final ItemType BEETROOT_SOUP = get("minecraft:beetroot_soup"); - @Nullable public static final ItemType BELL = get("minecraft:bell"); - @Nullable public static final ItemType BIRCH_BOAT = get("minecraft:birch_boat"); - @Nullable public static final ItemType BIRCH_BUTTON = get("minecraft:birch_button"); - @Nullable public static final ItemType BIRCH_DOOR = get("minecraft:birch_door"); - @Nullable public static final ItemType BIRCH_FENCE = get("minecraft:birch_fence"); - @Nullable public static final ItemType BIRCH_FENCE_GATE = get("minecraft:birch_fence_gate"); - @Nullable public static final ItemType BIRCH_LEAVES = get("minecraft:birch_leaves"); - @Nullable public static final ItemType BIRCH_LOG = get("minecraft:birch_log"); - @Nullable public static final ItemType BIRCH_PLANKS = get("minecraft:birch_planks"); - @Nullable public static final ItemType BIRCH_PRESSURE_PLATE = get("minecraft:birch_pressure_plate"); - @Nullable public static final ItemType BIRCH_SAPLING = get("minecraft:birch_sapling"); - @Nullable public static final ItemType BIRCH_SIGN = get("minecraft:birch_sign"); - @Nullable public static final ItemType BIRCH_SLAB = get("minecraft:birch_slab"); - @Nullable public static final ItemType BIRCH_STAIRS = get("minecraft:birch_stairs"); - @Nullable public static final ItemType BIRCH_TRAPDOOR = get("minecraft:birch_trapdoor"); - @Nullable public static final ItemType BIRCH_WOOD = get("minecraft:birch_wood"); - @Nullable public static final ItemType BLACK_BANNER = get("minecraft:black_banner"); - @Nullable public static final ItemType BLACK_BED = get("minecraft:black_bed"); - @Nullable public static final ItemType BLACK_CARPET = get("minecraft:black_carpet"); - @Nullable public static final ItemType BLACK_CONCRETE = get("minecraft:black_concrete"); - @Nullable public static final ItemType BLACK_CONCRETE_POWDER = get("minecraft:black_concrete_powder"); - @Nullable public static final ItemType BLACK_DYE = get("minecraft:black_dye"); - @Nullable public static final ItemType BLACK_GLAZED_TERRACOTTA = get("minecraft:black_glazed_terracotta"); - @Nullable public static final ItemType BLACK_SHULKER_BOX = get("minecraft:black_shulker_box"); - @Nullable public static final ItemType BLACK_STAINED_GLASS = get("minecraft:black_stained_glass"); - @Nullable public static final ItemType BLACK_STAINED_GLASS_PANE = get("minecraft:black_stained_glass_pane"); - @Nullable public static final ItemType BLACK_TERRACOTTA = get("minecraft:black_terracotta"); - @Nullable public static final ItemType BLACK_WOOL = get("minecraft:black_wool"); - @Nullable public static final ItemType BLAST_FURNACE = get("minecraft:blast_furnace"); - @Nullable public static final ItemType BLAZE_POWDER = get("minecraft:blaze_powder"); - @Nullable public static final ItemType BLAZE_ROD = get("minecraft:blaze_rod"); - @Nullable public static final ItemType BLAZE_SPAWN_EGG = get("minecraft:blaze_spawn_egg"); - @Nullable public static final ItemType BLUE_BANNER = get("minecraft:blue_banner"); - @Nullable public static final ItemType BLUE_BED = get("minecraft:blue_bed"); - @Nullable public static final ItemType BLUE_CARPET = get("minecraft:blue_carpet"); - @Nullable public static final ItemType BLUE_CONCRETE = get("minecraft:blue_concrete"); - @Nullable public static final ItemType BLUE_CONCRETE_POWDER = get("minecraft:blue_concrete_powder"); - @Nullable public static final ItemType BLUE_DYE = get("minecraft:blue_dye"); - @Nullable public static final ItemType BLUE_GLAZED_TERRACOTTA = get("minecraft:blue_glazed_terracotta"); - @Nullable public static final ItemType BLUE_ICE = get("minecraft:blue_ice"); - @Nullable public static final ItemType BLUE_ORCHID = get("minecraft:blue_orchid"); - @Nullable public static final ItemType BLUE_SHULKER_BOX = get("minecraft:blue_shulker_box"); - @Nullable public static final ItemType BLUE_STAINED_GLASS = get("minecraft:blue_stained_glass"); - @Nullable public static final ItemType BLUE_STAINED_GLASS_PANE = get("minecraft:blue_stained_glass_pane"); - @Nullable public static final ItemType BLUE_TERRACOTTA = get("minecraft:blue_terracotta"); - @Nullable public static final ItemType BLUE_WOOL = get("minecraft:blue_wool"); - @Nullable public static final ItemType BONE = get("minecraft:bone"); - @Nullable public static final ItemType BONE_BLOCK = get("minecraft:bone_block"); - @Nullable public static final ItemType BONE_MEAL = get("minecraft:bone_meal"); - @Nullable public static final ItemType BOOK = get("minecraft:book"); - @Nullable public static final ItemType BOOKSHELF = get("minecraft:bookshelf"); - @Nullable public static final ItemType BOW = get("minecraft:bow"); - @Nullable public static final ItemType BOWL = get("minecraft:bowl"); - @Nullable public static final ItemType BRAIN_CORAL = get("minecraft:brain_coral"); - @Nullable public static final ItemType BRAIN_CORAL_BLOCK = get("minecraft:brain_coral_block"); - @Nullable public static final ItemType BRAIN_CORAL_FAN = get("minecraft:brain_coral_fan"); - @Nullable public static final ItemType BREAD = get("minecraft:bread"); - @Nullable public static final ItemType BREWING_STAND = get("minecraft:brewing_stand"); - @Nullable public static final ItemType BRICK = get("minecraft:brick"); - @Nullable public static final ItemType BRICK_SLAB = get("minecraft:brick_slab"); - @Nullable public static final ItemType BRICK_STAIRS = get("minecraft:brick_stairs"); - @Nullable public static final ItemType BRICK_WALL = get("minecraft:brick_wall"); - @Nullable public static final ItemType BRICKS = get("minecraft:bricks"); - @Nullable public static final ItemType BROWN_BANNER = get("minecraft:brown_banner"); - @Nullable public static final ItemType BROWN_BED = get("minecraft:brown_bed"); - @Nullable public static final ItemType BROWN_CARPET = get("minecraft:brown_carpet"); - @Nullable public static final ItemType BROWN_CONCRETE = get("minecraft:brown_concrete"); - @Nullable public static final ItemType BROWN_CONCRETE_POWDER = get("minecraft:brown_concrete_powder"); - @Nullable public static final ItemType BROWN_DYE = get("minecraft:brown_dye"); - @Nullable public static final ItemType BROWN_GLAZED_TERRACOTTA = get("minecraft:brown_glazed_terracotta"); - @Nullable public static final ItemType BROWN_MUSHROOM = get("minecraft:brown_mushroom"); - @Nullable public static final ItemType BROWN_MUSHROOM_BLOCK = get("minecraft:brown_mushroom_block"); - @Nullable public static final ItemType BROWN_SHULKER_BOX = get("minecraft:brown_shulker_box"); - @Nullable public static final ItemType BROWN_STAINED_GLASS = get("minecraft:brown_stained_glass"); - @Nullable public static final ItemType BROWN_STAINED_GLASS_PANE = get("minecraft:brown_stained_glass_pane"); - @Nullable public static final ItemType BROWN_TERRACOTTA = get("minecraft:brown_terracotta"); - @Nullable public static final ItemType BROWN_WOOL = get("minecraft:brown_wool"); - @Nullable public static final ItemType BUBBLE_CORAL = get("minecraft:bubble_coral"); - @Nullable public static final ItemType BUBBLE_CORAL_BLOCK = get("minecraft:bubble_coral_block"); - @Nullable public static final ItemType BUBBLE_CORAL_FAN = get("minecraft:bubble_coral_fan"); - @Nullable public static final ItemType BUCKET = get("minecraft:bucket"); - @Nullable public static final ItemType CACTUS = get("minecraft:cactus"); - @Deprecated @Nullable public static final ItemType CACTUS_GREEN = Optional.ofNullable(get("minecraft:cactus_green")).orElseGet(() -> get("minecraft:green_dye")); - @Nullable public static final ItemType CAKE = get("minecraft:cake"); - @Nullable public static final ItemType CAMPFIRE = get("minecraft:campfire"); - @Nullable public static final ItemType CARROT = get("minecraft:carrot"); - @Nullable public static final ItemType CARROT_ON_A_STICK = get("minecraft:carrot_on_a_stick"); - @Nullable public static final ItemType CARTOGRAPHY_TABLE = get("minecraft:cartography_table"); - @Nullable public static final ItemType CARVED_PUMPKIN = get("minecraft:carved_pumpkin"); - @Nullable public static final ItemType CAT_SPAWN_EGG = get("minecraft:cat_spawn_egg"); - @Nullable public static final ItemType CAULDRON = get("minecraft:cauldron"); - @Nullable public static final ItemType CAVE_SPIDER_SPAWN_EGG = get("minecraft:cave_spider_spawn_egg"); - @Nullable public static final ItemType CHAIN_COMMAND_BLOCK = get("minecraft:chain_command_block"); - @Nullable public static final ItemType CHAINMAIL_BOOTS = get("minecraft:chainmail_boots"); - @Nullable public static final ItemType CHAINMAIL_CHESTPLATE = get("minecraft:chainmail_chestplate"); - @Nullable public static final ItemType CHAINMAIL_HELMET = get("minecraft:chainmail_helmet"); - @Nullable public static final ItemType CHAINMAIL_LEGGINGS = get("minecraft:chainmail_leggings"); - @Nullable public static final ItemType CHARCOAL = get("minecraft:charcoal"); - @Nullable public static final ItemType CHEST = get("minecraft:chest"); - @Nullable public static final ItemType CHEST_MINECART = get("minecraft:chest_minecart"); - @Nullable public static final ItemType CHICKEN = get("minecraft:chicken"); - @Nullable public static final ItemType CHICKEN_SPAWN_EGG = get("minecraft:chicken_spawn_egg"); - @Nullable public static final ItemType CHIPPED_ANVIL = get("minecraft:chipped_anvil"); - @Nullable public static final ItemType CHISELED_QUARTZ_BLOCK = get("minecraft:chiseled_quartz_block"); - @Nullable public static final ItemType CHISELED_RED_SANDSTONE = get("minecraft:chiseled_red_sandstone"); - @Nullable public static final ItemType CHISELED_SANDSTONE = get("minecraft:chiseled_sandstone"); - @Nullable public static final ItemType CHISELED_STONE_BRICKS = get("minecraft:chiseled_stone_bricks"); - @Nullable public static final ItemType CHORUS_FLOWER = get("minecraft:chorus_flower"); - @Nullable public static final ItemType CHORUS_FRUIT = get("minecraft:chorus_fruit"); - @Nullable public static final ItemType CHORUS_PLANT = get("minecraft:chorus_plant"); - @Nullable public static final ItemType CLAY = get("minecraft:clay"); - @Nullable public static final ItemType CLAY_BALL = get("minecraft:clay_ball"); - @Nullable public static final ItemType CLOCK = get("minecraft:clock"); - @Nullable public static final ItemType COAL = get("minecraft:coal"); - @Nullable public static final ItemType COAL_BLOCK = get("minecraft:coal_block"); - @Nullable public static final ItemType COAL_ORE = get("minecraft:coal_ore"); - @Nullable public static final ItemType COARSE_DIRT = get("minecraft:coarse_dirt"); - @Nullable public static final ItemType COBBLESTONE = get("minecraft:cobblestone"); - @Nullable public static final ItemType COBBLESTONE_SLAB = get("minecraft:cobblestone_slab"); - @Nullable public static final ItemType COBBLESTONE_STAIRS = get("minecraft:cobblestone_stairs"); - @Nullable public static final ItemType COBBLESTONE_WALL = get("minecraft:cobblestone_wall"); - @Nullable public static final ItemType COBWEB = get("minecraft:cobweb"); - @Nullable public static final ItemType COCOA_BEANS = get("minecraft:cocoa_beans"); - @Nullable public static final ItemType COD = get("minecraft:cod"); - @Nullable public static final ItemType COD_BUCKET = get("minecraft:cod_bucket"); - @Nullable public static final ItemType COD_SPAWN_EGG = get("minecraft:cod_spawn_egg"); - @Nullable public static final ItemType COMMAND_BLOCK = get("minecraft:command_block"); - @Nullable public static final ItemType COMMAND_BLOCK_MINECART = get("minecraft:command_block_minecart"); - @Nullable public static final ItemType COMPARATOR = get("minecraft:comparator"); - @Nullable public static final ItemType COMPASS = get("minecraft:compass"); - @Nullable public static final ItemType COMPOSTER = get("minecraft:composter"); - @Nullable public static final ItemType CONDUIT = get("minecraft:conduit"); - @Nullable public static final ItemType COOKED_BEEF = get("minecraft:cooked_beef"); - @Nullable public static final ItemType COOKED_CHICKEN = get("minecraft:cooked_chicken"); - @Nullable public static final ItemType COOKED_COD = get("minecraft:cooked_cod"); - @Nullable public static final ItemType COOKED_MUTTON = get("minecraft:cooked_mutton"); - @Nullable public static final ItemType COOKED_PORKCHOP = get("minecraft:cooked_porkchop"); - @Nullable public static final ItemType COOKED_RABBIT = get("minecraft:cooked_rabbit"); - @Nullable public static final ItemType COOKED_SALMON = get("minecraft:cooked_salmon"); - @Nullable public static final ItemType COOKIE = get("minecraft:cookie"); - @Nullable public static final ItemType CORNFLOWER = get("minecraft:cornflower"); - @Nullable public static final ItemType COW_SPAWN_EGG = get("minecraft:cow_spawn_egg"); - @Nullable public static final ItemType CRACKED_STONE_BRICKS = get("minecraft:cracked_stone_bricks"); - @Nullable public static final ItemType CRAFTING_TABLE = get("minecraft:crafting_table"); - @Nullable public static final ItemType CREEPER_BANNER_PATTERN = get("minecraft:creeper_banner_pattern"); - @Nullable public static final ItemType CREEPER_HEAD = get("minecraft:creeper_head"); - @Nullable public static final ItemType CREEPER_SPAWN_EGG = get("minecraft:creeper_spawn_egg"); - @Nullable public static final ItemType CROSSBOW = get("minecraft:crossbow"); - @Nullable public static final ItemType CUT_RED_SANDSTONE = get("minecraft:cut_red_sandstone"); - @Nullable public static final ItemType CUT_RED_SANDSTONE_SLAB = get("minecraft:cut_red_sandstone_slab"); - @Nullable public static final ItemType CUT_SANDSTONE = get("minecraft:cut_sandstone"); - @Nullable public static final ItemType CUT_SANDSTONE_SLAB = get("minecraft:cut_sandstone_slab"); - @Nullable public static final ItemType CYAN_BANNER = get("minecraft:cyan_banner"); - @Nullable public static final ItemType CYAN_BED = get("minecraft:cyan_bed"); - @Nullable public static final ItemType CYAN_CARPET = get("minecraft:cyan_carpet"); - @Nullable public static final ItemType CYAN_CONCRETE = get("minecraft:cyan_concrete"); - @Nullable public static final ItemType CYAN_CONCRETE_POWDER = get("minecraft:cyan_concrete_powder"); - @Nullable public static final ItemType CYAN_DYE = get("minecraft:cyan_dye"); - @Nullable public static final ItemType CYAN_GLAZED_TERRACOTTA = get("minecraft:cyan_glazed_terracotta"); - @Nullable public static final ItemType CYAN_SHULKER_BOX = get("minecraft:cyan_shulker_box"); - @Nullable public static final ItemType CYAN_STAINED_GLASS = get("minecraft:cyan_stained_glass"); - @Nullable public static final ItemType CYAN_STAINED_GLASS_PANE = get("minecraft:cyan_stained_glass_pane"); - @Nullable public static final ItemType CYAN_TERRACOTTA = get("minecraft:cyan_terracotta"); - @Nullable public static final ItemType CYAN_WOOL = get("minecraft:cyan_wool"); - @Nullable public static final ItemType DAMAGED_ANVIL = get("minecraft:damaged_anvil"); - @Nullable public static final ItemType DANDELION = get("minecraft:dandelion"); - @Deprecated @Nullable public static final ItemType DANDELION_YELLOW = Optional.ofNullable(get("minecraft:dandelion_yellow")).orElseGet(() -> (get("minecraft:yellow_dye"))); - @Nullable public static final ItemType DARK_OAK_BOAT = get("minecraft:dark_oak_boat"); - @Nullable public static final ItemType DARK_OAK_BUTTON = get("minecraft:dark_oak_button"); - @Nullable public static final ItemType DARK_OAK_DOOR = get("minecraft:dark_oak_door"); - @Nullable public static final ItemType DARK_OAK_FENCE = get("minecraft:dark_oak_fence"); - @Nullable public static final ItemType DARK_OAK_FENCE_GATE = get("minecraft:dark_oak_fence_gate"); - @Nullable public static final ItemType DARK_OAK_LEAVES = get("minecraft:dark_oak_leaves"); - @Nullable public static final ItemType DARK_OAK_LOG = get("minecraft:dark_oak_log"); - @Nullable public static final ItemType DARK_OAK_PLANKS = get("minecraft:dark_oak_planks"); - @Nullable public static final ItemType DARK_OAK_PRESSURE_PLATE = get("minecraft:dark_oak_pressure_plate"); - @Nullable public static final ItemType DARK_OAK_SAPLING = get("minecraft:dark_oak_sapling"); - @Nullable public static final ItemType DARK_OAK_SIGN = get("minecraft:dark_oak_sign"); - @Nullable public static final ItemType DARK_OAK_SLAB = get("minecraft:dark_oak_slab"); - @Nullable public static final ItemType DARK_OAK_STAIRS = get("minecraft:dark_oak_stairs"); - @Nullable public static final ItemType DARK_OAK_TRAPDOOR = get("minecraft:dark_oak_trapdoor"); - @Nullable public static final ItemType DARK_OAK_WOOD = get("minecraft:dark_oak_wood"); - @Nullable public static final ItemType DARK_PRISMARINE = get("minecraft:dark_prismarine"); - @Nullable public static final ItemType DARK_PRISMARINE_SLAB = get("minecraft:dark_prismarine_slab"); - @Nullable public static final ItemType DARK_PRISMARINE_STAIRS = get("minecraft:dark_prismarine_stairs"); - @Nullable public static final ItemType DAYLIGHT_DETECTOR = get("minecraft:daylight_detector"); - @Nullable public static final ItemType DEAD_BRAIN_CORAL = get("minecraft:dead_brain_coral"); - @Nullable public static final ItemType DEAD_BRAIN_CORAL_BLOCK = get("minecraft:dead_brain_coral_block"); - @Nullable public static final ItemType DEAD_BRAIN_CORAL_FAN = get("minecraft:dead_brain_coral_fan"); - @Nullable public static final ItemType DEAD_BUBBLE_CORAL = get("minecraft:dead_bubble_coral"); - @Nullable public static final ItemType DEAD_BUBBLE_CORAL_BLOCK = get("minecraft:dead_bubble_coral_block"); - @Nullable public static final ItemType DEAD_BUBBLE_CORAL_FAN = get("minecraft:dead_bubble_coral_fan"); - @Nullable public static final ItemType DEAD_BUSH = get("minecraft:dead_bush"); - @Nullable public static final ItemType DEAD_FIRE_CORAL = get("minecraft:dead_fire_coral"); - @Nullable public static final ItemType DEAD_FIRE_CORAL_BLOCK = get("minecraft:dead_fire_coral_block"); - @Nullable public static final ItemType DEAD_FIRE_CORAL_FAN = get("minecraft:dead_fire_coral_fan"); - @Nullable public static final ItemType DEAD_HORN_CORAL = get("minecraft:dead_horn_coral"); - @Nullable public static final ItemType DEAD_HORN_CORAL_BLOCK = get("minecraft:dead_horn_coral_block"); - @Nullable public static final ItemType DEAD_HORN_CORAL_FAN = get("minecraft:dead_horn_coral_fan"); - @Nullable public static final ItemType DEAD_TUBE_CORAL = get("minecraft:dead_tube_coral"); - @Nullable public static final ItemType DEAD_TUBE_CORAL_BLOCK = get("minecraft:dead_tube_coral_block"); - @Nullable public static final ItemType DEAD_TUBE_CORAL_FAN = get("minecraft:dead_tube_coral_fan"); - @Nullable public static final ItemType DEBUG_STICK = get("minecraft:debug_stick"); - @Nullable public static final ItemType DETECTOR_RAIL = get("minecraft:detector_rail"); - @Nullable public static final ItemType DIAMOND = get("minecraft:diamond"); - @Nullable public static final ItemType DIAMOND_AXE = get("minecraft:diamond_axe"); - @Nullable public static final ItemType DIAMOND_BLOCK = get("minecraft:diamond_block"); - @Nullable public static final ItemType DIAMOND_BOOTS = get("minecraft:diamond_boots"); - @Nullable public static final ItemType DIAMOND_CHESTPLATE = get("minecraft:diamond_chestplate"); - @Nullable public static final ItemType DIAMOND_HELMET = get("minecraft:diamond_helmet"); - @Nullable public static final ItemType DIAMOND_HOE = get("minecraft:diamond_hoe"); - @Nullable public static final ItemType DIAMOND_HORSE_ARMOR = get("minecraft:diamond_horse_armor"); - @Nullable public static final ItemType DIAMOND_LEGGINGS = get("minecraft:diamond_leggings"); - @Nullable public static final ItemType DIAMOND_ORE = get("minecraft:diamond_ore"); - @Nullable public static final ItemType DIAMOND_PICKAXE = get("minecraft:diamond_pickaxe"); - @Nullable public static final ItemType DIAMOND_SHOVEL = get("minecraft:diamond_shovel"); - @Nullable public static final ItemType DIAMOND_SWORD = get("minecraft:diamond_sword"); - @Nullable public static final ItemType DIORITE = get("minecraft:diorite"); - @Nullable public static final ItemType DIORITE_SLAB = get("minecraft:diorite_slab"); - @Nullable public static final ItemType DIORITE_STAIRS = get("minecraft:diorite_stairs"); - @Nullable public static final ItemType DIORITE_WALL = get("minecraft:diorite_wall"); - @Nullable public static final ItemType DIRT = get("minecraft:dirt"); - @Nullable public static final ItemType DISPENSER = get("minecraft:dispenser"); - @Nullable public static final ItemType DOLPHIN_SPAWN_EGG = get("minecraft:dolphin_spawn_egg"); - @Nullable public static final ItemType DONKEY_SPAWN_EGG = get("minecraft:donkey_spawn_egg"); - @Nullable public static final ItemType DRAGON_BREATH = get("minecraft:dragon_breath"); - @Nullable public static final ItemType DRAGON_EGG = get("minecraft:dragon_egg"); - @Nullable public static final ItemType DRAGON_HEAD = get("minecraft:dragon_head"); - @Nullable public static final ItemType DRIED_KELP = get("minecraft:dried_kelp"); - @Nullable public static final ItemType DRIED_KELP_BLOCK = get("minecraft:dried_kelp_block"); - @Nullable public static final ItemType DROPPER = get("minecraft:dropper"); - @Nullable public static final ItemType DROWNED_SPAWN_EGG = get("minecraft:drowned_spawn_egg"); - @Nullable public static final ItemType EGG = get("minecraft:egg"); - @Nullable public static final ItemType ELDER_GUARDIAN_SPAWN_EGG = get("minecraft:elder_guardian_spawn_egg"); - @Nullable public static final ItemType ELYTRA = get("minecraft:elytra"); - @Nullable public static final ItemType EMERALD = get("minecraft:emerald"); - @Nullable public static final ItemType EMERALD_BLOCK = get("minecraft:emerald_block"); - @Nullable public static final ItemType EMERALD_ORE = get("minecraft:emerald_ore"); - @Nullable public static final ItemType ENCHANTED_BOOK = get("minecraft:enchanted_book"); - @Nullable public static final ItemType ENCHANTED_GOLDEN_APPLE = get("minecraft:enchanted_golden_apple"); - @Nullable public static final ItemType ENCHANTING_TABLE = get("minecraft:enchanting_table"); - @Nullable public static final ItemType END_CRYSTAL = get("minecraft:end_crystal"); - @Nullable public static final ItemType END_PORTAL_FRAME = get("minecraft:end_portal_frame"); - @Nullable public static final ItemType END_ROD = get("minecraft:end_rod"); - @Nullable public static final ItemType END_STONE = get("minecraft:end_stone"); - @Nullable public static final ItemType END_STONE_BRICK_SLAB = get("minecraft:end_stone_brick_slab"); - @Nullable public static final ItemType END_STONE_BRICK_STAIRS = get("minecraft:end_stone_brick_stairs"); - @Nullable public static final ItemType END_STONE_BRICK_WALL = get("minecraft:end_stone_brick_wall"); - @Nullable public static final ItemType END_STONE_BRICKS = get("minecraft:end_stone_bricks"); - @Nullable public static final ItemType ENDER_CHEST = get("minecraft:ender_chest"); - @Nullable public static final ItemType ENDER_EYE = get("minecraft:ender_eye"); - @Nullable public static final ItemType ENDER_PEARL = get("minecraft:ender_pearl"); - @Nullable public static final ItemType ENDERMAN_SPAWN_EGG = get("minecraft:enderman_spawn_egg"); - @Nullable public static final ItemType ENDERMITE_SPAWN_EGG = get("minecraft:endermite_spawn_egg"); - @Nullable public static final ItemType EVOKER_SPAWN_EGG = get("minecraft:evoker_spawn_egg"); - @Nullable public static final ItemType EXPERIENCE_BOTTLE = get("minecraft:experience_bottle"); - @Nullable public static final ItemType FARMLAND = get("minecraft:farmland"); - @Nullable public static final ItemType FEATHER = get("minecraft:feather"); - @Nullable public static final ItemType FERMENTED_SPIDER_EYE = get("minecraft:fermented_spider_eye"); - @Nullable public static final ItemType FERN = get("minecraft:fern"); - @Nullable public static final ItemType FILLED_MAP = get("minecraft:filled_map"); - @Nullable public static final ItemType FIRE_CHARGE = get("minecraft:fire_charge"); - @Nullable public static final ItemType FIRE_CORAL = get("minecraft:fire_coral"); - @Nullable public static final ItemType FIRE_CORAL_BLOCK = get("minecraft:fire_coral_block"); - @Nullable public static final ItemType FIRE_CORAL_FAN = get("minecraft:fire_coral_fan"); - @Nullable public static final ItemType FIREWORK_ROCKET = get("minecraft:firework_rocket"); - @Nullable public static final ItemType FIREWORK_STAR = get("minecraft:firework_star"); - @Nullable public static final ItemType FISHING_ROD = get("minecraft:fishing_rod"); - @Nullable public static final ItemType FLETCHING_TABLE = get("minecraft:fletching_table"); - @Nullable public static final ItemType FLINT = get("minecraft:flint"); - @Nullable public static final ItemType FLINT_AND_STEEL = get("minecraft:flint_and_steel"); - @Nullable public static final ItemType FLOWER_BANNER_PATTERN = get("minecraft:flower_banner_pattern"); - @Nullable public static final ItemType FLOWER_POT = get("minecraft:flower_pot"); - @Nullable public static final ItemType FOX_SPAWN_EGG = get("minecraft:fox_spawn_egg"); - @Nullable public static final ItemType FURNACE = get("minecraft:furnace"); - @Nullable public static final ItemType FURNACE_MINECART = get("minecraft:furnace_minecart"); - @Nullable public static final ItemType GHAST_SPAWN_EGG = get("minecraft:ghast_spawn_egg"); - @Nullable public static final ItemType GHAST_TEAR = get("minecraft:ghast_tear"); - @Nullable public static final ItemType GLASS = get("minecraft:glass"); - @Nullable public static final ItemType GLASS_BOTTLE = get("minecraft:glass_bottle"); - @Nullable public static final ItemType GLASS_PANE = get("minecraft:glass_pane"); - @Nullable public static final ItemType GLISTERING_MELON_SLICE = get("minecraft:glistering_melon_slice"); - @Nullable public static final ItemType GLOBE_BANNER_PATTERN = get("minecraft:globe_banner_pattern"); - @Nullable public static final ItemType GLOWSTONE = get("minecraft:glowstone"); - @Nullable public static final ItemType GLOWSTONE_DUST = get("minecraft:glowstone_dust"); - @Nullable public static final ItemType GOLD_BLOCK = get("minecraft:gold_block"); - @Nullable public static final ItemType GOLD_INGOT = get("minecraft:gold_ingot"); - @Nullable public static final ItemType GOLD_NUGGET = get("minecraft:gold_nugget"); - @Nullable public static final ItemType GOLD_ORE = get("minecraft:gold_ore"); - @Nullable public static final ItemType GOLDEN_APPLE = get("minecraft:golden_apple"); - @Nullable public static final ItemType GOLDEN_AXE = get("minecraft:golden_axe"); - @Nullable public static final ItemType GOLDEN_BOOTS = get("minecraft:golden_boots"); - @Nullable public static final ItemType GOLDEN_CARROT = get("minecraft:golden_carrot"); - @Nullable public static final ItemType GOLDEN_CHESTPLATE = get("minecraft:golden_chestplate"); - @Nullable public static final ItemType GOLDEN_HELMET = get("minecraft:golden_helmet"); - @Nullable public static final ItemType GOLDEN_HOE = get("minecraft:golden_hoe"); - @Nullable public static final ItemType GOLDEN_HORSE_ARMOR = get("minecraft:golden_horse_armor"); - @Nullable public static final ItemType GOLDEN_LEGGINGS = get("minecraft:golden_leggings"); - @Nullable public static final ItemType GOLDEN_PICKAXE = get("minecraft:golden_pickaxe"); - @Nullable public static final ItemType GOLDEN_SHOVEL = get("minecraft:golden_shovel"); - @Nullable public static final ItemType GOLDEN_SWORD = get("minecraft:golden_sword"); - @Nullable public static final ItemType GRANITE = get("minecraft:granite"); - @Nullable public static final ItemType GRANITE_SLAB = get("minecraft:granite_slab"); - @Nullable public static final ItemType GRANITE_STAIRS = get("minecraft:granite_stairs"); - @Nullable public static final ItemType GRANITE_WALL = get("minecraft:granite_wall"); - @Nullable public static final ItemType GRASS = get("minecraft:grass"); - @Nullable public static final ItemType GRASS_BLOCK = get("minecraft:grass_block"); - @Nullable public static final ItemType GRASS_PATH = get("minecraft:grass_path"); - @Nullable public static final ItemType GRAVEL = get("minecraft:gravel"); - @Nullable public static final ItemType GRAY_BANNER = get("minecraft:gray_banner"); - @Nullable public static final ItemType GRAY_BED = get("minecraft:gray_bed"); - @Nullable public static final ItemType GRAY_CARPET = get("minecraft:gray_carpet"); - @Nullable public static final ItemType GRAY_CONCRETE = get("minecraft:gray_concrete"); - @Nullable public static final ItemType GRAY_CONCRETE_POWDER = get("minecraft:gray_concrete_powder"); - @Nullable public static final ItemType GRAY_DYE = get("minecraft:gray_dye"); - @Nullable public static final ItemType GRAY_GLAZED_TERRACOTTA = get("minecraft:gray_glazed_terracotta"); - @Nullable public static final ItemType GRAY_SHULKER_BOX = get("minecraft:gray_shulker_box"); - @Nullable public static final ItemType GRAY_STAINED_GLASS = get("minecraft:gray_stained_glass"); - @Nullable public static final ItemType GRAY_STAINED_GLASS_PANE = get("minecraft:gray_stained_glass_pane"); - @Nullable public static final ItemType GRAY_TERRACOTTA = get("minecraft:gray_terracotta"); - @Nullable public static final ItemType GRAY_WOOL = get("minecraft:gray_wool"); - @Nullable public static final ItemType GREEN_BANNER = get("minecraft:green_banner"); - @Nullable public static final ItemType GREEN_BED = get("minecraft:green_bed"); - @Nullable public static final ItemType GREEN_CARPET = get("minecraft:green_carpet"); - @Nullable public static final ItemType GREEN_CONCRETE = get("minecraft:green_concrete"); - @Nullable public static final ItemType GREEN_CONCRETE_POWDER = get("minecraft:green_concrete_powder"); - @Nullable public static final ItemType GREEN_DYE = get("minecraft:green_dye"); - @Nullable public static final ItemType GREEN_GLAZED_TERRACOTTA = get("minecraft:green_glazed_terracotta"); - @Nullable public static final ItemType GREEN_SHULKER_BOX = get("minecraft:green_shulker_box"); - @Nullable public static final ItemType GREEN_STAINED_GLASS = get("minecraft:green_stained_glass"); - @Nullable public static final ItemType GREEN_STAINED_GLASS_PANE = get("minecraft:green_stained_glass_pane"); - @Nullable public static final ItemType GREEN_TERRACOTTA = get("minecraft:green_terracotta"); - @Nullable public static final ItemType GREEN_WOOL = get("minecraft:green_wool"); - @Nullable public static final ItemType GRINDSTONE = get("minecraft:grindstone"); - @Nullable public static final ItemType GUARDIAN_SPAWN_EGG = get("minecraft:guardian_spawn_egg"); - @Nullable public static final ItemType GUNPOWDER = get("minecraft:gunpowder"); - @Nullable public static final ItemType HAY_BLOCK = get("minecraft:hay_block"); - @Nullable public static final ItemType HEART_OF_THE_SEA = get("minecraft:heart_of_the_sea"); - @Nullable public static final ItemType HEAVY_WEIGHTED_PRESSURE_PLATE = get("minecraft:heavy_weighted_pressure_plate"); - @Nullable public static final ItemType HOPPER = get("minecraft:hopper"); - @Nullable public static final ItemType HOPPER_MINECART = get("minecraft:hopper_minecart"); - @Nullable public static final ItemType HORN_CORAL = get("minecraft:horn_coral"); - @Nullable public static final ItemType HORN_CORAL_BLOCK = get("minecraft:horn_coral_block"); - @Nullable public static final ItemType HORN_CORAL_FAN = get("minecraft:horn_coral_fan"); - @Nullable public static final ItemType HORSE_SPAWN_EGG = get("minecraft:horse_spawn_egg"); - @Nullable public static final ItemType HUSK_SPAWN_EGG = get("minecraft:husk_spawn_egg"); - @Nullable public static final ItemType ICE = get("minecraft:ice"); - @Nullable public static final ItemType INFESTED_CHISELED_STONE_BRICKS = get("minecraft:infested_chiseled_stone_bricks"); - @Nullable public static final ItemType INFESTED_COBBLESTONE = get("minecraft:infested_cobblestone"); - @Nullable public static final ItemType INFESTED_CRACKED_STONE_BRICKS = get("minecraft:infested_cracked_stone_bricks"); - @Nullable public static final ItemType INFESTED_MOSSY_STONE_BRICKS = get("minecraft:infested_mossy_stone_bricks"); - @Nullable public static final ItemType INFESTED_STONE = get("minecraft:infested_stone"); - @Nullable public static final ItemType INFESTED_STONE_BRICKS = get("minecraft:infested_stone_bricks"); - @Nullable public static final ItemType INK_SAC = get("minecraft:ink_sac"); - @Nullable public static final ItemType IRON_AXE = get("minecraft:iron_axe"); - @Nullable public static final ItemType IRON_BARS = get("minecraft:iron_bars"); - @Nullable public static final ItemType IRON_BLOCK = get("minecraft:iron_block"); - @Nullable public static final ItemType IRON_BOOTS = get("minecraft:iron_boots"); - @Nullable public static final ItemType IRON_CHESTPLATE = get("minecraft:iron_chestplate"); - @Nullable public static final ItemType IRON_DOOR = get("minecraft:iron_door"); - @Nullable public static final ItemType IRON_HELMET = get("minecraft:iron_helmet"); - @Nullable public static final ItemType IRON_HOE = get("minecraft:iron_hoe"); - @Nullable public static final ItemType IRON_HORSE_ARMOR = get("minecraft:iron_horse_armor"); - @Nullable public static final ItemType IRON_INGOT = get("minecraft:iron_ingot"); - @Nullable public static final ItemType IRON_LEGGINGS = get("minecraft:iron_leggings"); - @Nullable public static final ItemType IRON_NUGGET = get("minecraft:iron_nugget"); - @Nullable public static final ItemType IRON_ORE = get("minecraft:iron_ore"); - @Nullable public static final ItemType IRON_PICKAXE = get("minecraft:iron_pickaxe"); - @Nullable public static final ItemType IRON_SHOVEL = get("minecraft:iron_shovel"); - @Nullable public static final ItemType IRON_SWORD = get("minecraft:iron_sword"); - @Nullable public static final ItemType IRON_TRAPDOOR = get("minecraft:iron_trapdoor"); - @Nullable public static final ItemType ITEM_FRAME = get("minecraft:item_frame"); - @Nullable public static final ItemType JACK_O_LANTERN = get("minecraft:jack_o_lantern"); - @Nullable public static final ItemType JIGSAW = get("minecraft:jigsaw"); - @Nullable public static final ItemType JUKEBOX = get("minecraft:jukebox"); - @Nullable public static final ItemType JUNGLE_BOAT = get("minecraft:jungle_boat"); - @Nullable public static final ItemType JUNGLE_BUTTON = get("minecraft:jungle_button"); - @Nullable public static final ItemType JUNGLE_DOOR = get("minecraft:jungle_door"); - @Nullable public static final ItemType JUNGLE_FENCE = get("minecraft:jungle_fence"); - @Nullable public static final ItemType JUNGLE_FENCE_GATE = get("minecraft:jungle_fence_gate"); - @Nullable public static final ItemType JUNGLE_LEAVES = get("minecraft:jungle_leaves"); - @Nullable public static final ItemType JUNGLE_LOG = get("minecraft:jungle_log"); - @Nullable public static final ItemType JUNGLE_PLANKS = get("minecraft:jungle_planks"); - @Nullable public static final ItemType JUNGLE_PRESSURE_PLATE = get("minecraft:jungle_pressure_plate"); - @Nullable public static final ItemType JUNGLE_SAPLING = get("minecraft:jungle_sapling"); - @Nullable public static final ItemType JUNGLE_SIGN = get("minecraft:jungle_sign"); - @Nullable public static final ItemType JUNGLE_SLAB = get("minecraft:jungle_slab"); - @Nullable public static final ItemType JUNGLE_STAIRS = get("minecraft:jungle_stairs"); - @Nullable public static final ItemType JUNGLE_TRAPDOOR = get("minecraft:jungle_trapdoor"); - @Nullable public static final ItemType JUNGLE_WOOD = get("minecraft:jungle_wood"); - @Nullable public static final ItemType KELP = get("minecraft:kelp"); - @Nullable public static final ItemType KNOWLEDGE_BOOK = get("minecraft:knowledge_book"); - @Nullable public static final ItemType LADDER = get("minecraft:ladder"); - @Nullable public static final ItemType LANTERN = get("minecraft:lantern"); - @Nullable public static final ItemType LAPIS_BLOCK = get("minecraft:lapis_block"); - @Nullable public static final ItemType LAPIS_LAZULI = get("minecraft:lapis_lazuli"); - @Nullable public static final ItemType LAPIS_ORE = get("minecraft:lapis_ore"); - @Nullable public static final ItemType LARGE_FERN = get("minecraft:large_fern"); - @Nullable public static final ItemType LAVA_BUCKET = get("minecraft:lava_bucket"); - @Nullable public static final ItemType LEAD = get("minecraft:lead"); - @Nullable public static final ItemType LEATHER = get("minecraft:leather"); - @Nullable public static final ItemType LEATHER_BOOTS = get("minecraft:leather_boots"); - @Nullable public static final ItemType LEATHER_CHESTPLATE = get("minecraft:leather_chestplate"); - @Nullable public static final ItemType LEATHER_HELMET = get("minecraft:leather_helmet"); - @Nullable public static final ItemType LEATHER_HORSE_ARMOR = get("minecraft:leather_horse_armor"); - @Nullable public static final ItemType LEATHER_LEGGINGS = get("minecraft:leather_leggings"); - @Nullable public static final ItemType LECTERN = get("minecraft:lectern"); - @Nullable public static final ItemType LEVER = get("minecraft:lever"); - @Nullable public static final ItemType LIGHT_BLUE_BANNER = get("minecraft:light_blue_banner"); - @Nullable public static final ItemType LIGHT_BLUE_BED = get("minecraft:light_blue_bed"); - @Nullable public static final ItemType LIGHT_BLUE_CARPET = get("minecraft:light_blue_carpet"); - @Nullable public static final ItemType LIGHT_BLUE_CONCRETE = get("minecraft:light_blue_concrete"); - @Nullable public static final ItemType LIGHT_BLUE_CONCRETE_POWDER = get("minecraft:light_blue_concrete_powder"); - @Nullable public static final ItemType LIGHT_BLUE_DYE = get("minecraft:light_blue_dye"); - @Nullable public static final ItemType LIGHT_BLUE_GLAZED_TERRACOTTA = get("minecraft:light_blue_glazed_terracotta"); - @Nullable public static final ItemType LIGHT_BLUE_SHULKER_BOX = get("minecraft:light_blue_shulker_box"); - @Nullable public static final ItemType LIGHT_BLUE_STAINED_GLASS = get("minecraft:light_blue_stained_glass"); - @Nullable public static final ItemType LIGHT_BLUE_STAINED_GLASS_PANE = get("minecraft:light_blue_stained_glass_pane"); - @Nullable public static final ItemType LIGHT_BLUE_TERRACOTTA = get("minecraft:light_blue_terracotta"); - @Nullable public static final ItemType LIGHT_BLUE_WOOL = get("minecraft:light_blue_wool"); - @Nullable public static final ItemType LIGHT_GRAY_BANNER = get("minecraft:light_gray_banner"); - @Nullable public static final ItemType LIGHT_GRAY_BED = get("minecraft:light_gray_bed"); - @Nullable public static final ItemType LIGHT_GRAY_CARPET = get("minecraft:light_gray_carpet"); - @Nullable public static final ItemType LIGHT_GRAY_CONCRETE = get("minecraft:light_gray_concrete"); - @Nullable public static final ItemType LIGHT_GRAY_CONCRETE_POWDER = get("minecraft:light_gray_concrete_powder"); - @Nullable public static final ItemType LIGHT_GRAY_DYE = get("minecraft:light_gray_dye"); - @Nullable public static final ItemType LIGHT_GRAY_GLAZED_TERRACOTTA = get("minecraft:light_gray_glazed_terracotta"); - @Nullable public static final ItemType LIGHT_GRAY_SHULKER_BOX = get("minecraft:light_gray_shulker_box"); - @Nullable public static final ItemType LIGHT_GRAY_STAINED_GLASS = get("minecraft:light_gray_stained_glass"); - @Nullable public static final ItemType LIGHT_GRAY_STAINED_GLASS_PANE = get("minecraft:light_gray_stained_glass_pane"); - @Nullable public static final ItemType LIGHT_GRAY_TERRACOTTA = get("minecraft:light_gray_terracotta"); - @Nullable public static final ItemType LIGHT_GRAY_WOOL = get("minecraft:light_gray_wool"); - @Nullable public static final ItemType LIGHT_WEIGHTED_PRESSURE_PLATE = get("minecraft:light_weighted_pressure_plate"); - @Nullable public static final ItemType LILAC = get("minecraft:lilac"); - @Nullable public static final ItemType LILY_OF_THE_VALLEY = get("minecraft:lily_of_the_valley"); - @Nullable public static final ItemType LILY_PAD = get("minecraft:lily_pad"); - @Nullable public static final ItemType LIME_BANNER = get("minecraft:lime_banner"); - @Nullable public static final ItemType LIME_BED = get("minecraft:lime_bed"); - @Nullable public static final ItemType LIME_CARPET = get("minecraft:lime_carpet"); - @Nullable public static final ItemType LIME_CONCRETE = get("minecraft:lime_concrete"); - @Nullable public static final ItemType LIME_CONCRETE_POWDER = get("minecraft:lime_concrete_powder"); - @Nullable public static final ItemType LIME_DYE = get("minecraft:lime_dye"); - @Nullable public static final ItemType LIME_GLAZED_TERRACOTTA = get("minecraft:lime_glazed_terracotta"); - @Nullable public static final ItemType LIME_SHULKER_BOX = get("minecraft:lime_shulker_box"); - @Nullable public static final ItemType LIME_STAINED_GLASS = get("minecraft:lime_stained_glass"); - @Nullable public static final ItemType LIME_STAINED_GLASS_PANE = get("minecraft:lime_stained_glass_pane"); - @Nullable public static final ItemType LIME_TERRACOTTA = get("minecraft:lime_terracotta"); - @Nullable public static final ItemType LIME_WOOL = get("minecraft:lime_wool"); - @Nullable public static final ItemType LINGERING_POTION = get("minecraft:lingering_potion"); - @Nullable public static final ItemType LLAMA_SPAWN_EGG = get("minecraft:llama_spawn_egg"); - @Nullable public static final ItemType LOOM = get("minecraft:loom"); - @Nullable public static final ItemType MAGENTA_BANNER = get("minecraft:magenta_banner"); - @Nullable public static final ItemType MAGENTA_BED = get("minecraft:magenta_bed"); - @Nullable public static final ItemType MAGENTA_CARPET = get("minecraft:magenta_carpet"); - @Nullable public static final ItemType MAGENTA_CONCRETE = get("minecraft:magenta_concrete"); - @Nullable public static final ItemType MAGENTA_CONCRETE_POWDER = get("minecraft:magenta_concrete_powder"); - @Nullable public static final ItemType MAGENTA_DYE = get("minecraft:magenta_dye"); - @Nullable public static final ItemType MAGENTA_GLAZED_TERRACOTTA = get("minecraft:magenta_glazed_terracotta"); - @Nullable public static final ItemType MAGENTA_SHULKER_BOX = get("minecraft:magenta_shulker_box"); - @Nullable public static final ItemType MAGENTA_STAINED_GLASS = get("minecraft:magenta_stained_glass"); - @Nullable public static final ItemType MAGENTA_STAINED_GLASS_PANE = get("minecraft:magenta_stained_glass_pane"); - @Nullable public static final ItemType MAGENTA_TERRACOTTA = get("minecraft:magenta_terracotta"); - @Nullable public static final ItemType MAGENTA_WOOL = get("minecraft:magenta_wool"); - @Nullable public static final ItemType MAGMA_BLOCK = get("minecraft:magma_block"); - @Nullable public static final ItemType MAGMA_CREAM = get("minecraft:magma_cream"); - @Nullable public static final ItemType MAGMA_CUBE_SPAWN_EGG = get("minecraft:magma_cube_spawn_egg"); - @Nullable public static final ItemType MAP = get("minecraft:map"); - @Nullable public static final ItemType MELON = get("minecraft:melon"); - @Nullable public static final ItemType MELON_SEEDS = get("minecraft:melon_seeds"); - @Nullable public static final ItemType MELON_SLICE = get("minecraft:melon_slice"); - @Nullable public static final ItemType MILK_BUCKET = get("minecraft:milk_bucket"); - @Nullable public static final ItemType MINECART = get("minecraft:minecart"); - @Nullable public static final ItemType MOJANG_BANNER_PATTERN = get("minecraft:mojang_banner_pattern"); - @Nullable public static final ItemType MOOSHROOM_SPAWN_EGG = get("minecraft:mooshroom_spawn_egg"); - @Nullable public static final ItemType MOSSY_COBBLESTONE = get("minecraft:mossy_cobblestone"); - @Nullable public static final ItemType MOSSY_COBBLESTONE_SLAB = get("minecraft:mossy_cobblestone_slab"); - @Nullable public static final ItemType MOSSY_COBBLESTONE_STAIRS = get("minecraft:mossy_cobblestone_stairs"); - @Nullable public static final ItemType MOSSY_COBBLESTONE_WALL = get("minecraft:mossy_cobblestone_wall"); - @Nullable public static final ItemType MOSSY_STONE_BRICK_SLAB = get("minecraft:mossy_stone_brick_slab"); - @Nullable public static final ItemType MOSSY_STONE_BRICK_STAIRS = get("minecraft:mossy_stone_brick_stairs"); - @Nullable public static final ItemType MOSSY_STONE_BRICK_WALL = get("minecraft:mossy_stone_brick_wall"); - @Nullable public static final ItemType MOSSY_STONE_BRICKS = get("minecraft:mossy_stone_bricks"); - @Nullable public static final ItemType MULE_SPAWN_EGG = get("minecraft:mule_spawn_egg"); - @Nullable public static final ItemType MUSHROOM_STEM = get("minecraft:mushroom_stem"); - @Nullable public static final ItemType MUSHROOM_STEW = get("minecraft:mushroom_stew"); - @Nullable public static final ItemType MUSIC_DISC_11 = get("minecraft:music_disc_11"); - @Nullable public static final ItemType MUSIC_DISC_13 = get("minecraft:music_disc_13"); - @Nullable public static final ItemType MUSIC_DISC_BLOCKS = get("minecraft:music_disc_blocks"); - @Nullable public static final ItemType MUSIC_DISC_CAT = get("minecraft:music_disc_cat"); - @Nullable public static final ItemType MUSIC_DISC_CHIRP = get("minecraft:music_disc_chirp"); - @Nullable public static final ItemType MUSIC_DISC_FAR = get("minecraft:music_disc_far"); - @Nullable public static final ItemType MUSIC_DISC_MALL = get("minecraft:music_disc_mall"); - @Nullable public static final ItemType MUSIC_DISC_MELLOHI = get("minecraft:music_disc_mellohi"); - @Nullable public static final ItemType MUSIC_DISC_STAL = get("minecraft:music_disc_stal"); - @Nullable public static final ItemType MUSIC_DISC_STRAD = get("minecraft:music_disc_strad"); - @Nullable public static final ItemType MUSIC_DISC_WAIT = get("minecraft:music_disc_wait"); - @Nullable public static final ItemType MUSIC_DISC_WARD = get("minecraft:music_disc_ward"); - @Nullable public static final ItemType MUTTON = get("minecraft:mutton"); - @Nullable public static final ItemType MYCELIUM = get("minecraft:mycelium"); - @Nullable public static final ItemType NAME_TAG = get("minecraft:name_tag"); - @Nullable public static final ItemType NAUTILUS_SHELL = get("minecraft:nautilus_shell"); - @Nullable public static final ItemType NETHER_BRICK = get("minecraft:nether_brick"); - @Nullable public static final ItemType NETHER_BRICK_FENCE = get("minecraft:nether_brick_fence"); - @Nullable public static final ItemType NETHER_BRICK_SLAB = get("minecraft:nether_brick_slab"); - @Nullable public static final ItemType NETHER_BRICK_STAIRS = get("minecraft:nether_brick_stairs"); - @Nullable public static final ItemType NETHER_BRICK_WALL = get("minecraft:nether_brick_wall"); - @Nullable public static final ItemType NETHER_BRICKS = get("minecraft:nether_bricks"); - @Nullable public static final ItemType NETHER_QUARTZ_ORE = get("minecraft:nether_quartz_ore"); - @Nullable public static final ItemType NETHER_STAR = get("minecraft:nether_star"); - @Nullable public static final ItemType NETHER_WART = get("minecraft:nether_wart"); - @Nullable public static final ItemType NETHER_WART_BLOCK = get("minecraft:nether_wart_block"); - @Nullable public static final ItemType NETHERRACK = get("minecraft:netherrack"); - @Nullable public static final ItemType NOTE_BLOCK = get("minecraft:note_block"); - @Nullable public static final ItemType OAK_BOAT = get("minecraft:oak_boat"); - @Nullable public static final ItemType OAK_BUTTON = get("minecraft:oak_button"); - @Nullable public static final ItemType OAK_DOOR = get("minecraft:oak_door"); - @Nullable public static final ItemType OAK_FENCE = get("minecraft:oak_fence"); - @Nullable public static final ItemType OAK_FENCE_GATE = get("minecraft:oak_fence_gate"); - @Nullable public static final ItemType OAK_LEAVES = get("minecraft:oak_leaves"); - @Nullable public static final ItemType OAK_LOG = get("minecraft:oak_log"); - @Nullable public static final ItemType OAK_PLANKS = get("minecraft:oak_planks"); - @Nullable public static final ItemType OAK_PRESSURE_PLATE = get("minecraft:oak_pressure_plate"); - @Nullable public static final ItemType OAK_SAPLING = get("minecraft:oak_sapling"); - @Nullable public static final ItemType OAK_SIGN = get("minecraft:oak_sign"); - @Nullable public static final ItemType OAK_SLAB = get("minecraft:oak_slab"); - @Nullable public static final ItemType OAK_STAIRS = get("minecraft:oak_stairs"); - @Nullable public static final ItemType OAK_TRAPDOOR = get("minecraft:oak_trapdoor"); - @Nullable public static final ItemType OAK_WOOD = get("minecraft:oak_wood"); - @Nullable public static final ItemType OBSERVER = get("minecraft:observer"); - @Nullable public static final ItemType OBSIDIAN = get("minecraft:obsidian"); - @Nullable public static final ItemType OCELOT_SPAWN_EGG = get("minecraft:ocelot_spawn_egg"); - @Nullable public static final ItemType ORANGE_BANNER = get("minecraft:orange_banner"); - @Nullable public static final ItemType ORANGE_BED = get("minecraft:orange_bed"); - @Nullable public static final ItemType ORANGE_CARPET = get("minecraft:orange_carpet"); - @Nullable public static final ItemType ORANGE_CONCRETE = get("minecraft:orange_concrete"); - @Nullable public static final ItemType ORANGE_CONCRETE_POWDER = get("minecraft:orange_concrete_powder"); - @Nullable public static final ItemType ORANGE_DYE = get("minecraft:orange_dye"); - @Nullable public static final ItemType ORANGE_GLAZED_TERRACOTTA = get("minecraft:orange_glazed_terracotta"); - @Nullable public static final ItemType ORANGE_SHULKER_BOX = get("minecraft:orange_shulker_box"); - @Nullable public static final ItemType ORANGE_STAINED_GLASS = get("minecraft:orange_stained_glass"); - @Nullable public static final ItemType ORANGE_STAINED_GLASS_PANE = get("minecraft:orange_stained_glass_pane"); - @Nullable public static final ItemType ORANGE_TERRACOTTA = get("minecraft:orange_terracotta"); - @Nullable public static final ItemType ORANGE_TULIP = get("minecraft:orange_tulip"); - @Nullable public static final ItemType ORANGE_WOOL = get("minecraft:orange_wool"); - @Nullable public static final ItemType OXEYE_DAISY = get("minecraft:oxeye_daisy"); - @Nullable public static final ItemType PACKED_ICE = get("minecraft:packed_ice"); - @Nullable public static final ItemType PAINTING = get("minecraft:painting"); - @Nullable public static final ItemType PANDA_SPAWN_EGG = get("minecraft:panda_spawn_egg"); - @Nullable public static final ItemType PAPER = get("minecraft:paper"); - @Nullable public static final ItemType PARROT_SPAWN_EGG = get("minecraft:parrot_spawn_egg"); - @Nullable public static final ItemType PEONY = get("minecraft:peony"); - @Nullable public static final ItemType PETRIFIED_OAK_SLAB = get("minecraft:petrified_oak_slab"); - @Nullable public static final ItemType PHANTOM_MEMBRANE = get("minecraft:phantom_membrane"); - @Nullable public static final ItemType PHANTOM_SPAWN_EGG = get("minecraft:phantom_spawn_egg"); - @Nullable public static final ItemType PIG_SPAWN_EGG = get("minecraft:pig_spawn_egg"); - @Nullable public static final ItemType PILLAGER_SPAWN_EGG = get("minecraft:pillager_spawn_egg"); - @Nullable public static final ItemType PINK_BANNER = get("minecraft:pink_banner"); - @Nullable public static final ItemType PINK_BED = get("minecraft:pink_bed"); - @Nullable public static final ItemType PINK_CARPET = get("minecraft:pink_carpet"); - @Nullable public static final ItemType PINK_CONCRETE = get("minecraft:pink_concrete"); - @Nullable public static final ItemType PINK_CONCRETE_POWDER = get("minecraft:pink_concrete_powder"); - @Nullable public static final ItemType PINK_DYE = get("minecraft:pink_dye"); - @Nullable public static final ItemType PINK_GLAZED_TERRACOTTA = get("minecraft:pink_glazed_terracotta"); - @Nullable public static final ItemType PINK_SHULKER_BOX = get("minecraft:pink_shulker_box"); - @Nullable public static final ItemType PINK_STAINED_GLASS = get("minecraft:pink_stained_glass"); - @Nullable public static final ItemType PINK_STAINED_GLASS_PANE = get("minecraft:pink_stained_glass_pane"); - @Nullable public static final ItemType PINK_TERRACOTTA = get("minecraft:pink_terracotta"); - @Nullable public static final ItemType PINK_TULIP = get("minecraft:pink_tulip"); - @Nullable public static final ItemType PINK_WOOL = get("minecraft:pink_wool"); - @Nullable public static final ItemType PISTON = get("minecraft:piston"); - @Nullable public static final ItemType PLAYER_HEAD = get("minecraft:player_head"); - @Nullable public static final ItemType PODZOL = get("minecraft:podzol"); - @Nullable public static final ItemType POISONOUS_POTATO = get("minecraft:poisonous_potato"); - @Nullable public static final ItemType POLAR_BEAR_SPAWN_EGG = get("minecraft:polar_bear_spawn_egg"); - @Nullable public static final ItemType POLISHED_ANDESITE = get("minecraft:polished_andesite"); - @Nullable public static final ItemType POLISHED_ANDESITE_SLAB = get("minecraft:polished_andesite_slab"); - @Nullable public static final ItemType POLISHED_ANDESITE_STAIRS = get("minecraft:polished_andesite_stairs"); - @Nullable public static final ItemType POLISHED_DIORITE = get("minecraft:polished_diorite"); - @Nullable public static final ItemType POLISHED_DIORITE_SLAB = get("minecraft:polished_diorite_slab"); - @Nullable public static final ItemType POLISHED_DIORITE_STAIRS = get("minecraft:polished_diorite_stairs"); - @Nullable public static final ItemType POLISHED_GRANITE = get("minecraft:polished_granite"); - @Nullable public static final ItemType POLISHED_GRANITE_SLAB = get("minecraft:polished_granite_slab"); - @Nullable public static final ItemType POLISHED_GRANITE_STAIRS = get("minecraft:polished_granite_stairs"); - @Nullable public static final ItemType POPPED_CHORUS_FRUIT = get("minecraft:popped_chorus_fruit"); - @Nullable public static final ItemType POPPY = get("minecraft:poppy"); - @Nullable public static final ItemType PORKCHOP = get("minecraft:porkchop"); - @Nullable public static final ItemType POTATO = get("minecraft:potato"); - @Nullable public static final ItemType POTION = get("minecraft:potion"); - @Nullable public static final ItemType POWERED_RAIL = get("minecraft:powered_rail"); - @Nullable public static final ItemType PRISMARINE = get("minecraft:prismarine"); - @Nullable public static final ItemType PRISMARINE_BRICK_SLAB = get("minecraft:prismarine_brick_slab"); - @Nullable public static final ItemType PRISMARINE_BRICK_STAIRS = get("minecraft:prismarine_brick_stairs"); - @Nullable public static final ItemType PRISMARINE_BRICKS = get("minecraft:prismarine_bricks"); - @Nullable public static final ItemType PRISMARINE_CRYSTALS = get("minecraft:prismarine_crystals"); - @Nullable public static final ItemType PRISMARINE_SHARD = get("minecraft:prismarine_shard"); - @Nullable public static final ItemType PRISMARINE_SLAB = get("minecraft:prismarine_slab"); - @Nullable public static final ItemType PRISMARINE_STAIRS = get("minecraft:prismarine_stairs"); - @Nullable public static final ItemType PRISMARINE_WALL = get("minecraft:prismarine_wall"); - @Nullable public static final ItemType PUFFERFISH = get("minecraft:pufferfish"); - @Nullable public static final ItemType PUFFERFISH_BUCKET = get("minecraft:pufferfish_bucket"); - @Nullable public static final ItemType PUFFERFISH_SPAWN_EGG = get("minecraft:pufferfish_spawn_egg"); - @Nullable public static final ItemType PUMPKIN = get("minecraft:pumpkin"); - @Nullable public static final ItemType PUMPKIN_PIE = get("minecraft:pumpkin_pie"); - @Nullable public static final ItemType PUMPKIN_SEEDS = get("minecraft:pumpkin_seeds"); - @Nullable public static final ItemType PURPLE_BANNER = get("minecraft:purple_banner"); - @Nullable public static final ItemType PURPLE_BED = get("minecraft:purple_bed"); - @Nullable public static final ItemType PURPLE_CARPET = get("minecraft:purple_carpet"); - @Nullable public static final ItemType PURPLE_CONCRETE = get("minecraft:purple_concrete"); - @Nullable public static final ItemType PURPLE_CONCRETE_POWDER = get("minecraft:purple_concrete_powder"); - @Nullable public static final ItemType PURPLE_DYE = get("minecraft:purple_dye"); - @Nullable public static final ItemType PURPLE_GLAZED_TERRACOTTA = get("minecraft:purple_glazed_terracotta"); - @Nullable public static final ItemType PURPLE_SHULKER_BOX = get("minecraft:purple_shulker_box"); - @Nullable public static final ItemType PURPLE_STAINED_GLASS = get("minecraft:purple_stained_glass"); - @Nullable public static final ItemType PURPLE_STAINED_GLASS_PANE = get("minecraft:purple_stained_glass_pane"); - @Nullable public static final ItemType PURPLE_TERRACOTTA = get("minecraft:purple_terracotta"); - @Nullable public static final ItemType PURPLE_WOOL = get("minecraft:purple_wool"); - @Nullable public static final ItemType PURPUR_BLOCK = get("minecraft:purpur_block"); - @Nullable public static final ItemType PURPUR_PILLAR = get("minecraft:purpur_pillar"); - @Nullable public static final ItemType PURPUR_SLAB = get("minecraft:purpur_slab"); - @Nullable public static final ItemType PURPUR_STAIRS = get("minecraft:purpur_stairs"); - @Nullable public static final ItemType QUARTZ = get("minecraft:quartz"); - @Nullable public static final ItemType QUARTZ_BLOCK = get("minecraft:quartz_block"); - @Nullable public static final ItemType QUARTZ_PILLAR = get("minecraft:quartz_pillar"); - @Nullable public static final ItemType QUARTZ_SLAB = get("minecraft:quartz_slab"); - @Nullable public static final ItemType QUARTZ_STAIRS = get("minecraft:quartz_stairs"); - @Nullable public static final ItemType RABBIT = get("minecraft:rabbit"); - @Nullable public static final ItemType RABBIT_FOOT = get("minecraft:rabbit_foot"); - @Nullable public static final ItemType RABBIT_HIDE = get("minecraft:rabbit_hide"); - @Nullable public static final ItemType RABBIT_SPAWN_EGG = get("minecraft:rabbit_spawn_egg"); - @Nullable public static final ItemType RABBIT_STEW = get("minecraft:rabbit_stew"); - @Nullable public static final ItemType RAIL = get("minecraft:rail"); - @Nullable public static final ItemType RAVAGER_SPAWN_EGG = get("minecraft:ravager_spawn_egg"); - @Nullable public static final ItemType RED_BANNER = get("minecraft:red_banner"); - @Nullable public static final ItemType RED_BED = get("minecraft:red_bed"); - @Nullable public static final ItemType RED_CARPET = get("minecraft:red_carpet"); - @Nullable public static final ItemType RED_CONCRETE = get("minecraft:red_concrete"); - @Nullable public static final ItemType RED_CONCRETE_POWDER = get("minecraft:red_concrete_powder"); - @Nullable public static final ItemType RED_DYE = get("minecraft:red_dye"); - @Nullable public static final ItemType RED_GLAZED_TERRACOTTA = get("minecraft:red_glazed_terracotta"); - @Nullable public static final ItemType RED_MUSHROOM = get("minecraft:red_mushroom"); - @Nullable public static final ItemType RED_MUSHROOM_BLOCK = get("minecraft:red_mushroom_block"); - @Nullable public static final ItemType RED_NETHER_BRICK_SLAB = get("minecraft:red_nether_brick_slab"); - @Nullable public static final ItemType RED_NETHER_BRICK_STAIRS = get("minecraft:red_nether_brick_stairs"); - @Nullable public static final ItemType RED_NETHER_BRICK_WALL = get("minecraft:red_nether_brick_wall"); - @Nullable public static final ItemType RED_NETHER_BRICKS = get("minecraft:red_nether_bricks"); - @Nullable public static final ItemType RED_SAND = get("minecraft:red_sand"); - @Nullable public static final ItemType RED_SANDSTONE = get("minecraft:red_sandstone"); - @Nullable public static final ItemType RED_SANDSTONE_SLAB = get("minecraft:red_sandstone_slab"); - @Nullable public static final ItemType RED_SANDSTONE_STAIRS = get("minecraft:red_sandstone_stairs"); - @Nullable public static final ItemType RED_SANDSTONE_WALL = get("minecraft:red_sandstone_wall"); - @Nullable public static final ItemType RED_SHULKER_BOX = get("minecraft:red_shulker_box"); - @Nullable public static final ItemType RED_STAINED_GLASS = get("minecraft:red_stained_glass"); - @Nullable public static final ItemType RED_STAINED_GLASS_PANE = get("minecraft:red_stained_glass_pane"); - @Nullable public static final ItemType RED_TERRACOTTA = get("minecraft:red_terracotta"); - @Nullable public static final ItemType RED_TULIP = get("minecraft:red_tulip"); - @Nullable public static final ItemType RED_WOOL = get("minecraft:red_wool"); - @Nullable public static final ItemType REDSTONE = get("minecraft:redstone"); - @Nullable public static final ItemType REDSTONE_BLOCK = get("minecraft:redstone_block"); - @Nullable public static final ItemType REDSTONE_LAMP = get("minecraft:redstone_lamp"); - @Nullable public static final ItemType REDSTONE_ORE = get("minecraft:redstone_ore"); - @Nullable public static final ItemType REDSTONE_TORCH = get("minecraft:redstone_torch"); - @Nullable public static final ItemType REPEATER = get("minecraft:repeater"); - @Nullable public static final ItemType REPEATING_COMMAND_BLOCK = get("minecraft:repeating_command_block"); - @Nullable public static final ItemType ROSE_BUSH = get("minecraft:rose_bush"); - @Deprecated @Nullable public static final ItemType ROSE_RED = Optional.ofNullable(get("minecraft:rose_red")).orElseGet(() -> (get("minecraft:red_dye"))); - @Nullable public static final ItemType ROTTEN_FLESH = get("minecraft:rotten_flesh"); - @Nullable public static final ItemType SADDLE = get("minecraft:saddle"); - @Nullable public static final ItemType SALMON = get("minecraft:salmon"); - @Nullable public static final ItemType SALMON_BUCKET = get("minecraft:salmon_bucket"); - @Nullable public static final ItemType SALMON_SPAWN_EGG = get("minecraft:salmon_spawn_egg"); - @Nullable public static final ItemType SAND = get("minecraft:sand"); - @Nullable public static final ItemType SANDSTONE = get("minecraft:sandstone"); - @Nullable public static final ItemType SANDSTONE_SLAB = get("minecraft:sandstone_slab"); - @Nullable public static final ItemType SANDSTONE_STAIRS = get("minecraft:sandstone_stairs"); - @Nullable public static final ItemType SANDSTONE_WALL = get("minecraft:sandstone_wall"); - @Nullable public static final ItemType SCAFFOLDING = get("minecraft:scaffolding"); - @Nullable public static final ItemType SCUTE = get("minecraft:scute"); - @Nullable public static final ItemType SEA_LANTERN = get("minecraft:sea_lantern"); - @Nullable public static final ItemType SEA_PICKLE = get("minecraft:sea_pickle"); - @Nullable public static final ItemType SEAGRASS = get("minecraft:seagrass"); - @Nullable public static final ItemType SHEARS = get("minecraft:shears"); - @Nullable public static final ItemType SHEEP_SPAWN_EGG = get("minecraft:sheep_spawn_egg"); - @Nullable public static final ItemType SHIELD = get("minecraft:shield"); - @Nullable public static final ItemType SHULKER_BOX = get("minecraft:shulker_box"); - @Nullable public static final ItemType SHULKER_SHELL = get("minecraft:shulker_shell"); - @Nullable public static final ItemType SHULKER_SPAWN_EGG = get("minecraft:shulker_spawn_egg"); - @Deprecated @Nullable public static final ItemType SIGN = Optional.ofNullable(get("minecraft:sign")).orElseGet(() -> (get("minecraft:oak_sign"))); - @Nullable public static final ItemType SILVERFISH_SPAWN_EGG = get("minecraft:silverfish_spawn_egg"); - @Nullable public static final ItemType SKELETON_HORSE_SPAWN_EGG = get("minecraft:skeleton_horse_spawn_egg"); - @Nullable public static final ItemType SKELETON_SKULL = get("minecraft:skeleton_skull"); - @Nullable public static final ItemType SKELETON_SPAWN_EGG = get("minecraft:skeleton_spawn_egg"); - @Nullable public static final ItemType SKULL_BANNER_PATTERN = get("minecraft:skull_banner_pattern"); - @Nullable public static final ItemType SLIME_BALL = get("minecraft:slime_ball"); - @Nullable public static final ItemType SLIME_BLOCK = get("minecraft:slime_block"); - @Nullable public static final ItemType SLIME_SPAWN_EGG = get("minecraft:slime_spawn_egg"); - @Nullable public static final ItemType SMITHING_TABLE = get("minecraft:smithing_table"); - @Nullable public static final ItemType SMOKER = get("minecraft:smoker"); - @Nullable public static final ItemType SMOOTH_QUARTZ = get("minecraft:smooth_quartz"); - @Nullable public static final ItemType SMOOTH_QUARTZ_SLAB = get("minecraft:smooth_quartz_slab"); - @Nullable public static final ItemType SMOOTH_QUARTZ_STAIRS = get("minecraft:smooth_quartz_stairs"); - @Nullable public static final ItemType SMOOTH_RED_SANDSTONE = get("minecraft:smooth_red_sandstone"); - @Nullable public static final ItemType SMOOTH_RED_SANDSTONE_SLAB = get("minecraft:smooth_red_sandstone_slab"); - @Nullable public static final ItemType SMOOTH_RED_SANDSTONE_STAIRS = get("minecraft:smooth_red_sandstone_stairs"); - @Nullable public static final ItemType SMOOTH_SANDSTONE = get("minecraft:smooth_sandstone"); - @Nullable public static final ItemType SMOOTH_SANDSTONE_SLAB = get("minecraft:smooth_sandstone_slab"); - @Nullable public static final ItemType SMOOTH_SANDSTONE_STAIRS = get("minecraft:smooth_sandstone_stairs"); - @Nullable public static final ItemType SMOOTH_STONE = get("minecraft:smooth_stone"); - @Nullable public static final ItemType SMOOTH_STONE_SLAB = get("minecraft:smooth_stone_slab"); - @Nullable public static final ItemType SNOW = get("minecraft:snow"); - @Nullable public static final ItemType SNOW_BLOCK = get("minecraft:snow_block"); - @Nullable public static final ItemType SNOWBALL = get("minecraft:snowball"); - @Nullable public static final ItemType SOUL_SAND = get("minecraft:soul_sand"); - @Nullable public static final ItemType SPAWNER = get("minecraft:spawner"); - @Nullable public static final ItemType SPECTRAL_ARROW = get("minecraft:spectral_arrow"); - @Nullable public static final ItemType SPIDER_EYE = get("minecraft:spider_eye"); - @Nullable public static final ItemType SPIDER_SPAWN_EGG = get("minecraft:spider_spawn_egg"); - @Nullable public static final ItemType SPLASH_POTION = get("minecraft:splash_potion"); - @Nullable public static final ItemType SPONGE = get("minecraft:sponge"); - @Nullable public static final ItemType SPRUCE_BOAT = get("minecraft:spruce_boat"); - @Nullable public static final ItemType SPRUCE_BUTTON = get("minecraft:spruce_button"); - @Nullable public static final ItemType SPRUCE_DOOR = get("minecraft:spruce_door"); - @Nullable public static final ItemType SPRUCE_FENCE = get("minecraft:spruce_fence"); - @Nullable public static final ItemType SPRUCE_FENCE_GATE = get("minecraft:spruce_fence_gate"); - @Nullable public static final ItemType SPRUCE_LEAVES = get("minecraft:spruce_leaves"); - @Nullable public static final ItemType SPRUCE_LOG = get("minecraft:spruce_log"); - @Nullable public static final ItemType SPRUCE_PLANKS = get("minecraft:spruce_planks"); - @Nullable public static final ItemType SPRUCE_PRESSURE_PLATE = get("minecraft:spruce_pressure_plate"); - @Nullable public static final ItemType SPRUCE_SAPLING = get("minecraft:spruce_sapling"); - @Nullable public static final ItemType SPRUCE_SIGN = get("minecraft:spruce_sign"); - @Nullable public static final ItemType SPRUCE_SLAB = get("minecraft:spruce_slab"); - @Nullable public static final ItemType SPRUCE_STAIRS = get("minecraft:spruce_stairs"); - @Nullable public static final ItemType SPRUCE_TRAPDOOR = get("minecraft:spruce_trapdoor"); - @Nullable public static final ItemType SPRUCE_WOOD = get("minecraft:spruce_wood"); - @Nullable public static final ItemType SQUID_SPAWN_EGG = get("minecraft:squid_spawn_egg"); - @Nullable public static final ItemType STICK = get("minecraft:stick"); - @Nullable public static final ItemType STICKY_PISTON = get("minecraft:sticky_piston"); - @Nullable public static final ItemType STONE = get("minecraft:stone"); - @Nullable public static final ItemType STONE_AXE = get("minecraft:stone_axe"); - @Nullable public static final ItemType STONE_BRICK_SLAB = get("minecraft:stone_brick_slab"); - @Nullable public static final ItemType STONE_BRICK_STAIRS = get("minecraft:stone_brick_stairs"); - @Nullable public static final ItemType STONE_BRICK_WALL = get("minecraft:stone_brick_wall"); - @Nullable public static final ItemType STONE_BRICKS = get("minecraft:stone_bricks"); - @Nullable public static final ItemType STONE_BUTTON = get("minecraft:stone_button"); - @Nullable public static final ItemType STONE_HOE = get("minecraft:stone_hoe"); - @Nullable public static final ItemType STONE_PICKAXE = get("minecraft:stone_pickaxe"); - @Nullable public static final ItemType STONE_PRESSURE_PLATE = get("minecraft:stone_pressure_plate"); - @Nullable public static final ItemType STONE_SHOVEL = get("minecraft:stone_shovel"); - @Nullable public static final ItemType STONE_SLAB = get("minecraft:stone_slab"); - @Nullable public static final ItemType STONE_STAIRS = get("minecraft:stone_stairs"); - @Nullable public static final ItemType STONE_SWORD = get("minecraft:stone_sword"); - @Nullable public static final ItemType STONECUTTER = get("minecraft:stonecutter"); - @Nullable public static final ItemType STRAY_SPAWN_EGG = get("minecraft:stray_spawn_egg"); - @Nullable public static final ItemType STRING = get("minecraft:string"); - @Nullable public static final ItemType STRIPPED_ACACIA_LOG = get("minecraft:stripped_acacia_log"); - @Nullable public static final ItemType STRIPPED_ACACIA_WOOD = get("minecraft:stripped_acacia_wood"); - @Nullable public static final ItemType STRIPPED_BIRCH_LOG = get("minecraft:stripped_birch_log"); - @Nullable public static final ItemType STRIPPED_BIRCH_WOOD = get("minecraft:stripped_birch_wood"); - @Nullable public static final ItemType STRIPPED_DARK_OAK_LOG = get("minecraft:stripped_dark_oak_log"); - @Nullable public static final ItemType STRIPPED_DARK_OAK_WOOD = get("minecraft:stripped_dark_oak_wood"); - @Nullable public static final ItemType STRIPPED_JUNGLE_LOG = get("minecraft:stripped_jungle_log"); - @Nullable public static final ItemType STRIPPED_JUNGLE_WOOD = get("minecraft:stripped_jungle_wood"); - @Nullable public static final ItemType STRIPPED_OAK_LOG = get("minecraft:stripped_oak_log"); - @Nullable public static final ItemType STRIPPED_OAK_WOOD = get("minecraft:stripped_oak_wood"); - @Nullable public static final ItemType STRIPPED_SPRUCE_LOG = get("minecraft:stripped_spruce_log"); - @Nullable public static final ItemType STRIPPED_SPRUCE_WOOD = get("minecraft:stripped_spruce_wood"); - @Nullable public static final ItemType STRUCTURE_BLOCK = get("minecraft:structure_block"); - @Nullable public static final ItemType STRUCTURE_VOID = get("minecraft:structure_void"); - @Nullable public static final ItemType SUGAR = get("minecraft:sugar"); - @Nullable public static final ItemType SUGAR_CANE = get("minecraft:sugar_cane"); - @Nullable public static final ItemType SUNFLOWER = get("minecraft:sunflower"); - @Nullable public static final ItemType SUSPICIOUS_STEW = get("minecraft:suspicious_stew"); - @Nullable public static final ItemType SWEET_BERRIES = get("minecraft:sweet_berries"); - @Nullable public static final ItemType TALL_GRASS = get("minecraft:tall_grass"); - @Nullable public static final ItemType TERRACOTTA = get("minecraft:terracotta"); - @Nullable public static final ItemType TIPPED_ARROW = get("minecraft:tipped_arrow"); - @Nullable public static final ItemType TNT = get("minecraft:tnt"); - @Nullable public static final ItemType TNT_MINECART = get("minecraft:tnt_minecart"); - @Nullable public static final ItemType TORCH = get("minecraft:torch"); - @Nullable public static final ItemType TOTEM_OF_UNDYING = get("minecraft:totem_of_undying"); - @Nullable public static final ItemType TRADER_LLAMA_SPAWN_EGG = get("minecraft:trader_llama_spawn_egg"); - @Nullable public static final ItemType TRAPPED_CHEST = get("minecraft:trapped_chest"); - @Nullable public static final ItemType TRIDENT = get("minecraft:trident"); - @Nullable public static final ItemType TRIPWIRE_HOOK = get("minecraft:tripwire_hook"); - @Nullable public static final ItemType TROPICAL_FISH = get("minecraft:tropical_fish"); - @Nullable public static final ItemType TROPICAL_FISH_BUCKET = get("minecraft:tropical_fish_bucket"); - @Nullable public static final ItemType TROPICAL_FISH_SPAWN_EGG = get("minecraft:tropical_fish_spawn_egg"); - @Nullable public static final ItemType TUBE_CORAL = get("minecraft:tube_coral"); - @Nullable public static final ItemType TUBE_CORAL_BLOCK = get("minecraft:tube_coral_block"); - @Nullable public static final ItemType TUBE_CORAL_FAN = get("minecraft:tube_coral_fan"); - @Nullable public static final ItemType TURTLE_EGG = get("minecraft:turtle_egg"); - @Nullable public static final ItemType TURTLE_HELMET = get("minecraft:turtle_helmet"); - @Nullable public static final ItemType TURTLE_SPAWN_EGG = get("minecraft:turtle_spawn_egg"); - @Nullable public static final ItemType VEX_SPAWN_EGG = get("minecraft:vex_spawn_egg"); - @Nullable public static final ItemType VILLAGER_SPAWN_EGG = get("minecraft:villager_spawn_egg"); - @Nullable public static final ItemType VINDICATOR_SPAWN_EGG = get("minecraft:vindicator_spawn_egg"); - @Nullable public static final ItemType VINE = get("minecraft:vine"); - @Nullable public static final ItemType WANDERING_TRADER_SPAWN_EGG = get("minecraft:wandering_trader_spawn_egg"); - @Nullable public static final ItemType WATER_BUCKET = get("minecraft:water_bucket"); - @Nullable public static final ItemType WET_SPONGE = get("minecraft:wet_sponge"); - @Nullable public static final ItemType WHEAT = get("minecraft:wheat"); - @Nullable public static final ItemType WHEAT_SEEDS = get("minecraft:wheat_seeds"); - @Nullable public static final ItemType WHITE_BANNER = get("minecraft:white_banner"); - @Nullable public static final ItemType WHITE_BED = get("minecraft:white_bed"); - @Nullable public static final ItemType WHITE_CARPET = get("minecraft:white_carpet"); - @Nullable public static final ItemType WHITE_CONCRETE = get("minecraft:white_concrete"); - @Nullable public static final ItemType WHITE_CONCRETE_POWDER = get("minecraft:white_concrete_powder"); - @Nullable public static final ItemType WHITE_DYE = get("minecraft:white_dye"); - @Nullable public static final ItemType WHITE_GLAZED_TERRACOTTA = get("minecraft:white_glazed_terracotta"); - @Nullable public static final ItemType WHITE_SHULKER_BOX = get("minecraft:white_shulker_box"); - @Nullable public static final ItemType WHITE_STAINED_GLASS = get("minecraft:white_stained_glass"); - @Nullable public static final ItemType WHITE_STAINED_GLASS_PANE = get("minecraft:white_stained_glass_pane"); - @Nullable public static final ItemType WHITE_TERRACOTTA = get("minecraft:white_terracotta"); - @Nullable public static final ItemType WHITE_TULIP = get("minecraft:white_tulip"); - @Nullable public static final ItemType WHITE_WOOL = get("minecraft:white_wool"); - @Nullable public static final ItemType WITCH_SPAWN_EGG = get("minecraft:witch_spawn_egg"); - @Nullable public static final ItemType WITHER_ROSE = get("minecraft:wither_rose"); - @Nullable public static final ItemType WITHER_SKELETON_SKULL = get("minecraft:wither_skeleton_skull"); - @Nullable public static final ItemType WITHER_SKELETON_SPAWN_EGG = get("minecraft:wither_skeleton_spawn_egg"); - @Nullable public static final ItemType WOLF_SPAWN_EGG = get("minecraft:wolf_spawn_egg"); - @Nullable public static final ItemType WOODEN_AXE = get("minecraft:wooden_axe"); - @Nullable public static final ItemType WOODEN_HOE = get("minecraft:wooden_hoe"); - @Nullable public static final ItemType WOODEN_PICKAXE = get("minecraft:wooden_pickaxe"); - @Nullable public static final ItemType WOODEN_SHOVEL = get("minecraft:wooden_shovel"); - @Nullable public static final ItemType WOODEN_SWORD = get("minecraft:wooden_sword"); - @Nullable public static final ItemType WRITABLE_BOOK = get("minecraft:writable_book"); - @Nullable public static final ItemType WRITTEN_BOOK = get("minecraft:written_book"); - @Nullable public static final ItemType YELLOW_BANNER = get("minecraft:yellow_banner"); - @Nullable public static final ItemType YELLOW_BED = get("minecraft:yellow_bed"); - @Nullable public static final ItemType YELLOW_CARPET = get("minecraft:yellow_carpet"); - @Nullable public static final ItemType YELLOW_CONCRETE = get("minecraft:yellow_concrete"); - @Nullable public static final ItemType YELLOW_CONCRETE_POWDER = get("minecraft:yellow_concrete_powder"); - @Nullable public static final ItemType YELLOW_DYE = get("minecraft:yellow_dye"); - @Nullable public static final ItemType YELLOW_GLAZED_TERRACOTTA = get("minecraft:yellow_glazed_terracotta"); - @Nullable public static final ItemType YELLOW_SHULKER_BOX = get("minecraft:yellow_shulker_box"); - @Nullable public static final ItemType YELLOW_STAINED_GLASS = get("minecraft:yellow_stained_glass"); - @Nullable public static final ItemType YELLOW_STAINED_GLASS_PANE = get("minecraft:yellow_stained_glass_pane"); - @Nullable public static final ItemType YELLOW_TERRACOTTA = get("minecraft:yellow_terracotta"); - @Nullable public static final ItemType YELLOW_WOOL = get("minecraft:yellow_wool"); - @Nullable public static final ItemType ZOMBIE_HEAD = get("minecraft:zombie_head"); - @Nullable public static final ItemType ZOMBIE_HORSE_SPAWN_EGG = get("minecraft:zombie_horse_spawn_egg"); - @Nullable public static final ItemType ZOMBIE_PIGMAN_SPAWN_EGG = get("minecraft:zombie_pigman_spawn_egg"); - @Nullable public static final ItemType ZOMBIE_SPAWN_EGG = get("minecraft:zombie_spawn_egg"); - @Nullable public static final ItemType ZOMBIE_VILLAGER_SPAWN_EGG = get("minecraft:zombie_villager_spawn_egg"); + @Nullable public static final ItemType ACACIA_BOAT = init(); + @Nullable public static final ItemType ACACIA_BUTTON = init(); + @Nullable public static final ItemType ACACIA_DOOR = init(); + @Nullable public static final ItemType ACACIA_FENCE = init(); + @Nullable public static final ItemType ACACIA_FENCE_GATE = init(); + @Nullable public static final ItemType ACACIA_LEAVES = init(); + @Nullable public static final ItemType ACACIA_LOG = init(); + @Nullable public static final ItemType ACACIA_PLANKS = init(); + @Nullable public static final ItemType ACACIA_PRESSURE_PLATE = init(); + @Nullable public static final ItemType ACACIA_SAPLING = init(); + @Nullable public static final ItemType ACACIA_SIGN = init(); + @Nullable public static final ItemType ACACIA_SLAB = init(); + @Nullable public static final ItemType ACACIA_STAIRS = init(); + @Nullable public static final ItemType ACACIA_TRAPDOOR = init(); + @Nullable public static final ItemType ACACIA_WOOD = init(); + @Nullable public static final ItemType ACTIVATOR_RAIL = init(); + @Nullable public static final ItemType AIR = init(); + @Nullable public static final ItemType ALLIUM = init(); + @Nullable public static final ItemType ANDESITE = init(); + @Nullable public static final ItemType ANDESITE_SLAB = init(); + @Nullable public static final ItemType ANDESITE_STAIRS = init(); + @Nullable public static final ItemType ANDESITE_WALL = init(); + @Nullable public static final ItemType ANVIL = init(); + @Nullable public static final ItemType APPLE = init(); + @Nullable public static final ItemType ARMOR_STAND = init(); + @Nullable public static final ItemType ARROW = init(); + @Nullable public static final ItemType AZURE_BLUET = init(); + @Nullable public static final ItemType BAKED_POTATO = init(); + @Nullable public static final ItemType BAMBOO = init(); + @Nullable public static final ItemType BARREL = init(); + @Nullable public static final ItemType BARRIER = init(); + @Nullable public static final ItemType BAT_SPAWN_EGG = init(); + @Nullable public static final ItemType BEACON = init(); + @Nullable public static final ItemType BEDROCK = init(); + @Nullable public static final ItemType BEEF = init(); + @Nullable public static final ItemType BEETROOT = init(); + @Nullable public static final ItemType BEETROOT_SEEDS = init(); + @Nullable public static final ItemType BEETROOT_SOUP = init(); + @Nullable public static final ItemType BELL = init(); + @Nullable public static final ItemType BIRCH_BOAT = init(); + @Nullable public static final ItemType BIRCH_BUTTON = init(); + @Nullable public static final ItemType BIRCH_DOOR = init(); + @Nullable public static final ItemType BIRCH_FENCE = init(); + @Nullable public static final ItemType BIRCH_FENCE_GATE = init(); + @Nullable public static final ItemType BIRCH_LEAVES = init(); + @Nullable public static final ItemType BIRCH_LOG = init(); + @Nullable public static final ItemType BIRCH_PLANKS = init(); + @Nullable public static final ItemType BIRCH_PRESSURE_PLATE = init(); + @Nullable public static final ItemType BIRCH_SAPLING = init(); + @Nullable public static final ItemType BIRCH_SIGN = init(); + @Nullable public static final ItemType BIRCH_SLAB = init(); + @Nullable public static final ItemType BIRCH_STAIRS = init(); + @Nullable public static final ItemType BIRCH_TRAPDOOR = init(); + @Nullable public static final ItemType BIRCH_WOOD = init(); + @Nullable public static final ItemType BLACK_BANNER = init(); + @Nullable public static final ItemType BLACK_BED = init(); + @Nullable public static final ItemType BLACK_CARPET = init(); + @Nullable public static final ItemType BLACK_CONCRETE = init(); + @Nullable public static final ItemType BLACK_CONCRETE_POWDER = init(); + @Nullable public static final ItemType BLACK_DYE = init(); + @Nullable public static final ItemType BLACK_GLAZED_TERRACOTTA = init(); + @Nullable public static final ItemType BLACK_SHULKER_BOX = init(); + @Nullable public static final ItemType BLACK_STAINED_GLASS = init(); + @Nullable public static final ItemType BLACK_STAINED_GLASS_PANE = init(); + @Nullable public static final ItemType BLACK_TERRACOTTA = init(); + @Nullable public static final ItemType BLACK_WOOL = init(); + @Nullable public static final ItemType BLAST_FURNACE = init(); + @Nullable public static final ItemType BLAZE_POWDER = init(); + @Nullable public static final ItemType BLAZE_ROD = init(); + @Nullable public static final ItemType BLAZE_SPAWN_EGG = init(); + @Nullable public static final ItemType BLUE_BANNER = init(); + @Nullable public static final ItemType BLUE_BED = init(); + @Nullable public static final ItemType BLUE_CARPET = init(); + @Nullable public static final ItemType BLUE_CONCRETE = init(); + @Nullable public static final ItemType BLUE_CONCRETE_POWDER = init(); + @Nullable public static final ItemType BLUE_DYE = init(); + @Nullable public static final ItemType BLUE_GLAZED_TERRACOTTA = init(); + @Nullable public static final ItemType BLUE_ICE = init(); + @Nullable public static final ItemType BLUE_ORCHID = init(); + @Nullable public static final ItemType BLUE_SHULKER_BOX = init(); + @Nullable public static final ItemType BLUE_STAINED_GLASS = init(); + @Nullable public static final ItemType BLUE_STAINED_GLASS_PANE = init(); + @Nullable public static final ItemType BLUE_TERRACOTTA = init(); + @Nullable public static final ItemType BLUE_WOOL = init(); + @Nullable public static final ItemType BONE = init(); + @Nullable public static final ItemType BONE_BLOCK = init(); + @Nullable public static final ItemType BONE_MEAL = init(); + @Nullable public static final ItemType BOOK = init(); + @Nullable public static final ItemType BOOKSHELF = init(); + @Nullable public static final ItemType BOW = init(); + @Nullable public static final ItemType BOWL = init(); + @Nullable public static final ItemType BRAIN_CORAL = init(); + @Nullable public static final ItemType BRAIN_CORAL_BLOCK = init(); + @Nullable public static final ItemType BRAIN_CORAL_FAN = init(); + @Nullable public static final ItemType BREAD = init(); + @Nullable public static final ItemType BREWING_STAND = init(); + @Nullable public static final ItemType BRICK = init(); + @Nullable public static final ItemType BRICK_SLAB = init(); + @Nullable public static final ItemType BRICK_STAIRS = init(); + @Nullable public static final ItemType BRICK_WALL = init(); + @Nullable public static final ItemType BRICKS = init(); + @Nullable public static final ItemType BROWN_BANNER = init(); + @Nullable public static final ItemType BROWN_BED = init(); + @Nullable public static final ItemType BROWN_CARPET = init(); + @Nullable public static final ItemType BROWN_CONCRETE = init(); + @Nullable public static final ItemType BROWN_CONCRETE_POWDER = init(); + @Nullable public static final ItemType BROWN_DYE = init(); + @Nullable public static final ItemType BROWN_GLAZED_TERRACOTTA = init(); + @Nullable public static final ItemType BROWN_MUSHROOM = init(); + @Nullable public static final ItemType BROWN_MUSHROOM_BLOCK = init(); + @Nullable public static final ItemType BROWN_SHULKER_BOX = init(); + @Nullable public static final ItemType BROWN_STAINED_GLASS = init(); + @Nullable public static final ItemType BROWN_STAINED_GLASS_PANE = init(); + @Nullable public static final ItemType BROWN_TERRACOTTA = init(); + @Nullable public static final ItemType BROWN_WOOL = init(); + @Nullable public static final ItemType BUBBLE_CORAL = init(); + @Nullable public static final ItemType BUBBLE_CORAL_BLOCK = init(); + @Nullable public static final ItemType BUBBLE_CORAL_FAN = init(); + @Nullable public static final ItemType BUCKET = init(); + @Nullable public static final ItemType CACTUS = init(); + @Nullable public static final ItemType CAKE = init(); + @Nullable public static final ItemType CAMPFIRE = init(); + @Nullable public static final ItemType CARROT = init(); + @Nullable public static final ItemType CARROT_ON_A_STICK = init(); + @Nullable public static final ItemType CARTOGRAPHY_TABLE = init(); + @Nullable public static final ItemType CARVED_PUMPKIN = init(); + @Nullable public static final ItemType CAT_SPAWN_EGG = init(); + @Nullable public static final ItemType CAULDRON = init(); + @Nullable public static final ItemType CAVE_SPIDER_SPAWN_EGG = init(); + @Nullable public static final ItemType CHAIN_COMMAND_BLOCK = init(); + @Nullable public static final ItemType CHAINMAIL_BOOTS = init(); + @Nullable public static final ItemType CHAINMAIL_CHESTPLATE = init(); + @Nullable public static final ItemType CHAINMAIL_HELMET = init(); + @Nullable public static final ItemType CHAINMAIL_LEGGINGS = init(); + @Nullable public static final ItemType CHARCOAL = init(); + @Nullable public static final ItemType CHEST = init(); + @Nullable public static final ItemType CHEST_MINECART = init(); + @Nullable public static final ItemType CHICKEN = init(); + @Nullable public static final ItemType CHICKEN_SPAWN_EGG = init(); + @Nullable public static final ItemType CHIPPED_ANVIL = init(); + @Nullable public static final ItemType CHISELED_QUARTZ_BLOCK = init(); + @Nullable public static final ItemType CHISELED_RED_SANDSTONE = init(); + @Nullable public static final ItemType CHISELED_SANDSTONE = init(); + @Nullable public static final ItemType CHISELED_STONE_BRICKS = init(); + @Nullable public static final ItemType CHORUS_FLOWER = init(); + @Nullable public static final ItemType CHORUS_FRUIT = init(); + @Nullable public static final ItemType CHORUS_PLANT = init(); + @Nullable public static final ItemType CLAY = init(); + @Nullable public static final ItemType CLAY_BALL = init(); + @Nullable public static final ItemType CLOCK = init(); + @Nullable public static final ItemType COAL = init(); + @Nullable public static final ItemType COAL_BLOCK = init(); + @Nullable public static final ItemType COAL_ORE = init(); + @Nullable public static final ItemType COARSE_DIRT = init(); + @Nullable public static final ItemType COBBLESTONE = init(); + @Nullable public static final ItemType COBBLESTONE_SLAB = init(); + @Nullable public static final ItemType COBBLESTONE_STAIRS = init(); + @Nullable public static final ItemType COBBLESTONE_WALL = init(); + @Nullable public static final ItemType COBWEB = init(); + @Nullable public static final ItemType COCOA_BEANS = init(); + @Nullable public static final ItemType COD = init(); + @Nullable public static final ItemType COD_BUCKET = init(); + @Nullable public static final ItemType COD_SPAWN_EGG = init(); + @Nullable public static final ItemType COMMAND_BLOCK = init(); + @Nullable public static final ItemType COMMAND_BLOCK_MINECART = init(); + @Nullable public static final ItemType COMPARATOR = init(); + @Nullable public static final ItemType COMPASS = init(); + @Nullable public static final ItemType COMPOSTER = init(); + @Nullable public static final ItemType CONDUIT = init(); + @Nullable public static final ItemType COOKED_BEEF = init(); + @Nullable public static final ItemType COOKED_CHICKEN = init(); + @Nullable public static final ItemType COOKED_COD = init(); + @Nullable public static final ItemType COOKED_MUTTON = init(); + @Nullable public static final ItemType COOKED_PORKCHOP = init(); + @Nullable public static final ItemType COOKED_RABBIT = init(); + @Nullable public static final ItemType COOKED_SALMON = init(); + @Nullable public static final ItemType COOKIE = init(); + @Nullable public static final ItemType CORNFLOWER = init(); + @Nullable public static final ItemType COW_SPAWN_EGG = init(); + @Nullable public static final ItemType CRACKED_STONE_BRICKS = init(); + @Nullable public static final ItemType CRAFTING_TABLE = init(); + @Nullable public static final ItemType CREEPER_BANNER_PATTERN = init(); + @Nullable public static final ItemType CREEPER_HEAD = init(); + @Nullable public static final ItemType CREEPER_SPAWN_EGG = init(); + @Nullable public static final ItemType CROSSBOW = init(); + @Nullable public static final ItemType CUT_RED_SANDSTONE = init(); + @Nullable public static final ItemType CUT_RED_SANDSTONE_SLAB = init(); + @Nullable public static final ItemType CUT_SANDSTONE = init(); + @Nullable public static final ItemType CUT_SANDSTONE_SLAB = init(); + @Nullable public static final ItemType CYAN_BANNER = init(); + @Nullable public static final ItemType CYAN_BED = init(); + @Nullable public static final ItemType CYAN_CARPET = init(); + @Nullable public static final ItemType CYAN_CONCRETE = init(); + @Nullable public static final ItemType CYAN_CONCRETE_POWDER = init(); + @Nullable public static final ItemType CYAN_DYE = init(); + @Nullable public static final ItemType CYAN_GLAZED_TERRACOTTA = init(); + @Nullable public static final ItemType CYAN_SHULKER_BOX = init(); + @Nullable public static final ItemType CYAN_STAINED_GLASS = init(); + @Nullable public static final ItemType CYAN_STAINED_GLASS_PANE = init(); + @Nullable public static final ItemType CYAN_TERRACOTTA = init(); + @Nullable public static final ItemType CYAN_WOOL = init(); + @Nullable public static final ItemType DAMAGED_ANVIL = init(); + @Nullable public static final ItemType DANDELION = init(); + @Nullable public static final ItemType DARK_OAK_BOAT = init(); + @Nullable public static final ItemType DARK_OAK_BUTTON = init(); + @Nullable public static final ItemType DARK_OAK_DOOR = init(); + @Nullable public static final ItemType DARK_OAK_FENCE = init(); + @Nullable public static final ItemType DARK_OAK_FENCE_GATE = init(); + @Nullable public static final ItemType DARK_OAK_LEAVES = init(); + @Nullable public static final ItemType DARK_OAK_LOG = init(); + @Nullable public static final ItemType DARK_OAK_PLANKS = init(); + @Nullable public static final ItemType DARK_OAK_PRESSURE_PLATE = init(); + @Nullable public static final ItemType DARK_OAK_SAPLING = init(); + @Nullable public static final ItemType DARK_OAK_SIGN = init(); + @Nullable public static final ItemType DARK_OAK_SLAB = init(); + @Nullable public static final ItemType DARK_OAK_STAIRS = init(); + @Nullable public static final ItemType DARK_OAK_TRAPDOOR = init(); + @Nullable public static final ItemType DARK_OAK_WOOD = init(); + @Nullable public static final ItemType DARK_PRISMARINE = init(); + @Nullable public static final ItemType DARK_PRISMARINE_SLAB = init(); + @Nullable public static final ItemType DARK_PRISMARINE_STAIRS = init(); + @Nullable public static final ItemType DAYLIGHT_DETECTOR = init(); + @Nullable public static final ItemType DEAD_BRAIN_CORAL = init(); + @Nullable public static final ItemType DEAD_BRAIN_CORAL_BLOCK = init(); + @Nullable public static final ItemType DEAD_BRAIN_CORAL_FAN = init(); + @Nullable public static final ItemType DEAD_BUBBLE_CORAL = init(); + @Nullable public static final ItemType DEAD_BUBBLE_CORAL_BLOCK = init(); + @Nullable public static final ItemType DEAD_BUBBLE_CORAL_FAN = init(); + @Nullable public static final ItemType DEAD_BUSH = init(); + @Nullable public static final ItemType DEAD_FIRE_CORAL = init(); + @Nullable public static final ItemType DEAD_FIRE_CORAL_BLOCK = init(); + @Nullable public static final ItemType DEAD_FIRE_CORAL_FAN = init(); + @Nullable public static final ItemType DEAD_HORN_CORAL = init(); + @Nullable public static final ItemType DEAD_HORN_CORAL_BLOCK = init(); + @Nullable public static final ItemType DEAD_HORN_CORAL_FAN = init(); + @Nullable public static final ItemType DEAD_TUBE_CORAL = init(); + @Nullable public static final ItemType DEAD_TUBE_CORAL_BLOCK = init(); + @Nullable public static final ItemType DEAD_TUBE_CORAL_FAN = init(); + @Nullable public static final ItemType DEBUG_STICK = init(); + @Nullable public static final ItemType DETECTOR_RAIL = init(); + @Nullable public static final ItemType DIAMOND = init(); + @Nullable public static final ItemType DIAMOND_AXE = init(); + @Nullable public static final ItemType DIAMOND_BLOCK = init(); + @Nullable public static final ItemType DIAMOND_BOOTS = init(); + @Nullable public static final ItemType DIAMOND_CHESTPLATE = init(); + @Nullable public static final ItemType DIAMOND_HELMET = init(); + @Nullable public static final ItemType DIAMOND_HOE = init(); + @Nullable public static final ItemType DIAMOND_HORSE_ARMOR = init(); + @Nullable public static final ItemType DIAMOND_LEGGINGS = init(); + @Nullable public static final ItemType DIAMOND_ORE = init(); + @Nullable public static final ItemType DIAMOND_PICKAXE = init(); + @Nullable public static final ItemType DIAMOND_SHOVEL = init(); + @Nullable public static final ItemType DIAMOND_SWORD = init(); + @Nullable public static final ItemType DIORITE = init(); + @Nullable public static final ItemType DIORITE_SLAB = init(); + @Nullable public static final ItemType DIORITE_STAIRS = init(); + @Nullable public static final ItemType DIORITE_WALL = init(); + @Nullable public static final ItemType DIRT = init(); + @Nullable public static final ItemType DISPENSER = init(); + @Nullable public static final ItemType DOLPHIN_SPAWN_EGG = init(); + @Nullable public static final ItemType DONKEY_SPAWN_EGG = init(); + @Nullable public static final ItemType DRAGON_BREATH = init(); + @Nullable public static final ItemType DRAGON_EGG = init(); + @Nullable public static final ItemType DRAGON_HEAD = init(); + @Nullable public static final ItemType DRIED_KELP = init(); + @Nullable public static final ItemType DRIED_KELP_BLOCK = init(); + @Nullable public static final ItemType DROPPER = init(); + @Nullable public static final ItemType DROWNED_SPAWN_EGG = init(); + @Nullable public static final ItemType EGG = init(); + @Nullable public static final ItemType ELDER_GUARDIAN_SPAWN_EGG = init(); + @Nullable public static final ItemType ELYTRA = init(); + @Nullable public static final ItemType EMERALD = init(); + @Nullable public static final ItemType EMERALD_BLOCK = init(); + @Nullable public static final ItemType EMERALD_ORE = init(); + @Nullable public static final ItemType ENCHANTED_BOOK = init(); + @Nullable public static final ItemType ENCHANTED_GOLDEN_APPLE = init(); + @Nullable public static final ItemType ENCHANTING_TABLE = init(); + @Nullable public static final ItemType END_CRYSTAL = init(); + @Nullable public static final ItemType END_PORTAL_FRAME = init(); + @Nullable public static final ItemType END_ROD = init(); + @Nullable public static final ItemType END_STONE = init(); + @Nullable public static final ItemType END_STONE_BRICK_SLAB = init(); + @Nullable public static final ItemType END_STONE_BRICK_STAIRS = init(); + @Nullable public static final ItemType END_STONE_BRICK_WALL = init(); + @Nullable public static final ItemType END_STONE_BRICKS = init(); + @Nullable public static final ItemType ENDER_CHEST = init(); + @Nullable public static final ItemType ENDER_EYE = init(); + @Nullable public static final ItemType ENDER_PEARL = init(); + @Nullable public static final ItemType ENDERMAN_SPAWN_EGG = init(); + @Nullable public static final ItemType ENDERMITE_SPAWN_EGG = init(); + @Nullable public static final ItemType EVOKER_SPAWN_EGG = init(); + @Nullable public static final ItemType EXPERIENCE_BOTTLE = init(); + @Nullable public static final ItemType FARMLAND = init(); + @Nullable public static final ItemType FEATHER = init(); + @Nullable public static final ItemType FERMENTED_SPIDER_EYE = init(); + @Nullable public static final ItemType FERN = init(); + @Nullable public static final ItemType FILLED_MAP = init(); + @Nullable public static final ItemType FIRE_CHARGE = init(); + @Nullable public static final ItemType FIRE_CORAL = init(); + @Nullable public static final ItemType FIRE_CORAL_BLOCK = init(); + @Nullable public static final ItemType FIRE_CORAL_FAN = init(); + @Nullable public static final ItemType FIREWORK_ROCKET = init(); + @Nullable public static final ItemType FIREWORK_STAR = init(); + @Nullable public static final ItemType FISHING_ROD = init(); + @Nullable public static final ItemType FLETCHING_TABLE = init(); + @Nullable public static final ItemType FLINT = init(); + @Nullable public static final ItemType FLINT_AND_STEEL = init(); + @Nullable public static final ItemType FLOWER_BANNER_PATTERN = init(); + @Nullable public static final ItemType FLOWER_POT = init(); + @Nullable public static final ItemType FOX_SPAWN_EGG = init(); + @Nullable public static final ItemType FURNACE = init(); + @Nullable public static final ItemType FURNACE_MINECART = init(); + @Nullable public static final ItemType GHAST_SPAWN_EGG = init(); + @Nullable public static final ItemType GHAST_TEAR = init(); + @Nullable public static final ItemType GLASS = init(); + @Nullable public static final ItemType GLASS_BOTTLE = init(); + @Nullable public static final ItemType GLASS_PANE = init(); + @Nullable public static final ItemType GLISTERING_MELON_SLICE = init(); + @Nullable public static final ItemType GLOBE_BANNER_PATTERN = init(); + @Nullable public static final ItemType GLOWSTONE = init(); + @Nullable public static final ItemType GLOWSTONE_DUST = init(); + @Nullable public static final ItemType GOLD_BLOCK = init(); + @Nullable public static final ItemType GOLD_INGOT = init(); + @Nullable public static final ItemType GOLD_NUGGET = init(); + @Nullable public static final ItemType GOLD_ORE = init(); + @Nullable public static final ItemType GOLDEN_APPLE = init(); + @Nullable public static final ItemType GOLDEN_AXE = init(); + @Nullable public static final ItemType GOLDEN_BOOTS = init(); + @Nullable public static final ItemType GOLDEN_CARROT = init(); + @Nullable public static final ItemType GOLDEN_CHESTPLATE = init(); + @Nullable public static final ItemType GOLDEN_HELMET = init(); + @Nullable public static final ItemType GOLDEN_HOE = init(); + @Nullable public static final ItemType GOLDEN_HORSE_ARMOR = init(); + @Nullable public static final ItemType GOLDEN_LEGGINGS = init(); + @Nullable public static final ItemType GOLDEN_PICKAXE = init(); + @Nullable public static final ItemType GOLDEN_SHOVEL = init(); + @Nullable public static final ItemType GOLDEN_SWORD = init(); + @Nullable public static final ItemType GRANITE = init(); + @Nullable public static final ItemType GRANITE_SLAB = init(); + @Nullable public static final ItemType GRANITE_STAIRS = init(); + @Nullable public static final ItemType GRANITE_WALL = init(); + @Nullable public static final ItemType GRASS = init(); + @Nullable public static final ItemType GRASS_BLOCK = init(); + @Nullable public static final ItemType GRASS_PATH = init(); + @Nullable public static final ItemType GRAVEL = init(); + @Nullable public static final ItemType GRAY_BANNER = init(); + @Nullable public static final ItemType GRAY_BED = init(); + @Nullable public static final ItemType GRAY_CARPET = init(); + @Nullable public static final ItemType GRAY_CONCRETE = init(); + @Nullable public static final ItemType GRAY_CONCRETE_POWDER = init(); + @Nullable public static final ItemType GRAY_DYE = init(); + @Nullable public static final ItemType GRAY_GLAZED_TERRACOTTA = init(); + @Nullable public static final ItemType GRAY_SHULKER_BOX = init(); + @Nullable public static final ItemType GRAY_STAINED_GLASS = init(); + @Nullable public static final ItemType GRAY_STAINED_GLASS_PANE = init(); + @Nullable public static final ItemType GRAY_TERRACOTTA = init(); + @Nullable public static final ItemType GRAY_WOOL = init(); + @Nullable public static final ItemType GREEN_BANNER = init(); + @Nullable public static final ItemType GREEN_BED = init(); + @Nullable public static final ItemType GREEN_CARPET = init(); + @Nullable public static final ItemType GREEN_CONCRETE = init(); + @Nullable public static final ItemType GREEN_CONCRETE_POWDER = init(); + @Nullable public static final ItemType GREEN_DYE = init(); + @Nullable public static final ItemType GREEN_GLAZED_TERRACOTTA = init(); + @Nullable public static final ItemType GREEN_SHULKER_BOX = init(); + @Nullable public static final ItemType GREEN_STAINED_GLASS = init(); + @Nullable public static final ItemType GREEN_STAINED_GLASS_PANE = init(); + @Nullable public static final ItemType GREEN_TERRACOTTA = init(); + @Nullable public static final ItemType GREEN_WOOL = init(); + @Nullable public static final ItemType GRINDSTONE = init(); + @Nullable public static final ItemType GUARDIAN_SPAWN_EGG = init(); + @Nullable public static final ItemType GUNPOWDER = init(); + @Nullable public static final ItemType HAY_BLOCK = init(); + @Nullable public static final ItemType HEART_OF_THE_SEA = init(); + @Nullable public static final ItemType HEAVY_WEIGHTED_PRESSURE_PLATE = init(); + @Nullable public static final ItemType HOPPER = init(); + @Nullable public static final ItemType HOPPER_MINECART = init(); + @Nullable public static final ItemType HORN_CORAL = init(); + @Nullable public static final ItemType HORN_CORAL_BLOCK = init(); + @Nullable public static final ItemType HORN_CORAL_FAN = init(); + @Nullable public static final ItemType HORSE_SPAWN_EGG = init(); + @Nullable public static final ItemType HUSK_SPAWN_EGG = init(); + @Nullable public static final ItemType ICE = init(); + @Nullable public static final ItemType INFESTED_CHISELED_STONE_BRICKS = init(); + @Nullable public static final ItemType INFESTED_COBBLESTONE = init(); + @Nullable public static final ItemType INFESTED_CRACKED_STONE_BRICKS = init(); + @Nullable public static final ItemType INFESTED_MOSSY_STONE_BRICKS = init(); + @Nullable public static final ItemType INFESTED_STONE = init(); + @Nullable public static final ItemType INFESTED_STONE_BRICKS = init(); + @Nullable public static final ItemType INK_SAC = init(); + @Nullable public static final ItemType IRON_AXE = init(); + @Nullable public static final ItemType IRON_BARS = init(); + @Nullable public static final ItemType IRON_BLOCK = init(); + @Nullable public static final ItemType IRON_BOOTS = init(); + @Nullable public static final ItemType IRON_CHESTPLATE = init(); + @Nullable public static final ItemType IRON_DOOR = init(); + @Nullable public static final ItemType IRON_HELMET = init(); + @Nullable public static final ItemType IRON_HOE = init(); + @Nullable public static final ItemType IRON_HORSE_ARMOR = init(); + @Nullable public static final ItemType IRON_INGOT = init(); + @Nullable public static final ItemType IRON_LEGGINGS = init(); + @Nullable public static final ItemType IRON_NUGGET = init(); + @Nullable public static final ItemType IRON_ORE = init(); + @Nullable public static final ItemType IRON_PICKAXE = init(); + @Nullable public static final ItemType IRON_SHOVEL = init(); + @Nullable public static final ItemType IRON_SWORD = init(); + @Nullable public static final ItemType IRON_TRAPDOOR = init(); + @Nullable public static final ItemType ITEM_FRAME = init(); + @Nullable public static final ItemType JACK_O_LANTERN = init(); + @Nullable public static final ItemType JIGSAW = init(); + @Nullable public static final ItemType JUKEBOX = init(); + @Nullable public static final ItemType JUNGLE_BOAT = init(); + @Nullable public static final ItemType JUNGLE_BUTTON = init(); + @Nullable public static final ItemType JUNGLE_DOOR = init(); + @Nullable public static final ItemType JUNGLE_FENCE = init(); + @Nullable public static final ItemType JUNGLE_FENCE_GATE = init(); + @Nullable public static final ItemType JUNGLE_LEAVES = init(); + @Nullable public static final ItemType JUNGLE_LOG = init(); + @Nullable public static final ItemType JUNGLE_PLANKS = init(); + @Nullable public static final ItemType JUNGLE_PRESSURE_PLATE = init(); + @Nullable public static final ItemType JUNGLE_SAPLING = init(); + @Nullable public static final ItemType JUNGLE_SIGN = init(); + @Nullable public static final ItemType JUNGLE_SLAB = init(); + @Nullable public static final ItemType JUNGLE_STAIRS = init(); + @Nullable public static final ItemType JUNGLE_TRAPDOOR = init(); + @Nullable public static final ItemType JUNGLE_WOOD = init(); + @Nullable public static final ItemType KELP = init(); + @Nullable public static final ItemType KNOWLEDGE_BOOK = init(); + @Nullable public static final ItemType LADDER = init(); + @Nullable public static final ItemType LANTERN = init(); + @Nullable public static final ItemType LAPIS_BLOCK = init(); + @Nullable public static final ItemType LAPIS_LAZULI = init(); + @Nullable public static final ItemType LAPIS_ORE = init(); + @Nullable public static final ItemType LARGE_FERN = init(); + @Nullable public static final ItemType LAVA_BUCKET = init(); + @Nullable public static final ItemType LEAD = init(); + @Nullable public static final ItemType LEATHER = init(); + @Nullable public static final ItemType LEATHER_BOOTS = init(); + @Nullable public static final ItemType LEATHER_CHESTPLATE = init(); + @Nullable public static final ItemType LEATHER_HELMET = init(); + @Nullable public static final ItemType LEATHER_HORSE_ARMOR = init(); + @Nullable public static final ItemType LEATHER_LEGGINGS = init(); + @Nullable public static final ItemType LECTERN = init(); + @Nullable public static final ItemType LEVER = init(); + @Nullable public static final ItemType LIGHT_BLUE_BANNER = init(); + @Nullable public static final ItemType LIGHT_BLUE_BED = init(); + @Nullable public static final ItemType LIGHT_BLUE_CARPET = init(); + @Nullable public static final ItemType LIGHT_BLUE_CONCRETE = init(); + @Nullable public static final ItemType LIGHT_BLUE_CONCRETE_POWDER = init(); + @Nullable public static final ItemType LIGHT_BLUE_DYE = init(); + @Nullable public static final ItemType LIGHT_BLUE_GLAZED_TERRACOTTA = init(); + @Nullable public static final ItemType LIGHT_BLUE_SHULKER_BOX = init(); + @Nullable public static final ItemType LIGHT_BLUE_STAINED_GLASS = init(); + @Nullable public static final ItemType LIGHT_BLUE_STAINED_GLASS_PANE = init(); + @Nullable public static final ItemType LIGHT_BLUE_TERRACOTTA = init(); + @Nullable public static final ItemType LIGHT_BLUE_WOOL = init(); + @Nullable public static final ItemType LIGHT_GRAY_BANNER = init(); + @Nullable public static final ItemType LIGHT_GRAY_BED = init(); + @Nullable public static final ItemType LIGHT_GRAY_CARPET = init(); + @Nullable public static final ItemType LIGHT_GRAY_CONCRETE = init(); + @Nullable public static final ItemType LIGHT_GRAY_CONCRETE_POWDER = init(); + @Nullable public static final ItemType LIGHT_GRAY_DYE = init(); + @Nullable public static final ItemType LIGHT_GRAY_GLAZED_TERRACOTTA = init(); + @Nullable public static final ItemType LIGHT_GRAY_SHULKER_BOX = init(); + @Nullable public static final ItemType LIGHT_GRAY_STAINED_GLASS = init(); + @Nullable public static final ItemType LIGHT_GRAY_STAINED_GLASS_PANE = init(); + @Nullable public static final ItemType LIGHT_GRAY_TERRACOTTA = init(); + @Nullable public static final ItemType LIGHT_GRAY_WOOL = init(); + @Nullable public static final ItemType LIGHT_WEIGHTED_PRESSURE_PLATE = init(); + @Nullable public static final ItemType LILAC = init(); + @Nullable public static final ItemType LILY_OF_THE_VALLEY = init(); + @Nullable public static final ItemType LILY_PAD = init(); + @Nullable public static final ItemType LIME_BANNER = init(); + @Nullable public static final ItemType LIME_BED = init(); + @Nullable public static final ItemType LIME_CARPET = init(); + @Nullable public static final ItemType LIME_CONCRETE = init(); + @Nullable public static final ItemType LIME_CONCRETE_POWDER = init(); + @Nullable public static final ItemType LIME_DYE = init(); + @Nullable public static final ItemType LIME_GLAZED_TERRACOTTA = init(); + @Nullable public static final ItemType LIME_SHULKER_BOX = init(); + @Nullable public static final ItemType LIME_STAINED_GLASS = init(); + @Nullable public static final ItemType LIME_STAINED_GLASS_PANE = init(); + @Nullable public static final ItemType LIME_TERRACOTTA = init(); + @Nullable public static final ItemType LIME_WOOL = init(); + @Nullable public static final ItemType LINGERING_POTION = init(); + @Nullable public static final ItemType LLAMA_SPAWN_EGG = init(); + @Nullable public static final ItemType LOOM = init(); + @Nullable public static final ItemType MAGENTA_BANNER = init(); + @Nullable public static final ItemType MAGENTA_BED = init(); + @Nullable public static final ItemType MAGENTA_CARPET = init(); + @Nullable public static final ItemType MAGENTA_CONCRETE = init(); + @Nullable public static final ItemType MAGENTA_CONCRETE_POWDER = init(); + @Nullable public static final ItemType MAGENTA_DYE = init(); + @Nullable public static final ItemType MAGENTA_GLAZED_TERRACOTTA = init(); + @Nullable public static final ItemType MAGENTA_SHULKER_BOX = init(); + @Nullable public static final ItemType MAGENTA_STAINED_GLASS = init(); + @Nullable public static final ItemType MAGENTA_STAINED_GLASS_PANE = init(); + @Nullable public static final ItemType MAGENTA_TERRACOTTA = init(); + @Nullable public static final ItemType MAGENTA_WOOL = init(); + @Nullable public static final ItemType MAGMA_BLOCK = init(); + @Nullable public static final ItemType MAGMA_CREAM = init(); + @Nullable public static final ItemType MAGMA_CUBE_SPAWN_EGG = init(); + @Nullable public static final ItemType MAP = init(); + @Nullable public static final ItemType MELON = init(); + @Nullable public static final ItemType MELON_SEEDS = init(); + @Nullable public static final ItemType MELON_SLICE = init(); + @Nullable public static final ItemType MILK_BUCKET = init(); + @Nullable public static final ItemType MINECART = init(); + @Nullable public static final ItemType MOJANG_BANNER_PATTERN = init(); + @Nullable public static final ItemType MOOSHROOM_SPAWN_EGG = init(); + @Nullable public static final ItemType MOSSY_COBBLESTONE = init(); + @Nullable public static final ItemType MOSSY_COBBLESTONE_SLAB = init(); + @Nullable public static final ItemType MOSSY_COBBLESTONE_STAIRS = init(); + @Nullable public static final ItemType MOSSY_COBBLESTONE_WALL = init(); + @Nullable public static final ItemType MOSSY_STONE_BRICK_SLAB = init(); + @Nullable public static final ItemType MOSSY_STONE_BRICK_STAIRS = init(); + @Nullable public static final ItemType MOSSY_STONE_BRICK_WALL = init(); + @Nullable public static final ItemType MOSSY_STONE_BRICKS = init(); + @Nullable public static final ItemType MULE_SPAWN_EGG = init(); + @Nullable public static final ItemType MUSHROOM_STEM = init(); + @Nullable public static final ItemType MUSHROOM_STEW = init(); + @Nullable public static final ItemType MUSIC_DISC_11 = init(); + @Nullable public static final ItemType MUSIC_DISC_13 = init(); + @Nullable public static final ItemType MUSIC_DISC_BLOCKS = init(); + @Nullable public static final ItemType MUSIC_DISC_CAT = init(); + @Nullable public static final ItemType MUSIC_DISC_CHIRP = init(); + @Nullable public static final ItemType MUSIC_DISC_FAR = init(); + @Nullable public static final ItemType MUSIC_DISC_MALL = init(); + @Nullable public static final ItemType MUSIC_DISC_MELLOHI = init(); + @Nullable public static final ItemType MUSIC_DISC_STAL = init(); + @Nullable public static final ItemType MUSIC_DISC_STRAD = init(); + @Nullable public static final ItemType MUSIC_DISC_WAIT = init(); + @Nullable public static final ItemType MUSIC_DISC_WARD = init(); + @Nullable public static final ItemType MUTTON = init(); + @Nullable public static final ItemType MYCELIUM = init(); + @Nullable public static final ItemType NAME_TAG = init(); + @Nullable public static final ItemType NAUTILUS_SHELL = init(); + @Nullable public static final ItemType NETHER_BRICK = init(); + @Nullable public static final ItemType NETHER_BRICK_FENCE = init(); + @Nullable public static final ItemType NETHER_BRICK_SLAB = init(); + @Nullable public static final ItemType NETHER_BRICK_STAIRS = init(); + @Nullable public static final ItemType NETHER_BRICK_WALL = init(); + @Nullable public static final ItemType NETHER_BRICKS = init(); + @Nullable public static final ItemType NETHER_QUARTZ_ORE = init(); + @Nullable public static final ItemType NETHER_STAR = init(); + @Nullable public static final ItemType NETHER_WART = init(); + @Nullable public static final ItemType NETHER_WART_BLOCK = init(); + @Nullable public static final ItemType NETHERRACK = init(); + @Nullable public static final ItemType NOTE_BLOCK = init(); + @Nullable public static final ItemType OAK_BOAT = init(); + @Nullable public static final ItemType OAK_BUTTON = init(); + @Nullable public static final ItemType OAK_DOOR = init(); + @Nullable public static final ItemType OAK_FENCE = init(); + @Nullable public static final ItemType OAK_FENCE_GATE = init(); + @Nullable public static final ItemType OAK_LEAVES = init(); + @Nullable public static final ItemType OAK_LOG = init(); + @Nullable public static final ItemType OAK_PLANKS = init(); + @Nullable public static final ItemType OAK_PRESSURE_PLATE = init(); + @Nullable public static final ItemType OAK_SAPLING = init(); + @Nullable public static final ItemType OAK_SIGN = init(); + @Nullable public static final ItemType OAK_SLAB = init(); + @Nullable public static final ItemType OAK_STAIRS = init(); + @Nullable public static final ItemType OAK_TRAPDOOR = init(); + @Nullable public static final ItemType OAK_WOOD = init(); + @Nullable public static final ItemType OBSERVER = init(); + @Nullable public static final ItemType OBSIDIAN = init(); + @Nullable public static final ItemType OCELOT_SPAWN_EGG = init(); + @Nullable public static final ItemType ORANGE_BANNER = init(); + @Nullable public static final ItemType ORANGE_BED = init(); + @Nullable public static final ItemType ORANGE_CARPET = init(); + @Nullable public static final ItemType ORANGE_CONCRETE = init(); + @Nullable public static final ItemType ORANGE_CONCRETE_POWDER = init(); + @Nullable public static final ItemType ORANGE_DYE = init(); + @Nullable public static final ItemType ORANGE_GLAZED_TERRACOTTA = init(); + @Nullable public static final ItemType ORANGE_SHULKER_BOX = init(); + @Nullable public static final ItemType ORANGE_STAINED_GLASS = init(); + @Nullable public static final ItemType ORANGE_STAINED_GLASS_PANE = init(); + @Nullable public static final ItemType ORANGE_TERRACOTTA = init(); + @Nullable public static final ItemType ORANGE_TULIP = init(); + @Nullable public static final ItemType ORANGE_WOOL = init(); + @Nullable public static final ItemType OXEYE_DAISY = init(); + @Nullable public static final ItemType PACKED_ICE = init(); + @Nullable public static final ItemType PAINTING = init(); + @Nullable public static final ItemType PANDA_SPAWN_EGG = init(); + @Nullable public static final ItemType PAPER = init(); + @Nullable public static final ItemType PARROT_SPAWN_EGG = init(); + @Nullable public static final ItemType PEONY = init(); + @Nullable public static final ItemType PETRIFIED_OAK_SLAB = init(); + @Nullable public static final ItemType PHANTOM_MEMBRANE = init(); + @Nullable public static final ItemType PHANTOM_SPAWN_EGG = init(); + @Nullable public static final ItemType PIG_SPAWN_EGG = init(); + @Nullable public static final ItemType PILLAGER_SPAWN_EGG = init(); + @Nullable public static final ItemType PINK_BANNER = init(); + @Nullable public static final ItemType PINK_BED = init(); + @Nullable public static final ItemType PINK_CARPET = init(); + @Nullable public static final ItemType PINK_CONCRETE = init(); + @Nullable public static final ItemType PINK_CONCRETE_POWDER = init(); + @Nullable public static final ItemType PINK_DYE = init(); + @Nullable public static final ItemType PINK_GLAZED_TERRACOTTA = init(); + @Nullable public static final ItemType PINK_SHULKER_BOX = init(); + @Nullable public static final ItemType PINK_STAINED_GLASS = init(); + @Nullable public static final ItemType PINK_STAINED_GLASS_PANE = init(); + @Nullable public static final ItemType PINK_TERRACOTTA = init(); + @Nullable public static final ItemType PINK_TULIP = init(); + @Nullable public static final ItemType PINK_WOOL = init(); + @Nullable public static final ItemType PISTON = init(); + @Nullable public static final ItemType PLAYER_HEAD = init(); + @Nullable public static final ItemType PODZOL = init(); + @Nullable public static final ItemType POISONOUS_POTATO = init(); + @Nullable public static final ItemType POLAR_BEAR_SPAWN_EGG = init(); + @Nullable public static final ItemType POLISHED_ANDESITE = init(); + @Nullable public static final ItemType POLISHED_ANDESITE_SLAB = init(); + @Nullable public static final ItemType POLISHED_ANDESITE_STAIRS = init(); + @Nullable public static final ItemType POLISHED_DIORITE = init(); + @Nullable public static final ItemType POLISHED_DIORITE_SLAB = init(); + @Nullable public static final ItemType POLISHED_DIORITE_STAIRS = init(); + @Nullable public static final ItemType POLISHED_GRANITE = init(); + @Nullable public static final ItemType POLISHED_GRANITE_SLAB = init(); + @Nullable public static final ItemType POLISHED_GRANITE_STAIRS = init(); + @Nullable public static final ItemType POPPED_CHORUS_FRUIT = init(); + @Nullable public static final ItemType POPPY = init(); + @Nullable public static final ItemType PORKCHOP = init(); + @Nullable public static final ItemType POTATO = init(); + @Nullable public static final ItemType POTION = init(); + @Nullable public static final ItemType POWERED_RAIL = init(); + @Nullable public static final ItemType PRISMARINE = init(); + @Nullable public static final ItemType PRISMARINE_BRICK_SLAB = init(); + @Nullable public static final ItemType PRISMARINE_BRICK_STAIRS = init(); + @Nullable public static final ItemType PRISMARINE_BRICKS = init(); + @Nullable public static final ItemType PRISMARINE_CRYSTALS = init(); + @Nullable public static final ItemType PRISMARINE_SHARD = init(); + @Nullable public static final ItemType PRISMARINE_SLAB = init(); + @Nullable public static final ItemType PRISMARINE_STAIRS = init(); + @Nullable public static final ItemType PRISMARINE_WALL = init(); + @Nullable public static final ItemType PUFFERFISH = init(); + @Nullable public static final ItemType PUFFERFISH_BUCKET = init(); + @Nullable public static final ItemType PUFFERFISH_SPAWN_EGG = init(); + @Nullable public static final ItemType PUMPKIN = init(); + @Nullable public static final ItemType PUMPKIN_PIE = init(); + @Nullable public static final ItemType PUMPKIN_SEEDS = init(); + @Nullable public static final ItemType PURPLE_BANNER = init(); + @Nullable public static final ItemType PURPLE_BED = init(); + @Nullable public static final ItemType PURPLE_CARPET = init(); + @Nullable public static final ItemType PURPLE_CONCRETE = init(); + @Nullable public static final ItemType PURPLE_CONCRETE_POWDER = init(); + @Nullable public static final ItemType PURPLE_DYE = init(); + @Nullable public static final ItemType PURPLE_GLAZED_TERRACOTTA = init(); + @Nullable public static final ItemType PURPLE_SHULKER_BOX = init(); + @Nullable public static final ItemType PURPLE_STAINED_GLASS = init(); + @Nullable public static final ItemType PURPLE_STAINED_GLASS_PANE = init(); + @Nullable public static final ItemType PURPLE_TERRACOTTA = init(); + @Nullable public static final ItemType PURPLE_WOOL = init(); + @Nullable public static final ItemType PURPUR_BLOCK = init(); + @Nullable public static final ItemType PURPUR_PILLAR = init(); + @Nullable public static final ItemType PURPUR_SLAB = init(); + @Nullable public static final ItemType PURPUR_STAIRS = init(); + @Nullable public static final ItemType QUARTZ = init(); + @Nullable public static final ItemType QUARTZ_BLOCK = init(); + @Nullable public static final ItemType QUARTZ_PILLAR = init(); + @Nullable public static final ItemType QUARTZ_SLAB = init(); + @Nullable public static final ItemType QUARTZ_STAIRS = init(); + @Nullable public static final ItemType RABBIT = init(); + @Nullable public static final ItemType RABBIT_FOOT = init(); + @Nullable public static final ItemType RABBIT_HIDE = init(); + @Nullable public static final ItemType RABBIT_SPAWN_EGG = init(); + @Nullable public static final ItemType RABBIT_STEW = init(); + @Nullable public static final ItemType RAIL = init(); + @Nullable public static final ItemType RAVAGER_SPAWN_EGG = init(); + @Nullable public static final ItemType RED_BANNER = init(); + @Nullable public static final ItemType RED_BED = init(); + @Nullable public static final ItemType RED_CARPET = init(); + @Nullable public static final ItemType RED_CONCRETE = init(); + @Nullable public static final ItemType RED_CONCRETE_POWDER = init(); + @Nullable public static final ItemType RED_DYE = init(); + @Nullable public static final ItemType RED_GLAZED_TERRACOTTA = init(); + @Nullable public static final ItemType RED_MUSHROOM = init(); + @Nullable public static final ItemType RED_MUSHROOM_BLOCK = init(); + @Nullable public static final ItemType RED_NETHER_BRICK_SLAB = init(); + @Nullable public static final ItemType RED_NETHER_BRICK_STAIRS = init(); + @Nullable public static final ItemType RED_NETHER_BRICK_WALL = init(); + @Nullable public static final ItemType RED_NETHER_BRICKS = init(); + @Nullable public static final ItemType RED_SAND = init(); + @Nullable public static final ItemType RED_SANDSTONE = init(); + @Nullable public static final ItemType RED_SANDSTONE_SLAB = init(); + @Nullable public static final ItemType RED_SANDSTONE_STAIRS = init(); + @Nullable public static final ItemType RED_SANDSTONE_WALL = init(); + @Nullable public static final ItemType RED_SHULKER_BOX = init(); + @Nullable public static final ItemType RED_STAINED_GLASS = init(); + @Nullable public static final ItemType RED_STAINED_GLASS_PANE = init(); + @Nullable public static final ItemType RED_TERRACOTTA = init(); + @Nullable public static final ItemType RED_TULIP = init(); + @Nullable public static final ItemType RED_WOOL = init(); + @Nullable public static final ItemType REDSTONE = init(); + @Nullable public static final ItemType REDSTONE_BLOCK = init(); + @Nullable public static final ItemType REDSTONE_LAMP = init(); + @Nullable public static final ItemType REDSTONE_ORE = init(); + @Nullable public static final ItemType REDSTONE_TORCH = init(); + @Nullable public static final ItemType REPEATER = init(); + @Nullable public static final ItemType REPEATING_COMMAND_BLOCK = init(); + @Nullable public static final ItemType ROSE_BUSH = init(); + @Nullable public static final ItemType ROTTEN_FLESH = init(); + @Nullable public static final ItemType SADDLE = init(); + @Nullable public static final ItemType SALMON = init(); + @Nullable public static final ItemType SALMON_BUCKET = init(); + @Nullable public static final ItemType SALMON_SPAWN_EGG = init(); + @Nullable public static final ItemType SAND = init(); + @Nullable public static final ItemType SANDSTONE = init(); + @Nullable public static final ItemType SANDSTONE_SLAB = init(); + @Nullable public static final ItemType SANDSTONE_STAIRS = init(); + @Nullable public static final ItemType SANDSTONE_WALL = init(); + @Nullable public static final ItemType SCAFFOLDING = init(); + @Nullable public static final ItemType SCUTE = init(); + @Nullable public static final ItemType SEA_LANTERN = init(); + @Nullable public static final ItemType SEA_PICKLE = init(); + @Nullable public static final ItemType SEAGRASS = init(); + @Nullable public static final ItemType SHEARS = init(); + @Nullable public static final ItemType SHEEP_SPAWN_EGG = init(); + @Nullable public static final ItemType SHIELD = init(); + @Nullable public static final ItemType SHULKER_BOX = init(); + @Nullable public static final ItemType SHULKER_SHELL = init(); + @Nullable public static final ItemType SHULKER_SPAWN_EGG = init(); + @Nullable public static final ItemType SILVERFISH_SPAWN_EGG = init(); + @Nullable public static final ItemType SKELETON_HORSE_SPAWN_EGG = init(); + @Nullable public static final ItemType SKELETON_SKULL = init(); + @Nullable public static final ItemType SKELETON_SPAWN_EGG = init(); + @Nullable public static final ItemType SKULL_BANNER_PATTERN = init(); + @Nullable public static final ItemType SLIME_BALL = init(); + @Nullable public static final ItemType SLIME_BLOCK = init(); + @Nullable public static final ItemType SLIME_SPAWN_EGG = init(); + @Nullable public static final ItemType SMITHING_TABLE = init(); + @Nullable public static final ItemType SMOKER = init(); + @Nullable public static final ItemType SMOOTH_QUARTZ = init(); + @Nullable public static final ItemType SMOOTH_QUARTZ_SLAB = init(); + @Nullable public static final ItemType SMOOTH_QUARTZ_STAIRS = init(); + @Nullable public static final ItemType SMOOTH_RED_SANDSTONE = init(); + @Nullable public static final ItemType SMOOTH_RED_SANDSTONE_SLAB = init(); + @Nullable public static final ItemType SMOOTH_RED_SANDSTONE_STAIRS = init(); + @Nullable public static final ItemType SMOOTH_SANDSTONE = init(); + @Nullable public static final ItemType SMOOTH_SANDSTONE_SLAB = init(); + @Nullable public static final ItemType SMOOTH_SANDSTONE_STAIRS = init(); + @Nullable public static final ItemType SMOOTH_STONE = init(); + @Nullable public static final ItemType SMOOTH_STONE_SLAB = init(); + @Nullable public static final ItemType SNOW = init(); + @Nullable public static final ItemType SNOW_BLOCK = init(); + @Nullable public static final ItemType SNOWBALL = init(); + @Nullable public static final ItemType SOUL_SAND = init(); + @Nullable public static final ItemType SPAWNER = init(); + @Nullable public static final ItemType SPECTRAL_ARROW = init(); + @Nullable public static final ItemType SPIDER_EYE = init(); + @Nullable public static final ItemType SPIDER_SPAWN_EGG = init(); + @Nullable public static final ItemType SPLASH_POTION = init(); + @Nullable public static final ItemType SPONGE = init(); + @Nullable public static final ItemType SPRUCE_BOAT = init(); + @Nullable public static final ItemType SPRUCE_BUTTON = init(); + @Nullable public static final ItemType SPRUCE_DOOR = init(); + @Nullable public static final ItemType SPRUCE_FENCE = init(); + @Nullable public static final ItemType SPRUCE_FENCE_GATE = init(); + @Nullable public static final ItemType SPRUCE_LEAVES = init(); + @Nullable public static final ItemType SPRUCE_LOG = init(); + @Nullable public static final ItemType SPRUCE_PLANKS = init(); + @Nullable public static final ItemType SPRUCE_PRESSURE_PLATE = init(); + @Nullable public static final ItemType SPRUCE_SAPLING = init(); + @Nullable public static final ItemType SPRUCE_SIGN = init(); + @Nullable public static final ItemType SPRUCE_SLAB = init(); + @Nullable public static final ItemType SPRUCE_STAIRS = init(); + @Nullable public static final ItemType SPRUCE_TRAPDOOR = init(); + @Nullable public static final ItemType SPRUCE_WOOD = init(); + @Nullable public static final ItemType SQUID_SPAWN_EGG = init(); + @Nullable public static final ItemType STICK = init(); + @Nullable public static final ItemType STICKY_PISTON = init(); + @Nullable public static final ItemType STONE = init(); + @Nullable public static final ItemType STONE_AXE = init(); + @Nullable public static final ItemType STONE_BRICK_SLAB = init(); + @Nullable public static final ItemType STONE_BRICK_STAIRS = init(); + @Nullable public static final ItemType STONE_BRICK_WALL = init(); + @Nullable public static final ItemType STONE_BRICKS = init(); + @Nullable public static final ItemType STONE_BUTTON = init(); + @Nullable public static final ItemType STONE_HOE = init(); + @Nullable public static final ItemType STONE_PICKAXE = init(); + @Nullable public static final ItemType STONE_PRESSURE_PLATE = init(); + @Nullable public static final ItemType STONE_SHOVEL = init(); + @Nullable public static final ItemType STONE_SLAB = init(); + @Nullable public static final ItemType STONE_STAIRS = init(); + @Nullable public static final ItemType STONE_SWORD = init(); + @Nullable public static final ItemType STONECUTTER = init(); + @Nullable public static final ItemType STRAY_SPAWN_EGG = init(); + @Nullable public static final ItemType STRING = init(); + @Nullable public static final ItemType STRIPPED_ACACIA_LOG = init(); + @Nullable public static final ItemType STRIPPED_ACACIA_WOOD = init(); + @Nullable public static final ItemType STRIPPED_BIRCH_LOG = init(); + @Nullable public static final ItemType STRIPPED_BIRCH_WOOD = init(); + @Nullable public static final ItemType STRIPPED_DARK_OAK_LOG = init(); + @Nullable public static final ItemType STRIPPED_DARK_OAK_WOOD = init(); + @Nullable public static final ItemType STRIPPED_JUNGLE_LOG = init(); + @Nullable public static final ItemType STRIPPED_JUNGLE_WOOD = init(); + @Nullable public static final ItemType STRIPPED_OAK_LOG = init(); + @Nullable public static final ItemType STRIPPED_OAK_WOOD = init(); + @Nullable public static final ItemType STRIPPED_SPRUCE_LOG = init(); + @Nullable public static final ItemType STRIPPED_SPRUCE_WOOD = init(); + @Nullable public static final ItemType STRUCTURE_BLOCK = init(); + @Nullable public static final ItemType STRUCTURE_VOID = init(); + @Nullable public static final ItemType SUGAR = init(); + @Nullable public static final ItemType SUGAR_CANE = init(); + @Nullable public static final ItemType SUNFLOWER = init(); + @Nullable public static final ItemType SUSPICIOUS_STEW = init(); + @Nullable public static final ItemType SWEET_BERRIES = init(); + @Nullable public static final ItemType TALL_GRASS = init(); + @Nullable public static final ItemType TERRACOTTA = init(); + @Nullable public static final ItemType TIPPED_ARROW = init(); + @Nullable public static final ItemType TNT = init(); + @Nullable public static final ItemType TNT_MINECART = init(); + @Nullable public static final ItemType TORCH = init(); + @Nullable public static final ItemType TOTEM_OF_UNDYING = init(); + @Nullable public static final ItemType TRADER_LLAMA_SPAWN_EGG = init(); + @Nullable public static final ItemType TRAPPED_CHEST = init(); + @Nullable public static final ItemType TRIDENT = init(); + @Nullable public static final ItemType TRIPWIRE_HOOK = init(); + @Nullable public static final ItemType TROPICAL_FISH = init(); + @Nullable public static final ItemType TROPICAL_FISH_BUCKET = init(); + @Nullable public static final ItemType TROPICAL_FISH_SPAWN_EGG = init(); + @Nullable public static final ItemType TUBE_CORAL = init(); + @Nullable public static final ItemType TUBE_CORAL_BLOCK = init(); + @Nullable public static final ItemType TUBE_CORAL_FAN = init(); + @Nullable public static final ItemType TURTLE_EGG = init(); + @Nullable public static final ItemType TURTLE_HELMET = init(); + @Nullable public static final ItemType TURTLE_SPAWN_EGG = init(); + @Nullable public static final ItemType VEX_SPAWN_EGG = init(); + @Nullable public static final ItemType VILLAGER_SPAWN_EGG = init(); + @Nullable public static final ItemType VINDICATOR_SPAWN_EGG = init(); + @Nullable public static final ItemType VINE = init(); + @Nullable public static final ItemType WANDERING_TRADER_SPAWN_EGG = init(); + @Nullable public static final ItemType WATER_BUCKET = init(); + @Nullable public static final ItemType WET_SPONGE = init(); + @Nullable public static final ItemType WHEAT = init(); + @Nullable public static final ItemType WHEAT_SEEDS = init(); + @Nullable public static final ItemType WHITE_BANNER = init(); + @Nullable public static final ItemType WHITE_BED = init(); + @Nullable public static final ItemType WHITE_CARPET = init(); + @Nullable public static final ItemType WHITE_CONCRETE = init(); + @Nullable public static final ItemType WHITE_CONCRETE_POWDER = init(); + @Nullable public static final ItemType WHITE_DYE = init(); + @Nullable public static final ItemType WHITE_GLAZED_TERRACOTTA = init(); + @Nullable public static final ItemType WHITE_SHULKER_BOX = init(); + @Nullable public static final ItemType WHITE_STAINED_GLASS = init(); + @Nullable public static final ItemType WHITE_STAINED_GLASS_PANE = init(); + @Nullable public static final ItemType WHITE_TERRACOTTA = init(); + @Nullable public static final ItemType WHITE_TULIP = init(); + @Nullable public static final ItemType WHITE_WOOL = init(); + @Nullable public static final ItemType WITCH_SPAWN_EGG = init(); + @Nullable public static final ItemType WITHER_ROSE = init(); + @Nullable public static final ItemType WITHER_SKELETON_SKULL = init(); + @Nullable public static final ItemType WITHER_SKELETON_SPAWN_EGG = init(); + @Nullable public static final ItemType WOLF_SPAWN_EGG = init(); + @Nullable public static final ItemType WOODEN_AXE = init(); + @Nullable public static final ItemType WOODEN_HOE = init(); + @Nullable public static final ItemType WOODEN_PICKAXE = init(); + @Nullable public static final ItemType WOODEN_SHOVEL = init(); + @Nullable public static final ItemType WOODEN_SWORD = init(); + @Nullable public static final ItemType WRITABLE_BOOK = init(); + @Nullable public static final ItemType WRITTEN_BOOK = init(); + @Nullable public static final ItemType YELLOW_BANNER = init(); + @Nullable public static final ItemType YELLOW_BED = init(); + @Nullable public static final ItemType YELLOW_CARPET = init(); + @Nullable public static final ItemType YELLOW_CONCRETE = init(); + @Nullable public static final ItemType YELLOW_CONCRETE_POWDER = init(); + @Nullable public static final ItemType YELLOW_DYE = init(); + @Nullable public static final ItemType YELLOW_GLAZED_TERRACOTTA = init(); + @Nullable public static final ItemType YELLOW_SHULKER_BOX = init(); + @Nullable public static final ItemType YELLOW_STAINED_GLASS = init(); + @Nullable public static final ItemType YELLOW_STAINED_GLASS_PANE = init(); + @Nullable public static final ItemType YELLOW_TERRACOTTA = init(); + @Nullable public static final ItemType YELLOW_WOOL = init(); + @Nullable public static final ItemType ZOMBIE_HEAD = init(); + @Nullable public static final ItemType ZOMBIE_HORSE_SPAWN_EGG = init(); + @Nullable public static final ItemType ZOMBIE_PIGMAN_SPAWN_EGG = init(); + @Nullable public static final ItemType ZOMBIE_SPAWN_EGG = init(); + @Nullable public static final ItemType ZOMBIE_VILLAGER_SPAWN_EGG = init(); + + // legacy + @Deprecated @Nullable public static final ItemType CACTUS_GREEN = GREEN_DYE; + @Deprecated @Nullable public static final ItemType DANDELION_YELLOW = YELLOW_DYE; + @Deprecated @Nullable public static final ItemType ROSE_RED = RED_DYE; + @Deprecated @Nullable public static final ItemType SIGN = OAK_SIGN; private ItemTypes() { } + private static Field[] fieldsTmp; + private static JoinedCharSequence joined; + private static int initIndex = 0; + + private static ItemType init() { + try { + if (fieldsTmp == null) { + fieldsTmp = ItemTypes.class.getDeclaredFields(); + ItemTypesCache.init(); // force class to load + joined = new JoinedCharSequence(); + } + String name = fieldsTmp[initIndex++].getName().toLowerCase(Locale.ROOT); + CharSequence fullName = joined.init(ItemType.REGISTRY.getDefaultNamespace(), ':', name); + System.out.println("Name " + fullName + " | " + ItemType.REGISTRY.getMap().get(fullName)); + return ItemType.REGISTRY.getMap().get(fullName); + } catch (Throwable e) { + e.printStackTrace(); + throw e; + } + } + static { + fieldsTmp = null; + joined = null; + } + @Nullable public static ItemType parse(String input) { input = input.toLowerCase(Locale.ROOT); diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/world/registry/BlockRegistry.java b/worldedit-core/src/main/java/com/sk89q/worldedit/world/registry/BlockRegistry.java index 1e8f1ab2c..3dd9bf599 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/world/registry/BlockRegistry.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/world/registry/BlockRegistry.java @@ -77,7 +77,7 @@ public interface BlockRegistry { /** * Register all blocks */ - default Collection registerBlocks() { + default Collection values() { return Collections.emptyList(); } } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/world/registry/ItemRegistry.java b/worldedit-core/src/main/java/com/sk89q/worldedit/world/registry/ItemRegistry.java index c44be9b8c..ae8c9d38e 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/world/registry/ItemRegistry.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/world/registry/ItemRegistry.java @@ -22,6 +22,8 @@ package com.sk89q.worldedit.world.registry; import com.sk89q.worldedit.world.item.ItemType; import javax.annotation.Nullable; +import java.util.Collection; +import java.util.Collections; public interface ItemRegistry { @@ -34,4 +36,10 @@ public interface ItemRegistry { @Nullable String getName(ItemType itemType); + /** + * Register all items + */ + default Collection values() { + return Collections.emptyList(); + } }