package net.minecraft.server;
import com.google.common.collect.Maps;
import com.koloboke.collect.map.hash.HashObjObjMaps;
import java.util.Map;
import javax.annotation.Nullable;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
public class DataInspectorBlockEntity implements DataInspector {
private static final Logger a = LogManager.getLogger();
private static final Map<String, String> b = HashObjObjMaps.newMutableMap();
private static final Map<String, String> c = HashObjObjMaps.newMutableMap();
public DataInspectorBlockEntity() {}
@Nullable
private static String a(int i, String s) {
return i < 515 ? (String) DataInspectorBlockEntity.b.get((new MinecraftKey(s)).toString()) : (String) DataInspectorBlockEntity.c.get((new MinecraftKey(s)).toString());
}
@Override
public NBTTagCompound a(DataConverter dataconverter, NBTTagCompound nbttagcompound, int i) {
if (!nbttagcompound.hasKeyOfType("tag", 10)) {
return nbttagcompound;
} else {
NBTTagCompound nbttagcompound1 = nbttagcompound.getCompound("tag");
if (nbttagcompound1.hasKeyOfType("BlockEntityTag", 10)) {
NBTTagCompound nbttagcompound2 = nbttagcompound1.getCompound("BlockEntityTag");
String s = nbttagcompound.getString("id");
String s1 = a(i, 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: {}", new Object[] { s});
flag = false;
} else {
flag = !nbttagcompound2.hasKey("id");
nbttagcompound2.setString("id", s1);
}
dataconverter.a(DataConverterTypes.BLOCK_ENTITY, nbttagcompound2, i);
if (flag) {
nbttagcompound2.remove("id");
}
}
return nbttagcompound;
}
}
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: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");
}
}