diff --git a/BauSystem/BauSystem_RegionFixed/build.gradle.kts b/BauSystem/BauSystem_RegionFixed/build.gradle.kts index beb90143..ccff9662 100644 --- a/BauSystem/BauSystem_RegionFixed/build.gradle.kts +++ b/BauSystem/BauSystem_RegionFixed/build.gradle.kts @@ -26,8 +26,8 @@ tasks.compileJava { } java { - sourceCompatibility = JavaVersion.VERSION_17 - targetCompatibility = JavaVersion.VERSION_17 + sourceCompatibility = JavaVersion.VERSION_21 + targetCompatibility = JavaVersion.VERSION_21 } dependencies { diff --git a/SpigotCore/SpigotCore_10/build.gradle.kts b/SpigotCore/SpigotCore_10/build.gradle.kts deleted file mode 100644 index cff91969..00000000 --- a/SpigotCore/SpigotCore_10/build.gradle.kts +++ /dev/null @@ -1,28 +0,0 @@ -/* - * This file is a part of the SteamWar software. - * - * Copyright (C) 2025 SteamWar.de-Serverteam - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero 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 Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see . - */ - -plugins { - steamwar.java -} - -dependencies { - compileOnly(project(":SpigotCore:SpigotCore_Main", "default")) - - compileOnly(libs.nms10) -} diff --git a/SpigotCore/SpigotCore_12/build.gradle.kts b/SpigotCore/SpigotCore_12/build.gradle.kts deleted file mode 100644 index 79ec438a..00000000 --- a/SpigotCore/SpigotCore_12/build.gradle.kts +++ /dev/null @@ -1,29 +0,0 @@ -/* - * This file is a part of the SteamWar software. - * - * Copyright (C) 2025 SteamWar.de-Serverteam - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero 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 Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see . - */ - -plugins { - steamwar.java -} - -dependencies { - compileOnly(project(":CommonCore", "default")) - compileOnly(project(":SpigotCore:SpigotCore_Main", "default")) - - compileOnly(libs.nms12) -} diff --git a/SpigotCore/SpigotCore_12/src/de/steamwar/core/LocaleChangeWrapper12.java b/SpigotCore/SpigotCore_12/src/de/steamwar/core/LocaleChangeWrapper12.java deleted file mode 100644 index 718369d4..00000000 --- a/SpigotCore/SpigotCore_12/src/de/steamwar/core/LocaleChangeWrapper12.java +++ /dev/null @@ -1,34 +0,0 @@ -/* - * This file is a part of the SteamWar software. - * - * Copyright (C) 2025 SteamWar.de-Serverteam - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero 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 Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see . - */ - -package de.steamwar.core; - -import de.steamwar.sql.SteamwarUser; -import org.bukkit.event.EventHandler; -import org.bukkit.event.player.PlayerLocaleChangeEvent; - -import java.util.Locale; - -public class LocaleChangeWrapper12 implements LocaleChangeWrapper { - - @EventHandler - private void onLocale(PlayerLocaleChangeEvent event) { - SteamwarUser.get(event.getPlayer().getUniqueId()).setLocale(Locale.forLanguageTag(event.getLocale()), false); - } -} diff --git a/SpigotCore/SpigotCore_14/build.gradle.kts b/SpigotCore/SpigotCore_14/build.gradle.kts deleted file mode 100644 index e4746ba5..00000000 --- a/SpigotCore/SpigotCore_14/build.gradle.kts +++ /dev/null @@ -1,32 +0,0 @@ -/* - * This file is a part of the SteamWar software. - * - * Copyright (C) 2025 SteamWar.de-Serverteam - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero 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 Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see . - */ - -plugins { - steamwar.java -} - -dependencies { - compileOnly(project(":CommonCore", "default")) - compileOnly(project(":SpigotCore:SpigotCore_Main", "default")) - compileOnly(project(":SpigotCore:SpigotCore_8", "default")) - compileOnly(project(":SpigotCore:SpigotCore_9", "default")) - - compileOnly(libs.nms14) - compileOnly(libs.worldedit15) -} diff --git a/SpigotCore/SpigotCore_14/src/de/steamwar/core/FlatteningWrapper14.java b/SpigotCore/SpigotCore_14/src/de/steamwar/core/FlatteningWrapper14.java deleted file mode 100644 index f751cf41..00000000 --- a/SpigotCore/SpigotCore_14/src/de/steamwar/core/FlatteningWrapper14.java +++ /dev/null @@ -1,361 +0,0 @@ -/* - * This file is a part of the SteamWar software. - * - * Copyright (C) 2025 SteamWar.de-Serverteam - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero 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 Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see . - */ - -package de.steamwar.core; - -import de.steamwar.Reflection; -import org.bukkit.Bukkit; -import org.bukkit.Material; -import org.bukkit.NamespacedKey; -import org.bukkit.World; -import org.bukkit.entity.EntityType; -import org.bukkit.entity.Player; -import org.bukkit.inventory.ItemStack; -import org.bukkit.inventory.meta.SkullMeta; - -import java.util.HashMap; -import java.util.Map; -import java.util.Optional; - -public class FlatteningWrapper14 implements FlatteningWrapper.IFlatteningWrapper { - - private static final Map renamedLegacy = new HashMap<>(); - - static{ - renamedLegacy.put("WOOD", Material.OAK_WOOD); - renamedLegacy.put("SAPLING", Material.OAK_SAPLING); - renamedLegacy.put("STATIONARY_WATER", Material.WATER); - renamedLegacy.put("STATIONARY_LAVA", Material.LAVA); - renamedLegacy.put("LOG", Material.OAK_LOG); - renamedLegacy.put("LEAVES", Material.OAK_LEAVES); - renamedLegacy.put("BED_BLOCK", Material.RED_BED); - renamedLegacy.put("BED", Material.RED_BED); - renamedLegacy.put("PISTON_STICKY_BASE", Material.STICKY_PISTON); - renamedLegacy.put("WEB", Material.COBWEB); - renamedLegacy.put("LONG_GRASS", Material.TALL_GRASS); - renamedLegacy.put("PISTON_BASE", Material.PISTON); - renamedLegacy.put("PISTON_EXTENSION", Material.PISTON_HEAD); - renamedLegacy.put("WOOL", Material.WHITE_WOOL); - renamedLegacy.put("PISTON_MOVING_PIECE", Material.MOVING_PISTON); - renamedLegacy.put("YELLOW_FLOWER", Material.DANDELION); - renamedLegacy.put("RED_ROSE", Material.POPPY); - renamedLegacy.put("DOUBLE_STEP", Material.SMOOTH_STONE); - renamedLegacy.put("STEP", Material.SMOOTH_STONE_SLAB); - renamedLegacy.put("MOB_SPAWNER", Material.SPAWNER); - renamedLegacy.put("WOOD_STAIRS", Material.OAK_STAIRS); - renamedLegacy.put("WORKBENCH", Material.CRAFTING_TABLE); - renamedLegacy.put("CROPS", Material.WHEAT_SEEDS); - renamedLegacy.put("SEEDS", Material.WHEAT_SEEDS); - renamedLegacy.put("SOIL", Material.FARMLAND); - renamedLegacy.put("BURNING_FURNACE", Material.FURNACE); - renamedLegacy.put("SIGN_POST", Material.OAK_SIGN); - renamedLegacy.put("SIGN", Material.OAK_SIGN); - renamedLegacy.put("WOODEN_DOOR", Material.OAK_DOOR); - renamedLegacy.put("WOOD_DOOR", Material.OAK_DOOR); - renamedLegacy.put("RAILS", Material.RAIL); - renamedLegacy.put("WALL_SIGN", Material.OAK_WALL_SIGN); - renamedLegacy.put("STONE_PLATE", Material.STONE_PRESSURE_PLATE); - renamedLegacy.put("WOOD_PLATE", Material.OAK_PRESSURE_PLATE); - renamedLegacy.put("GLOWING_REDSTONE_ORE", Material.REDSTONE_ORE); - renamedLegacy.put("REDSTONE_TORCH_OFF", Material.REDSTONE_TORCH); - renamedLegacy.put("REDSTONE_TORCH_ON", Material.REDSTONE_TORCH); - renamedLegacy.put("IRON_DOOR_BLOCK", Material.IRON_DOOR); - renamedLegacy.put("SUGAR_CANE_BLOCK", Material.SUGAR_CANE); - renamedLegacy.put("CAKE_BLOCK", Material.CAKE); - renamedLegacy.put("MELON_BLOCK", Material.MELON); - renamedLegacy.put("BEETROOT_BLOCK", Material.BEETROOT); - renamedLegacy.put("FENCE", Material.OAK_FENCE); - renamedLegacy.put("PORTAL", Material.NETHER_PORTAL); - renamedLegacy.put("DIODE_BLOCK_OFF", Material.REPEATER); - renamedLegacy.put("DIODE_BLOCK_ON", Material.REPEATER); - renamedLegacy.put("DIODE", Material.REPEATER); - renamedLegacy.put("STAINED_GLASS", Material.WHITE_STAINED_GLASS); - renamedLegacy.put("TRAP_DOOR", Material.OAK_TRAPDOOR); - renamedLegacy.put("MONSTER_EGGS", Material.SKELETON_SPAWN_EGG); - renamedLegacy.put("MONSTER_EGG", Material.SKELETON_SPAWN_EGG); - renamedLegacy.put("SMOOTH_BRICK", Material.STONE_BRICKS); - renamedLegacy.put("HUGE_MUSHROOM_1", Material.MUSHROOM_STEM); - renamedLegacy.put("HUGE_MUSHROOM_2", Material.RED_MUSHROOM); - renamedLegacy.put("IRON_FENCE", Material.IRON_BARS); - renamedLegacy.put("THIN_GLASS", Material.GLASS_PANE); - renamedLegacy.put("FENCE_GATE", Material.OAK_FENCE_GATE); - renamedLegacy.put("SMOOTH_STAIRS", Material.STONE_BRICK_STAIRS); - renamedLegacy.put("MYCEL", Material.MYCELIUM); - renamedLegacy.put("WATER_LILY", Material.LILY_PAD); - renamedLegacy.put("NETHER_FENCE", Material.NETHER_BRICK_FENCE); - renamedLegacy.put("NETHER_WARTS", Material.NETHER_WART); - renamedLegacy.put("NETHER_STALK", Material.NETHER_WART); - renamedLegacy.put("ENCHANTMENT_TABLE", Material.ENCHANTING_TABLE); - renamedLegacy.put("ENDER_PORTAL", Material.END_PORTAL); - renamedLegacy.put("ENDER_PORTAL_FRAME", Material.END_PORTAL_FRAME); - renamedLegacy.put("ENDER_STONE", Material.END_STONE); - renamedLegacy.put("REDSTONE_LAMP_OFF", Material.REDSTONE_LAMP); - renamedLegacy.put("REDSTONE_LAMP_ON", Material.REDSTONE_LAMP); - renamedLegacy.put("WOOD_DOUBLE_STEP", Material.OAK_SLAB); - renamedLegacy.put("WOOD_STEP", Material.OAK_SLAB); - renamedLegacy.put("SPRUCE_WOOD_STAIRS", Material.SPRUCE_STAIRS); - renamedLegacy.put("BIRCH_WOOD_STAIRS", Material.BIRCH_STAIRS); - renamedLegacy.put("JUNGLE_WOOD_STAIRS", Material.JUNGLE_STAIRS); - renamedLegacy.put("COMMAND", Material.COMMAND_BLOCK); - renamedLegacy.put("COBBLE_WALL", Material.COBBLESTONE_WALL); - renamedLegacy.put("WOOD_BUTTON", Material.OAK_BUTTON); - renamedLegacy.put("SKULL", Material.SKELETON_SKULL); - renamedLegacy.put("SKULL_ITEM", Material.SKELETON_SKULL); - renamedLegacy.put("GOLD_PLATE", Material.LIGHT_WEIGHTED_PRESSURE_PLATE); - renamedLegacy.put("IRON_PLATE", Material.HEAVY_WEIGHTED_PRESSURE_PLATE); - renamedLegacy.put("REDSTONE_COMPARATOR_OFF", Material.COMPARATOR); - renamedLegacy.put("REDSTONE_COMPARATOR_ON", Material.COMPARATOR); - renamedLegacy.put("REDSTONE_COMPARATOR", Material.COMPARATOR); - renamedLegacy.put("QUARTZ_ORE", Material.QUARTZ); - renamedLegacy.put("STAINED_CLAY", Material.WHITE_TERRACOTTA); - renamedLegacy.put("STAINED_GLASS_PANE", Material.WHITE_STAINED_GLASS_PANE); - renamedLegacy.put("LEAVES_2", Material.ACACIA_LEAVES); - renamedLegacy.put("LOG_2", Material.ACACIA_LOG); - renamedLegacy.put("CARPET", Material.WHITE_CARPET); - renamedLegacy.put("HARD_CLAY", Material.TERRACOTTA); - renamedLegacy.put("DOUBLE_PLANT", Material.SUNFLOWER); - renamedLegacy.put("STANDING_BANNER", Material.WHITE_BANNER); - renamedLegacy.put("BANNER", Material.WHITE_BANNER); - renamedLegacy.put("WALL_BANNER", Material.WHITE_WALL_BANNER); - renamedLegacy.put("DAYLIGHT_DETECTOR_INVERTED", Material.DAYLIGHT_DETECTOR); - renamedLegacy.put("DOUBLE_STONE_SLAB2", Material.RED_SANDSTONE_SLAB); - renamedLegacy.put("STONE_SLAB2", Material.RED_SANDSTONE_SLAB); - renamedLegacy.put("PURPUR_DOUBLE_SLAB", Material.PURPUR_SLAB); - renamedLegacy.put("END_BRICKS", Material.END_STONE_BRICKS); - renamedLegacy.put("COMMAND_REPEATING", Material.REPEATING_COMMAND_BLOCK); - renamedLegacy.put("COMMAND_CHAIN", Material.CHAIN_COMMAND_BLOCK); - renamedLegacy.put("MAGMA", Material.MAGMA_BLOCK); - renamedLegacy.put("RED_NETHER_BRICK", Material.RED_NETHER_BRICKS); - renamedLegacy.put("SILVER_SHULKER_BOX", Material.LIGHT_GRAY_SHULKER_BOX); - renamedLegacy.put("SILVER_GLAZED_TERRACOTTA", Material.LIGHT_GRAY_TERRACOTTA); - renamedLegacy.put("CONCRETE", Material.WHITE_CONCRETE); - renamedLegacy.put("CONCRETE_POWDER", Material.WHITE_CONCRETE_POWDER); - renamedLegacy.put("IRON_SPADE", Material.IRON_SHOVEL); - renamedLegacy.put("WOOD_SWORD", Material.WOODEN_SWORD); - renamedLegacy.put("WOOD_SPADE", Material.WOODEN_SHOVEL); - renamedLegacy.put("WOOD_PICKAXE", Material.WOODEN_PICKAXE); - renamedLegacy.put("WOOD_AXE", Material.WOODEN_AXE); - renamedLegacy.put("STONE_SPADE", Material.STONE_SHOVEL); - renamedLegacy.put("DIAMOND_SPADE", Material.DIAMOND_SHOVEL); - renamedLegacy.put("MUSHROOM_SOUP", Material.MUSHROOM_STEW); - renamedLegacy.put("GOLD_SWORD", Material.GOLDEN_SWORD); - renamedLegacy.put("GOLD_SPADE", Material.GOLDEN_SHOVEL); - renamedLegacy.put("GOLD_PICKAXE", Material.GOLDEN_PICKAXE); - renamedLegacy.put("GOLD_AXE", Material.GOLDEN_AXE); - renamedLegacy.put("SULPHUR", Material.GUNPOWDER); - renamedLegacy.put("WOOD_HOE", Material.WOODEN_HOE); - renamedLegacy.put("GOLD_HOE", Material.GOLDEN_HOE); - renamedLegacy.put("GOLD_HELMET", Material.GOLDEN_HELMET); - renamedLegacy.put("GOLD_CHESTPLATE", Material.GOLDEN_CHESTPLATE); - renamedLegacy.put("GOLD_LEGGINGS", Material.GOLDEN_LEGGINGS); - renamedLegacy.put("GOLD_BOOTS", Material.GOLDEN_BOOTS); - renamedLegacy.put("PORK", Material.PORKCHOP); - renamedLegacy.put("GRILLED_PORK", Material.COOKED_PORKCHOP); - renamedLegacy.put("SNOW_BALL", Material.SNOWBALL); - renamedLegacy.put("BOAT", Material.OAK_BOAT); - renamedLegacy.put("CLAY_BRICK", Material.BRICKS); - renamedLegacy.put("STORAGE_MINECART", Material.CHEST_MINECART); - renamedLegacy.put("POWERED_MINECART", Material.FURNACE_MINECART); - renamedLegacy.put("WATCH", Material.CLOCK); - renamedLegacy.put("RAW_FISH", Material.SALMON); - renamedLegacy.put("COOKED_FISH", Material.COOKED_SALMON); - renamedLegacy.put("INK_SACK", Material.INK_SAC); - renamedLegacy.put("RAW_BEEF", Material.BEEF); - renamedLegacy.put("RAW_CHICKEN", Material.CHICKEN); - renamedLegacy.put("EYE_OF_ENDER", Material.ENDER_EYE); - renamedLegacy.put("SPECKLED_MELON", Material.GLISTERING_MELON_SLICE); - renamedLegacy.put("EXP_BOTTLE", Material.EXPERIENCE_BOTTLE); - renamedLegacy.put("FIREBALL", Material.FIRE_CHARGE); - renamedLegacy.put("BOOK_AND_QUILL", Material.WRITABLE_BOOK); - renamedLegacy.put("FLOWER_POT_ITEM", Material.FLOWER_POT); - renamedLegacy.put("EMPTY_MAP", Material.MAP); - renamedLegacy.put("BREWING_STAND_ITEM", Material.BREWING_STAND); - renamedLegacy.put("CAULDRON_ITEM", Material.CAULDRON); - renamedLegacy.put("CARROT_ITEM", Material.CARROT); - renamedLegacy.put("POTATO_ITEM", Material.POTATO); - renamedLegacy.put("SPRUCE_DOOR_ITEM", Material.SPRUCE_DOOR); - renamedLegacy.put("BIRCH_DOOR_ITEM", Material.BIRCH_DOOR); - renamedLegacy.put("JUNGLE_DOOR_ITEM", Material.JUNGLE_DOOR); - renamedLegacy.put("ACACIA_DOOR_ITEM", Material.ACACIA_DOOR); - renamedLegacy.put("DARK_OAK_DOOR_ITEM", Material.DARK_OAK_DOOR); - renamedLegacy.put("CARROT_STICK", Material.CARROT_ON_A_STICK); - renamedLegacy.put("FIREWORK", Material.FIREWORK_ROCKET); - renamedLegacy.put("FIREWORK_CHARGE", Material.FIREWORK_STAR); - renamedLegacy.put("NETHER_BRICK_ITEM", Material.NETHER_BRICKS); - renamedLegacy.put("EXPLOSIVE_MINECART", Material.TNT_MINECART); - renamedLegacy.put("IRON_BARDING", Material.IRON_HORSE_ARMOR); - renamedLegacy.put("GOLD_BARDING", Material.GOLDEN_HORSE_ARMOR); - renamedLegacy.put("DIAMOND_BARDING", Material.DIAMOND_HORSE_ARMOR); - renamedLegacy.put("LEASH", Material.LEAD); - renamedLegacy.put("COMMAND_MINECART", Material.COMMAND_BLOCK_MINECART); - renamedLegacy.put("CHORUS_FRUIT_POPPED", Material.POPPED_CHORUS_FRUIT); - renamedLegacy.put("DRAGONS_BREATH", Material.DRAGON_BREATH); - renamedLegacy.put("BOAT_SPRUCE", Material.SPRUCE_BOAT); - renamedLegacy.put("BOAT_BIRCH", Material.BIRCH_BOAT); - renamedLegacy.put("BOAT_JUNGLE", Material.JUNGLE_BOAT); - renamedLegacy.put("BOAT_ACACIA", Material.ACACIA_BOAT); - renamedLegacy.put("BOAT_DARK_OAK", Material.DARK_OAK_BOAT); - renamedLegacy.put("TOTEM", Material.TOTEM_OF_UNDYING); - renamedLegacy.put("GOLD_RECORD", Material.MUSIC_DISC_13); - renamedLegacy.put("GREEN_RECORD", Material.MUSIC_DISC_CAT); - renamedLegacy.put("RECORD_3", Material.MUSIC_DISC_BLOCKS); - renamedLegacy.put("RECORD_4", Material.MUSIC_DISC_CHIRP); - renamedLegacy.put("RECORD_5", Material.MUSIC_DISC_FAR); - renamedLegacy.put("RECORD_6", Material.MUSIC_DISC_MALL); - renamedLegacy.put("RECORD_7", Material.MUSIC_DISC_MELLOHI); - renamedLegacy.put("RECORD_8", Material.MUSIC_DISC_STAL); - renamedLegacy.put("RECORD_9", Material.MUSIC_DISC_STRAD); - renamedLegacy.put("RECORD_10", Material.MUSIC_DISC_WARD); - renamedLegacy.put("RECORD_11", Material.MUSIC_DISC_11); - renamedLegacy.put("RECORD_12", Material.MUSIC_DISC_WAIT); - } - - private static final Reflection.Field scoreboardName = Reflection.getField(FlatteningWrapper.scoreboardObjective, Reflection.getClass("net.minecraft.network.chat.Component"), 0); - @Override - public void setScoreboardTitle(Object packet, String title) { - scoreboardName.set(packet, ChatWrapper.impl.stringToChatComponent(title)); - } - - private static final Class scoreActionEnum = Core.getVersion() < 21 ? Reflection.getClass("net.minecraft.server.ServerScoreboard$Method") : null; - private static final Reflection.Field scoreAction = Core.getVersion() < 21 ? Reflection.getField(FlatteningWrapper.scoreboardScore, scoreActionEnum, 0) : null; - private static final Object scoreActionChange = Core.getVersion() < 21 ? scoreActionEnum.getEnumConstants()[0] : null; - - @Override - public void setScoreAction(Object packet) { - scoreAction.set(packet, scoreActionChange); - } - - @Override - public Material getMaterial(String material) { - try{ - return Material.valueOf(material); - }catch(IllegalArgumentException e){ - return renamedLegacy.get(material); - } - } - - @Override - public Material getDye(int colorCode) { - switch(colorCode){ - case 1: - return Material.RED_DYE; - case 2: - return Material.GREEN_DYE; - case 3: - return Material.BROWN_DYE; - case 4: - return Material.LAPIS_LAZULI; - case 5: - return Material.PURPLE_DYE; - case 6: - return Material.CYAN_DYE; - case 7: - return Material.LIGHT_GRAY_DYE; - case 8: - return Material.GRAY_DYE; - case 9: - return Material.PINK_DYE; - case 10: - return Material.LIME_DYE; - case 11: - return Material.YELLOW_DYE; - case 12: - return Material.LIGHT_BLUE_DYE; - case 13: - return Material.MAGENTA_DYE; - case 14: - return Material.ORANGE_DYE; - case 15: - return Material.WHITE_DYE; - default: - return Material.BLACK_DYE; - } - } - - @SuppressWarnings("deprecation") - @Override - public ItemStack setSkullOwner(String player) { - ItemStack head = new ItemStack(Material.PLAYER_HEAD, 1); - SkullMeta headmeta = (SkullMeta) head.getItemMeta(); - assert headmeta != null; - headmeta.setOwningPlayer(Bukkit.getOfflinePlayer(player.startsWith(".") ? player.substring(1) : player)); - headmeta.setDisplayName(player); - head.setItemMeta(headmeta); - return head; - } - - protected static final Class entityPose = Reflection.getClass("net.minecraft.world.entity.Pose"); - protected static final Object standing = entityPose.getEnumConstants()[0]; - protected static final Object swimming = entityPose.getEnumConstants()[3]; - protected static final Object sneaking = entityPose.getEnumConstants()[5]; - @Override - public Object getPose(FlatteningWrapper.EntityPose pose) { - switch (pose) { - case SNEAKING: - return sneaking; - case SWIMMING: - return swimming; - case NORMAL: - default: - return standing; - } - } - - @Override - public void setNamedSpawnPacketDataWatcher(Object packet) { - // field not present - } - - @Override - public Object formatDisplayName(String displayName) { - return displayName != null ? Optional.of(ChatWrapper.impl.stringToChatComponent(displayName)) : Optional.empty(); - } - - private static final Class registryBlocks = Reflection.getClass("net.minecraft.core.DefaultedRegistry"); - private static final Class entityTypes = Reflection.getClass("net.minecraft.world.entity.EntityType"); - private static final Object entityTypesRegistry = Reflection.getField(Reflection.getClass(Core.getVersion() > 18 ? "net.minecraft.core.registries.BuiltInRegistries" : "net.minecraft.core.IRegistry"), registryBlocks, 0, entityTypes).get(null); - private static final Reflection.Method get = Reflection.getMethod(registryBlocks, null, Reflection.getClass("net.minecraft.resources.ResourceLocation")); - private static final Reflection.Field spawnType = Reflection.getField(ProtocolWrapper.spawnPacket, entityTypes, 0); - private static final Reflection.Field spawnLivingType = Core.getVersion() > 18 ? spawnType : Reflection.getField(ProtocolWrapper.spawnLivingPacket, int.class, 1); - private static final Reflection.Method toMinecraft = Reflection.getMethod("org.bukkit.craftbukkit.util.CraftNamespacedKey", "toMinecraft", NamespacedKey.class); - private static final Map types = new HashMap<>(); - static { - types.put(EntityType.ARMOR_STAND, 1); - } - @Override - public void setSpawnPacketType(Object packet, EntityType type) { - if(type.isAlive()) { - spawnLivingType.set(packet, Core.getVersion() > 18 ? get.invoke(entityTypesRegistry, toMinecraft.invoke(null, type.getKey())) : types.get(type)); - } else { - spawnType.set(packet, get.invoke(entityTypesRegistry, toMinecraft.invoke(null, type.getKey()))); - } - } - - @Override - public int getViewDistance(Player player) { - return player.getClientViewDistance(); - } - - private static final Reflection.Method getHandle = Reflection.getMethod("org.bukkit.craftbukkit.CraftWorld", "getHandle"); - private static final Reflection.Method save = Reflection.getMethod("net.minecraft.server.level.ServerLevel", null, Reflection.getClass("net.minecraft.util.ProgressListener"), boolean.class, boolean.class); - @Override - public void syncSave(World world) { - save.invoke(getHandle.invoke(world), null, true, false); - } -} diff --git a/SpigotCore/SpigotCore_14/src/de/steamwar/core/RecipeDiscoverWrapper14.java b/SpigotCore/SpigotCore_14/src/de/steamwar/core/RecipeDiscoverWrapper14.java deleted file mode 100644 index d9b4bf17..00000000 --- a/SpigotCore/SpigotCore_14/src/de/steamwar/core/RecipeDiscoverWrapper14.java +++ /dev/null @@ -1,30 +0,0 @@ -/* - * This file is a part of the SteamWar software. - * - * Copyright (C) 2025 SteamWar.de-Serverteam - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero 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 Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see . - */ - -package de.steamwar.core; - -import org.bukkit.event.EventHandler; -import org.bukkit.event.player.PlayerRecipeDiscoverEvent; - -public class RecipeDiscoverWrapper14 implements RecipeDiscoverWrapper { - @EventHandler - public void onRecipeDiscover(PlayerRecipeDiscoverEvent e) { - e.setCancelled(true); - } -} diff --git a/SpigotCore/SpigotCore_14/src/de/steamwar/core/TrickyTrialsWrapper14.java b/SpigotCore/SpigotCore_14/src/de/steamwar/core/TrickyTrialsWrapper14.java deleted file mode 100644 index 6b337111..00000000 --- a/SpigotCore/SpigotCore_14/src/de/steamwar/core/TrickyTrialsWrapper14.java +++ /dev/null @@ -1,30 +0,0 @@ -/* - * This file is a part of the SteamWar software. - * - * Copyright (C) 2025 SteamWar.de-Serverteam - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero 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 Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see . - */ - -package de.steamwar.core; - -import org.bukkit.Material; - -public class TrickyTrialsWrapper14 extends TrickyTrialsWrapper8 { - - @Override - public Material getTurtleScute() { - return Material.SCUTE; - } -} diff --git a/SpigotCore/SpigotCore_14/src/de/steamwar/core/WorldEditWrapper14.java b/SpigotCore/SpigotCore_14/src/de/steamwar/core/WorldEditWrapper14.java deleted file mode 100644 index b0f0238e..00000000 --- a/SpigotCore/SpigotCore_14/src/de/steamwar/core/WorldEditWrapper14.java +++ /dev/null @@ -1,634 +0,0 @@ -/* - * This file is a part of the SteamWar software. - * - * Copyright (C) 2025 SteamWar.de-Serverteam - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero 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 Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see . - */ - -package de.steamwar.core; - -import com.google.common.collect.ImmutableList; -import com.google.common.collect.Maps; -import com.sk89q.jnbt.*; -import com.sk89q.worldedit.WorldEdit; -import com.sk89q.worldedit.WorldEditException; -import com.sk89q.worldedit.extension.input.InputParseException; -import com.sk89q.worldedit.extension.input.ParserContext; -import com.sk89q.worldedit.extension.platform.Actor; -import com.sk89q.worldedit.extension.platform.Capability; -import com.sk89q.worldedit.extension.platform.Platform; -import com.sk89q.worldedit.extent.clipboard.BlockArrayClipboard; -import com.sk89q.worldedit.extent.clipboard.Clipboard; -import com.sk89q.worldedit.extent.clipboard.io.*; -import com.sk89q.worldedit.extent.clipboard.io.legacycompat.*; -import com.sk89q.worldedit.math.BlockVector3; -import com.sk89q.worldedit.math.Vector3; -import com.sk89q.worldedit.math.transform.Transform; -import com.sk89q.worldedit.regions.CuboidRegion; -import com.sk89q.worldedit.regions.Region; -import com.sk89q.worldedit.session.ClipboardHolder; -import com.sk89q.worldedit.world.DataFixer; -import com.sk89q.worldedit.world.block.BlockState; -import com.sk89q.worldedit.world.block.BlockTypes; -import com.sk89q.worldedit.world.registry.LegacyMapper; -import de.steamwar.sql.NoClipboardException; -import de.steamwar.sql.NodeData; -import org.bukkit.entity.Player; -import org.bukkit.util.Vector; - -import java.io.*; -import java.util.*; -import java.util.stream.Collectors; - -import static com.google.common.base.Preconditions.checkNotNull; - -@SuppressWarnings("removal") -public class WorldEditWrapper14 implements WorldEditWrapper { - - @Override - public InputStream getPlayerClipboard(Player player) { - return WorldEditWrapper.getPlayerClipboard(player, (outputStream, clipboard, clipboardHolder) -> { - ClipboardWriter writer = BuiltInClipboardFormat.SPONGE_SCHEMATIC.getWriter(outputStream); - writer.write(clipboard); - writer.close(); - }); - } - - @Override - public void setPlayerClipboard(Player player, Clipboard clipboard) { - Actor actor = WorldEditWrapper.getWorldEditPlugin().wrapCommandSender(player); - WorldEditWrapper.getWorldEditPlugin().getWorldEdit().getSessionManager().get(actor).setClipboard(new ClipboardHolder(clipboard)); - } - - @Override - public Clipboard getClipboard(NodeData data) throws IOException { - InputStream is = data.schemData(true); - return readClipboard(is, data.getNodeFormat()); - } - - @Override - public Clipboard getClipboard(InputStream inputStream) throws IOException { - return readClipboard(inputStream, getNativeFormat()); - } - - private Clipboard readClipboard(InputStream is, NodeData.SchematicFormat format) throws IOException { - switch (format) { - case SPONGE_V2: - case SPONGE_V3: - return new SpongeSchematicReader(new NBTInputStream(is), this).read(); - case MCEDIT: - return new MCEditSchematicReader(new NBTInputStream(is)).read(); - default: - throw new IOException("This schematic format is currently not supported"); - } - } - - @Override - public org.bukkit.util.Vector getOrigin(Clipboard clipboard) { - return new org.bukkit.util.Vector(clipboard.getOrigin().getX(), clipboard.getOrigin().getY(), clipboard.getOrigin().getZ()); - } - - @Override - public Vector getMinimum(Region region) { - return new Vector(region.getMinimumPoint().getX(), region.getMinimumPoint().getY(), region.getMinimumPoint().getZ()); - } - - @Override - public Vector getMaximum(Region region) { - return new Vector(region.getMaximumPoint().getX(), region.getMaximumPoint().getY(), region.getMaximumPoint().getZ()); - } - - @Override - public Vector applyTransform(Vector vector, Transform transform) { - Vector3 v = Vector3.at(vector.getX(), vector.getY(), vector.getZ()); - v = transform.apply(v); - return new org.bukkit.util.Vector(v.getX(), v.getY(), v.getZ()); - } - - @Override - public NodeData.SchematicFormat getNativeFormat() { - return NodeData.SchematicFormat.SPONGE_V2; - } - - public Map applyDataFixer(DataFixer fixer, int dataVersion, Map values) { - return fixer.fixUp(DataFixer.FixTypes.BLOCK_ENTITY, new CompoundTag(values), dataVersion).getValue(); - } - - private static class MCEditSchematicReader extends NBTSchematicReader { - - private final NBTInputStream inputStream; - private final DataFixer fixer; - private boolean faweSchem = false; - private static final ImmutableList COMPATIBILITY_HANDLERS - = ImmutableList.of( - new SignCompatibilityHandler(), - new FlowerPotCompatibilityHandler(), - new NoteBlockCompatibilityHandler(), - new SkullBlockCompatibilityHandler() - ); - - /** - * Create a new instance. - * - * @param inputStream the input stream to read from - */ - MCEditSchematicReader(NBTInputStream inputStream) { - checkNotNull(inputStream); - this.inputStream = inputStream; - this.fixer = null; - } - - @Override - public Clipboard read() throws IOException { - // Schematic tag - NamedTag rootTag = inputStream.readNamedTag(); - if (!rootTag.getName().equals("Schematic")) { - throw new IOException("Tag 'Schematic' does not exist or is not first"); - } - CompoundTag schematicTag = (CompoundTag) rootTag.getTag(); - - // Check - Map schematic = schematicTag.getValue(); - if (!schematic.containsKey("Blocks")) { - throw new IOException("Schematic file is missing a 'Blocks' tag"); - } - - // Check type of Schematic - String materials = requireTag(schematic, "Materials", StringTag.class).getValue(); - if (!materials.equals("Alpha")) { - throw new IOException("Schematic file is not an Alpha schematic"); - } - - // ==================================================================== - // Metadata - // ==================================================================== - - BlockVector3 origin; - Region region; - - // Get information - short width = requireTag(schematic, "Width", ShortTag.class).getValue(); - short height = requireTag(schematic, "Height", ShortTag.class).getValue(); - short length = requireTag(schematic, "Length", ShortTag.class).getValue(); - - int originX = 0; - int originY = 0; - int originZ = 0; - try { - originX = requireTag(schematic, "WEOriginX", IntTag.class).getValue(); - originY = requireTag(schematic, "WEOriginY", IntTag.class).getValue(); - originZ = requireTag(schematic, "WEOriginZ", IntTag.class).getValue(); - BlockVector3 min = BlockVector3.at(originX, originY, originZ); - - int offsetX = requireTag(schematic, "WEOffsetX", IntTag.class).getValue(); - int offsetY = requireTag(schematic, "WEOffsetY", IntTag.class).getValue(); - int offsetZ = requireTag(schematic, "WEOffsetZ", IntTag.class).getValue(); - BlockVector3 offset = BlockVector3.at(offsetX, offsetY, offsetZ); - - origin = min.subtract(offset); - region = new CuboidRegion(min, min.add(width, height, length).subtract(BlockVector3.ONE)); - } catch (IOException ignored) { - origin = BlockVector3.ZERO; - region = new CuboidRegion(origin, origin.add(width, height, length).subtract(BlockVector3.ONE)); - } - - // ==================================================================== - // Blocks - // ==================================================================== - - // Get blocks - byte[] blockId = requireTag(schematic, "Blocks", ByteArrayTag.class).getValue(); - byte[] blockData = requireTag(schematic, "Data", ByteArrayTag.class).getValue(); - byte[] addId = new byte[0]; - short[] blocks = new short[blockId.length]; // Have to later combine IDs - - // We support 4096 block IDs using the same method as vanilla Minecraft, where - // the highest 4 bits are stored in a separate byte array. - if (schematic.containsKey("AddBlocks")) { - addId = requireTag(schematic, "AddBlocks", ByteArrayTag.class).getValue(); - } - - // Combine the AddBlocks data with the first 8-bit block ID - for (int index = 0; index < blockId.length; index++) { - if ((index >> 1) >= addId.length) { // No corresponding AddBlocks index - blocks[index] = (short) (blockId[index] & 0xFF); - } else { - if ((index & 1) == 0) { - blocks[index] = (short) (((addId[index >> 1] & 0x0F) << 8) + (blockId[index] & 0xFF)); - } else { - blocks[index] = (short) (((addId[index >> 1] & 0xF0) << 4) + (blockId[index] & 0xFF)); - } - } - } - - // Need to pull out tile entities - final ListTag tileEntityTag = getTag(schematic, "TileEntities", ListTag.class); - List tileEntities = tileEntityTag == null ? new ArrayList<>() : tileEntityTag.getValue(); - Map> tileEntitiesMap = new HashMap<>(); - Map blockStates = new HashMap<>(); - - for (Tag tag : tileEntities) { - if (!(tag instanceof CompoundTag)) continue; - CompoundTag t = (CompoundTag) tag; - int x = t.getInt("x"); - int y = t.getInt("y"); - int z = t.getInt("z"); - int index = y * width * length + z * width + x; - if(index < 0 || index >= blocks.length) - faweSchem = true; - } - - for (Tag tag : tileEntities) { - if (!(tag instanceof CompoundTag)) continue; - CompoundTag t = (CompoundTag) tag; - Map values = new HashMap<>(t.getValue()); - String id = t.getString("id"); - values.put("id", new StringTag(convertBlockEntityId(id))); - int x = t.getInt("x"); - int y = t.getInt("y"); - int z = t.getInt("z"); - if(faweSchem){ - x -= originX; - y -= originY; - z -= originZ; - } - - int index = y * width * length + z * width + x; - - try{ - BlockState block = getBlockState(blocks[index], blockData[index]); - BlockState newBlock = block; - if (newBlock != null) { - for (NBTCompatibilityHandler handler : COMPATIBILITY_HANDLERS) { - if (handler.isAffectedBlock(newBlock)) { - newBlock = handler.updateNBT(block, values); - if (newBlock == null || values.isEmpty()) { - break; - } - } - } - } - if (values.isEmpty()) { - t = null; - } else { - t = new CompoundTag(values); - } - - if (fixer != null && t != null) { - t = fixer.fixUp(DataFixer.FixTypes.BLOCK_ENTITY, t, -1); - } - - BlockVector3 vec = BlockVector3.at(x, y, z); - if (t != null) { - tileEntitiesMap.put(vec, t.getValue()); - } - blockStates.put(vec, newBlock); - }catch(ArrayIndexOutOfBoundsException e){ - //ignored - } - } - - BlockArrayClipboard clipboard = new BlockArrayClipboard(region); - clipboard.setOrigin(origin); - - - for (int x = 0; x < width; ++x) { - for (int y = 0; y < height; ++y) { - for (int z = 0; z < length; ++z) { - int index = y * width * length + z * width + x; - BlockVector3 pt = BlockVector3.at(x, y, z); - BlockState state = blockStates.computeIfAbsent(pt, p -> getBlockState(blocks[index], blockData[index])); - - try { - if (state != null) { - if (tileEntitiesMap.containsKey(pt)) { - clipboard.setBlock(region.getMinimumPoint().add(pt), state.toBaseBlock(new CompoundTag(tileEntitiesMap.get(pt)))); - } else { - clipboard.setBlock(region.getMinimumPoint().add(pt), state); - } - } - } catch (WorldEditException ignored) { // BlockArrayClipboard won't throw this - } - } - } - } - - return clipboard; - } - - private String convertBlockEntityId(String id) { - switch (id) { - case "Cauldron": - return "brewing_stand"; - case "Control": - return "command_block"; - case "DLDetector": - return "daylight_detector"; - case "Trap": - return "dispenser"; - case "EnchantTable": - return "enchanting_table"; - case "EndGateway": - return "end_gateway"; - case "AirPortal": - return "end_portal"; - case "EnderChest": - return "ender_chest"; - case "FlowerPot": - return "flower_pot"; - case "RecordPlayer": - return "jukebox"; - case "MobSpawner": - return "mob_spawner"; - case "Music": - case "noteblock": - return "note_block"; - case "Structure": - return "structure_block"; - case "Chest": - return "chest"; - case "Sign": - return "sign"; - case "Banner": - return "banner"; - case "Beacon": - return "beacon"; - case "Comparator": - return "comparator"; - case "Dropper": - return "dropper"; - case "Furnace": - return "furnace"; - case "Hopper": - return "hopper"; - case "Skull": - return "skull"; - default: - return id; - } - } - - private BlockState getBlockState(int id, int data) { - return LegacyMapper.getInstance().getBlockFromLegacy(id, data); - } - - @Override - public void close() throws IOException { - inputStream.close(); - } - } - public static class SpongeSchematicReader extends NBTSchematicReader { - - private final NBTInputStream inputStream; - private DataFixer fixer = null; - private int schematicVersion = -1; - private int dataVersion = -1; - private boolean faweSchem = false; - private final WorldEditWrapper14 wrapper; - - /** - * Create a new instance. - * - * @param inputStream the input stream to read from - */ - public SpongeSchematicReader(NBTInputStream inputStream, WorldEditWrapper14 wrapper) { - checkNotNull(inputStream); - this.inputStream = inputStream; - this.wrapper = wrapper; - } - - @Override - public Clipboard read() throws IOException { - CompoundTag schematicTag = getBaseTag(); - Map schematic = schematicTag.getValue(); - - final Platform platform = WorldEdit.getInstance().getPlatformManager() - .queryCapability(Capability.WORLD_EDITING); - int liveDataVersion = platform.getDataVersion(); - - if (schematicVersion == 1) { - dataVersion = 1631; // this is a relatively safe assumption unless someone imports a schematic from 1.12, e.g. sponge 7.1- - fixer = platform.getDataFixer(); - return readVersion1(schematicTag); - } else if (schematicVersion == 2 || schematicVersion == 3) { - dataVersion = requireTag(schematic, "DataVersion", IntTag.class).getValue(); - if (dataVersion < liveDataVersion) { - fixer = platform.getDataFixer(); - } - - return readVersion1(schematicTag); - } - throw new IOException("This schematic version is currently not supported"); - } - - @Override - public OptionalInt getDataVersion() { - try { - CompoundTag schematicTag = getBaseTag(); - Map schematic = schematicTag.getValue(); - if (schematicVersion == 1) { - return OptionalInt.of(1631); - } else if (schematicVersion == 2) { - return OptionalInt.of(requireTag(schematic, "DataVersion", IntTag.class).getValue()); - } - return OptionalInt.empty(); - } catch (IOException e) { - return OptionalInt.empty(); - } - } - - private CompoundTag getBaseTag() throws IOException { - NamedTag rootTag = inputStream.readNamedTag(); - CompoundTag schematicTag = (CompoundTag) rootTag.getTag(); - - // Check - Map schematic = schematicTag.getValue(); - - if (schematic.size() == 1) { - schematicTag = requireTag(schematic, "Schematic", CompoundTag.class); - schematic = schematicTag.getValue(); - } else if (!rootTag.getName().equals("Schematic")) { - throw new IOException("Tag 'Schematic' does not exist or is not first"); - } - - schematicVersion = requireTag(schematic, "Version", IntTag.class).getValue(); - return schematicTag; - } - - private BlockArrayClipboard readVersion1(CompoundTag schematicTag) throws IOException { - BlockVector3 origin; - Region region; - Map schematic = schematicTag.getValue(); - - int width = requireTag(schematic, "Width", ShortTag.class).getValue(); - int height = requireTag(schematic, "Height", ShortTag.class).getValue(); - int length = requireTag(schematic, "Length", ShortTag.class).getValue(); - - IntArrayTag offsetTag = getTag(schematic, "Offset", IntArrayTag.class); - int[] offsetParts; - if (offsetTag != null) { - offsetParts = offsetTag.getValue(); - if (offsetParts.length != 3) { - throw new IOException("Invalid offset specified in schematic."); - } - } else { - offsetParts = new int[] {0, 0, 0}; - } - - BlockVector3 min = BlockVector3.at(offsetParts[0], offsetParts[1], offsetParts[2]); - - CompoundTag metadataTag = getTag(schematic, "Metadata", CompoundTag.class); - int offsetX = 0; - int offsetY = 0; - int offsetZ = 0; - if (metadataTag != null && metadataTag.containsKey("WEOffsetX")) { - // We appear to have WorldEdit Metadata - Map metadata = metadataTag.getValue(); - offsetX = requireTag(metadata, "WEOffsetX", IntTag.class).getValue(); - offsetY = requireTag(metadata, "WEOffsetY", IntTag.class).getValue(); - offsetZ = requireTag(metadata, "WEOffsetZ", IntTag.class).getValue(); - BlockVector3 offset = BlockVector3.at(offsetX, offsetY, offsetZ); - origin = min.subtract(offset); - region = new CuboidRegion(min, min.add(width, height, length).subtract(BlockVector3.ONE)); - } else { - origin = min; - region = new CuboidRegion(origin, origin.add(width, height, length).subtract(BlockVector3.ONE)); - } - - Map blockContainer = null; - boolean v3Mode = false; - - if (schematicVersion == 3) { - blockContainer = requireTag(schematic, "Blocks", CompoundTag.class).getValue(); - v3Mode = true; - } - - Map paletteObject = requireTag(v3Mode ? blockContainer: schematic, "Palette", CompoundTag.class).getValue(); - - Map palette = new HashMap<>(); - - ParserContext parserContext = new ParserContext(); - parserContext.setRestricted(false); - parserContext.setTryLegacy(false); - parserContext.setPreferringWildcard(false); - - for (String palettePart : paletteObject.keySet()) { - int id = requireTag(paletteObject, palettePart, IntTag.class).getValue(); - if (fixer != null) { - palettePart = fixer.fixUp(DataFixer.FixTypes.BLOCK_STATE, palettePart, dataVersion); - } - BlockState state; - try { - state = WorldEdit.getInstance().getBlockFactory().parseFromInput(palettePart, parserContext).toImmutableState(); - } catch (InputParseException e) { - state = BlockTypes.AIR.getDefaultState(); - } - palette.put(id, state); - } - - byte[] blocks = requireTag(v3Mode ? blockContainer: schematic, v3Mode ? "Data" : "BlockData", ByteArrayTag.class).getValue(); - - Map> tileEntitiesMap = new HashMap<>(); - ListTag tileEntities = getTag(v3Mode ? blockContainer: schematic, "BlockEntities", ListTag.class); - if (tileEntities == null) { - tileEntities = getTag(v3Mode ? blockContainer: schematic, "TileEntities", ListTag.class); - } - if (tileEntities != null) { - List> tileEntityTags = tileEntities.getValue().stream() - .map(tag -> (CompoundTag) tag) - .map(CompoundTag::getValue) - .collect(Collectors.toList()); - - for (Map tileEntity : tileEntityTags) { - int[] pos = requireTag(tileEntity, "Pos", IntArrayTag.class).getValue(); - if(pos[0] < 0 || pos[0] >= width || pos[1] < 0 || pos[1] >= height || pos[2] < 0 || pos[2] >= length) - faweSchem = true; - } - - for (Map tileEntity : tileEntityTags) { - int[] pos = requireTag(tileEntity, "Pos", IntArrayTag.class).getValue(); - final BlockVector3 pt = BlockVector3.at(pos[0], pos[1], pos[2]); - Map values = Maps.newHashMap(v3Mode ? requireTag(tileEntity, "Data", CompoundTag.class).getValue() : tileEntity); - if(faweSchem){ - values.put("x", new IntTag(pt.getBlockX() - offsetX)); - values.put("y", new IntTag(pt.getBlockY() - offsetY)); - values.put("z", new IntTag(pt.getBlockZ() - offsetZ)); - }else{ - values.putIfAbsent("x", new IntTag(pt.getBlockX())); - values.putIfAbsent("y", new IntTag(pt.getBlockY())); - values.putIfAbsent("z", new IntTag(pt.getBlockZ())); - } - values.putIfAbsent("id", values.get("Id")); - values.remove("Id"); - values.remove("Pos"); - if (fixer != null) { - tileEntity = wrapper.applyDataFixer(fixer, dataVersion, values); - } else { - tileEntity = values; - } - tileEntitiesMap.put(pt, tileEntity); - } - } - - BlockArrayClipboard clipboard = new BlockArrayClipboard(region); - clipboard.setOrigin(origin); - - int index = 0; - int i = 0; - int value; - int varintLength; - while (i < blocks.length) { - value = 0; - varintLength = 0; - - while (true) { - value |= (blocks[i] & 127) << (varintLength++ * 7); - if (varintLength > 5) { - throw new IOException("VarInt too big (probably corrupted data)"); - } - if ((blocks[i] & 128) != 128) { - i++; - break; - } - i++; - } - // index = (y * length * width) + (z * width) + x - int y = index / (width * length); - int z = (index % (width * length)) / width; - int x = (index % (width * length)) % width; - BlockState state = palette.get(value); - BlockVector3 pt = BlockVector3.at(x, y, z); - try { - if (tileEntitiesMap.containsKey(pt)) { - clipboard.setBlock(clipboard.getMinimumPoint().add(pt), state.toBaseBlock(new CompoundTag(tileEntitiesMap.get(pt)))); - } else { - clipboard.setBlock(clipboard.getMinimumPoint().add(pt), state); - } - } catch (WorldEditException e) { - throw new IOException("Failed to load a block in the schematic"); - } - - index++; - } - - return clipboard; - } - - @Override - public void close() throws IOException { - inputStream.close(); - } - } -} diff --git a/SpigotCore/SpigotCore_14/src/de/steamwar/techhider/BlockIds14.java b/SpigotCore/SpigotCore_14/src/de/steamwar/techhider/BlockIds14.java deleted file mode 100644 index 5b1a7b4c..00000000 --- a/SpigotCore/SpigotCore_14/src/de/steamwar/techhider/BlockIds14.java +++ /dev/null @@ -1,73 +0,0 @@ -/* - * This file is a part of the SteamWar software. - * - * Copyright (C) 2025 SteamWar.de-Serverteam - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero 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 Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see . - */ - -package de.steamwar.techhider; - -import de.steamwar.Reflection; -import com.google.common.collect.ImmutableList; -import org.bukkit.Material; - -import java.util.HashSet; -import java.util.Set; - -public class BlockIds14 implements BlockIds { - - private static final Class blockStateList = Reflection.getClass("net.minecraft.world.level.block.state.StateDefinition"); - private static final Class fluidTypeFlowing = Reflection.getClass("net.minecraft.world.level.material.FlowingFluid"); - private static final Class fluid = Reflection.getClass("net.minecraft.world.level.material.FluidState"); - - private static final Reflection.Method getBlockData = Reflection.getTypedMethod(TechHider.block, null, TechHider.iBlockData); - @Override - public int materialToId(Material material) { - return getCombinedId(getBlockData.invoke(getBlock(material))); - } - - private static final Reflection.Method getStates = Reflection.getTypedMethod(TechHider.block, null, blockStateList); - private static final Reflection.Method getStateList = Reflection.getTypedMethod(blockStateList, null, ImmutableList.class); - private static final Object water = Reflection.getTypedMethod(fluidTypeFlowing, null, fluid, boolean.class).invoke(Reflection.getField(Reflection.getClass("net.minecraft.world.level.material.Fluids"), fluidTypeFlowing, 1).get(null), false); - private static final Iterable registryBlockId = (Iterable) Reflection.getField(TechHider.block, Reflection.getClass("net.minecraft.core.IdMapper"), 0).get(null); - private static final Reflection.Method getFluid = Reflection.getTypedMethod(TechHider.iBlockData, null, fluid); - @Override - public Set materialToAllIds(Material material) { - Set ids = new HashSet<>(); - for(Object data : (ImmutableList) getStateList.invoke(getStates.invoke(getBlock(material)))) { - ids.add(getCombinedId(data)); - } - - if(material == Material.WATER) { - for(Object data : registryBlockId) { - if(getFluid.invoke(data) == water) { - ids.add(getCombinedId(data)); - } - } - } - - return ids; - } - - private static final Reflection.Method getBlock = Reflection.getTypedMethod(TechHider.craftMagicNumbers, "getBlock", TechHider.block, Material.class); - private Object getBlock(Material material) { - return getBlock.invoke(null, material); - } - - @Override - public int getCombinedId(Object blockData) { - return (int) getCombinedId.invoke(null, blockData); - } -} diff --git a/SpigotCore/SpigotCore_14/src/de/steamwar/techhider/ChunkHider14.java b/SpigotCore/SpigotCore_14/src/de/steamwar/techhider/ChunkHider14.java deleted file mode 100644 index eade69b0..00000000 --- a/SpigotCore/SpigotCore_14/src/de/steamwar/techhider/ChunkHider14.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * This file is a part of the SteamWar software. - * - * Copyright (C) 2025 SteamWar.de-Serverteam - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero 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 Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see . - */ - -package de.steamwar.techhider; - -public class ChunkHider14 extends ChunkHider9 { - - @Override - protected void dataHider(SectionHider section) { - section.copyBlockCount(); - section.copyBitsPerBlock(); - - boolean hasPalette = section.getBitsPerBlock() < 9; - if(hasPalette) - section.processPalette(); - - if(section.isSkipSection()) { - section.skipDataArray(); - } else { - if(hasPalette && !section.blockPrecise()) { - section.skipDataArray(); - return; - } - - processDataArray(section); - } - } -} diff --git a/SpigotCore/SpigotCore_14/src/de/steamwar/techhider/ProtocolWrapper14.java b/SpigotCore/SpigotCore_14/src/de/steamwar/techhider/ProtocolWrapper14.java deleted file mode 100644 index c68b6937..00000000 --- a/SpigotCore/SpigotCore_14/src/de/steamwar/techhider/ProtocolWrapper14.java +++ /dev/null @@ -1,55 +0,0 @@ -/* - * This file is a part of the SteamWar software. - * - * Copyright (C) 2025 SteamWar.de-Serverteam - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero 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 Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see . - */ - -package de.steamwar.techhider; - -import de.steamwar.Reflection; -import org.bukkit.entity.Player; - -import java.util.function.BiFunction; -import java.util.function.UnaryOperator; - -public class ProtocolWrapper14 extends ProtocolWrapper8 { - - @Override - public BiFunction blockBreakHiderGenerator(Class blockBreakPacket, TechHider techHider) { - UnaryOperator blockBreakCloner = ProtocolUtils.shallowCloneGenerator(blockBreakPacket); - Reflection.Field blockBreakPosition = Reflection.getField(blockBreakPacket, TechHider.blockPosition, 0); - Reflection.Field blockBreakBlockData = Reflection.getField(blockBreakPacket, TechHider.iBlockData, 0); - - return (p, packet) -> { - switch (techHider.getLocationEvaluator().checkBlockPos(p, blockBreakPosition.get(packet))) { - case SKIP: - return packet; - case CHECK: - if(!techHider.iBlockDataHidden(blockBreakBlockData.get(packet))) - return packet; - case HIDE: - packet = blockBreakCloner.apply(packet); - blockBreakBlockData.set(packet, techHider.getObfuscationTarget()); - return packet; - case HIDE_AIR: - default: - packet = blockBreakCloner.apply(packet); - blockBreakBlockData.set(packet, TechHider.AIR); - return packet; - } - }; - } -} diff --git a/SpigotCore/SpigotCore_15/build.gradle.kts b/SpigotCore/SpigotCore_15/build.gradle.kts deleted file mode 100644 index d112f426..00000000 --- a/SpigotCore/SpigotCore_15/build.gradle.kts +++ /dev/null @@ -1,28 +0,0 @@ -/* - * This file is a part of the SteamWar software. - * - * Copyright (C) 2025 SteamWar.de-Serverteam - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero 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 Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see . - */ - -plugins { - steamwar.java -} - -dependencies { - compileOnly(project(":SpigotCore:SpigotCore_Main", "default")) - - compileOnly(libs.nms15) -} diff --git a/SpigotCore/SpigotCore_18/build.gradle.kts b/SpigotCore/SpigotCore_18/build.gradle.kts deleted file mode 100644 index 7c445409..00000000 --- a/SpigotCore/SpigotCore_18/build.gradle.kts +++ /dev/null @@ -1,40 +0,0 @@ -/* - * This file is a part of the SteamWar software. - * - * Copyright (C) 2025 SteamWar.de-Serverteam - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero 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 Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see . - */ - -plugins { - steamwar.java -} - -tasks.compileJava { - options.isWarnings = false -} - -dependencies { - compileOnly(project(":CommonCore", "default")) - compileOnly(project(":SpigotCore:SpigotCore_Main", "default")) - compileOnly(project(":SpigotCore:SpigotCore_14", "default")) - - compileOnly(libs.spigotapi) - compileOnly(libs.nms18) - compileOnly(libs.fawe18) - - compileOnly(libs.datafixer) - compileOnly(libs.netty) - compileOnly(libs.authlib) -} diff --git a/SpigotCore/SpigotCore_18/src/de/steamwar/core/CraftbukkitWrapper18.java b/SpigotCore/SpigotCore_18/src/de/steamwar/core/CraftbukkitWrapper18.java deleted file mode 100644 index 9e7c1785..00000000 --- a/SpigotCore/SpigotCore_18/src/de/steamwar/core/CraftbukkitWrapper18.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * This file is a part of the SteamWar software. - * - * Copyright (C) 2025 SteamWar.de-Serverteam - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero 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 Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see . - */ - -package de.steamwar.core; - -import de.steamwar.Reflection; -import com.comphenix.tinyprotocol.TinyProtocol; -import net.minecraft.network.protocol.game.ClientboundLevelChunkWithLightPacket; -import net.minecraft.world.level.World; -import net.minecraft.world.level.chunk.Chunk; -import net.minecraft.world.level.lighting.LightEngine; -import org.bukkit.entity.Player; - -public class CraftbukkitWrapper18 implements CraftbukkitWrapper.ICraftbukkitWrapper { - - private static final Reflection.Method getHandle = Reflection.getMethod("org.bukkit.craftbukkit.CraftChunk", "getHandle"); - private static final Reflection.Method getLightEngine = Reflection.getTypedMethod(World.class, null, LightEngine.class); - - @Override - public void sendChunk(Player p, int chunkX, int chunkZ) { - Chunk chunk = (Chunk) getHandle.invoke(p.getWorld().getChunkAt(chunkX, chunkZ)); - TinyProtocol.instance.sendPacket(p, new ClientboundLevelChunkWithLightPacket(chunk, (LightEngine) getLightEngine.invoke(chunk.q), null, null, false, true)); - } -} diff --git a/SpigotCore/SpigotCore_18/src/de/steamwar/core/ProtocolWrapper18.java b/SpigotCore/SpigotCore_18/src/de/steamwar/core/ProtocolWrapper18.java deleted file mode 100644 index 544237ce..00000000 --- a/SpigotCore/SpigotCore_18/src/de/steamwar/core/ProtocolWrapper18.java +++ /dev/null @@ -1,61 +0,0 @@ -/* - * This file is a part of the SteamWar software. - * - * Copyright (C) 2025 SteamWar.de-Serverteam - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero 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 Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see . - */ - -package de.steamwar.core; - -import de.steamwar.Reflection; -import com.mojang.authlib.GameProfile; -import com.mojang.datafixers.util.Pair; -import org.bukkit.GameMode; - -import java.util.Collections; -import java.util.EnumMap; -import java.util.List; - -public class ProtocolWrapper18 implements ProtocolWrapper { - - private static final Reflection.Field equipmentStack = Reflection.getField(equipmentPacket, List.class, 0); - @Override - public void setEquipmentPacketStack(Object packet, Object slot, Object stack) { - equipmentStack.set(packet, Collections.singletonList(new Pair<>(slot, stack))); - } - - private static final Class playerInfoPacket = Reflection.getClass("net.minecraft.network.protocol.game.PacketPlayOutPlayerInfo"); - private static final Class playerInfoActionClass = Reflection.getClass("net.minecraft.network.protocol.game.PacketPlayOutPlayerInfo$EnumPlayerInfoAction"); - private static final Reflection.Field playerInfoAction = Reflection.getField(playerInfoPacket, playerInfoActionClass, 0); - private static final Reflection.Field playerInfoData = Reflection.getField(playerInfoPacket, List.class, 0); - private static final EnumMap actions = new EnumMap<>(PlayerInfoAction.class); - static { - Object[] nativeActions = playerInfoActionClass.getEnumConstants(); - actions.put(PlayerInfoAction.ADD, nativeActions[0]); - actions.put(PlayerInfoAction.GAMEMODE, nativeActions[1]); - actions.put(PlayerInfoAction.REMOVE, nativeActions[4]); - } - private static final Class iChatBaseComponent = Reflection.getClass("net.minecraft.network.chat.Component"); - private static final Reflection.Constructor playerInfoDataConstructor = Reflection.getConstructor("net.minecraft.network.protocol.game.PacketPlayOutPlayerInfo$PlayerInfoData", GameProfile.class, int.class, enumGamemode, iChatBaseComponent); - - @Override - @SuppressWarnings("deprecation") - public Object playerInfoPacketConstructor(PlayerInfoAction action, GameProfile profile, GameMode mode) { - Object packet = Reflection.newInstance(playerInfoPacket); - playerInfoAction.set(packet, actions.get(action)); - playerInfoData.set(packet, Collections.singletonList(playerInfoDataConstructor.invoke(profile, 0, ProtocolWrapper.getGameModeById.invoke(null, mode.getValue()), null))); - return packet; - } -} diff --git a/SpigotCore/SpigotCore_18/src/de/steamwar/core/WorldEditWrapper18.java b/SpigotCore/SpigotCore_18/src/de/steamwar/core/WorldEditWrapper18.java deleted file mode 100644 index 111265cc..00000000 --- a/SpigotCore/SpigotCore_18/src/de/steamwar/core/WorldEditWrapper18.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * This file is a part of the SteamWar software. - * - * Copyright (C) 2025 SteamWar.de-Serverteam - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero 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 Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see . - */ - -package de.steamwar.core; - -import com.sk89q.jnbt.AdventureNBTConverter; -import com.sk89q.jnbt.CompoundTag; -import com.sk89q.jnbt.Tag; -import com.sk89q.worldedit.world.DataFixer; - -import java.util.Map; - -public class WorldEditWrapper18 extends WorldEditWrapper14 { - - @Override - @SuppressWarnings("removal") - public Map applyDataFixer(DataFixer fixer, int dataVersion, Map values) { - return ((CompoundTag) AdventureNBTConverter.fromAdventure(fixer.fixUp(DataFixer.FixTypes.BLOCK_ENTITY, new CompoundTag(values).asBinaryTag(), dataVersion))).getValue(); - } -} diff --git a/SpigotCore/SpigotCore_18/src/de/steamwar/techhider/ChunkHider18.java b/SpigotCore/SpigotCore_18/src/de/steamwar/techhider/ChunkHider18.java deleted file mode 100644 index 3033feac..00000000 --- a/SpigotCore/SpigotCore_18/src/de/steamwar/techhider/ChunkHider18.java +++ /dev/null @@ -1,152 +0,0 @@ -/* - * This file is a part of the SteamWar software. - * - * Copyright (C) 2025 SteamWar.de-Serverteam - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero 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 Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see . - */ - -package de.steamwar.techhider; - -import de.steamwar.Reflection; -import de.steamwar.core.Core; -import io.netty.buffer.ByteBuf; -import io.netty.buffer.Unpooled; -import net.minecraft.core.IRegistry; -import net.minecraft.network.protocol.game.ClientboundLevelChunkPacketData; -import net.minecraft.network.protocol.game.ClientboundLevelChunkWithLightPacket; -import net.minecraft.resources.MinecraftKey; -import net.minecraft.util.SimpleBitStorage; -import net.minecraft.world.level.block.entity.TileEntityTypes; -import org.bukkit.entity.Player; - -import java.util.List; -import java.util.Set; -import java.util.function.BiFunction; -import java.util.function.UnaryOperator; -import java.util.stream.Collectors; - -public class ChunkHider18 implements ChunkHider { - @Override - public Class mapChunkPacket() { - return ClientboundLevelChunkWithLightPacket.class; - } - - private static final UnaryOperator chunkPacketCloner = ProtocolUtils.shallowCloneGenerator(ClientboundLevelChunkWithLightPacket.class); - private static final UnaryOperator chunkDataCloner = ProtocolUtils.shallowCloneGenerator(ClientboundLevelChunkPacketData.class); - - private static final Reflection.Field chunkXField = Reflection.getField(ClientboundLevelChunkWithLightPacket.class, int.class, 0); - private static final Reflection.Field chunkZField = Reflection.getField(ClientboundLevelChunkWithLightPacket.class, int.class, 1); - private static final Reflection.Field chunkData = Reflection.getField(ClientboundLevelChunkWithLightPacket.class, ClientboundLevelChunkPacketData.class, 0); - - private static final Reflection.Field dataField = Reflection.getField(ClientboundLevelChunkPacketData.class, byte[].class, 0); - private static final Reflection.Field tileEntities = Reflection.getField(ClientboundLevelChunkPacketData.class, List.class, 0); - - @Override - public BiFunction chunkHiderGenerator(TechHider techHider) { - return (p, packet) -> { - int chunkX = chunkXField.get(packet); - int chunkZ = chunkZField.get(packet); - if (techHider.getLocationEvaluator().skipChunk(p, chunkX, chunkZ)) - return packet; - - packet = chunkPacketCloner.apply(packet); - Object dataWrapper = chunkDataCloner.apply(chunkData.get(packet)); - - Set hiddenBlockEntities = techHider.getHiddenBlockEntities(); - tileEntities.set(dataWrapper, ((List)tileEntities.get(dataWrapper)).stream().filter(te -> tileEntityVisible(hiddenBlockEntities, te)).collect(Collectors.toList())); - - ByteBuf in = Unpooled.wrappedBuffer(dataField.get(dataWrapper)); - ByteBuf out = Unpooled.buffer(in.readableBytes() + 64); - for(int yOffset = p.getWorld().getMinHeight(); yOffset < p.getWorld().getMaxHeight(); yOffset += 16) { - SectionHider section = new SectionHider(p, techHider, in, out, chunkX, yOffset/16, chunkZ); - - section.copyBlockCount(); - blocks(section); - biomes(section); - } - out.writeBytes(in); // MC appends a 0 byte at the end if there is a full chunk, idk why - - byte[] data = new byte[out.readableBytes()]; - out.readBytes(data); - dataField.set(dataWrapper, data); - - chunkData.set(packet, dataWrapper); - return packet; - }; - } - - public static final Class tileEntity = Reflection.getClass("net.minecraft.network.protocol.game.ClientboundLevelChunkPacketData$BlockEntityInfo"); - protected static final Reflection.Field entityType = Reflection.getField(tileEntity, TileEntityTypes.class, 0); - private static final IRegistry tileEntityTypes = Reflection.getField(Core.getVersion() > 18 ? Reflection.getClass("net.minecraft.core.registries.BuiltInRegistries") : IRegistry.class, IRegistry.class, 0, TileEntityTypes.class).get(null); - private static final Reflection.Method getKey = Reflection.getTypedMethod(IRegistry.class, null, MinecraftKey.class, Object.class); - private static final Reflection.Method getName = Reflection.getTypedMethod(MinecraftKey.class, null, String.class); - protected boolean tileEntityVisible(Set hiddenBlockEntities, Object tile) { - return !hiddenBlockEntities.contains((String) getName.invoke(getKey.invoke(tileEntityTypes, entityType.get(tile)))); - } - - private void blocks(SectionHider section) { - section.copyBitsPerBlock(); - - boolean singletonPalette = section.getBitsPerBlock() == 0; - if(singletonPalette) { - int value = ProtocolUtils.readVarInt(section.getIn()); - ProtocolUtils.writeVarInt(section.getOut(), !section.isSkipSection() && section.getObfuscate().contains(value) ? section.getTarget() : value); - }else if(section.getBitsPerBlock() < 15) { - section.processPalette(); - } - - if(section.isSkipSection() || singletonPalette || (!section.blockPrecise() && section.isPaletted())) { - section.skipDataArray(); - return; - } - - SimpleBitStorage values = new SimpleBitStorage(section.getBitsPerBlock(), 4096, section.readDataArray()); - - for (int y = 0; y < 16; y++) { - for (int z = 0; z < 16; z++) { - for (int x = 0; x < 16; x++) { - int pos = (((y * 16) + z) * 16) + x; - - switch (section.test(x, y, z)) { - case SKIP: - break; - case CHECK: - if(!section.getObfuscate().contains(values.a(pos))) - break; - case HIDE: - values.b(pos, section.getTarget()); - break; - case HIDE_AIR: - default: - values.b(pos, section.getAir()); - } - } - } - } - - section.writeDataArray(values.a()); - } - - private void biomes(SectionHider section) { - section.copyBitsPerBlock(); - boolean singletonPalette = section.getBitsPerBlock() == 0; - if(singletonPalette) - section.copyVarInt(); - else if(section.getBitsPerBlock() < 6) - section.skipPalette(); - - section.skipDataArray(); - } -} diff --git a/SpigotCore/SpigotCore_18/src/de/steamwar/techhider/ProtocolWrapper18.java b/SpigotCore/SpigotCore_18/src/de/steamwar/techhider/ProtocolWrapper18.java deleted file mode 100644 index 54f41d90..00000000 --- a/SpigotCore/SpigotCore_18/src/de/steamwar/techhider/ProtocolWrapper18.java +++ /dev/null @@ -1,109 +0,0 @@ -/* - * This file is a part of the SteamWar software. - * - * Copyright (C) 2025 SteamWar.de-Serverteam - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero 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 Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see . - */ - -package de.steamwar.techhider; - -import de.steamwar.Reflection; -import net.minecraft.core.SectionPosition; -import net.minecraft.network.protocol.game.PacketPlayOutBlockBreak; -import net.minecraft.world.level.block.entity.TileEntitySign; -import net.minecraft.world.level.block.entity.TileEntityTypes; -import net.minecraft.world.level.block.state.IBlockData; -import org.bukkit.entity.Player; - -import java.util.ArrayList; -import java.util.function.BiFunction; - -public class ProtocolWrapper18 implements ProtocolWrapper { - - private static final Reflection.Field multiBlockChangeChunk = Reflection.getField(TechHider.multiBlockChangePacket, SectionPosition.class, 0); - private static final Reflection.Field multiBlockChangePos = Reflection.getField(TechHider.multiBlockChangePacket, short[].class, 0); - private static final Reflection.Field multiBlockChangeBlocks = Reflection.getField(TechHider.multiBlockChangePacket, IBlockData[].class, 0); - @Override - public BiFunction multiBlockChangeGenerator(TechHider techHider) { - return (p, packet) -> { - TechHider.LocationEvaluator locationEvaluator = techHider.getLocationEvaluator(); - Object chunkCoords = multiBlockChangeChunk.get(packet); - int chunkX = TechHider.blockPositionX.get(chunkCoords); - int chunkY = TechHider.blockPositionY.get(chunkCoords); - int chunkZ = TechHider.blockPositionZ.get(chunkCoords); - if(locationEvaluator.skipChunkSection(p, chunkX, chunkY, chunkZ)) - return packet; - - packet = TechHider.multiBlockChangeCloner.apply(packet); - final short[] oldPos = multiBlockChangePos.get(packet); - final IBlockData[] oldBlocks = multiBlockChangeBlocks.get(packet); - ArrayList poss = new ArrayList<>(oldPos.length); - ArrayList blocks = new ArrayList<>(oldPos.length); - for(int i = 0; i < oldPos.length; i++) { - short pos = oldPos[i]; - IBlockData block = oldBlocks[i]; - switch(locationEvaluator.check(p, 16*chunkX + (pos >> 8 & 0xF), 16*chunkY + (pos & 0xF), 16*chunkZ + (pos >> 4 & 0xF))) { - case SKIP: - poss.add(pos); - blocks.add(block); - break; - case CHECK: - poss.add(pos); - blocks.add(techHider.iBlockDataHidden(block) ? (IBlockData) techHider.getObfuscationTarget() : block); - break; - default: - break; - } - } - - if(blocks.isEmpty()) - return null; - - short[] newPos = new short[poss.size()]; - for(int i = 0; i < newPos.length; i++) - newPos[i] = poss.get(i); - - multiBlockChangePos.set(packet, newPos); - multiBlockChangeBlocks.set(packet, blocks.toArray(new IBlockData[0])); - return packet; - }; - } - - private static final Reflection.Field tileEntityType = Reflection.getField(TechHider.tileEntityDataPacket, TileEntityTypes.class, 0); - private static final TileEntityTypes signType = Reflection.getField(TileEntityTypes.class, TileEntityTypes.class, 0, TileEntitySign.class).get(null); - @Override - public boolean unfilteredTileEntityDataAction(Object packet) { - return tileEntityType.get(packet) != signType; - } - - @Override - public BiFunction blockBreakHiderGenerator(Class blockBreakPacket, TechHider techHider) { - return (p, packet) -> { - PacketPlayOutBlockBreak breakPacket = (PacketPlayOutBlockBreak) packet; - switch (techHider.getLocationEvaluator().checkBlockPos(p, breakPacket.b())) { - case SKIP: - return packet; - case CHECK: - if(!techHider.iBlockDataHidden(breakPacket.c())) - return packet; - case HIDE: - return new PacketPlayOutBlockBreak(breakPacket.b(), (IBlockData) techHider.getObfuscationTarget(), breakPacket.d(), breakPacket.a()); - case HIDE_AIR: - default: - return new PacketPlayOutBlockBreak(breakPacket.b(), (IBlockData) TechHider.AIR, breakPacket.d(), breakPacket.a()); - } - }; - } -} diff --git a/SpigotCore/SpigotCore_19/build.gradle.kts b/SpigotCore/SpigotCore_19/build.gradle.kts deleted file mode 100644 index 13a4ee47..00000000 --- a/SpigotCore/SpigotCore_19/build.gradle.kts +++ /dev/null @@ -1,37 +0,0 @@ -/* - * This file is a part of the SteamWar software. - * - * Copyright (C) 2025 SteamWar.de-Serverteam - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero 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 Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see . - */ - -plugins { - steamwar.java -} - -dependencies { - compileOnly(project(":CommonCore", "default")) - compileOnly(project(":SpigotCore:SpigotCore_Main", "default")) - compileOnly(project(":SpigotCore:SpigotCore_14", "default")) - compileOnly(project(":SpigotCore:SpigotCore_18", "default")) - - compileOnly(libs.worldedit15) - compileOnly(libs.nms19) - - compileOnly(libs.spigotapi) - compileOnly(libs.brigadier) - compileOnly(libs.datafixer) - compileOnly(libs.authlib) -} diff --git a/SpigotCore/SpigotCore_19/src/de/steamwar/core/ChatWrapper19.java b/SpigotCore/SpigotCore_19/src/de/steamwar/core/ChatWrapper19.java deleted file mode 100644 index 79c98420..00000000 --- a/SpigotCore/SpigotCore_19/src/de/steamwar/core/ChatWrapper19.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * This file is a part of the SteamWar software. - * - * Copyright (C) 2025 SteamWar.de-Serverteam - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero 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 Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see . - */ - -package de.steamwar.core; - -import net.minecraft.network.chat.IChatMutableComponent; -import net.minecraft.network.chat.contents.LiteralContents; -import net.minecraft.network.protocol.game.PacketPlayOutEntityMetadata; -import net.minecraft.network.syncher.DataWatcher; - -import java.util.ArrayList; - -public class ChatWrapper19 implements ChatWrapper { - - @Override - public Object stringToChatComponent(String text) { - return IChatMutableComponent.a(new LiteralContents(text)); - } - - @Override - public Object getDataWatcherPacket(int entityId, Object... dataWatcherKeyValues) { - ArrayList> nativeWatchers = new ArrayList<>(1); - for(int i = 0; i < dataWatcherKeyValues.length; i+=2) { - nativeWatchers.add(((DataWatcher.Item) BountifulWrapper.impl.getDataWatcherItem(dataWatcherKeyValues[i], dataWatcherKeyValues[i+1])).e()); - } - - return new PacketPlayOutEntityMetadata(entityId, nativeWatchers); - } -} diff --git a/SpigotCore/SpigotCore_19/src/de/steamwar/core/ProtocolWrapper19.java b/SpigotCore/SpigotCore_19/src/de/steamwar/core/ProtocolWrapper19.java deleted file mode 100644 index ac378188..00000000 --- a/SpigotCore/SpigotCore_19/src/de/steamwar/core/ProtocolWrapper19.java +++ /dev/null @@ -1,64 +0,0 @@ -/* - * This file is a part of the SteamWar software. - * - * Copyright (C) 2025 SteamWar.de-Serverteam - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero 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 Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see . - */ - -package de.steamwar.core; - -import de.steamwar.Reflection; -import com.mojang.authlib.GameProfile; -import com.mojang.datafixers.util.Pair; -import net.minecraft.SystemUtils; -import net.minecraft.network.protocol.game.ClientboundPlayerInfoRemovePacket; -import net.minecraft.network.protocol.game.ClientboundPlayerInfoUpdatePacket; -import net.minecraft.world.level.EnumGamemode; -import org.bukkit.GameMode; - -import java.util.Collections; -import java.util.EnumSet; -import java.util.List; -import java.util.function.LongSupplier; - -public class ProtocolWrapper19 implements ProtocolWrapper { - - private static final Reflection.Field equipmentStack = Reflection.getField(equipmentPacket, List.class, 0); - @Override - public void setEquipmentPacketStack(Object packet, Object slot, Object stack) { - equipmentStack.set(packet, Collections.singletonList(new Pair<>(slot, stack))); - } - - private static final Reflection.Constructor removePacketConstructor = Reflection.getConstructor(ClientboundPlayerInfoRemovePacket.class, List.class); - private static final Reflection.Field updateActions = Reflection.getField(ClientboundPlayerInfoUpdatePacket.class, EnumSet.class, 0); - private static final Reflection.Field updatePlayers = Reflection.getField(ClientboundPlayerInfoUpdatePacket.class, List.class, 0); - - @Override - @SuppressWarnings("deprecation") - public Object playerInfoPacketConstructor(PlayerInfoAction action, GameProfile profile, GameMode mode) { - if(action == PlayerInfoAction.REMOVE) - return removePacketConstructor.invoke(Collections.singletonList(profile.getId())); - - Object packet = Reflection.newInstance(ClientboundPlayerInfoUpdatePacket.class); - updateActions.set(packet, action == PlayerInfoAction.ADD ? EnumSet.of(ClientboundPlayerInfoUpdatePacket.a.a, ClientboundPlayerInfoUpdatePacket.a.c) : EnumSet.of(ClientboundPlayerInfoUpdatePacket.a.c)); - updatePlayers.set(packet, Collections.singletonList(new ClientboundPlayerInfoUpdatePacket.b(profile.getId(), profile, false, 0, EnumGamemode.a(mode.getValue()), null, null))); - return packet; - } - - @Override - public void initTPSWarp(LongSupplier longSupplier) { - SystemUtils.a = () -> System.nanoTime() + longSupplier.getAsLong(); - } -} diff --git a/SpigotCore/SpigotCore_19/src/de/steamwar/core/WorldIdentifier19.java b/SpigotCore/SpigotCore_19/src/de/steamwar/core/WorldIdentifier19.java deleted file mode 100644 index 74a2dc14..00000000 --- a/SpigotCore/SpigotCore_19/src/de/steamwar/core/WorldIdentifier19.java +++ /dev/null @@ -1,68 +0,0 @@ -/* - * This file is a part of the SteamWar software. - * - * Copyright (C) 2025 SteamWar.de-Serverteam - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero 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 Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see . - */ - -package de.steamwar.core; - -import com.comphenix.tinyprotocol.TinyProtocol; -import de.steamwar.Reflection; -import net.minecraft.network.protocol.game.PacketPlayOutLogin; -import net.minecraft.resources.ResourceKey; -import net.minecraft.world.level.World; - -public class WorldIdentifier19 implements WorldIdentifier.IWorldIdentifier { - - private static ResourceKey resourceKey = null; - - private static final Class resourceKeyClass = Reflection.getClass("net.minecraft.resources.ResourceKey"); - private static final Class minecraftKeyClass = Reflection.getClass("net.minecraft.resources.MinecraftKey"); - private static final Reflection.Constructor resourceKeyConstructor = Reflection.getConstructor(resourceKeyClass, minecraftKeyClass, minecraftKeyClass); - private static final Reflection.Constructor minecraftKeyConstructor = Reflection.getConstructor(minecraftKeyClass, String.class, String.class); - - @Override - public void setResourceKey(String name) { - resourceKey = (ResourceKey) resourceKeyConstructor.invoke(minecraftKeyConstructor.invoke("minecraft", "dimension"), minecraftKeyConstructor.invoke("steamwar", name)); - } - - public WorldIdentifier19() { - TinyProtocol.instance.addFilter(PacketPlayOutLogin.class, (player, o) -> { - if (resourceKey == null) return o; - PacketPlayOutLogin packet = (PacketPlayOutLogin) o; - - return new PacketPlayOutLogin( - packet.b(), - packet.c(), - packet.d(), - packet.e(), - packet.f(), - packet.g(), - packet.h(), - resourceKey, - packet.j(), - packet.k(), - packet.l(), - packet.m(), - packet.n(), - packet.o(), - packet.p(), - packet.q(), - packet.r() - ); - }); - } -} diff --git a/SpigotCore/SpigotCore_19/src/de/steamwar/core/authlib/SteamwarGameProfileRepository19.java b/SpigotCore/SpigotCore_19/src/de/steamwar/core/authlib/SteamwarGameProfileRepository19.java deleted file mode 100644 index c0d90efa..00000000 --- a/SpigotCore/SpigotCore_19/src/de/steamwar/core/authlib/SteamwarGameProfileRepository19.java +++ /dev/null @@ -1,68 +0,0 @@ -/* - * This file is a part of the SteamWar software. - * - * Copyright (C) 2025 SteamWar.de-Serverteam - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero 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 Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see . - */ - -package de.steamwar.core.authlib; - -import com.mojang.authlib.Agent; -import com.mojang.authlib.GameProfile; -import com.mojang.authlib.GameProfileRepository; -import com.mojang.authlib.ProfileLookupCallback; -import de.steamwar.Reflection; -import de.steamwar.sql.SteamwarUser; -import net.minecraft.server.MinecraftServer; -import net.minecraft.server.Services; - -import java.util.ArrayList; -import java.util.List; - -public class SteamwarGameProfileRepository19 extends SteamwarGameProfileRepository { - private static final GameProfileRepository fallback; - private static final Reflection.Field field; - private static final Services current; - - static { - Class clazz = MinecraftServer.getServer().getClass(); - field = Reflection.getField(clazz, Services.class, 0); - current = field.get(MinecraftServer.getServer()); - fallback = current.c(); - } - - @Override - public void inject() { - Services newServices = new Services(current.a(), current.b(), this, current.d(), current.paperConfigurations()); - field.set(MinecraftServer.getServer(), newServices); - } - - @Override - public void findProfilesByNames(String[] strings, Agent agent, ProfileLookupCallback profileLookupCallback) { - List unknownNames = new ArrayList<>(); - for (String name:strings) { - SteamwarUser user = SteamwarUser.get(name); - if(user == null) { - unknownNames.add(name); - continue; - } - - profileLookupCallback.onProfileLookupSucceeded(new GameProfile(user.getUUID(), user.getUserName())); - } - if(!unknownNames.isEmpty()) { - fallback.findProfilesByNames(unknownNames.toArray(new String[0]), agent, profileLookupCallback); - } - } -} diff --git a/SpigotCore/SpigotCore_19/src/de/steamwar/techhider/ProtocolWrapper19.java b/SpigotCore/SpigotCore_19/src/de/steamwar/techhider/ProtocolWrapper19.java deleted file mode 100644 index 2aded961..00000000 --- a/SpigotCore/SpigotCore_19/src/de/steamwar/techhider/ProtocolWrapper19.java +++ /dev/null @@ -1,32 +0,0 @@ -/* - * This file is a part of the SteamWar software. - * - * Copyright (C) 2025 SteamWar.de-Serverteam - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero 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 Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see . - */ - -package de.steamwar.techhider; - -import org.bukkit.entity.Player; - -import java.util.function.BiFunction; - -public class ProtocolWrapper19 extends ProtocolWrapper18 { - - @Override - public BiFunction blockBreakHiderGenerator(Class blockBreakPacket, TechHider techHider) { - return null; - } -} diff --git a/SpigotCore/SpigotCore_20/build.gradle.kts b/SpigotCore/SpigotCore_20/build.gradle.kts deleted file mode 100644 index 357feb75..00000000 --- a/SpigotCore/SpigotCore_20/build.gradle.kts +++ /dev/null @@ -1,31 +0,0 @@ -/* - * This file is a part of the SteamWar software. - * - * Copyright (C) 2025 SteamWar.de-Serverteam - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero 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 Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see . - */ - -plugins { - steamwar.java -} - -dependencies { - compileOnly(project(":SpigotCore:SpigotCore_Main", "default")) - - compileOnly(libs.spigotapi) - - compileOnly(libs.fawe18) - compileOnly(libs.nms20) -} diff --git a/SpigotCore/SpigotCore_20/src/de/steamwar/core/CraftbukkitWrapper20.java b/SpigotCore/SpigotCore_20/src/de/steamwar/core/CraftbukkitWrapper20.java deleted file mode 100644 index ca2e059e..00000000 --- a/SpigotCore/SpigotCore_20/src/de/steamwar/core/CraftbukkitWrapper20.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * This file is a part of the SteamWar software. - * - * Copyright (C) 2025 SteamWar.de-Serverteam - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero 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 Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see . - */ - -package de.steamwar.core; - -import de.steamwar.Reflection; -import com.comphenix.tinyprotocol.TinyProtocol; -import net.minecraft.network.protocol.game.ClientboundLevelChunkWithLightPacket; -import net.minecraft.world.level.World; -import net.minecraft.world.level.chunk.Chunk; -import net.minecraft.world.level.chunk.ChunkStatus; -import net.minecraft.world.level.lighting.LevelLightEngine; -import org.bukkit.entity.Player; - -public class CraftbukkitWrapper20 implements CraftbukkitWrapper.ICraftbukkitWrapper { - - private static final Reflection.Method getHandle = Reflection.getMethod("org.bukkit.craftbukkit.CraftChunk", "getHandle", ChunkStatus.class); - private static final Reflection.Method getLightEngine = Reflection.getTypedMethod(World.class, null, LevelLightEngine.class); - - @Override - public void sendChunk(Player p, int chunkX, int chunkZ) { - Chunk chunk = (Chunk) getHandle.invoke(p.getWorld().getChunkAt(chunkX, chunkZ), ChunkStatus.n); - TinyProtocol.instance.sendPacket(p, new ClientboundLevelChunkWithLightPacket(chunk, (LevelLightEngine) getLightEngine.invoke(chunk.r), null, null, true)); - } -} diff --git a/SpigotCore/SpigotCore_20/src/de/steamwar/core/WorldEditRendererWrapper20.java b/SpigotCore/SpigotCore_20/src/de/steamwar/core/WorldEditRendererWrapper20.java deleted file mode 100644 index 3403415a..00000000 --- a/SpigotCore/SpigotCore_20/src/de/steamwar/core/WorldEditRendererWrapper20.java +++ /dev/null @@ -1,117 +0,0 @@ -/* - * This file is a part of the SteamWar software. - * - * Copyright (C) 2025 SteamWar.de-Serverteam - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero 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 Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see . - */ - -package de.steamwar.core; - -import de.steamwar.entity.CWireframe; -import de.steamwar.entity.REntityServer; -import org.bukkit.Material; -import org.bukkit.block.data.BlockData; -import org.bukkit.entity.Player; -import org.bukkit.util.Vector; - -import java.util.HashMap; -import java.util.Map; - -public class WorldEditRendererWrapper20 implements WorldEditRendererWrapper { - - private static final class BoxPair { - private CWireframe regionBox; - private CWireframe clipboardBox; - - public CWireframe get(boolean clipboard) { - if (clipboard) { - return clipboardBox; - } else { - return regionBox; - } - } - - public void set(boolean clipboard, CWireframe box) { - if (clipboard) { - this.clipboardBox = box; - } else { - this.regionBox = box; - } - } - - public void die() { - if (clipboardBox != null) { - clipboardBox.die(); - } - if (regionBox != null) { - regionBox.die(); - } - } - } - - private static final Map servers = new HashMap<>(); - private static final Map boxes = new HashMap<>(); - - @Override - public void draw(Player player, boolean scheduled, boolean clipboard, Vector pos1, Vector pos2) { - REntityServer server = servers.computeIfAbsent(player, __ -> { - REntityServer entityServer = new REntityServer(); - entityServer.addPlayer(player); - return entityServer; - }); - - WorldEditRendererCUIEditor.Type type = clipboard ? WorldEditRendererCUIEditor.Type.CLIPBOARD : WorldEditRendererCUIEditor.Type.SELECTION; - float width = type.getWidth(player).value; - Material material = type.getMaterial(player); - if (material == Material.BARRIER) { - hide(player, clipboard, true); - return; - } - BlockData block = material.createBlockData(); - - BoxPair boxPair = boxes.computeIfAbsent(player, __ -> new BoxPair()); - CWireframe box = boxPair.get(clipboard); - if (box == null) { - box = new CWireframe(server); - boxPair.set(clipboard, box); - } - box.setPos1And2(pos1.toLocation(player.getWorld()), pos2.toLocation(player.getWorld())); - box.setWidth(width); - box.setBlock(block); - } - - @Override - public void tick(Player player) { - REntityServer server = servers.get(player); - if (server != null) server.tick(); - } - - @Override - public void hide(Player player, boolean clipboard, boolean hide) { - BoxPair boxPair = boxes.get(player); - if (boxPair == null) return; - CWireframe box = boxPair.get(clipboard); - if (box == null) return; - box.hide(hide); - } - - @Override - public void remove(Player player) { - BoxPair boxPair = boxes.remove(player); - if (boxPair != null) boxPair.die(); - REntityServer server = servers.remove(player); - if (server != null) server.close(); - } -} diff --git a/SpigotCore/SpigotCore_20/src/de/steamwar/core/WorldIdentifier20.java b/SpigotCore/SpigotCore_20/src/de/steamwar/core/WorldIdentifier20.java deleted file mode 100644 index 354d8710..00000000 --- a/SpigotCore/SpigotCore_20/src/de/steamwar/core/WorldIdentifier20.java +++ /dev/null @@ -1,70 +0,0 @@ -/* - * This file is a part of the SteamWar software. - * - * Copyright (C) 2025 SteamWar.de-Serverteam - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero 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 Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see . - */ - -package de.steamwar.core; - -import com.comphenix.tinyprotocol.TinyProtocol; -import de.steamwar.Reflection; -import net.minecraft.network.protocol.game.PacketPlayOutLogin; -import net.minecraft.resources.ResourceKey; -import net.minecraft.world.level.World; - -public class WorldIdentifier20 implements WorldIdentifier.IWorldIdentifier { - - private static ResourceKey resourceKey = null; - - private static final Reflection.Field playerId = Reflection.getField(PacketPlayOutLogin.class, int.class, 0); - private static final Class resourceKeyClass = Reflection.getClass("net.minecraft.resources.ResourceKey"); - private static final Class minecraftKeyClass = Reflection.getClass("net.minecraft.resources.MinecraftKey"); - private static final Reflection.Constructor resourceKeyConstructor = Reflection.getConstructor(resourceKeyClass, minecraftKeyClass, minecraftKeyClass); - private static final Reflection.Constructor minecraftKeyConstructor = Reflection.getConstructor(minecraftKeyClass, String.class, String.class); - - @Override - public void setResourceKey(String name) { - resourceKey = (ResourceKey) resourceKeyConstructor.invoke(minecraftKeyConstructor.invoke("minecraft", "dimension"), minecraftKeyConstructor.invoke("steamwar", name)); - } - - public WorldIdentifier20() { - TinyProtocol.instance.addFilter(PacketPlayOutLogin.class, (player, o) -> { - if (resourceKey == null) return o; - PacketPlayOutLogin packet = (PacketPlayOutLogin) o; - - return new PacketPlayOutLogin( - playerId.get(packet), - packet.c(), - packet.d(), - packet.e(), - packet.f(), - packet.g(), - packet.h(), - resourceKey, - packet.j(), - packet.k(), - packet.l(), - packet.m(), - packet.n(), - packet.o(), - packet.p(), - packet.q(), - packet.r(), - packet.s() - ); - }); - } -} diff --git a/SpigotCore/SpigotCore_21/build.gradle.kts b/SpigotCore/SpigotCore_21/build.gradle.kts deleted file mode 100644 index a05a08fa..00000000 --- a/SpigotCore/SpigotCore_21/build.gradle.kts +++ /dev/null @@ -1,44 +0,0 @@ -/* - * This file is a part of the SteamWar software. - * - * Copyright (C) 2025 SteamWar.de-Serverteam - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero 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 Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see . - */ - -plugins { - steamwar.java -} - -java { - sourceCompatibility = JavaVersion.VERSION_21 - targetCompatibility = JavaVersion.VERSION_21 -} - -dependencies { - compileOnly(project(":CommonCore", "default")) - compileOnly(project(":SpigotCore:SpigotCore_Main", "default")) - compileOnly(project(":SpigotCore:SpigotCore_18", "default")) - compileOnly(project(":SpigotCore:SpigotCore_14", "default")) - compileOnly(project(":SpigotCore:SpigotCore_9", "default")) - - compileOnly(libs.fawe21) - - compileOnly(libs.paperapi21) - compileOnly(libs.nms21) - compileOnly(libs.authlib2) - compileOnly(libs.datafixer) - compileOnly(libs.netty) - compileOnly(libs.authlib) -} diff --git a/SpigotCore/SpigotCore_21/src/de/steamwar/core/BountifulWrapper21.java b/SpigotCore/SpigotCore_21/src/de/steamwar/core/BountifulWrapper21.java deleted file mode 100644 index c8b4c8b0..00000000 --- a/SpigotCore/SpigotCore_21/src/de/steamwar/core/BountifulWrapper21.java +++ /dev/null @@ -1,42 +0,0 @@ -/* - * This file is a part of the SteamWar software. - * - * Copyright (C) 2025 SteamWar.de-Serverteam - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero 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 Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see . - */ - -package de.steamwar.core; - -import de.steamwar.Reflection; -import net.minecraft.world.entity.PositionMoveRotation; -import net.minecraft.world.phys.Vec3; - -public class BountifulWrapper21 extends BountifulWrapper9 { - - @Override - public BountifulWrapper.PositionSetter getPositionSetter(Class packetClass, int fieldOffset) { - try { - Reflection.Field field = Reflection.getField(packetClass, PositionMoveRotation.class, 0); - - return (packet, x, y, z, pitch, yaw) -> { - PositionMoveRotation pos = field.get(packet); - - field.set(packet, new PositionMoveRotation(new Vec3(x, y, z), pos.deltaMovement(), yaw, pitch)); - }; - } catch (IllegalArgumentException e) { - return super.getPositionSetter(packetClass, fieldOffset); - } - } -} diff --git a/SpigotCore/SpigotCore_21/src/de/steamwar/core/ChatWrapper21.java b/SpigotCore/SpigotCore_21/src/de/steamwar/core/ChatWrapper21.java deleted file mode 100644 index b3570146..00000000 --- a/SpigotCore/SpigotCore_21/src/de/steamwar/core/ChatWrapper21.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * This file is a part of the SteamWar software. - * - * Copyright (C) 2025 SteamWar.de-Serverteam - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero 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 Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see . - */ - -package de.steamwar.core; - -import net.minecraft.network.chat.MutableComponent; -import net.minecraft.network.chat.contents.PlainTextContents; -import net.minecraft.network.protocol.game.ClientboundSetEntityDataPacket; -import net.minecraft.network.syncher.SynchedEntityData; - -import java.util.ArrayList; - -public class ChatWrapper21 implements ChatWrapper { - @Override - public Object stringToChatComponent(String text) { - return MutableComponent.create(PlainTextContents.create(text)); - } - - @Override - public Object getDataWatcherPacket(int entityId, Object... dataWatcherKeyValues) { - ArrayList> nativeWatchers = new ArrayList<>(1); - for(int i = 0; i < dataWatcherKeyValues.length; i+=2) { - nativeWatchers.add(((SynchedEntityData.DataItem) BountifulWrapper.impl.getDataWatcherItem(dataWatcherKeyValues[i], dataWatcherKeyValues[i+1])).value()); - } - - return new ClientboundSetEntityDataPacket(entityId, nativeWatchers); - } -} diff --git a/SpigotCore/SpigotCore_21/src/de/steamwar/core/CraftbukkitWrapper21.java b/SpigotCore/SpigotCore_21/src/de/steamwar/core/CraftbukkitWrapper21.java deleted file mode 100644 index 033ab273..00000000 --- a/SpigotCore/SpigotCore_21/src/de/steamwar/core/CraftbukkitWrapper21.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * This file is a part of the SteamWar software. - * - * Copyright (C) 2025 SteamWar.de-Serverteam - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero 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 Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see . - */ - -package de.steamwar.core; - -import de.steamwar.Reflection; -import com.comphenix.tinyprotocol.TinyProtocol; -import net.minecraft.network.protocol.game.ClientboundLevelChunkWithLightPacket; -import net.minecraft.world.level.chunk.LevelChunk; -import net.minecraft.world.level.chunk.status.ChunkStatus; -import org.bukkit.craftbukkit.CraftChunk; -import org.bukkit.entity.Player; - -public class CraftbukkitWrapper21 implements CraftbukkitWrapper.ICraftbukkitWrapper { - - private static final Reflection.Method getHandle = Reflection.getMethod("org.bukkit.craftbukkit.CraftChunk", "getHandle", ChunkStatus.class); - - @Override - public void sendChunk(Player p, int chunkX, int chunkZ) { - LevelChunk chunk = (LevelChunk) ((CraftChunk) p.getWorld().getChunkAt(chunkX, chunkZ)).getHandle(ChunkStatus.FULL); - TinyProtocol.instance.sendPacket(p, new ClientboundLevelChunkWithLightPacket(chunk, chunk.level.getLightEngine(), null, null, true)); - } -} diff --git a/SpigotCore/SpigotCore_21/src/de/steamwar/core/FlatteningWrapper21.java b/SpigotCore/SpigotCore_21/src/de/steamwar/core/FlatteningWrapper21.java deleted file mode 100644 index 1d791a90..00000000 --- a/SpigotCore/SpigotCore_21/src/de/steamwar/core/FlatteningWrapper21.java +++ /dev/null @@ -1,53 +0,0 @@ -/* - * This file is a part of the SteamWar software. - * - * Copyright (C) 2025 SteamWar.de-Serverteam - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero 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 Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see . - */ - -package de.steamwar.core; - -import com.destroystokyo.paper.profile.PlayerProfile; -import org.bukkit.Bukkit; -import org.bukkit.Material; -import org.bukkit.OfflinePlayer; -import org.bukkit.inventory.ItemStack; -import org.bukkit.inventory.meta.SkullMeta; - -public class FlatteningWrapper21 extends FlatteningWrapper14 implements FlatteningWrapper.IFlatteningWrapper { - - @Override - public ItemStack setSkullOwner(String player) { - ItemStack head = new ItemStack(Material.PLAYER_HEAD, 1); - head.editMeta(SkullMeta.class, skullMeta -> { - try { - OfflinePlayer offlinePlayer = Bukkit.getOfflinePlayer(player.startsWith(".") ? player.substring(1) : player); - PlayerProfile playerProfile = offlinePlayer.getPlayerProfile(); - playerProfile.complete(); - skullMeta.setPlayerProfile(playerProfile); - } catch (Exception e) { - // Ignore - } - }); - return head; - } - - protected static final Object shooting = entityPose.getEnumConstants()[16]; - @Override - public Object getPose(FlatteningWrapper.EntityPose pose) { - if (pose == FlatteningWrapper.EntityPose.SHOOTING) return shooting; - return super.getPose(pose); - } -} diff --git a/SpigotCore/SpigotCore_21/src/de/steamwar/core/ProtocolWrapper21.java b/SpigotCore/SpigotCore_21/src/de/steamwar/core/ProtocolWrapper21.java deleted file mode 100644 index 32cf4618..00000000 --- a/SpigotCore/SpigotCore_21/src/de/steamwar/core/ProtocolWrapper21.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * This file is a part of the SteamWar software. - * - * Copyright (C) 2025 SteamWar.de-Serverteam - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero 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 Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see . - */ - -package de.steamwar.core; - -import com.mojang.authlib.GameProfile; -import com.mojang.datafixers.util.Pair; -import net.minecraft.network.protocol.game.ClientboundPlayerInfoRemovePacket; -import net.minecraft.network.protocol.game.ClientboundPlayerInfoUpdatePacket; -import net.minecraft.network.protocol.game.ClientboundSetEquipmentPacket; -import net.minecraft.world.entity.EquipmentSlot; -import net.minecraft.world.item.ItemStack; -import net.minecraft.world.level.GameType; -import org.bukkit.GameMode; - -import java.util.Collections; -import java.util.EnumSet; - -public class ProtocolWrapper21 implements ProtocolWrapper { - @Override - public void setEquipmentPacketStack(Object packet, Object slot, Object stack) { - ClientboundSetEquipmentPacket setEquipmentPacket = (ClientboundSetEquipmentPacket) packet; - setEquipmentPacket.getSlots().add(Pair.of((EquipmentSlot) slot, (ItemStack) stack)); - } - - @Override - public Object playerInfoPacketConstructor(PlayerInfoAction action, GameProfile profile, GameMode mode) { - if(action == PlayerInfoAction.REMOVE) - return new ClientboundPlayerInfoRemovePacket(Collections.singletonList(profile.getId())); - - return new ClientboundPlayerInfoUpdatePacket(action == PlayerInfoAction.ADD ? - EnumSet.of(ClientboundPlayerInfoUpdatePacket.Action.ADD_PLAYER, ClientboundPlayerInfoUpdatePacket.Action.UPDATE_GAME_MODE) : EnumSet.of(ClientboundPlayerInfoUpdatePacket.Action.UPDATE_GAME_MODE), - Collections.singletonList(new ClientboundPlayerInfoUpdatePacket.Entry(profile.getId(), profile, false, 0, GameType.byId(mode.getValue()), null, false, 0, null))); - } -} diff --git a/SpigotCore/SpigotCore_21/src/de/steamwar/core/TrickyParticleWrapper21.java b/SpigotCore/SpigotCore_21/src/de/steamwar/core/TrickyParticleWrapper21.java deleted file mode 100644 index 4f3ca8f0..00000000 --- a/SpigotCore/SpigotCore_21/src/de/steamwar/core/TrickyParticleWrapper21.java +++ /dev/null @@ -1,29 +0,0 @@ -/* - * This file is a part of the SteamWar software. - * - * Copyright (C) 2025 SteamWar.de-Serverteam - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero 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 Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see . - */ - -package de.steamwar.core; - -import org.bukkit.Particle; - -public class TrickyParticleWrapper21 implements TrickyParticleWrapper { - @Override - public Particle getVillagerHappy() { - return Particle.HAPPY_VILLAGER; - } -} diff --git a/SpigotCore/SpigotCore_21/src/de/steamwar/core/TrickyTrialsWrapper21.java b/SpigotCore/SpigotCore_21/src/de/steamwar/core/TrickyTrialsWrapper21.java deleted file mode 100644 index 562c7058..00000000 --- a/SpigotCore/SpigotCore_21/src/de/steamwar/core/TrickyTrialsWrapper21.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * This file is a part of the SteamWar software. - * - * Copyright (C) 2025 SteamWar.de-Serverteam - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero 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 Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see . - */ - -package de.steamwar.core; - -import com.mojang.authlib.properties.Property; -import org.bukkit.Material; -import org.bukkit.enchantments.Enchantment; -import org.bukkit.entity.EntityType; -import org.bukkit.inventory.Inventory; -import org.bukkit.inventory.InventoryView; - -public class TrickyTrialsWrapper21 implements TrickyTrialsWrapper { - @Override - public EntityType getTntEntityType() { - return EntityType.TNT; - } - - @Override - public Enchantment getUnbreakingEnchantment() { - return Enchantment.UNBREAKING; - } - - @Override - public Material getTurtleScute() { - return Material.TURTLE_SCUTE; - } - - @Override - public String getValue(Property property) { - return property.value(); - } -} diff --git a/SpigotCore/SpigotCore_21/src/de/steamwar/core/WorldEditWrapper21.java b/SpigotCore/SpigotCore_21/src/de/steamwar/core/WorldEditWrapper21.java deleted file mode 100644 index b1e97156..00000000 --- a/SpigotCore/SpigotCore_21/src/de/steamwar/core/WorldEditWrapper21.java +++ /dev/null @@ -1,182 +0,0 @@ -/* - * This file is a part of the SteamWar software. - * - * Copyright (C) 2025 SteamWar.de-Serverteam - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero 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 Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see . - */ - -package de.steamwar.core; - -import com.fastasyncworldedit.core.extent.clipboard.io.FastSchematicReaderV2; -import com.fastasyncworldedit.core.extent.clipboard.io.FastSchematicReaderV3; -import com.sk89q.jnbt.NBTInputStream; -import com.sk89q.worldedit.extension.platform.Actor; -import com.sk89q.worldedit.extent.clipboard.Clipboard; -import com.sk89q.worldedit.extent.clipboard.io.*; -import com.sk89q.worldedit.extent.clipboard.io.sponge.SpongeSchematicV1Reader; -import com.sk89q.worldedit.extent.clipboard.io.sponge.SpongeSchematicV2Reader; -import com.sk89q.worldedit.extent.clipboard.io.sponge.SpongeSchematicV3Reader; -import com.sk89q.worldedit.math.Vector3; -import com.sk89q.worldedit.math.transform.Transform; -import com.sk89q.worldedit.regions.Region; -import com.sk89q.worldedit.session.ClipboardHolder; -import de.steamwar.sql.NodeData; -import org.bukkit.entity.Player; -import org.bukkit.util.Vector; -import org.enginehub.linbus.stream.LinBinaryIO; - -import java.io.DataInputStream; -import java.io.FilterInputStream; -import java.io.IOException; -import java.io.InputStream; -import java.util.ArrayList; -import java.util.List; -import java.util.function.Function; - -public class WorldEditWrapper21 implements WorldEditWrapper { - - @Override - public InputStream getPlayerClipboard(Player player) { - return WorldEditWrapper.getPlayerClipboard(player, (outputStream, clipboard, clipboardHolder) -> { - ClipboardWriter writer = BuiltInClipboardFormat.FAST_V3.getWriter(outputStream); - writer.write(clipboard); - writer.close(); - }); - } - - @Override - public void setPlayerClipboard(Player player, Clipboard clipboard) { - Actor actor = WorldEditWrapper.getWorldEditPlugin().wrapCommandSender(player); - WorldEditWrapper.getWorldEditPlugin().getWorldEdit().getSessionManager().get(actor).setClipboard(new ClipboardHolder(clipboard)); - } - - @Override - public Clipboard getClipboard(NodeData data) throws IOException { - ResetableInputStream is = new ResetableInputStream(data.schemData(false)); - for (ClipboardFormat clipboardFormat : ClipboardFormats.getAll()) { - FilterInputStream fis = new FilterInputStream(is) { - @Override - public void close() throws IOException { - // Ignore close call! - } - }; - boolean canBeRead = clipboardFormat.isFormat(fis); - is.reset(); - if (!canBeRead) continue; - return clipboardFormat.load(is); - } - throw new IOException("No clipboard found"); - } - - private static final Function FastV3 = FastSchematicReaderV3::new; - @SuppressWarnings("removal") - private static final Function FastV2 = inputStream -> new FastSchematicReaderV2(new NBTInputStream(inputStream)); - @SuppressWarnings("removal") - private static final Function McEdit = inputStream -> new MCEditSchematicReader(new NBTInputStream(inputStream)); - private static final Function SpongeV3 = inputStream -> new SpongeSchematicV3Reader(LinBinaryIO.read(new DataInputStream(inputStream))); - private static final Function SpongeV2 = inputStream -> new SpongeSchematicV2Reader(LinBinaryIO.read(new DataInputStream(inputStream))); - private static final Function SpongeV1 = inputStream -> new SpongeSchematicV1Reader(LinBinaryIO.read(new DataInputStream(inputStream))); - - private static final Function[] READERS = new Function[]{ - FastV3, - FastV2, - SpongeV3, - SpongeV2, - SpongeV1, - McEdit - }; - - @Override - public Clipboard getClipboard(InputStream inputStream) throws IOException { - ResetableInputStream is = new ResetableInputStream(inputStream); - for (Function reader : READERS) { - FilterInputStream fis = new FilterInputStream(is) { - @Override - public void close() throws IOException { - // Ignore close call! - } - }; - try { - return reader.apply(fis).read(); - } catch (Exception e) { - is.reset(); - } - } - is.close(); - throw new IOException("No clipboard found"); - } - - private static class ResetableInputStream extends InputStream { - - private InputStream inputStream; - private int pointer = 0; - private List list = new ArrayList<>(); - - public ResetableInputStream(InputStream in) { - this.inputStream = in; - } - - @Override - public int read() throws IOException { - if (pointer >= list.size()) { - int data = inputStream.read(); - list.add(data); - pointer++; - return data; - } - int data = list.get(pointer); - pointer++; - return data; - } - - @Override - public void reset() throws IOException { - pointer = 0; - } - - @Override - public void close() throws IOException { - list.clear(); - pointer = -1; - } - } - - @Override - public org.bukkit.util.Vector getOrigin(Clipboard clipboard) { - return new org.bukkit.util.Vector(clipboard.getOrigin().x(), clipboard.getOrigin().y(), clipboard.getOrigin().z()); - } - - @Override - public Vector getMinimum(Region region) { - return new Vector(region.getMinimumPoint().x(), region.getMinimumPoint().y(), region.getMinimumPoint().z()); - } - - @Override - public Vector getMaximum(Region region) { - return new Vector(region.getMaximumPoint().x(), region.getMaximumPoint().y(), region.getMaximumPoint().z()); - } - - @Override - public Vector applyTransform(Vector vector, Transform transform) { - Vector3 v = Vector3.at(vector.getX(), vector.getY(), vector.getZ()); - v = transform.apply(v); - return new org.bukkit.util.Vector(v.x(), v.y(), v.z()); - } - - @Override - public NodeData.SchematicFormat getNativeFormat() { - return NodeData.SchematicFormat.SPONGE_V3; - } -} diff --git a/SpigotCore/SpigotCore_21/src/de/steamwar/core/WorldIdentifier21.java b/SpigotCore/SpigotCore_21/src/de/steamwar/core/WorldIdentifier21.java deleted file mode 100644 index 8553124c..00000000 --- a/SpigotCore/SpigotCore_21/src/de/steamwar/core/WorldIdentifier21.java +++ /dev/null @@ -1,73 +0,0 @@ -/* - * This file is a part of the SteamWar software. - * - * Copyright (C) 2025 SteamWar.de-Serverteam - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero 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 Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see . - */ - -package de.steamwar.core; - -import com.comphenix.tinyprotocol.TinyProtocol; -import de.steamwar.Reflection; -import net.minecraft.network.protocol.game.ClientboundLoginPacket; -import net.minecraft.network.protocol.game.CommonPlayerSpawnInfo; -import net.minecraft.resources.ResourceKey; -import net.minecraft.world.level.Level; - -public class WorldIdentifier21 implements WorldIdentifier.IWorldIdentifier { - - private static ResourceKey resourceKey = null; - - private static final Class resourceKeyClass = Reflection.getClass("net.minecraft.resources.ResourceKey"); - private static final Class minecraftKeyClass = Reflection.getClass("net.minecraft.resources.MinecraftKey"); - private static final Reflection.Constructor resourceKeyConstructor = Reflection.getConstructor(resourceKeyClass, minecraftKeyClass, minecraftKeyClass); - private static final Reflection.Constructor minecraftKeyConstructor = Reflection.getConstructor(minecraftKeyClass, String.class, String.class); - - @Override - public void setResourceKey(String name) { - resourceKey = (ResourceKey) resourceKeyConstructor.invoke(minecraftKeyConstructor.invoke("minecraft", "dimension"), minecraftKeyConstructor.invoke("steamwar", name)); - } - - public WorldIdentifier21() { - TinyProtocol.instance.addFilter(ClientboundLoginPacket.class, (player, o) -> { - if (resourceKey == null) return o; - ClientboundLoginPacket packet = (ClientboundLoginPacket) o; - - return new ClientboundLoginPacket(packet.playerId(), - packet.hardcore(), - packet.levels(), - packet.maxPlayers(), - packet.chunkRadius(), - packet.simulationDistance(), - packet.reducedDebugInfo(), - packet.showDeathScreen(), - packet.doLimitedCrafting(), - new CommonPlayerSpawnInfo( - packet.commonPlayerSpawnInfo().dimensionType(), - resourceKey, - packet.commonPlayerSpawnInfo().seed(), - packet.commonPlayerSpawnInfo().gameType(), - packet.commonPlayerSpawnInfo().previousGameType(), - packet.commonPlayerSpawnInfo().isDebug(), - packet.commonPlayerSpawnInfo().isFlat(), - packet.commonPlayerSpawnInfo().lastDeathLocation(), - packet.commonPlayerSpawnInfo().portalCooldown(), - packet.commonPlayerSpawnInfo().seaLevel() - ), - packet.enforcesSecureChat() - ); - }); - } -} diff --git a/SpigotCore/SpigotCore_21/src/de/steamwar/core/authlib/SteamwarGameProfileRepository21.java b/SpigotCore/SpigotCore_21/src/de/steamwar/core/authlib/SteamwarGameProfileRepository21.java deleted file mode 100644 index 21df7d4c..00000000 --- a/SpigotCore/SpigotCore_21/src/de/steamwar/core/authlib/SteamwarGameProfileRepository21.java +++ /dev/null @@ -1,73 +0,0 @@ -/* - * This file is a part of the SteamWar software. - * - * Copyright (C) 2025 SteamWar.de-Serverteam - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero 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 Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see . - */ - -package de.steamwar.core.authlib; - -import com.mojang.authlib.GameProfile; -import com.mojang.authlib.GameProfileRepository; -import com.mojang.authlib.ProfileLookupCallback; -import de.steamwar.Reflection; -import de.steamwar.sql.SteamwarUser; -import net.minecraft.server.MinecraftServer; -import net.minecraft.server.Services; - -import java.util.ArrayList; -import java.util.List; -import java.util.Optional; - -public class SteamwarGameProfileRepository21 extends SteamwarGameProfileRepository { - private static final GameProfileRepository fallback; - private static final Reflection.Field field; - private static final Services current; - - static { - Class clazz = MinecraftServer.getServer().getClass(); - field = Reflection.getField(clazz, Services.class, 0); - current = field.get(MinecraftServer.getServer()); - fallback = current.profileRepository(); - } - - @Override - public void findProfilesByNames(String[] strings, ProfileLookupCallback profileLookupCallback) { - List unknownNames = new ArrayList<>(); - for (String name:strings) { - SteamwarUser user = SteamwarUser.get(name); - if(user == null) { - unknownNames.add(name); - continue; - } - - profileLookupCallback.onProfileLookupSucceeded(new GameProfile(user.getUUID(), user.getUserName())); - } - if(!unknownNames.isEmpty()) { - fallback.findProfilesByNames(unknownNames.toArray(new String[0]), profileLookupCallback); - } - } - - @Override - public Optional findProfileByName(String s) { - return fallback.findProfileByName(s); - } - - @Override - public void inject() { - Services newServices = new Services(current.sessionService(), current.servicesKeySet(), this, current.profileCache(), current.paperConfigurations()); - field.set(MinecraftServer.getServer(), newServices); - } -} diff --git a/SpigotCore/SpigotCore_21/src/de/steamwar/entity/PacketConstructor21.java b/SpigotCore/SpigotCore_21/src/de/steamwar/entity/PacketConstructor21.java deleted file mode 100644 index 80ad1bc3..00000000 --- a/SpigotCore/SpigotCore_21/src/de/steamwar/entity/PacketConstructor21.java +++ /dev/null @@ -1,53 +0,0 @@ -/* - * This file is a part of the SteamWar software. - * - * Copyright (C) 2025 SteamWar.de-Serverteam - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero 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 Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see . - */ - -package de.steamwar.entity; - -import net.minecraft.network.protocol.game.ClientboundAddEntityPacket; -import net.minecraft.network.protocol.game.ClientboundTeleportEntityPacket; -import net.minecraft.world.entity.EntityType; -import net.minecraft.world.entity.PositionMoveRotation; -import net.minecraft.world.phys.Vec3; - -import java.util.Collections; - -public class PacketConstructor21 implements PacketConstructor{ - @Override - public Object teleportPacket(int entityId, double x, double y, double z, float yaw, float pitch) { - PositionMoveRotation rot = new PositionMoveRotation(new Vec3(x, y, z), Vec3.ZERO, pitch, yaw); - return new ClientboundTeleportEntityPacket(entityId, rot, Collections.emptySet(), false); - } - - @Override - public Object createRPlayerSpawn(RPlayer player) { - return new ClientboundAddEntityPacket( - player.entityId, - player.uuid, - player.x, - player.y, - player.z, - player.yaw, - player.pitch, - EntityType.PLAYER, - 0, - Vec3.ZERO, - player.headYaw - ); - } -} diff --git a/SpigotCore/SpigotCore_21/src/de/steamwar/scoreboard/SWScoreboard21.java b/SpigotCore/SpigotCore_21/src/de/steamwar/scoreboard/SWScoreboard21.java deleted file mode 100644 index cfb64049..00000000 --- a/SpigotCore/SpigotCore_21/src/de/steamwar/scoreboard/SWScoreboard21.java +++ /dev/null @@ -1,74 +0,0 @@ -/* - * This file is a part of the SteamWar software. - * - * Copyright (C) 2025 SteamWar.de-Serverteam - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero 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 Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see . - */ - -package de.steamwar.scoreboard; - -import de.steamwar.core.Core; -import net.kyori.adventure.text.Component; -import org.bukkit.Bukkit; -import org.bukkit.entity.Player; -import org.bukkit.scoreboard.DisplaySlot; -import org.bukkit.scoreboard.Objective; -import org.bukkit.scoreboard.Scoreboard; - -import java.util.HashMap; -import java.util.Map; - -public class SWScoreboard21 implements SWScoreboard { - - private static final HashMap playerBoards = new HashMap<>(); - private static final String SIDEBAR = "sw-sidebar"; - - static { - Bukkit.getScheduler().runTaskTimer(Core.getInstance(), () -> { - for(Map.Entry scoreboard : playerBoards.entrySet()) { - render(scoreboard.getKey(), scoreboard.getValue()); - } - }, 10, 5); - } - - private static void render(Player player, ScoreboardCallback callback) { - if (player.getScoreboard().getObjective(SIDEBAR) != null) { - player.getScoreboard().getObjective(SIDEBAR).unregister(); - } - - Objective objective = player.getScoreboard().registerNewObjective(SIDEBAR, "dummy", Component.text(callback.getTitle())); - objective.setAutoUpdateDisplay(true); - objective.setDisplaySlot(DisplaySlot.SIDEBAR); - - callback.getData().forEach((text, score) -> objective.getScore(text).setScore(score)); - } - - @Override - public boolean createScoreboard(Player player, ScoreboardCallback callback) { - Scoreboard scoreboard = Bukkit.getScoreboardManager().getNewScoreboard(); - player.setScoreboard(scoreboard); - - render(player, callback); - - playerBoards.put(player, callback); - return true; - } - - @Override - public void removeScoreboard(Player player) { - player.getScoreboard().getObjective(SIDEBAR).unregister(); - playerBoards.remove(player); - } -} diff --git a/SpigotCore/SpigotCore_21/src/de/steamwar/techhider/ChunkHider21.java b/SpigotCore/SpigotCore_21/src/de/steamwar/techhider/ChunkHider21.java deleted file mode 100644 index 1cc6c29c..00000000 --- a/SpigotCore/SpigotCore_21/src/de/steamwar/techhider/ChunkHider21.java +++ /dev/null @@ -1,161 +0,0 @@ -/* - * This file is a part of the SteamWar software. - * - * Copyright (C) 2025 SteamWar.de-Serverteam - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero 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 Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see . - */ - -package de.steamwar.techhider; - -import de.steamwar.Reflection; -import io.netty.buffer.ByteBuf; -import io.netty.buffer.Unpooled; -import net.minecraft.network.protocol.game.ClientboundLevelChunkPacketData; -import net.minecraft.network.protocol.game.ClientboundLevelChunkWithLightPacket; -import net.minecraft.util.SimpleBitStorage; -import net.minecraft.world.level.block.entity.BlockEntityType; -import org.bukkit.entity.Player; - -import java.util.List; -import java.util.Set; -import java.util.function.BiFunction; -import java.util.function.UnaryOperator; -import java.util.stream.Collectors; - -public class ChunkHider21 implements ChunkHider { - @Override - public Class mapChunkPacket() { - return ClientboundLevelChunkWithLightPacket.class; - } - - private static final UnaryOperator chunkPacketCloner = ProtocolUtils.shallowCloneGenerator(ClientboundLevelChunkWithLightPacket.class); - private static final UnaryOperator chunkDataCloner = ProtocolUtils.shallowCloneGenerator(ClientboundLevelChunkPacketData.class); - - private static final Reflection.Field chunkXField = Reflection.getField(ClientboundLevelChunkWithLightPacket.class, int.class, 0); - private static final Reflection.Field chunkZField = Reflection.getField(ClientboundLevelChunkWithLightPacket.class, int.class, 1); - private static final Reflection.Field chunkData = Reflection.getField(ClientboundLevelChunkWithLightPacket.class, ClientboundLevelChunkPacketData.class, 0); - - private static final Reflection.Field dataField = Reflection.getField(ClientboundLevelChunkPacketData.class, byte[].class, 0); - private static final Reflection.Field tileEntities = Reflection.getField(ClientboundLevelChunkPacketData.class, List.class, 0); - - @Override - public BiFunction chunkHiderGenerator(TechHider techHider) { - return (p, packet) -> { - int chunkX = chunkXField.get(packet); - int chunkZ = chunkZField.get(packet); - if (techHider.getLocationEvaluator().skipChunk(p, chunkX, chunkZ)) - return packet; - - packet = chunkPacketCloner.apply(packet); - Object dataWrapper = chunkDataCloner.apply(chunkData.get(packet)); - - Set hiddenBlockEntities = techHider.getHiddenBlockEntities(); - tileEntities.set(dataWrapper, ((List)tileEntities.get(dataWrapper)).stream().filter(te -> tileEntityVisible(hiddenBlockEntities, te)).collect(Collectors.toList())); - - ByteBuf in = Unpooled.wrappedBuffer(dataField.get(dataWrapper)); - ByteBuf out = Unpooled.buffer(in.readableBytes() + 64); - for(int yOffset = p.getWorld().getMinHeight(); yOffset < p.getWorld().getMaxHeight(); yOffset += 16) { - SectionHider section = new SectionHider(p, techHider, in, out, chunkX, yOffset/16, chunkZ); - section.copyBlockCount(); - - blocks(section); - biomes(section); - } - - if (in.readableBytes() != 0) { - throw new IllegalStateException("ChunkHider21: Incomplete chunk data, " + in.readableBytes() + " bytes left"); - } - - byte[] data = new byte[out.readableBytes()]; - out.readBytes(data); - dataField.set(dataWrapper, data); - - chunkData.set(packet, dataWrapper); - return packet; - }; - } - - public static final Class tileEntity = Reflection.getClass("net.minecraft.network.protocol.game.ClientboundLevelChunkPacketData$BlockEntityInfo"); - protected static final Reflection.Field entityType = Reflection.getField(tileEntity, BlockEntityType.class, 0); - private static final Class builtInRegestries = Reflection.getClass("net.minecraft.core.registries.BuiltInRegistries"); - private static final Class registry = Reflection.getClass("net.minecraft.core.Registry"); - private static final Reflection.Field nameField = Reflection.getField(builtInRegestries, "BLOCK_ENTITY_TYPE", registry); - private static final Class resourceLocation = Reflection.getClass("net.minecraft.resources.ResourceLocation"); - private static final Reflection.Method getKey = Reflection.getTypedMethod(registry, "getKey", resourceLocation, Object.class); - private static final Reflection.Method getName = Reflection.getTypedMethod(resourceLocation, "getPath", String.class); - protected boolean tileEntityVisible(Set hiddenBlockEntities, Object tile) { - return !hiddenBlockEntities.contains(getName.invoke(getKey.invoke(nameField.get(null), entityType.get(tile)))); - } - - private void blocks(SectionHider section) { - section.copyBitsPerBlock(); - - boolean singleValued = section.getBitsPerBlock() == 0; - if (singleValued) { - int value = ProtocolUtils.readVarInt(section.getIn()); - ProtocolUtils.writeVarInt(section.getOut(), !section.isSkipSection() && section.getObfuscate().contains(value) ? section.getTarget() : value); - return; - } else if (section.getBitsPerBlock() < 9) { - // Indirect (paletted) storage – only present when bitsPerBlock < 9 in 1.21+ - section.processPalette(); - } - - if (section.isSkipSection() || (!section.blockPrecise() && section.isPaletted())) { - section.skipNewDataArray(4096); - return; - } - - SimpleBitStorage values = new SimpleBitStorage(section.getBitsPerBlock(), 4096, section.readNewDataArray(4096)); - - for (int y = 0; y < 16; y++) { - for (int z = 0; z < 16; z++) { - for (int x = 0; x < 16; x++) { - int pos = (((y * 16) + z) * 16) + x; - - TechHider.State test = section.test(x, y, z); - - switch (test) { - case SKIP: - break; - case CHECK: - if (!section.getObfuscate().contains(values.get(pos))) - break; - case HIDE: - values.set(pos, section.getTarget()); - break; - case HIDE_AIR: - default: - values.set(pos, section.getAir()); - } - } - } - } - - section.writeDataArray(values.getRaw()); - } - - private void biomes(SectionHider section) { - section.copyBitsPerBlock(); - if(section.getBitsPerBlock() == 0) { - section.copyVarInt(); - } else if(section.getBitsPerBlock() < 6) { - section.skipPalette(); - section.skipNewDataArray(64); - } else { - // Direct (global) biome IDs – no palette present - section.skipNewDataArray(64); - } - } -} diff --git a/SpigotCore/SpigotCore_8/build.gradle.kts b/SpigotCore/SpigotCore_8/build.gradle.kts deleted file mode 100644 index cc99f61e..00000000 --- a/SpigotCore/SpigotCore_8/build.gradle.kts +++ /dev/null @@ -1,30 +0,0 @@ -/* - * This file is a part of the SteamWar software. - * - * Copyright (C) 2025 SteamWar.de-Serverteam - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero 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 Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see . - */ - -plugins { - steamwar.java -} - -dependencies { - compileOnly(project(":CommonCore", "default")) - compileOnly(project(":SpigotCore:SpigotCore_Main", "default")) - - compileOnly(libs.nms8) - compileOnly(libs.worldedit12) -} diff --git a/SpigotCore/SpigotCore_8/src/de/steamwar/core/BountifulWrapper8.java b/SpigotCore/SpigotCore_8/src/de/steamwar/core/BountifulWrapper8.java deleted file mode 100644 index eb3c8bc1..00000000 --- a/SpigotCore/SpigotCore_8/src/de/steamwar/core/BountifulWrapper8.java +++ /dev/null @@ -1,106 +0,0 @@ -/* - * This file is a part of the SteamWar software. - * - * Copyright (C) 2025 SteamWar.de-Serverteam - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero 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 Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see . - */ - -package de.steamwar.core; - -import de.steamwar.Reflection; -import net.md_5.bungee.api.ChatMessageType; -import net.md_5.bungee.api.chat.BaseComponent; -import net.minecraft.server.v1_8_R3.ChatComponentText; -import net.minecraft.server.v1_8_R3.MathHelper; -import net.minecraft.server.v1_8_R3.PacketPlayOutChat; -import org.bukkit.Sound; -import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer; -import org.bukkit.entity.Player; - -import java.util.HashMap; -import java.util.Map; - -public class BountifulWrapper8 implements BountifulWrapper.IBountifulWrapper { - - @Override - public void playPling(Player player) { - player.playSound(player.getLocation(), Sound.ORB_PICKUP, 1, 1); - } - - @Override - public void sendMessage(Player player, ChatMessageType type, BaseComponent... msg) { - ((CraftPlayer) player).getHandle().playerConnection.sendPacket(new PacketPlayOutChat(new ChatComponentText(BaseComponent.toLegacyText(msg)), (byte)type.ordinal())); - } - - @Override - public Object getDataWatcherObject(int index, Class type) { - return index; - } - - private static final Class watchableObject = Reflection.getClass("net.minecraft.DataWatcher$WatchableObject"); - private static final Reflection.Constructor watchableObjectConstructor = Reflection.getConstructor(watchableObject, int.class, int.class, Object.class); - private static final Map, Integer> watchableDatatypes = new HashMap<>(); - static { - watchableDatatypes.put(byte.class, 0); - watchableDatatypes.put(short.class, 1); - watchableDatatypes.put(int.class, 2); - watchableDatatypes.put(float.class, 3); - watchableDatatypes.put(String.class, 4); - } - - @Override - public Object getDataWatcherItem(Object dwo, Object value) { - return watchableObjectConstructor.invoke(watchableDatatypes.get(value.getClass()), dwo, value); - } - - @Override - public BountifulWrapper.PositionSetter getPositionSetter(Class packetClass, int fieldOffset) { - Reflection.Field posX = Reflection.getField(packetClass, int.class, fieldOffset); - Reflection.Field posY = Reflection.getField(packetClass, int.class, fieldOffset +1); - Reflection.Field posZ = Reflection.getField(packetClass, int.class, fieldOffset +2); - Reflection.Field lookYaw = Reflection.getField(packetClass, byte.class, 0); - Reflection.Field lookPitch = Reflection.getField(packetClass, byte.class, 1); - - return (packet, x, y, z, pitch, yaw) -> { - posX.set(packet, MathHelper.floor(x * 32)); - posY.set(packet, MathHelper.floor(y * 32)); - posZ.set(packet, MathHelper.floor(z * 32)); - lookYaw.set(packet, (byte)(yaw * 256 / 360)); - lookPitch.set(packet, (byte)(pitch * 256 / 360)); - }; - } - - @Override - public BountifulWrapper.PositionSetter getRelMoveSetter(Class packetClass) { - Reflection.Field moveX = Reflection.getField(packetClass, "b", byte.class); - Reflection.Field moveY = Reflection.getField(packetClass, "c", byte.class); - Reflection.Field moveZ = Reflection.getField(packetClass, "d", byte.class); - Reflection.Field lookYaw = Reflection.getField(packetClass, "e", byte.class); - Reflection.Field lookPitch = Reflection.getField(packetClass, "f", byte.class); - - return (packet, x, y, z, pitch, yaw) -> { - moveX.set(packet, (byte)(x*32)); - moveY.set(packet, (byte)(y*32)); - moveZ.set(packet, (byte)(z*32)); - lookYaw.set(packet, (byte)(yaw*256/360)); - lookPitch.set(packet, (byte)(pitch*256/360)); - }; - } - - @Override - public BountifulWrapper.UUIDSetter getUUIDSetter(Class packetClass) { - return (packet, uuid) -> {}; - } -} diff --git a/SpigotCore/SpigotCore_8/src/de/steamwar/core/ChatWrapper8.java b/SpigotCore/SpigotCore_8/src/de/steamwar/core/ChatWrapper8.java deleted file mode 100644 index 969e32ad..00000000 --- a/SpigotCore/SpigotCore_8/src/de/steamwar/core/ChatWrapper8.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * This file is a part of the SteamWar software. - * - * Copyright (C) 2025 SteamWar.de-Serverteam - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero 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 Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see . - */ - -package de.steamwar.core; - -import de.steamwar.Reflection; - -import java.util.ArrayList; -import java.util.List; - -public class ChatWrapper8 implements ChatWrapper { - - private static final Reflection.Constructor chatComponentConstructor = Reflection.getConstructor(Reflection.getClass("net.minecraft.network.chat.ChatComponentText"), String.class); - @Override - public Object stringToChatComponent(String text) { - return chatComponentConstructor.invoke(text); - } - - private static final Class metadataPacket = Reflection.getClass("net.minecraft.network.protocol.game.ClientboundSetEntityDataPacket"); - private static final Reflection.Field metadataEntity = Reflection.getField(metadataPacket, int.class, 0); - private static final Reflection.Field metadataMetadata = Reflection.getField(metadataPacket, List.class, 0); - @Override - public Object getDataWatcherPacket(int entityId, Object... dataWatcherKeyValues) { - Object packet = Reflection.newInstance(metadataPacket); - metadataEntity.set(packet, entityId); - - ArrayList nativeWatchers = new ArrayList<>(1); - for(int i = 0; i < dataWatcherKeyValues.length; i+=2) { - nativeWatchers.add(BountifulWrapper.impl.getDataWatcherItem(dataWatcherKeyValues[i], dataWatcherKeyValues[i+1])); - } - metadataMetadata.set(packet, nativeWatchers); - - return packet; - } -} diff --git a/SpigotCore/SpigotCore_8/src/de/steamwar/core/CraftbukkitWrapper8.java b/SpigotCore/SpigotCore_8/src/de/steamwar/core/CraftbukkitWrapper8.java deleted file mode 100644 index 9f04130f..00000000 --- a/SpigotCore/SpigotCore_8/src/de/steamwar/core/CraftbukkitWrapper8.java +++ /dev/null @@ -1,33 +0,0 @@ -/* - * This file is a part of the SteamWar software. - * - * Copyright (C) 2025 SteamWar.de-Serverteam - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero 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 Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see . - */ - -package de.steamwar.core; - -import net.minecraft.server.v1_8_R3.PacketPlayOutMapChunk; -import org.bukkit.craftbukkit.v1_8_R3.CraftChunk; -import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer; -import org.bukkit.entity.Player; - -public class CraftbukkitWrapper8 implements CraftbukkitWrapper.ICraftbukkitWrapper { - - @Override - public void sendChunk(Player p, int chunkX, int chunkZ) { - ((CraftPlayer)p).getHandle().playerConnection.sendPacket(new PacketPlayOutMapChunk(((CraftChunk)p.getWorld().getChunkAt(chunkX, chunkZ)).getHandle(), true, 65535)); - } -} diff --git a/SpigotCore/SpigotCore_8/src/de/steamwar/core/FlatteningWrapper8.java b/SpigotCore/SpigotCore_8/src/de/steamwar/core/FlatteningWrapper8.java deleted file mode 100644 index 4c85eca0..00000000 --- a/SpigotCore/SpigotCore_8/src/de/steamwar/core/FlatteningWrapper8.java +++ /dev/null @@ -1,121 +0,0 @@ -/* - * This file is a part of the SteamWar software. - * - * Copyright (C) 2025 SteamWar.de-Serverteam - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero 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 Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see . - */ - -package de.steamwar.core; - -import de.steamwar.Reflection; -import org.bukkit.Material; -import org.bukkit.World; -import org.bukkit.entity.EntityType; -import org.bukkit.entity.Player; -import org.bukkit.inventory.ItemStack; -import org.bukkit.inventory.meta.SkullMeta; - -import java.util.HashMap; -import java.util.Map; - -public class FlatteningWrapper8 implements FlatteningWrapper.IFlatteningWrapper { - - private static final Reflection.Field scoreboardName = Reflection.getField(FlatteningWrapper.scoreboardObjective, String.class, 1); - private static final Class scoreActionEnum = Reflection.getClass("net.minecraft.PacketPlayOutScoreboardScore$EnumScoreboardAction"); - private static final Reflection.Field scoreAction = Reflection.getField(FlatteningWrapper.scoreboardScore, scoreActionEnum, 0); - private static final Object scoreActionChange = scoreActionEnum.getEnumConstants()[0]; - - @Override - public void setScoreboardTitle(Object packet, String title) { - scoreboardName.set(packet, title); - } - - @Override - public void setScoreAction(Object packet) { - scoreAction.set(packet, scoreActionChange); - } - - @Override - public Material getMaterial(String material) { - try{ - return Material.valueOf(material); - }catch(IllegalArgumentException e){ - return Material.STONE; - } - } - - @Override - public Material getDye(int colorCode) { - return Material.INK_SACK; - } - - @Override - public ItemStack setSkullOwner(String player) { - ItemStack head = new ItemStack(Material.SKULL_ITEM, 1, (short) 3); - SkullMeta headmeta = (SkullMeta) head.getItemMeta(); - headmeta.setOwner(player.startsWith(".") ? player.substring(1) : player); - headmeta.setDisplayName(player); - head.setItemMeta(headmeta); - return head; - } - - @Override - public Object getPose(FlatteningWrapper.EntityPose pose) { - return Byte.valueOf((byte)(pose == FlatteningWrapper.EntityPose.SNEAKING ? 2 : 0)); - } - - private static final Class dataWatcher = Reflection.getClass("net.minecraft.DataWatcher"); - private static final Class namedSpawnPacket = Reflection.getClass("net.minecraft.network.protocol.game.ClientboundAddPlayerPacket"); - private static final Reflection.Field namedSpawnDataWatcher = Reflection.getField(namedSpawnPacket, dataWatcher, 0); - private static final Class entity = Reflection.getClass("net.minecraft.Entity"); - private static final Reflection.Constructor dataWatcherConstructor = Reflection.getConstructor(dataWatcher, entity); - @Override - public void setNamedSpawnPacketDataWatcher(Object packet) { - namedSpawnDataWatcher.set(packet, dataWatcherConstructor.invoke((Object) null)); - } - - @Override - public Object formatDisplayName(String displayName) { - return displayName != null ? displayName : ""; - } - - - private static final Reflection.Field spawnType = Reflection.getField(ProtocolWrapper.spawnPacket, int.class, Core.getVersion() > 8 ? 6 : 9); - private static final Reflection.Field spawnLivingType = Reflection.getField(ProtocolWrapper.spawnLivingPacket, int.class, 1); - private static final Map types = new HashMap<>(); - static { - types.put(TrickyTrialsWrapper.impl.getTntEntityType(), 50); - types.put(EntityType.ARMOR_STAND, 30); - types.put(EntityType.ARROW, 60); - types.put(EntityType.FIREBALL, 63); - types.put(EntityType.ITEM_FRAME, 18); - types.put(EntityType.FALLING_BLOCK, 21); - } - @Override - public void setSpawnPacketType(Object packet, EntityType type) { - (type.isAlive() ? spawnLivingType : spawnType).set(packet, types.get(type)); - } - - @Override - public int getViewDistance(Player player) { - return 10; - } - - private static final Reflection.Method save = Reflection.getMethod("org.bukkit.craftbukkit.CraftWorld", "save", boolean.class); - @Override - public void syncSave(World world) { - save.invoke(world, true); - } -} diff --git a/SpigotCore/SpigotCore_8/src/de/steamwar/core/IDConverter8.java b/SpigotCore/SpigotCore_8/src/de/steamwar/core/IDConverter8.java deleted file mode 100644 index e13ad74a..00000000 --- a/SpigotCore/SpigotCore_8/src/de/steamwar/core/IDConverter8.java +++ /dev/null @@ -1,113 +0,0 @@ -/* - * This file is a part of the SteamWar software. - * - * Copyright (C) 2025 SteamWar.de-Serverteam - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero 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 Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see . - */ - -package de.steamwar.core; - -import org.bukkit.configuration.file.YamlConfiguration; - -import java.io.InputStreamReader; -import java.util.*; -import java.util.stream.Collectors; - -public class IDConverter8 { - - private final Map> availibleAttributes; - private final Map, BlockTypeID>> map; - - public IDConverter8() { - Map, BlockTypeID>> map = new HashMap<>(); - - YamlConfiguration legacy = YamlConfiguration.loadConfiguration(new InputStreamReader(Objects.requireNonNull(IDConverter8.class.getClassLoader().getResourceAsStream("legacy.yml")))); - for(String blockString : legacy.getKeys(false)){ - String[] legacyBlockId = legacy.getString(blockString).split(":"); - - map.computeIfAbsent(getBlockId(blockString), bId -> { - Map, BlockTypeID> attributeMap = new HashMap<>(); - attributeMap.put(new HashSet<>(), new BlockTypeID(legacyBlockId[0], "0")); - return attributeMap; - }).put(getAttributes(blockString), new BlockTypeID(legacyBlockId[0], legacyBlockId[1])); - } - this.map = map; - - Map> availableAttributes = new HashMap<>(); - for (Map.Entry, BlockTypeID>> entry : map.entrySet()) { - availableAttributes.put(entry.getKey(), entry.getValue().keySet().stream().flatMap(Collection::stream).collect(Collectors.toSet())); - } - this.availibleAttributes = availableAttributes; - } - - public BlockTypeID getId(String blockString) { - String blockId = getBlockId(blockString); - Map, IDConverter8.BlockTypeID> attributeMap = map.get(blockId); - if(attributeMap == null) { // Block nonexistent pre-flattening - return new BlockTypeID("0", "0"); - } - - Set attributes = getAttributes(blockString); - Set knownAttributes = this.availibleAttributes.get(blockId); - attributes.removeIf(attribute -> !knownAttributes.contains(attribute)); - - long bestMatch = -1; - BlockTypeID blockID = null; - for(Map.Entry, BlockTypeID> entry : attributeMap.entrySet()) { - Set attrs = entry.getKey(); - if(attrs.size() <= bestMatch) - continue; - - long matching = attributes.stream().filter(attrs::contains).count(); - if(matching > bestMatch) { - blockID = entry.getValue(); - bestMatch = matching; - - if(bestMatch == attributes.size()) - break; - } - } - return blockID; - } - - private String getBlockId(String blockString) { - return blockString.split("\\[", 2)[0]; - } - - private Set getAttributes(String blockString) { - Set attributes = new HashSet<>(); - if(blockString.contains("[")) - Collections.addAll(attributes, blockString.split("\\[")[1].replace("]", "").split(",")); - return attributes; - } - - static class BlockTypeID{ - private final int blockId; - private final byte dataId; - - private BlockTypeID(String blockId, String dataId) { - this.blockId = Integer.parseInt(blockId); - this.dataId = Byte.parseByte(dataId); - } - - int getBlockId() { - return blockId; - } - - byte getDataId() { - return dataId; - } - } -} diff --git a/SpigotCore/SpigotCore_8/src/de/steamwar/core/LocaleChangeWrapper8.java b/SpigotCore/SpigotCore_8/src/de/steamwar/core/LocaleChangeWrapper8.java deleted file mode 100644 index 76c565df..00000000 --- a/SpigotCore/SpigotCore_8/src/de/steamwar/core/LocaleChangeWrapper8.java +++ /dev/null @@ -1,24 +0,0 @@ -/* - * This file is a part of the SteamWar software. - * - * Copyright (C) 2025 SteamWar.de-Serverteam - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero 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 Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see . - */ - -package de.steamwar.core; - -public class LocaleChangeWrapper8 implements LocaleChangeWrapper { - // Event not available in 1.8-1.10 -} diff --git a/SpigotCore/SpigotCore_8/src/de/steamwar/core/ProtocolWrapper8.java b/SpigotCore/SpigotCore_8/src/de/steamwar/core/ProtocolWrapper8.java deleted file mode 100644 index d897487b..00000000 --- a/SpigotCore/SpigotCore_8/src/de/steamwar/core/ProtocolWrapper8.java +++ /dev/null @@ -1,71 +0,0 @@ -/* - * This file is a part of the SteamWar software. - * - * Copyright (C) 2025 SteamWar.de-Serverteam - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero 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 Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see . - */ - -package de.steamwar.core; - -import de.steamwar.Reflection; -import com.mojang.authlib.GameProfile; -import org.bukkit.GameMode; - -import java.util.Collections; -import java.util.EnumMap; -import java.util.List; - -public class ProtocolWrapper8 implements ProtocolWrapper { - - private static final Reflection.Field equipmentSlot; - static { - if(Core.getVersion() == 8) { - equipmentSlot = Reflection.getField(equipmentPacket, int.class, 1); - } else { - Class enumItemSlot = Reflection.getClass("net.minecraft.world.entity.EnumItemSlot"); - equipmentSlot = Reflection.getField(equipmentPacket, enumItemSlot, 0); - } - } - - private static final Reflection.Field equipmentStack = Reflection.getField(equipmentPacket, itemStack, 0); - @Override - public void setEquipmentPacketStack(Object packet, Object slot, Object stack) { - equipmentSlot.set(packet, slot); - equipmentStack.set(packet, stack); - } - - private static final Class playerInfoPacket = Reflection.getClass("net.minecraft.network.protocol.game.PacketPlayOutPlayerInfo"); - private static final Class playerInfoActionClass = Reflection.getClass("net.minecraft.network.protocol.game.PacketPlayOutPlayerInfo$EnumPlayerInfoAction"); - private static final Reflection.Field playerInfoAction = Reflection.getField(playerInfoPacket, playerInfoActionClass, 0); - private static final Reflection.Field playerInfoData = Reflection.getField(playerInfoPacket, List.class, 0); - private static final EnumMap actions = new EnumMap<>(PlayerInfoAction.class); - static { - Object[] nativeActions = playerInfoActionClass.getEnumConstants(); - actions.put(PlayerInfoAction.ADD, nativeActions[0]); - actions.put(PlayerInfoAction.GAMEMODE, nativeActions[1]); - actions.put(PlayerInfoAction.REMOVE, nativeActions[4]); - } - private static final Class iChatBaseComponent = Reflection.getClass("net.minecraft.network.chat.Component"); - private static final Reflection.Constructor playerInfoDataConstructor = Reflection.getConstructor("net.minecraft.network.protocol.game.PacketPlayOutPlayerInfo$PlayerInfoData", playerInfoPacket, GameProfile.class, int.class, enumGamemode, iChatBaseComponent); - - @Override - @SuppressWarnings("deprecation") - public Object playerInfoPacketConstructor(PlayerInfoAction action, GameProfile profile, GameMode mode) { - Object packet = Reflection.newInstance(playerInfoPacket); - playerInfoAction.set(packet, actions.get(action)); - playerInfoData.set(packet, Collections.singletonList(playerInfoDataConstructor.invoke(packet, profile, 0, ProtocolWrapper.getGameModeById.invoke(null, mode.getValue()), null))); - return packet; - } -} diff --git a/SpigotCore/SpigotCore_8/src/de/steamwar/core/RecipeDiscoverWrapper8.java b/SpigotCore/SpigotCore_8/src/de/steamwar/core/RecipeDiscoverWrapper8.java deleted file mode 100644 index 841719cd..00000000 --- a/SpigotCore/SpigotCore_8/src/de/steamwar/core/RecipeDiscoverWrapper8.java +++ /dev/null @@ -1,24 +0,0 @@ -/* - * This file is a part of the SteamWar software. - * - * Copyright (C) 2025 SteamWar.de-Serverteam - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero 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 Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see . - */ - -package de.steamwar.core; - -public class RecipeDiscoverWrapper8 implements RecipeDiscoverWrapper { - // Event not available pre flattening -} diff --git a/SpigotCore/SpigotCore_8/src/de/steamwar/core/TrickyTrialsWrapper8.java b/SpigotCore/SpigotCore_8/src/de/steamwar/core/TrickyTrialsWrapper8.java deleted file mode 100644 index 1d9abc37..00000000 --- a/SpigotCore/SpigotCore_8/src/de/steamwar/core/TrickyTrialsWrapper8.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * This file is a part of the SteamWar software. - * - * Copyright (C) 2025 SteamWar.de-Serverteam - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero 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 Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see . - */ - -package de.steamwar.core; - -import com.mojang.authlib.properties.Property; -import org.bukkit.Material; -import org.bukkit.enchantments.Enchantment; -import org.bukkit.entity.EntityType; -import org.bukkit.inventory.Inventory; -import org.bukkit.inventory.InventoryView; - -public class TrickyTrialsWrapper8 implements TrickyTrialsWrapper { - @Override - public EntityType getTntEntityType() { - return EntityType.PRIMED_TNT; - } - - @Override - public Enchantment getUnbreakingEnchantment() { - return Enchantment.DURABILITY; - } - - @Override - public Material getTurtleScute() { - return Material.STONE; - } - - @Override - public String getValue(Property property) { - return property.getValue(); - } -} diff --git a/SpigotCore/SpigotCore_8/src/de/steamwar/core/WorldEditRendererWrapper8.java b/SpigotCore/SpigotCore_8/src/de/steamwar/core/WorldEditRendererWrapper8.java deleted file mode 100644 index 1994e42f..00000000 --- a/SpigotCore/SpigotCore_8/src/de/steamwar/core/WorldEditRendererWrapper8.java +++ /dev/null @@ -1,42 +0,0 @@ -/* - * This file is a part of the SteamWar software. - * - * Copyright (C) 2025 SteamWar.de-Serverteam - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero 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 Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see . - */ - -package de.steamwar.core; - -import org.bukkit.entity.Player; -import org.bukkit.util.Vector; - -public class WorldEditRendererWrapper8 implements WorldEditRendererWrapper { - - @Override - public void draw(Player player, boolean scheduled, boolean clipboard, Vector pos1, Vector pos2) { - } - - @Override - public void tick(Player player) { - } - - @Override - public void hide(Player player, boolean clipboard, boolean hide) { - } - - @Override - public void remove(Player player) { - } -} diff --git a/SpigotCore/SpigotCore_8/src/de/steamwar/core/WorldEditWrapper8.java b/SpigotCore/SpigotCore_8/src/de/steamwar/core/WorldEditWrapper8.java deleted file mode 100644 index 4f45729d..00000000 --- a/SpigotCore/SpigotCore_8/src/de/steamwar/core/WorldEditWrapper8.java +++ /dev/null @@ -1,305 +0,0 @@ -/* - * This file is a part of the SteamWar software. - * - * Copyright (C) 2025 SteamWar.de-Serverteam - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero 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 Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see . - */ - -package de.steamwar.core; - -import com.google.common.base.Preconditions; -import com.google.common.collect.Maps; -import com.sk89q.jnbt.*; -import com.sk89q.worldedit.BlockVector; -import com.sk89q.worldedit.Vector; -import com.sk89q.worldedit.WorldEdit; -import com.sk89q.worldedit.WorldEditException; -import com.sk89q.worldedit.blocks.BaseBlock; -import com.sk89q.worldedit.bukkit.BukkitWorld; -import com.sk89q.worldedit.extension.input.ParserContext; -import com.sk89q.worldedit.extension.platform.Actor; -import com.sk89q.worldedit.extent.clipboard.BlockArrayClipboard; -import com.sk89q.worldedit.extent.clipboard.Clipboard; -import com.sk89q.worldedit.extent.clipboard.io.ClipboardFormat; -import com.sk89q.worldedit.extent.clipboard.io.ClipboardReader; -import com.sk89q.worldedit.extent.clipboard.io.SchematicReader; -import com.sk89q.worldedit.math.transform.Transform; -import com.sk89q.worldedit.regions.CuboidRegion; -import com.sk89q.worldedit.regions.Region; -import com.sk89q.worldedit.session.ClipboardHolder; -import com.sk89q.worldedit.world.registry.WorldData; -import de.steamwar.sql.NodeData; -import org.bukkit.entity.Player; - -import java.io.IOException; -import java.io.InputStream; -import java.util.HashMap; -import java.util.Iterator; -import java.util.List; -import java.util.Map; -import java.util.stream.Collectors; - -public class WorldEditWrapper8 implements WorldEditWrapper { - - @Override - public InputStream getPlayerClipboard(Player player) { - return WorldEditWrapper.getPlayerClipboard(player, (outputStream, clipboard, clipboardHolder) -> - ClipboardFormat.SCHEMATIC.getWriter(outputStream).write(clipboard, clipboardHolder.getWorldData())); - } - - @Override - public void setPlayerClipboard(Player player, Clipboard clipboard) { - WorldData world = new BukkitWorld(player.getWorld()).getWorldData(); - Actor actor = WorldEditWrapper.getWorldEditPlugin().wrapCommandSender(player); - WorldEditWrapper.getWorldEditPlugin().getWorldEdit().getSessionManager().get(actor).setClipboard(new ClipboardHolder(clipboard, world)); - } - - @Override - public Clipboard getClipboard(NodeData data) throws IOException { - InputStream is = data.schemData(true); - return readClipboard(is, data.getNodeFormat()); - } - - @Override - public Clipboard getClipboard(InputStream inputStream) throws IOException { - return readClipboard(inputStream, getNativeFormat()); - } - - private Clipboard readClipboard(InputStream is, NodeData.SchematicFormat format) throws IOException { - switch (format) { - case MCEDIT: - return new SchematicReader(new NBTInputStream(is)).read(WorldEdit.getInstance().getServer().getWorlds().get(0).getWorldData()); - case SPONGE_V2: - case SPONGE_V3: - return new SpongeSchematicReader(new NBTInputStream(is)).read(WorldEdit.getInstance().getServer().getWorlds().get(0).getWorldData()); - default: - throw new IllegalArgumentException("Unsupported schematic format"); - } - } - - @Override - public org.bukkit.util.Vector getOrigin(Clipboard clipboard) { - return new org.bukkit.util.Vector(clipboard.getOrigin().getX(), clipboard.getOrigin().getY(), clipboard.getOrigin().getZ()); - } - - @Override - public org.bukkit.util.Vector getMinimum(Region region) { - return new org.bukkit.util.Vector(region.getMinimumPoint().getX(), region.getMinimumPoint().getY(), region.getMinimumPoint().getZ()); - } - - @Override - public org.bukkit.util.Vector getMaximum(Region region) { - return new org.bukkit.util.Vector(region.getMaximumPoint().getX(), region.getMaximumPoint().getY(), region.getMaximumPoint().getZ()); - } - - @Override - public org.bukkit.util.Vector applyTransform(org.bukkit.util.Vector vector, Transform transform) { - Vector v = new Vector(vector.getX(), vector.getY(), vector.getZ()); - v = transform.apply(v); - return new org.bukkit.util.Vector(v.getX(), v.getY(), v.getZ()); - } - - @Override - public NodeData.SchematicFormat getNativeFormat() { - return NodeData.SchematicFormat.MCEDIT; - } - - private static class SpongeSchematicReader implements ClipboardReader { - - private final NBTInputStream inputStream; - private int schematicVersion = -1; - - SpongeSchematicReader(NBTInputStream inputStream) { - Preconditions.checkNotNull(inputStream); - this.inputStream = inputStream; - } - - @Override - public Clipboard read(WorldData worldData) throws IOException { - CompoundTag schematicTag = this.getBaseTag(); - if (this.schematicVersion == 1) { - return this.readSchematic(schematicTag); - } else if (this.schematicVersion == 2) { - return this.readSchematic(schematicTag); - } else { - throw new IOException("This schematic version is currently not supported"); - } - } - - private CompoundTag getBaseTag() throws IOException { - NamedTag rootTag = this.inputStream.readNamedTag(); - if (!rootTag.getName().equals("Schematic")) { - throw new IOException("Tag 'Schematic' does not exist or is not first"); - } else { - CompoundTag schematicTag = (CompoundTag)rootTag.getTag(); - Map schematic = schematicTag.getValue(); - this.schematicVersion = (requireTag(schematic, "Version", IntTag.class)).getValue(); - return schematicTag; - } - } - - private BlockArrayClipboard readSchematic(CompoundTag schematicTag) throws IOException { - IDConverter8 ids = new IDConverter8(); - - Map schematic = schematicTag.getValue(); - boolean v3Mode = false; - - if (schematic.size() == 1) { - schematic = (requireTag(schematic, "Schematic", CompoundTag.class)).getValue(); - v3Mode = true; - } - - int width = (requireTag(schematic, "Width", ShortTag.class)).getValue(); - int height = (requireTag(schematic, "Height", ShortTag.class)).getValue(); - int length = (requireTag(schematic, "Length", ShortTag.class)).getValue(); - IntArrayTag offsetTag = getTag(schematic, "Offset", IntArrayTag.class); - int[] offsetParts; - if (offsetTag != null) { - offsetParts = offsetTag.getValue(); - if (offsetParts.length != 3) - throw new IOException("Invalid offset specified in schematic."); - } else { - offsetParts = new int[]{0, 0, 0}; - } - - BlockVector min = new BlockVector(offsetParts[0], offsetParts[1], offsetParts[2]); - CompoundTag metadataTag = getTag(schematic, "Metadata", CompoundTag.class); - Vector origin; - CuboidRegion region; - if (metadataTag != null && metadataTag.containsKey("WEOffsetX")) { - Map metadata = metadataTag.getValue(); - int offsetX = (requireTag(metadata, "WEOffsetX", IntTag.class)).getValue(); - int offsetY = (requireTag(metadata, "WEOffsetY", IntTag.class)).getValue(); - int offsetZ = (requireTag(metadata, "WEOffsetZ", IntTag.class)).getValue(); - BlockVector offset = new BlockVector(offsetX, offsetY, offsetZ); - origin = min.subtract(offset); - region = new CuboidRegion(min, min.add(width, height, length).subtract(BlockVector.ONE)); - } else { - origin = min; - region = new CuboidRegion(min, min.add(width, height, length).subtract(BlockVector.ONE)); - } - - Map blockContainer = null; - - if (v3Mode) { - blockContainer = getTag(schematic, "Blocks", CompoundTag.class).getValue(); - } - - Map paletteObject = requireTag(v3Mode ? blockContainer : schematic, "Palette", CompoundTag.class).getValue(); - - Map palette = new HashMap<>(); - ParserContext parserContext = new ParserContext(); - parserContext.setRestricted(false); - parserContext.setPreferringWildcard(false); - - for(String palettePart : paletteObject.keySet()) { - IDConverter8.BlockTypeID blockID = ids.getId(palettePart); - palette.put(requireTag(paletteObject, palettePart, IntTag.class).getValue(), new BaseBlock(blockID.getBlockId(), blockID.getDataId())); - } - - byte[] blocks = requireTag(v3Mode ? blockContainer : schematic, v3Mode ? "Data" : "BlockData", ByteArrayTag.class).getValue(); - Map> tileEntitiesMap = new HashMap<>(); - ListTag tileEntities = getTag(v3Mode ? blockContainer : schematic, "BlockEntities", ListTag.class); - if (tileEntities == null) { - tileEntities = getTag(v3Mode ? blockContainer : schematic, "TileEntities", ListTag.class); - } - - if (tileEntities != null) { - List> tileEntityTags = tileEntities.getValue().stream().map((tag) -> - (CompoundTag)tag - ).map(CompoundTag::getValue).collect(Collectors.toList()); - - BlockVector pt; - Map tileEntity; - for(Iterator> var20 = tileEntityTags.iterator(); var20.hasNext(); tileEntitiesMap.put(pt, tileEntity)) { - tileEntity = var20.next(); - int[] pos = requireTag(tileEntity, "Pos", IntArrayTag.class).getValue(); - pt = new BlockVector(pos[0], pos[1], pos[2]); - Map values = Maps.newHashMap(tileEntity); - values.put("x", new IntTag(pt.getBlockX())); - values.put("y", new IntTag(pt.getBlockY())); - values.put("z", new IntTag(pt.getBlockZ())); - values.put("id", values.get("Id")); - values.remove("Id"); - values.remove("Pos"); - tileEntity = values; - } - } - - BlockArrayClipboard clipboard = new BlockArrayClipboard(region); - clipboard.setOrigin(origin); - int index = 0; - - for(int i = 0; i < blocks.length; ++index) { - int value = 0; - int varintLength = 0; - - while(true) { - value |= (blocks[i] & 127) << varintLength++ * 7; - if (varintLength > 5) { - throw new IOException("VarInt too big (probably corrupted data)"); - } - - if ((blocks[i] & 128) != 128) { - ++i; - int y = index / (width * length); - int z = index % (width * length) / width; - int x = index % (width * length) % width; - BaseBlock block = palette.get(value); - BlockVector pt = new BlockVector(x, y, z); - - try { - if (tileEntitiesMap.containsKey(pt)) { - block.setNbtData(new CompoundTag(tileEntitiesMap.get(pt))); - clipboard.setBlock(clipboard.getMinimumPoint().add(pt), block); - } else { - clipboard.setBlock(clipboard.getMinimumPoint().add(pt), block); - } - break; - } catch (WorldEditException var30) { - throw new IOException("Failed to load a block in the schematic"); - } - } - - ++i; - } - } - - return clipboard; - } - - private static T requireTag(Map items, String key, Class expected) throws IOException { - if (!items.containsKey(key)) { - throw new IOException("Schematic file is missing a \"" + key + "\" tag"); - } else { - Tag tag = items.get(key); - if (!expected.isInstance(tag)) { - throw new IOException(key + " tag is not of tag type " + expected.getName()); - } else { - return expected.cast(tag); - } - } - } - - private static T getTag(Map items, String key, Class expected) { - if (!items.containsKey(key)) { - return null; - } else { - Tag test = items.get(key); - return !expected.isInstance(test) ? null : expected.cast(test); - } - } - } -} diff --git a/SpigotCore/SpigotCore_8/src/de/steamwar/core/WorldIdentifier8.java b/SpigotCore/SpigotCore_8/src/de/steamwar/core/WorldIdentifier8.java deleted file mode 100644 index 632201bb..00000000 --- a/SpigotCore/SpigotCore_8/src/de/steamwar/core/WorldIdentifier8.java +++ /dev/null @@ -1,27 +0,0 @@ -/* - * This file is a part of the SteamWar software. - * - * Copyright (C) 2025 SteamWar.de-Serverteam - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero 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 Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see . - */ - -package de.steamwar.core; - -public class WorldIdentifier8 implements WorldIdentifier.IWorldIdentifier { - - @Override - public void setResourceKey(String name) { - } -} diff --git a/SpigotCore/SpigotCore_8/src/de/steamwar/core/authlib/SteamwarGameProfileRepository8.java b/SpigotCore/SpigotCore_8/src/de/steamwar/core/authlib/SteamwarGameProfileRepository8.java deleted file mode 100644 index be7ba13e..00000000 --- a/SpigotCore/SpigotCore_8/src/de/steamwar/core/authlib/SteamwarGameProfileRepository8.java +++ /dev/null @@ -1,72 +0,0 @@ -/* - * This file is a part of the SteamWar software. - * - * Copyright (C) 2025 SteamWar.de-Serverteam - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero 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 Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see . - */ - -package de.steamwar.core.authlib; - -import com.mojang.authlib.Agent; -import com.mojang.authlib.GameProfile; -import com.mojang.authlib.GameProfileRepository; -import com.mojang.authlib.ProfileLookupCallback; -import de.steamwar.Reflection; -import de.steamwar.sql.SteamwarUser; - -import java.util.ArrayList; -import java.util.List; - -public class SteamwarGameProfileRepository8 extends SteamwarGameProfileRepository { - - private static final GameProfileRepository fallback; - - private static final Object minecraftServer; - private static final Reflection.Field gameProfile; - - static { - Class minecraftServerClass = Reflection.getClass("net.minecraft.server.MinecraftServer"); - Class gpr = Reflection.getClass("com.mojang.authlib.GameProfileRepository"); - gameProfile = Reflection.getField(minecraftServerClass, gpr, 0); - minecraftServer = Reflection.getTypedMethod(minecraftServerClass, "getServer", minecraftServerClass).invoke(null); - fallback = (GameProfileRepository) gameProfile.get(minecraftServer); - } - - @Override - public void inject() { - gameProfile.set(minecraftServer, this); - } - - @Override - public void findProfilesByNames(String[] strings, Agent agent, ProfileLookupCallback profileLookupCallback) { - if(agent == Agent.SCROLLS) { - fallback.findProfilesByNames(strings, agent, profileLookupCallback); - } else { - List unknownNames = new ArrayList<>(); - for (String name:strings) { - SteamwarUser user = SteamwarUser.get(name); - if(user == null) { - unknownNames.add(name); - continue; - } - - profileLookupCallback.onProfileLookupSucceeded(new GameProfile(user.getUUID(), user.getUserName())); - } - if(!unknownNames.isEmpty()) { - fallback.findProfilesByNames(unknownNames.toArray(new String[0]), agent, profileLookupCallback); - } - } - } -} diff --git a/SpigotCore/SpigotCore_8/src/de/steamwar/scoreboard/SWScoreboard8.java b/SpigotCore/SpigotCore_8/src/de/steamwar/scoreboard/SWScoreboard8.java deleted file mode 100644 index 75b4da57..00000000 --- a/SpigotCore/SpigotCore_8/src/de/steamwar/scoreboard/SWScoreboard8.java +++ /dev/null @@ -1,115 +0,0 @@ -/* - * This file is a part of the SteamWar software. - * - * Copyright (C) 2025 SteamWar.de-Serverteam - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero 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 Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see . - */ - -package de.steamwar.scoreboard; - -import de.steamwar.Reflection; -import com.comphenix.tinyprotocol.TinyProtocol; -import de.steamwar.core.Core; -import de.steamwar.core.FlatteningWrapper; -import org.bukkit.Bukkit; -import org.bukkit.entity.Player; - -import java.util.HashMap; -import java.util.Map; - -public class SWScoreboard8 implements SWScoreboard { - private static final Reflection.Field scoreboardName = Reflection.getField(FlatteningWrapper.scoreboardObjective, String.class, 0); - private static final Reflection.Field scoreboardAction = Reflection.getField(FlatteningWrapper.scoreboardObjective, int.class, Core.getVersion() > 15 ? 3 : 0); - private static final Class scoreboardDisplayEnum = Reflection.getClass("net.minecraft.world.scores.criteria.IScoreboardCriteria$EnumScoreboardHealthDisplay"); - private static final Reflection.Field scoreboardDisplayType = Reflection.getField(FlatteningWrapper.scoreboardObjective, scoreboardDisplayEnum, 0); - private static final Object displayTypeIntegers = scoreboardDisplayEnum.getEnumConstants()[0]; - - private static final Reflection.Field scoreName = Reflection.getField(FlatteningWrapper.scoreboardScore, String.class, 0); - private static final Reflection.Field scoreScoreboardName = Reflection.getField(FlatteningWrapper.scoreboardScore, String.class, 1); - private static final Reflection.Field scoreValue = Reflection.getField(FlatteningWrapper.scoreboardScore, int.class, 0); - - private static final HashMap playerBoards = new HashMap<>(); //Object -> Scoreboard | Alle Versionen in der Map! - private static int toggle = 0; // Scoreboard 0 updates while scoreboard 1 is presenting. toggle marks the current active scoreboard - - private static final String SIDEBAR = "Sidebar"; - private static final Object[] DELETE_SCOREBOARD = new Object[2]; - private static final Object[] DISPLAY_SIDEBAR = new Object[2]; - - static { - Class scoreboardDisplayObjective = Reflection.getClass("net.minecraft.network.protocol.game.PacketPlayOutScoreboardDisplayObjective"); - Reflection.Field scoreboardDisplayName = Reflection.getField(scoreboardDisplayObjective, String.class, 0); - Reflection.Field scoreboardDisplaySlot = Reflection.getField(scoreboardDisplayObjective, int.class, 0); - for(int id = 0; id < 2; id++) { - DELETE_SCOREBOARD[id] = Reflection.newInstance(FlatteningWrapper.scoreboardObjective); - scoreboardName.set(DELETE_SCOREBOARD[id], SIDEBAR + id); - scoreboardAction.set(DELETE_SCOREBOARD[id], 1); //1 to remove - - DISPLAY_SIDEBAR[id] = Reflection.newInstance(scoreboardDisplayObjective); - scoreboardDisplayName.set(DISPLAY_SIDEBAR[id], SIDEBAR + id); - scoreboardDisplaySlot.set(DISPLAY_SIDEBAR[id], 1); // 1 = Sidebar - } - - Bukkit.getScheduler().runTaskTimer(Core.getInstance(), () -> { - toggle ^= 1; // Toggle between 0 and 1 - - for(Map.Entry scoreboard : playerBoards.entrySet()) { - Player player = scoreboard.getKey(); - ScoreboardCallback callback = scoreboard.getValue(); - - TinyProtocol.instance.sendPacket(player, DELETE_SCOREBOARD[toggle]); - TinyProtocol.instance.sendPacket(player, createSidebarPacket(callback.getTitle())); - for(Map.Entry score : callback.getData().entrySet()){ - TinyProtocol.instance.sendPacket(player, createScorePacket(score.getKey(), score.getValue())); - } - - Bukkit.getScheduler().runTaskLater(Core.getInstance(), () -> { - if(!player.isOnline()) - return; - TinyProtocol.instance.sendPacket(player, DISPLAY_SIDEBAR[toggle]); - }, 2); - } - }, 10, 5); - } - - public boolean createScoreboard(Player player, ScoreboardCallback callback) { - playerBoards.put(player, callback); - return true; - } - - public void removeScoreboard(Player player) { - if(playerBoards.remove(player) == null || !player.isOnline()) - return; - - TinyProtocol.instance.sendPacket(player, DELETE_SCOREBOARD[toggle]); - } - - private static Object createSidebarPacket(String name){ - Object packet = Reflection.newInstance(FlatteningWrapper.scoreboardObjective); - scoreboardName.set(packet, SIDEBAR + toggle); - scoreboardAction.set(packet, 0); //0 to create - FlatteningWrapper.impl.setScoreboardTitle(packet, name); - scoreboardDisplayType.set(packet, displayTypeIntegers); - return packet; - } - - private static Object createScorePacket(String name, int value){ - Object packet = Reflection.newInstance(FlatteningWrapper.scoreboardScore); - scoreName.set(packet, name); - scoreScoreboardName.set(packet, SIDEBAR + toggle); - scoreValue.set(packet, value); - FlatteningWrapper.impl.setScoreAction(packet); - return packet; - } -} diff --git a/SpigotCore/SpigotCore_8/src/de/steamwar/techhider/BlockIds8.java b/SpigotCore/SpigotCore_8/src/de/steamwar/techhider/BlockIds8.java deleted file mode 100644 index 25535af8..00000000 --- a/SpigotCore/SpigotCore_8/src/de/steamwar/techhider/BlockIds8.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * This file is a part of the SteamWar software. - * - * Copyright (C) 2025 SteamWar.de-Serverteam - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero 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 Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see . - */ - -package de.steamwar.techhider; - -import org.bukkit.Material; - -import java.util.Collections; -import java.util.Set; - -public class BlockIds8 implements BlockIds { - @Override - public int getCombinedId(Object iBlockData) { - int id = (int) getCombinedId.invoke(null, iBlockData); // blockState << 12 | blockId - return (id & 4095) | (id >> 12); - } - - @Override - @SuppressWarnings("deprecation") - public int materialToId(Material material) { - return material.getId() << 4; - } - - @Override - public Set materialToAllIds(Material material) { - return Collections.singleton(materialToId(material)); - } -} diff --git a/SpigotCore/SpigotCore_8/src/de/steamwar/techhider/ChunkHider8.java b/SpigotCore/SpigotCore_8/src/de/steamwar/techhider/ChunkHider8.java deleted file mode 100644 index 6b7441a4..00000000 --- a/SpigotCore/SpigotCore_8/src/de/steamwar/techhider/ChunkHider8.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * This file is a part of the SteamWar software. - * - * Copyright (C) 2025 SteamWar.de-Serverteam - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero 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 Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see . - */ - -package de.steamwar.techhider; - -import de.steamwar.Reflection; -import org.bukkit.entity.Player; - -import java.util.function.BiFunction; - -public class ChunkHider8 implements ChunkHider { - - protected static final Class mapChunkPacket = Reflection.getClass("net.minecraft.PacketPlayOutMapChunk"); - @Override - public Class mapChunkPacket() { - return mapChunkPacket; - } - - @Override - public BiFunction chunkHiderGenerator(TechHider techHider) { - return (player, packet) -> packet; - } -} diff --git a/SpigotCore/SpigotCore_8/src/de/steamwar/techhider/ProtocolWrapper8.java b/SpigotCore/SpigotCore_8/src/de/steamwar/techhider/ProtocolWrapper8.java deleted file mode 100644 index 28d6b8f6..00000000 --- a/SpigotCore/SpigotCore_8/src/de/steamwar/techhider/ProtocolWrapper8.java +++ /dev/null @@ -1,85 +0,0 @@ -/* - * This file is a part of the SteamWar software. - * - * Copyright (C) 2025 SteamWar.de-Serverteam - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero 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 Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see . - */ - -package de.steamwar.techhider; - -import de.steamwar.Reflection; -import org.bukkit.entity.Player; - -import java.lang.reflect.Array; -import java.util.ArrayList; -import java.util.function.BiFunction; - -public class ProtocolWrapper8 implements ProtocolWrapper { - private static final Class chunkCoordinateIntPair = Reflection.getClass("net.minecraft.ChunkCoordIntPair"); - private static final Reflection.Field multiBlockChangeChunk = Reflection.getField(TechHider.multiBlockChangePacket, chunkCoordinateIntPair, 0); - private static final Reflection.Field chunkCoordinateX = Reflection.getField(chunkCoordinateIntPair, int.class, 0); - private static final Reflection.Field chunkCoordinateZ = Reflection.getField(chunkCoordinateIntPair, int.class, 1); - private static final Class multiBlockChangeInfo = Reflection.getClass("net.minecraft.PacketPlayOutMultiBlockChange$MultiBlockChangeInfo"); - private static final Reflection.Constructor multiBlockChangeInfoConstructor = Reflection.getConstructor(multiBlockChangeInfo, TechHider.multiBlockChangePacket, short.class, TechHider.iBlockData); - private static final Reflection.Field multiBlockChangeInfoBlock = Reflection.getField(multiBlockChangeInfo, TechHider.iBlockData, 0); - private static final Reflection.Field multiBlockChangeInfoPos = Reflection.getField(multiBlockChangeInfo, short.class, 0); - private static final Class multiBlockChangeInfoArray = Reflection.getClass("[L" + Reflection.LEGACY_NET_MINECRAFT_SERVER + ".PacketPlayOutMultiBlockChange$MultiBlockChangeInfo;"); - private static final Reflection.Field multiBlockChangeInfos = Reflection.getField(TechHider.multiBlockChangePacket, multiBlockChangeInfoArray, 0); - @Override - public BiFunction multiBlockChangeGenerator(TechHider techHider) { - return (p, packet) -> { - TechHider.LocationEvaluator locationEvaluator = techHider.getLocationEvaluator(); - Object chunkCoords = multiBlockChangeChunk.get(packet); - int chunkX = chunkCoordinateX.get(chunkCoords); - int chunkZ = chunkCoordinateZ.get(chunkCoords); - if(locationEvaluator.skipChunk(p, chunkX, chunkZ)) - return packet; - - packet = TechHider.multiBlockChangeCloner.apply(packet); - Object[] mbcis = (Object[]) multiBlockChangeInfos.get(packet); - ArrayList blockChangeInfos = new ArrayList<>(mbcis.length); - for(Object mbci : mbcis) { - short pos = (short) multiBlockChangeInfoPos.get(mbci); - switch(locationEvaluator.check(p, 16*chunkX + (pos >> 12 & 0xF), pos & 0xFF, 16*chunkZ + (pos >> 8 & 0xF))) { - case SKIP: - blockChangeInfos.add(mbci); - break; - case CHECK: - blockChangeInfos.add(techHider.iBlockDataHidden(multiBlockChangeInfoBlock.get(mbci)) ? multiBlockChangeInfoConstructor.invoke(packet, pos, techHider.getObfuscationTarget()) : mbci); - break; - default: - break; - } - } - - if(blockChangeInfos.isEmpty()) - return null; - - multiBlockChangeInfos.set(packet, blockChangeInfos.toArray((Object[])Array.newInstance(multiBlockChangeInfo, 0))); - return packet; - }; - } - - private static final Reflection.Field tileEntityDataAction = Reflection.getField(TechHider.tileEntityDataPacket, int.class, 0); - @Override - public boolean unfilteredTileEntityDataAction(Object packet) { - return tileEntityDataAction.get(packet) != 9; - } - - @Override - public BiFunction blockBreakHiderGenerator(Class blockBreakPacket, TechHider techHider) { - return null; - } -} diff --git a/SpigotCore/SpigotCore_8/src/legacy.yml b/SpigotCore/SpigotCore_8/src/legacy.yml deleted file mode 100644 index 51097cd6..00000000 --- a/SpigotCore/SpigotCore_8/src/legacy.yml +++ /dev/null @@ -1,1623 +0,0 @@ -"minecraft:air": "0:0" -"minecraft:stone": "1:0" -"minecraft:granite": "1:1" -"minecraft:polished_granite": "1:2" -"minecraft:diorite": "1:3" -"minecraft:polished_diorite": "1:4" -"minecraft:andesite": "1:5" -"minecraft:polished_andesite": "1:6" -"minecraft:grass_block[snowy=false]": "2:0" -"minecraft:dirt": "3:0" -"minecraft:coarse_dirt": "3:1" -"minecraft:podzol[snowy=false]": "3:2" -"minecraft:cobblestone": "4:0" -"minecraft:oak_planks": "5:0" -"minecraft:spruce_planks": "5:1" -"minecraft:birch_planks": "5:2" -"minecraft:jungle_planks": "5:3" -"minecraft:acacia_planks": "5:4" -"minecraft:dark_oak_planks": "5:5" -"minecraft:oak_sapling[stage=0]": "6:0" -"minecraft:spruce_sapling[stage=0]": "6:1" -"minecraft:birch_sapling[stage=0]": "6:2" -"minecraft:jungle_sapling[stage=0]": "6:3" -"minecraft:acacia_sapling[stage=0]": "6:4" -"minecraft:dark_oak_sapling[stage=0]": "6:5" -"minecraft:oak_sapling[stage=1]": "6:8" -"minecraft:spruce_sapling[stage=1]": "6:9" -"minecraft:birch_sapling[stage=1]": "6:10" -"minecraft:jungle_sapling[stage=1]": "6:11" -"minecraft:acacia_sapling[stage=1]": "6:12" -"minecraft:dark_oak_sapling[stage=1]": "6:13" -"minecraft:bedrock": "7:0" -"minecraft:water[level=0]": "8:0" -"minecraft:water[level=1]": "8:1" -"minecraft:water[level=2]": "8:2" -"minecraft:water[level=3]": "8:3" -"minecraft:water[level=4]": "8:4" -"minecraft:water[level=5]": "8:5" -"minecraft:water[level=6]": "8:6" -"minecraft:water[level=7]": "8:7" -"minecraft:water[level=8]": "8:8" -"minecraft:water[level=9]": "8:9" -"minecraft:water[level=10]": "8:10" -"minecraft:water[level=11]": "8:11" -"minecraft:water[level=12]": "8:12" -"minecraft:water[level=13]": "8:13" -"minecraft:water[level=14]": "8:14" -"minecraft:water[level=15]": "8:15" -"minecraft:lava[level=0]": "10:0" -"minecraft:lava[level=1]": "10:1" -"minecraft:lava[level=2]": "10:2" -"minecraft:lava[level=3]": "10:3" -"minecraft:lava[level=4]": "10:4" -"minecraft:lava[level=5]": "10:5" -"minecraft:lava[level=6]": "10:6" -"minecraft:lava[level=7]": "10:7" -"minecraft:lava[level=8]": "10:8" -"minecraft:lava[level=9]": "10:9" -"minecraft:lava[level=10]": "10:10" -"minecraft:lava[level=11]": "10:11" -"minecraft:lava[level=12]": "10:12" -"minecraft:lava[level=13]": "10:13" -"minecraft:lava[level=14]": "10:14" -"minecraft:lava[level=15]": "10:15" -"minecraft:sand": "12:0" -"minecraft:red_sand": "12:1" -"minecraft:gravel": "13:0" -"minecraft:gold_ore": "14:0" -"minecraft:iron_ore": "15:0" -"minecraft:coal_ore": "16:0" -"minecraft:oak_log[axis=y]": "17:0" -"minecraft:spruce_log[axis=y]": "17:1" -"minecraft:birch_log[axis=y]": "17:2" -"minecraft:jungle_log[axis=y]": "17:3" -"minecraft:oak_log[axis=x]": "17:4" -"minecraft:spruce_log[axis=x]": "17:5" -"minecraft:birch_log[axis=x]": "17:6" -"minecraft:jungle_log[axis=x]": "17:7" -"minecraft:oak_log[axis=z]": "17:8" -"minecraft:spruce_log[axis=z]": "17:9" -"minecraft:birch_log[axis=z]": "17:10" -"minecraft:jungle_log[axis=z]": "17:11" -"minecraft:oak_wood": "17:12" -"minecraft:spruce_wood": "17:13" -"minecraft:birch_wood": "17:14" -"minecraft:jungle_wood": "17:15" -"minecraft:oak_leaves[persistent=false,distance=1]": "18:0" -"minecraft:spruce_leaves[persistent=false,distance=1]": "18:1" -"minecraft:birch_leaves[persistent=false,distance=1]": "18:2" -"minecraft:jungle_leaves[persistent=false,distance=1]": "18:3" -"minecraft:oak_leaves[persistent=true,distance=1]": "18:4" -"minecraft:spruce_leaves[persistent=true,distance=1]": "18:5" -"minecraft:birch_leaves[persistent=true,distance=1]": "18:6" -"minecraft:jungle_leaves[persistent=true,distance=1]": "18:7" -"minecraft:sponge": "19:0" -"minecraft:wet_sponge": "19:1" -"minecraft:glass": "20:0" -"minecraft:lapis_ore": "21:0" -"minecraft:lapis_block": "22:0" -"minecraft:dispenser[triggered=false,facing=down]": "23:0" -"minecraft:dispenser[triggered=false,facing=up]": "23:1" -"minecraft:dispenser[triggered=false,facing=north]": "23:2" -"minecraft:dispenser[triggered=false,facing=south]": "23:3" -"minecraft:dispenser[triggered=false,facing=west]": "23:4" -"minecraft:dispenser[triggered=false,facing=east]": "23:5" -"minecraft:dispenser[triggered=true,facing=down]": "23:8" -"minecraft:dispenser[triggered=true,facing=up]": "23:9" -"minecraft:dispenser[triggered=true,facing=north]": "23:10" -"minecraft:dispenser[triggered=true,facing=south]": "23:11" -"minecraft:dispenser[triggered=true,facing=west]": "23:12" -"minecraft:dispenser[triggered=true,facing=east]": "23:13" -"minecraft:sandstone": "24:0" -"minecraft:chiseled_sandstone": "24:1" -"minecraft:cut_sandstone": "24:2" -"minecraft:note_block": "25:0" -"minecraft:red_bed[part=foot,facing=south,occupied=false]": "26:0" -"minecraft:red_bed[part=foot,facing=west,occupied=false]": "26:1" -"minecraft:red_bed[part=foot,facing=north,occupied=false]": "26:2" -"minecraft:red_bed[part=foot,facing=east,occupied=false]": "26:3" -"minecraft:red_bed[part=foot,facing=south,occupied=true]": "26:4" -"minecraft:red_bed[part=foot,facing=west,occupied=true]": "26:5" -"minecraft:red_bed[part=foot,facing=north,occupied=true]": "26:6" -"minecraft:red_bed[part=foot,facing=east,occupied=true]": "26:7" -"minecraft:red_bed[part=head,facing=south,occupied=false]": "26:8" -"minecraft:red_bed[part=head,facing=west,occupied=false]": "26:9" -"minecraft:red_bed[part=head,facing=north,occupied=false]": "26:10" -"minecraft:red_bed[part=head,facing=east,occupied=false]": "26:11" -"minecraft:red_bed[part=head,facing=south,occupied=true]": "26:12" -"minecraft:red_bed[part=head,facing=west,occupied=true]": "26:13" -"minecraft:red_bed[part=head,facing=north,occupied=true]": "26:14" -"minecraft:red_bed[part=head,facing=east,occupied=true]": "26:15" -"minecraft:powered_rail[shape=north_south,powered=false]": "27:0" -"minecraft:powered_rail[shape=east_west,powered=false]": "27:1" -"minecraft:powered_rail[shape=ascending_east,powered=false]": "27:2" -"minecraft:powered_rail[shape=ascending_west,powered=false]": "27:3" -"minecraft:powered_rail[shape=ascending_north,powered=false]": "27:4" -"minecraft:powered_rail[shape=ascending_south,powered=false]": "27:5" -"minecraft:powered_rail[shape=north_south,powered=true]": "27:8" -"minecraft:powered_rail[shape=east_west,powered=true]": "27:9" -"minecraft:powered_rail[shape=ascending_east,powered=true]": "27:10" -"minecraft:powered_rail[shape=ascending_west,powered=true]": "27:11" -"minecraft:powered_rail[shape=ascending_north,powered=true]": "27:12" -"minecraft:powered_rail[shape=ascending_south,powered=true]": "27:13" -"minecraft:detector_rail[shape=north_south,powered=false]": "28:0" -"minecraft:detector_rail[shape=east_west,powered=false]": "28:1" -"minecraft:detector_rail[shape=ascending_east,powered=false]": "28:2" -"minecraft:detector_rail[shape=ascending_west,powered=false]": "28:3" -"minecraft:detector_rail[shape=ascending_north,powered=false]": "28:4" -"minecraft:detector_rail[shape=ascending_south,powered=false]": "28:5" -"minecraft:detector_rail[shape=north_south,powered=true]": "28:8" -"minecraft:detector_rail[shape=east_west,powered=true]": "28:9" -"minecraft:detector_rail[shape=ascending_east,powered=true]": "28:10" -"minecraft:detector_rail[shape=ascending_west,powered=true]": "28:11" -"minecraft:detector_rail[shape=ascending_north,powered=true]": "28:12" -"minecraft:detector_rail[shape=ascending_south,powered=true]": "28:13" -"minecraft:sticky_piston[facing=down,extended=false]": "29:0" -"minecraft:sticky_piston[facing=up,extended=false]": "29:1" -"minecraft:sticky_piston[facing=north,extended=false]": "29:2" -"minecraft:sticky_piston[facing=south,extended=false]": "29:3" -"minecraft:sticky_piston[facing=west,extended=false]": "29:4" -"minecraft:sticky_piston[facing=east,extended=false]": "29:5" -"minecraft:sticky_piston[facing=down,extended=true]": "29:8" -"minecraft:sticky_piston[facing=up,extended=true]": "29:9" -"minecraft:sticky_piston[facing=north,extended=true]": "29:10" -"minecraft:sticky_piston[facing=south,extended=true]": "29:11" -"minecraft:sticky_piston[facing=west,extended=true]": "29:12" -"minecraft:sticky_piston[facing=east,extended=true]": "29:13" -"minecraft:cobweb": "30:0" -"minecraft:dead_bush": "31:0" -"minecraft:grass": "31:1" -"minecraft:fern": "31:2" -"minecraft:piston[facing=down,extended=false]": "33:0" -"minecraft:piston[facing=up,extended=false]": "33:1" -"minecraft:piston[facing=north,extended=false]": "33:2" -"minecraft:piston[facing=south,extended=false]": "33:3" -"minecraft:piston[facing=west,extended=false]": "33:4" -"minecraft:piston[facing=east,extended=false]": "33:5" -"minecraft:piston[facing=down,extended=true]": "33:8" -"minecraft:piston[facing=up,extended=true]": "33:9" -"minecraft:piston[facing=north,extended=true]": "33:10" -"minecraft:piston[facing=south,extended=true]": "33:11" -"minecraft:piston[facing=west,extended=true]": "33:12" -"minecraft:piston[facing=east,extended=true]": "33:13" -"minecraft:piston_head[short=false,facing=down,type=normal]": "34:0" -"minecraft:piston_head[short=false,facing=up,type=normal]": "34:1" -"minecraft:piston_head[short=false,facing=north,type=normal]": "34:2" -"minecraft:piston_head[short=false,facing=south,type=normal]": "34:3" -"minecraft:piston_head[short=false,facing=west,type=normal]": "34:4" -"minecraft:piston_head[short=false,facing=east,type=normal]": "34:5" -"minecraft:piston_head[short=false,facing=down,type=sticky]": "34:8" -"minecraft:piston_head[short=false,facing=up,type=sticky]": "34:9" -"minecraft:piston_head[short=false,facing=north,type=sticky]": "34:10" -"minecraft:piston_head[short=false,facing=south,type=sticky]": "34:11" -"minecraft:piston_head[short=false,facing=west,type=sticky]": "34:12" -"minecraft:piston_head[short=false,facing=east,type=sticky]": "34:13" -"minecraft:white_wool": "35:0" -"minecraft:orange_wool": "35:1" -"minecraft:magenta_wool": "35:2" -"minecraft:light_blue_wool": "35:3" -"minecraft:yellow_wool": "35:4" -"minecraft:lime_wool": "35:5" -"minecraft:pink_wool": "35:6" -"minecraft:gray_wool": "35:7" -"minecraft:light_gray_wool": "35:8" -"minecraft:cyan_wool": "35:9" -"minecraft:purple_wool": "35:10" -"minecraft:blue_wool": "35:11" -"minecraft:brown_wool": "35:12" -"minecraft:green_wool": "35:13" -"minecraft:red_wool": "35:14" -"minecraft:black_wool": "35:15" -"minecraft:moving_piston[facing=down,type=normal]": "36:0" -"minecraft:moving_piston[facing=up,type=normal]": "36:1" -"minecraft:moving_piston[facing=north,type=normal]": "36:2" -"minecraft:moving_piston[facing=south,type=normal]": "36:3" -"minecraft:moving_piston[facing=west,type=normal]": "36:4" -"minecraft:moving_piston[facing=east,type=normal]": "36:5" -"minecraft:moving_piston[facing=down,type=sticky]": "36:8" -"minecraft:moving_piston[facing=up,type=sticky]": "36:9" -"minecraft:moving_piston[facing=north,type=sticky]": "36:10" -"minecraft:moving_piston[facing=south,type=sticky]": "36:11" -"minecraft:moving_piston[facing=west,type=sticky]": "36:12" -"minecraft:moving_piston[facing=east,type=sticky]": "36:13" -"minecraft:dandelion": "37:0" -"minecraft:poppy": "38:0" -"minecraft:blue_orchid": "38:1" -"minecraft:allium": "38:2" -"minecraft:azure_bluet": "38:3" -"minecraft:red_tulip": "38:4" -"minecraft:orange_tulip": "38:5" -"minecraft:white_tulip": "38:6" -"minecraft:pink_tulip": "38:7" -"minecraft:oxeye_daisy": "38:8" -"minecraft:brown_mushroom": "39:0" -"minecraft:red_mushroom": "40:0" -"minecraft:gold_block": "41:0" -"minecraft:iron_block": "42:0" -"minecraft:stone_slab[type=double]": "43:0" -"minecraft:sandstone_slab[type=double]": "43:1" -"minecraft:petrified_oak_slab[type=double]": "43:2" -"minecraft:cobblestone_slab[type=double]": "43:3" -"minecraft:brick_slab[type=double]": "43:4" -"minecraft:stone_brick_slab[type=double]": "43:5" -"minecraft:nether_brick_slab[type=double]": "43:6" -"minecraft:quartz_slab[type=double]": "43:7" -"minecraft:smooth_stone": "43:8" -"minecraft:smooth_sandstone": "43:9" -"minecraft:smooth_quartz": "43:15" -"minecraft:stone_slab[type=bottom]": "44:0" -"minecraft:sandstone_slab[type=bottom]": "44:1" -"minecraft:petrified_oak_slab[type=bottom]": "44:2" -"minecraft:cobblestone_slab[type=bottom]": "44:3" -"minecraft:brick_slab[type=bottom]": "44:4" -"minecraft:stone_brick_slab[type=bottom]": "44:5" -"minecraft:nether_brick_slab[type=bottom]": "44:6" -"minecraft:quartz_slab[type=bottom]": "44:7" -"minecraft:stone_slab[type=top]": "44:8" -"minecraft:sandstone_slab[type=top]": "44:9" -"minecraft:petrified_oak_slab[type=top]": "44:10" -"minecraft:cobblestone_slab[type=top]": "44:11" -"minecraft:brick_slab[type=top]": "44:12" -"minecraft:stone_brick_slab[type=top]": "44:13" -"minecraft:nether_brick_slab[type=top]": "44:14" -"minecraft:quartz_slab[type=top]": "44:15" -"minecraft:bricks": "45:0" -"minecraft:tnt[unstable=false]": "46:0" -"minecraft:tnt[unstable=true]": "46:1" -"minecraft:bookshelf": "47:0" -"minecraft:mossy_cobblestone": "48:0" -"minecraft:obsidian": "49:0" -"minecraft:torch": "50:0" -"minecraft:wall_torch[facing=east]": "50:1" -"minecraft:wall_torch[facing=west]": "50:2" -"minecraft:wall_torch[facing=south]": "50:3" -"minecraft:wall_torch[facing=north]": "50:4" -"minecraft:fire[east=false,south=false,north=false,west=false,up=false,age=0]": "51:0" -"minecraft:fire[east=false,south=false,north=false,west=false,up=false,age=1]": "51:1" -"minecraft:fire[east=false,south=false,north=false,west=false,up=false,age=2]": "51:2" -"minecraft:fire[east=false,south=false,north=false,west=false,up=false,age=3]": "51:3" -"minecraft:fire[east=false,south=false,north=false,west=false,up=false,age=4]": "51:4" -"minecraft:fire[east=false,south=false,north=false,west=false,up=false,age=5]": "51:5" -"minecraft:fire[east=false,south=false,north=false,west=false,up=false,age=6]": "51:6" -"minecraft:fire[east=false,south=false,north=false,west=false,up=false,age=7]": "51:7" -"minecraft:fire[east=false,south=false,north=false,west=false,up=false,age=8]": "51:8" -"minecraft:fire[east=false,south=false,north=false,west=false,up=false,age=9]": "51:9" -"minecraft:fire[east=false,south=false,north=false,west=false,up=false,age=10]": "51:10" -"minecraft:fire[east=false,south=false,north=false,west=false,up=false,age=11]": "51:11" -"minecraft:fire[east=false,south=false,north=false,west=false,up=false,age=12]": "51:12" -"minecraft:fire[east=false,south=false,north=false,west=false,up=false,age=13]": "51:13" -"minecraft:fire[east=false,south=false,north=false,west=false,up=false,age=14]": "51:14" -"minecraft:fire[east=false,south=false,north=false,west=false,up=false,age=15]": "51:15" -"minecraft:spawner": "52:0" -"minecraft:oak_stairs[half=bottom,shape=outer_right,facing=east]": "53:0" -"minecraft:oak_stairs[half=bottom,shape=outer_right,facing=west]": "53:1" -"minecraft:oak_stairs[half=bottom,shape=outer_right,facing=south]": "53:2" -"minecraft:oak_stairs[half=bottom,shape=outer_right,facing=north]": "53:3" -"minecraft:oak_stairs[half=top,shape=outer_right,facing=east]": "53:4" -"minecraft:oak_stairs[half=top,shape=outer_right,facing=west]": "53:5" -"minecraft:oak_stairs[half=top,shape=outer_right,facing=south]": "53:6" -"minecraft:oak_stairs[half=top,shape=outer_right,facing=north]": "53:7" -"minecraft:chest": "54:0" -"minecraft:chest[facing=north,type=single]": "54:2" -"minecraft:chest[facing=south,type=single]": "54:3" -"minecraft:chest[facing=west,type=single]": "54:4" -"minecraft:chest[facing=east,type=single]": "54:5" -"minecraft:chest[facing=north]": "54:10" -"minecraft:chest[facing=south]": "54:11" -"minecraft:chest[facing=west]": "54:12" -"minecraft:chest[facing=east]": "54:13" -"minecraft:redstone_wire[east=none,south=none,north=none,west=none,power=0]": "55:0" -"minecraft:redstone_wire[east=none,south=none,north=none,west=none,power=1]": "55:1" -"minecraft:redstone_wire[east=none,south=none,north=none,west=none,power=2]": "55:2" -"minecraft:redstone_wire[east=none,south=none,north=none,west=none,power=3]": "55:3" -"minecraft:redstone_wire[east=none,south=none,north=none,west=none,power=4]": "55:4" -"minecraft:redstone_wire[east=none,south=none,north=none,west=none,power=5]": "55:5" -"minecraft:redstone_wire[east=none,south=none,north=none,west=none,power=6]": "55:6" -"minecraft:redstone_wire[east=none,south=none,north=none,west=none,power=7]": "55:7" -"minecraft:redstone_wire[east=none,south=none,north=none,west=none,power=8]": "55:8" -"minecraft:redstone_wire[east=none,south=none,north=none,west=none,power=9]": "55:9" -"minecraft:redstone_wire[east=none,south=none,north=none,west=none,power=10]": "55:10" -"minecraft:redstone_wire[east=none,south=none,north=none,west=none,power=11]": "55:11" -"minecraft:redstone_wire[east=none,south=none,north=none,west=none,power=12]": "55:12" -"minecraft:redstone_wire[east=none,south=none,north=none,west=none,power=13]": "55:13" -"minecraft:redstone_wire[east=none,south=none,north=none,west=none,power=14]": "55:14" -"minecraft:redstone_wire[east=none,south=none,north=none,west=none,power=15]": "55:15" -"minecraft:diamond_ore": "56:0" -"minecraft:diamond_block": "57:0" -"minecraft:crafting_table": "58:0" -"minecraft:wheat[age=0]": "59:0" -"minecraft:wheat[age=1]": "59:1" -"minecraft:wheat[age=2]": "59:2" -"minecraft:wheat[age=3]": "59:3" -"minecraft:wheat[age=4]": "59:4" -"minecraft:wheat[age=5]": "59:5" -"minecraft:wheat[age=6]": "59:6" -"minecraft:wheat[age=7]": "59:7" -"minecraft:farmland[moisture=0]": "60:0" -"minecraft:farmland[moisture=1]": "60:1" -"minecraft:farmland[moisture=2]": "60:2" -"minecraft:farmland[moisture=3]": "60:3" -"minecraft:farmland[moisture=4]": "60:4" -"minecraft:farmland[moisture=5]": "60:5" -"minecraft:farmland[moisture=6]": "60:6" -"minecraft:farmland[moisture=7]": "60:7" -"minecraft:furnace": "61:0" -"minecraft:furnace[facing=north,lit=false]": "61:2" -"minecraft:furnace[facing=south,lit=false]": "61:3" -"minecraft:furnace[facing=west,lit=false]": "61:4" -"minecraft:furnace[facing=east,lit=false]": "61:5" -"minecraft:furnace[lit=true]": "62:0" -"minecraft:furnace[facing=north,lit=true]": "62:2" -"minecraft:furnace[facing=south,lit=true]": "62:3" -"minecraft:furnace[facing=west,lit=true]": "62:4" -"minecraft:furnace[facing=east,lit=true]": "62:5" -"minecraft:oak_sign[rotation=0]": "63:0" -"minecraft:oak_sign[rotation=1]": "63:1" -"minecraft:oak_sign[rotation=2]": "63:2" -"minecraft:oak_sign[rotation=3]": "63:3" -"minecraft:oak_sign[rotation=4]": "63:4" -"minecraft:oak_sign[rotation=5]": "63:5" -"minecraft:oak_sign[rotation=6]": "63:6" -"minecraft:oak_sign[rotation=7]": "63:7" -"minecraft:oak_sign[rotation=8]": "63:8" -"minecraft:oak_sign[rotation=9]": "63:9" -"minecraft:oak_sign[rotation=10]": "63:10" -"minecraft:oak_sign[rotation=11]": "63:11" -"minecraft:oak_sign[rotation=12]": "63:12" -"minecraft:oak_sign[rotation=13]": "63:13" -"minecraft:oak_sign[rotation=14]": "63:14" -"minecraft:oak_sign[rotation=15]": "63:15" -"minecraft:oak_door[hinge=right,half=lower,powered=false,facing=east,open=false]": "64:0" -"minecraft:oak_door[hinge=right,half=lower,powered=false,facing=south,open=false]": "64:1" -"minecraft:oak_door[hinge=right,half=lower,powered=false,facing=west,open=false]": "64:2" -"minecraft:oak_door[hinge=right,half=lower,powered=false,facing=north,open=false]": "64:3" -"minecraft:oak_door[hinge=right,half=lower,powered=false,facing=east,open=true]": "64:4" -"minecraft:oak_door[hinge=right,half=lower,powered=false,facing=south,open=true]": "64:5" -"minecraft:oak_door[hinge=right,half=lower,powered=false,facing=west,open=true]": "64:6" -"minecraft:oak_door[hinge=right,half=lower,powered=false,facing=north,open=true]": "64:7" -"minecraft:oak_door[hinge=left,half=upper,powered=false,facing=east,open=false]": "64:8" -"minecraft:oak_door[hinge=right,half=upper,powered=false,facing=east,open=false]": "64:9" -"minecraft:oak_door[hinge=left,half=upper,powered=true,facing=east,open=false]": "64:10" -"minecraft:oak_door[hinge=right,half=upper,powered=true,facing=east,open=false]": "64:11" -"minecraft:ladder": "65:0" -"minecraft:ladder[facing=north]": "65:2" -"minecraft:ladder[facing=south]": "65:3" -"minecraft:ladder[facing=west]": "65:4" -"minecraft:ladder[facing=east]": "65:5" -"minecraft:rail[shape=north_south]": "66:0" -"minecraft:rail[shape=east_west]": "66:1" -"minecraft:rail[shape=ascending_east]": "66:2" -"minecraft:rail[shape=ascending_west]": "66:3" -"minecraft:rail[shape=ascending_north]": "66:4" -"minecraft:rail[shape=ascending_south]": "66:5" -"minecraft:rail[shape=south_east]": "66:6" -"minecraft:rail[shape=south_west]": "66:7" -"minecraft:rail[shape=north_west]": "66:8" -"minecraft:rail[shape=north_east]": "66:9" -"minecraft:cobblestone_stairs[half=bottom,shape=straight,facing=east]": "67:0" -"minecraft:cobblestone_stairs[half=bottom,shape=straight,facing=west]": "67:1" -"minecraft:cobblestone_stairs[half=bottom,shape=straight,facing=south]": "67:2" -"minecraft:cobblestone_stairs[half=bottom,shape=straight,facing=north]": "67:3" -"minecraft:cobblestone_stairs[half=top,shape=straight,facing=east]": "67:4" -"minecraft:cobblestone_stairs[half=top,shape=straight,facing=west]": "67:5" -"minecraft:cobblestone_stairs[half=top,shape=straight,facing=south]": "67:6" -"minecraft:cobblestone_stairs[half=top,shape=straight,facing=north]": "67:7" -"minecraft:oak_wall_sign": "68:0" -"minecraft:oak_wall_sign[facing=north]": "68:2" -"minecraft:oak_wall_sign[facing=south]": "68:3" -"minecraft:oak_wall_sign[facing=west]": "68:4" -"minecraft:oak_wall_sign[facing=east]": "68:5" -"minecraft:lever[powered=false,facing=north,face=ceiling]": "69:0" -"minecraft:lever[powered=false,facing=east,face=wall]": "69:1" -"minecraft:lever[powered=false,facing=west,face=wall]": "69:2" -"minecraft:lever[powered=false,facing=south,face=wall]": "69:3" -"minecraft:lever[powered=false,facing=north,face=wall]": "69:4" -"minecraft:lever[powered=false,facing=east,face=floor]": "69:5" -"minecraft:lever[powered=false,facing=north,face=floor]": "69:6" -"minecraft:lever[powered=false,facing=east,face=ceiling]": "69:7" -"minecraft:lever[powered=true,facing=north,face=ceiling]": "69:8" -"minecraft:lever[powered=true,facing=east,face=wall]": "69:9" -"minecraft:lever[powered=true,facing=west,face=wall]": "69:10" -"minecraft:lever[powered=true,facing=south,face=wall]": "69:11" -"minecraft:lever[powered=true,facing=north,face=wall]": "69:12" -"minecraft:lever[powered=true,facing=east,face=floor]": "69:13" -"minecraft:lever[powered=true,facing=north,face=floor]": "69:14" -"minecraft:lever[powered=true,facing=east,face=ceiling]": "69:15" -"minecraft:stone_pressure_plate[powered=false]": "70:0" -"minecraft:stone_pressure_plate[powered=true]": "70:1" -"minecraft:iron_door[hinge=right,half=lower,powered=false,facing=east,open=false]": "71:0" -"minecraft:iron_door[hinge=right,half=lower,powered=false,facing=south,open=false]": "71:1" -"minecraft:iron_door[hinge=right,half=lower,powered=false,facing=west,open=false]": "71:2" -"minecraft:iron_door[hinge=right,half=lower,powered=false,facing=north,open=false]": "71:3" -"minecraft:iron_door[hinge=right,half=lower,powered=false,facing=east,open=true]": "71:4" -"minecraft:iron_door[hinge=right,half=lower,powered=false,facing=south,open=true]": "71:5" -"minecraft:iron_door[hinge=right,half=lower,powered=false,facing=west,open=true]": "71:6" -"minecraft:iron_door[hinge=right,half=lower,powered=false,facing=north,open=true]": "71:7" -"minecraft:iron_door[hinge=left,half=upper,powered=false,facing=east,open=false]": "71:8" -"minecraft:iron_door[hinge=right,half=upper,powered=false,facing=east,open=false]": "71:9" -"minecraft:iron_door[hinge=left,half=upper,powered=true,facing=east,open=false]": "71:10" -"minecraft:iron_door[hinge=right,half=upper,powered=true,facing=east,open=false]": "71:11" -"minecraft:oak_pressure_plate[powered=false]": "72:0" -"minecraft:oak_pressure_plate[powered=true]": "72:1" -"minecraft:redstone_ore[lit=false]": "73:0" -"minecraft:redstone_ore[lit=true]": "74:0" -"minecraft:redstone_torch[lit=false]": "75:0" -"minecraft:redstone_wall_torch[facing=east,lit=false]": "75:1" -"minecraft:redstone_wall_torch[facing=west,lit=false]": "75:2" -"minecraft:redstone_wall_torch[facing=south,lit=false]": "75:3" -"minecraft:redstone_wall_torch[facing=north,lit=false]": "75:4" -"minecraft:redstone_wall_torch[lit=false]": "75:13" -"minecraft:redstone_torch[lit=true]": "76:0" -"minecraft:redstone_wall_torch[facing=east,lit=true]": "76:1" -"minecraft:redstone_wall_torch[facing=west,lit=true]": "76:2" -"minecraft:redstone_wall_torch[facing=south,lit=true]": "76:3" -"minecraft:redstone_wall_torch[facing=north,lit=true]": "76:4" -"minecraft:redstone_wall_torch[lit=true]": "76:5" -"minecraft:stone_button[powered=false,facing=east,face=ceiling]": "77:0" -"minecraft:stone_button[powered=false,facing=east,face=wall]": "77:1" -"minecraft:stone_button[powered=false,facing=west,face=wall]": "77:2" -"minecraft:stone_button[powered=false,facing=south,face=wall]": "77:3" -"minecraft:stone_button[powered=false,facing=north,face=wall]": "77:4" -"minecraft:stone_button[powered=false,facing=east,face=floor]": "77:5" -"minecraft:stone_button[powered=true,facing=south,face=ceiling]": "77:8" -"minecraft:stone_button[powered=true,facing=east,face=wall]": "77:9" -"minecraft:stone_button[powered=true,facing=west,face=wall]": "77:10" -"minecraft:stone_button[powered=true,facing=south,face=wall]": "77:11" -"minecraft:stone_button[powered=true,facing=north,face=wall]": "77:12" -"minecraft:stone_button[powered=true,facing=south,face=floor]": "77:13" -"minecraft:snow[layers=1]": "78:0" -"minecraft:snow[layers=2]": "78:1" -"minecraft:snow[layers=3]": "78:2" -"minecraft:snow[layers=4]": "78:3" -"minecraft:snow[layers=5]": "78:4" -"minecraft:snow[layers=6]": "78:5" -"minecraft:snow[layers=7]": "78:6" -"minecraft:snow[layers=8]": "78:7" -"minecraft:ice": "79:0" -"minecraft:snow_block": "80:0" -"minecraft:cactus[age=0]": "81:0" -"minecraft:cactus[age=1]": "81:1" -"minecraft:cactus[age=2]": "81:2" -"minecraft:cactus[age=3]": "81:3" -"minecraft:cactus[age=4]": "81:4" -"minecraft:cactus[age=5]": "81:5" -"minecraft:cactus[age=6]": "81:6" -"minecraft:cactus[age=7]": "81:7" -"minecraft:cactus[age=8]": "81:8" -"minecraft:cactus[age=9]": "81:9" -"minecraft:cactus[age=10]": "81:10" -"minecraft:cactus[age=11]": "81:11" -"minecraft:cactus[age=12]": "81:12" -"minecraft:cactus[age=13]": "81:13" -"minecraft:cactus[age=14]": "81:14" -"minecraft:cactus[age=15]": "81:15" -"minecraft:clay": "82:0" -"minecraft:sugar_cane[age=0]": "83:0" -"minecraft:sugar_cane[age=1]": "83:1" -"minecraft:sugar_cane[age=2]": "83:2" -"minecraft:sugar_cane[age=3]": "83:3" -"minecraft:sugar_cane[age=4]": "83:4" -"minecraft:sugar_cane[age=5]": "83:5" -"minecraft:sugar_cane[age=6]": "83:6" -"minecraft:sugar_cane[age=7]": "83:7" -"minecraft:sugar_cane[age=8]": "83:8" -"minecraft:sugar_cane[age=9]": "83:9" -"minecraft:sugar_cane[age=10]": "83:10" -"minecraft:sugar_cane[age=11]": "83:11" -"minecraft:sugar_cane[age=12]": "83:12" -"minecraft:sugar_cane[age=13]": "83:13" -"minecraft:sugar_cane[age=14]": "83:14" -"minecraft:sugar_cane[age=15]": "83:15" -"minecraft:jukebox[has_record=false]": "84:0" -"minecraft:jukebox[has_record=true]": "84:1" -"minecraft:oak_fence[east=false,south=false,north=false,west=false]": "85:0" -"minecraft:carved_pumpkin[facing=south]": "86:0" -"minecraft:carved_pumpkin[facing=west]": "86:1" -"minecraft:carved_pumpkin[facing=north]": "86:2" -"minecraft:carved_pumpkin[facing=east]": "86:3" -"minecraft:netherrack": "87:0" -"minecraft:soul_sand": "88:0" -"minecraft:glowstone": "89:0" -"minecraft:nether_portal": "90:0" -"minecraft:nether_portal[axis=x]": "90:1" -"minecraft:nether_portal[axis=z]": "90:2" -"minecraft:jack_o_lantern[facing=south]": "91:0" -"minecraft:jack_o_lantern[facing=west]": "91:1" -"minecraft:jack_o_lantern[facing=north]": "91:2" -"minecraft:jack_o_lantern[facing=east]": "91:3" -"minecraft:cake[bites=0]": "92:0" -"minecraft:cake[bites=1]": "92:1" -"minecraft:cake[bites=2]": "92:2" -"minecraft:cake[bites=3]": "92:3" -"minecraft:cake[bites=4]": "92:4" -"minecraft:cake[bites=5]": "92:5" -"minecraft:cake[bites=6]": "92:6" -"minecraft:repeater[delay=1,facing=south,locked=false,powered=false]": "93:0" -"minecraft:repeater[delay=1,facing=west,locked=false,powered=false]": "93:1" -"minecraft:repeater[delay=1,facing=north,locked=false,powered=false]": "93:2" -"minecraft:repeater[delay=1,facing=east,locked=false,powered=false]": "93:3" -"minecraft:repeater[delay=2,facing=south,locked=false,powered=false]": "93:4" -"minecraft:repeater[delay=2,facing=west,locked=false,powered=false]": "93:5" -"minecraft:repeater[delay=2,facing=north,locked=false,powered=false]": "93:6" -"minecraft:repeater[delay=2,facing=east,locked=false,powered=false]": "93:7" -"minecraft:repeater[delay=3,facing=south,locked=false,powered=false]": "93:8" -"minecraft:repeater[delay=3,facing=west,locked=false,powered=false]": "93:9" -"minecraft:repeater[delay=3,facing=north,locked=false,powered=false]": "93:10" -"minecraft:repeater[delay=3,facing=east,locked=false,powered=false]": "93:11" -"minecraft:repeater[delay=4,facing=south,locked=false,powered=false]": "93:12" -"minecraft:repeater[delay=4,facing=west,locked=false,powered=false]": "93:13" -"minecraft:repeater[delay=4,facing=north,locked=false,powered=false]": "93:14" -"minecraft:repeater[delay=4,facing=east,locked=false,powered=false]": "93:15" -"minecraft:repeater[delay=1,facing=south,locked=false,powered=true]": "94:0" -"minecraft:repeater[delay=1,facing=west,locked=false,powered=true]": "94:1" -"minecraft:repeater[delay=1,facing=north,locked=false,powered=true]": "94:2" -"minecraft:repeater[delay=1,facing=east,locked=false,powered=true]": "94:3" -"minecraft:repeater[delay=2,facing=south,locked=false,powered=true]": "94:4" -"minecraft:repeater[delay=2,facing=west,locked=false,powered=true]": "94:5" -"minecraft:repeater[delay=2,facing=north,locked=false,powered=true]": "94:6" -"minecraft:repeater[delay=2,facing=east,locked=false,powered=true]": "94:7" -"minecraft:repeater[delay=3,facing=south,locked=false,powered=true]": "94:8" -"minecraft:repeater[delay=3,facing=west,locked=false,powered=true]": "94:9" -"minecraft:repeater[delay=3,facing=north,locked=false,powered=true]": "94:10" -"minecraft:repeater[delay=3,facing=east,locked=false,powered=true]": "94:11" -"minecraft:repeater[delay=4,facing=south,locked=false,powered=true]": "94:12" -"minecraft:repeater[delay=4,facing=west,locked=false,powered=true]": "94:13" -"minecraft:repeater[delay=4,facing=north,locked=false,powered=true]": "94:14" -"minecraft:repeater[delay=4,facing=east,locked=false,powered=true]": "94:15" -"minecraft:white_stained_glass": "95:0" -"minecraft:orange_stained_glass": "95:1" -"minecraft:magenta_stained_glass": "95:2" -"minecraft:light_blue_stained_glass": "95:3" -"minecraft:yellow_stained_glass": "95:4" -"minecraft:lime_stained_glass": "95:5" -"minecraft:pink_stained_glass": "95:6" -"minecraft:gray_stained_glass": "95:7" -"minecraft:light_gray_stained_glass": "95:8" -"minecraft:cyan_stained_glass": "95:9" -"minecraft:purple_stained_glass": "95:10" -"minecraft:blue_stained_glass": "95:11" -"minecraft:brown_stained_glass": "95:12" -"minecraft:green_stained_glass": "95:13" -"minecraft:red_stained_glass": "95:14" -"minecraft:black_stained_glass": "95:15" -"minecraft:oak_trapdoor[half=bottom,facing=north,open=false,powered=false]": "96:0" -"minecraft:oak_trapdoor[half=bottom,facing=south,open=false,powered=false]": "96:1" -"minecraft:oak_trapdoor[half=bottom,facing=west,open=false,powered=false]": "96:2" -"minecraft:oak_trapdoor[half=bottom,facing=east,open=false,powered=false]": "96:3" -"minecraft:oak_trapdoor[half=bottom,facing=north,open=true,powered=true]": "96:4" -"minecraft:oak_trapdoor[half=bottom,facing=south,open=true,powered=true]": "96:5" -"minecraft:oak_trapdoor[half=bottom,facing=west,open=true,powered=true]": "96:6" -"minecraft:oak_trapdoor[half=bottom,facing=east,open=true,powered=true]": "96:7" -"minecraft:oak_trapdoor[half=top,facing=north,open=false,powered=false]": "96:8" -"minecraft:oak_trapdoor[half=top,facing=south,open=false,powered=false]": "96:9" -"minecraft:oak_trapdoor[half=top,facing=west,open=false,powered=false]": "96:10" -"minecraft:oak_trapdoor[half=top,facing=east,open=false,powered=false]": "96:11" -"minecraft:oak_trapdoor[half=top,facing=north,open=true,powered=true]": "96:12" -"minecraft:oak_trapdoor[half=top,facing=south,open=true,powered=true]": "96:13" -"minecraft:oak_trapdoor[half=top,facing=west,open=true,powered=true]": "96:14" -"minecraft:oak_trapdoor[half=top,facing=east,open=true,powered=true]": "96:15" -"minecraft:infested_stone": "97:0" -"minecraft:infested_cobblestone": "97:1" -"minecraft:infested_stone_bricks": "97:2" -"minecraft:infested_mossy_stone_bricks": "97:3" -"minecraft:infested_cracked_stone_bricks": "97:4" -"minecraft:infested_chiseled_stone_bricks": "97:5" -"minecraft:stone_bricks": "98:0" -"minecraft:mossy_stone_bricks": "98:1" -"minecraft:cracked_stone_bricks": "98:2" -"minecraft:chiseled_stone_bricks": "98:3" -"minecraft:brown_mushroom_block[north=false,east=false,south=false,west=false,up=false,down=false]": "99:0" -"minecraft:brown_mushroom_block[north=true,east=false,south=false,west=true,up=true,down=false]": "99:1" -"minecraft:brown_mushroom_block[north=true,east=false,south=false,west=false,up=true,down=false]": "99:2" -"minecraft:brown_mushroom_block[north=true,east=true,south=false,west=false,up=true,down=false]": "99:3" -"minecraft:brown_mushroom_block[north=false,east=false,south=false,west=true,up=true,down=false]": "99:4" -"minecraft:brown_mushroom_block[north=false,east=false,south=false,west=false,up=true,down=false]": "99:5" -"minecraft:brown_mushroom_block[north=false,east=true,south=false,west=false,up=true,down=false]": "99:6" -"minecraft:brown_mushroom_block[north=false,east=false,south=true,west=true,up=true,down=false]": "99:7" -"minecraft:brown_mushroom_block[north=false,east=false,south=true,west=false,up=true,down=false]": "99:8" -"minecraft:brown_mushroom_block[north=false,east=true,south=true,west=false,up=true,down=false]": "99:9" -"minecraft:mushroom_stem[north=true,east=true,south=true,west=true,up=false,down=false]": "99:10" -"minecraft:brown_mushroom_block[north=true,east=true,south=true,west=true,up=true,down=true]": "99:14" -"minecraft:mushroom_stem[north=true,east=true,south=true,west=true,up=true,down=true]": "99:15" -"minecraft:red_mushroom_block[north=false,east=false,south=false,west=false,up=false,down=false]": "100:0" -"minecraft:red_mushroom_block[north=true,east=false,south=false,west=true,up=true,down=false]": "100:1" -"minecraft:red_mushroom_block[north=true,east=false,south=false,west=false,up=true,down=false]": "100:2" -"minecraft:red_mushroom_block[north=true,east=true,south=false,west=false,up=true,down=false]": "100:3" -"minecraft:red_mushroom_block[north=false,east=false,south=false,west=true,up=true,down=false]": "100:4" -"minecraft:red_mushroom_block[north=false,east=false,south=false,west=false,up=true,down=false]": "100:5" -"minecraft:red_mushroom_block[north=false,east=true,south=false,west=false,up=true,down=false]": "100:6" -"minecraft:red_mushroom_block[north=false,east=false,south=true,west=true,up=true,down=false]": "100:7" -"minecraft:red_mushroom_block[north=false,east=false,south=true,west=false,up=true,down=false]": "100:8" -"minecraft:red_mushroom_block[north=false,east=true,south=true,west=false,up=true,down=false]": "100:9" -"minecraft:red_mushroom_block[north=true,east=true,south=true,west=true,up=true,down=true]": "100:14" -"minecraft:iron_bars[east=false,south=false,north=false,west=false]": "101:0" -"minecraft:glass_pane[east=false,south=false,north=false,west=false]": "102:0" -"minecraft:melon": "103:0" -"minecraft:pumpkin_stem[age=0]": "104:0" -"minecraft:pumpkin_stem[age=1]": "104:1" -"minecraft:pumpkin_stem[age=2]": "104:2" -"minecraft:pumpkin_stem[age=3]": "104:3" -"minecraft:pumpkin_stem[age=4]": "104:4" -"minecraft:pumpkin_stem[age=5]": "104:5" -"minecraft:pumpkin_stem[age=6]": "104:6" -"minecraft:pumpkin_stem[age=7]": "104:7" -"minecraft:melon_stem[age=0]": "105:0" -"minecraft:melon_stem[age=1]": "105:1" -"minecraft:melon_stem[age=2]": "105:2" -"minecraft:melon_stem[age=3]": "105:3" -"minecraft:melon_stem[age=4]": "105:4" -"minecraft:melon_stem[age=5]": "105:5" -"minecraft:melon_stem[age=6]": "105:6" -"minecraft:melon_stem[age=7]": "105:7" -"minecraft:vine[east=false,south=false,north=false,west=false,up=false]": "106:0" -"minecraft:vine[east=false,south=true,north=false,west=false,up=false]": "106:1" -"minecraft:vine[east=false,south=false,north=false,west=true,up=false]": "106:2" -"minecraft:vine[east=false,south=true,north=false,west=true,up=false]": "106:3" -"minecraft:vine[east=false,south=false,north=true,west=false,up=false]": "106:4" -"minecraft:vine[east=false,south=true,north=true,west=false,up=false]": "106:5" -"minecraft:vine[east=false,south=false,north=true,west=true,up=false]": "106:6" -"minecraft:vine[east=false,south=true,north=true,west=true,up=false]": "106:7" -"minecraft:vine[east=true,south=false,north=false,west=false,up=false]": "106:8" -"minecraft:vine[east=true,south=true,north=false,west=false,up=false]": "106:9" -"minecraft:vine[east=true,south=false,north=false,west=true,up=false]": "106:10" -"minecraft:vine[east=true,south=true,north=false,west=true,up=false]": "106:11" -"minecraft:vine[east=true,south=false,north=true,west=false,up=false]": "106:12" -"minecraft:vine[east=true,south=true,north=true,west=false,up=false]": "106:13" -"minecraft:vine[east=true,south=false,north=true,west=true,up=false]": "106:14" -"minecraft:vine[east=true,south=true,north=true,west=true,up=false]": "106:15" -"minecraft:oak_fence_gate[in_wall=false,powered=false,facing=south,open=false]": "107:0" -"minecraft:oak_fence_gate[in_wall=false,powered=false,facing=west,open=false]": "107:1" -"minecraft:oak_fence_gate[in_wall=false,powered=false,facing=north,open=false]": "107:2" -"minecraft:oak_fence_gate[in_wall=false,powered=false,facing=east,open=false]": "107:3" -"minecraft:oak_fence_gate[in_wall=false,powered=false,facing=south,open=true]": "107:4" -"minecraft:oak_fence_gate[in_wall=false,powered=false,facing=west,open=true]": "107:5" -"minecraft:oak_fence_gate[in_wall=false,powered=false,facing=north,open=true]": "107:6" -"minecraft:oak_fence_gate[in_wall=false,powered=false,facing=east,open=true]": "107:7" -"minecraft:oak_fence_gate[in_wall=false,powered=true,facing=south,open=false]": "107:8" -"minecraft:oak_fence_gate[in_wall=false,powered=true,facing=west,open=false]": "107:9" -"minecraft:oak_fence_gate[in_wall=false,powered=true,facing=north,open=false]": "107:10" -"minecraft:oak_fence_gate[in_wall=false,powered=true,facing=east,open=false]": "107:11" -"minecraft:oak_fence_gate[in_wall=false,powered=true,facing=south,open=true]": "107:12" -"minecraft:oak_fence_gate[in_wall=false,powered=true,facing=west,open=true]": "107:13" -"minecraft:oak_fence_gate[in_wall=false,powered=true,facing=north,open=true]": "107:14" -"minecraft:oak_fence_gate[in_wall=false,powered=true,facing=east,open=true]": "107:15" -"minecraft:brick_stairs[half=bottom,shape=straight,facing=east]": "108:0" -"minecraft:brick_stairs[half=bottom,shape=straight,facing=west]": "108:1" -"minecraft:brick_stairs[half=bottom,shape=straight,facing=south]": "108:2" -"minecraft:brick_stairs[half=bottom,shape=straight,facing=north]": "108:3" -"minecraft:brick_stairs[half=top,shape=straight,facing=east]": "108:4" -"minecraft:brick_stairs[half=top,shape=straight,facing=west]": "108:5" -"minecraft:brick_stairs[half=top,shape=straight,facing=south]": "108:6" -"minecraft:brick_stairs[half=top,shape=straight,facing=north]": "108:7" -"minecraft:stone_brick_stairs[half=bottom,shape=straight,facing=east]": "109:0" -"minecraft:stone_brick_stairs[half=bottom,shape=straight,facing=west]": "109:1" -"minecraft:stone_brick_stairs[half=bottom,shape=straight,facing=south]": "109:2" -"minecraft:stone_brick_stairs[half=bottom,shape=straight,facing=north]": "109:3" -"minecraft:stone_brick_stairs[half=top,shape=straight,facing=east]": "109:4" -"minecraft:stone_brick_stairs[half=top,shape=straight,facing=west]": "109:5" -"minecraft:stone_brick_stairs[half=top,shape=straight,facing=south]": "109:6" -"minecraft:stone_brick_stairs[half=top,shape=straight,facing=north]": "109:7" -"minecraft:mycelium[snowy=false]": "110:0" -"minecraft:lily_pad": "111:0" -"minecraft:nether_bricks": "112:0" -"minecraft:nether_brick_fence[east=false,south=false,north=false,west=false]": "113:0" -"minecraft:nether_brick_stairs[half=bottom,shape=straight,facing=east]": "114:0" -"minecraft:nether_brick_stairs[half=bottom,shape=straight,facing=west]": "114:1" -"minecraft:nether_brick_stairs[half=bottom,shape=straight,facing=south]": "114:2" -"minecraft:nether_brick_stairs[half=bottom,shape=straight,facing=north]": "114:3" -"minecraft:nether_brick_stairs[half=top,shape=straight,facing=east]": "114:4" -"minecraft:nether_brick_stairs[half=top,shape=straight,facing=west]": "114:5" -"minecraft:nether_brick_stairs[half=top,shape=straight,facing=south]": "114:6" -"minecraft:nether_brick_stairs[half=top,shape=straight,facing=north]": "114:7" -"minecraft:nether_wart[age=0]": "115:0" -"minecraft:nether_wart[age=1]": "115:1" -"minecraft:nether_wart[age=2]": "115:2" -"minecraft:nether_wart[age=3]": "115:3" -"minecraft:enchanting_table": "116:0" -"minecraft:brewing_stand[has_bottle_0=false,has_bottle_1=false,has_bottle_2=false]": "117:0" -"minecraft:brewing_stand[has_bottle_0=true,has_bottle_1=false,has_bottle_2=false]": "117:1" -"minecraft:brewing_stand[has_bottle_0=false,has_bottle_1=true,has_bottle_2=false]": "117:2" -"minecraft:brewing_stand[has_bottle_0=true,has_bottle_1=true,has_bottle_2=false]": "117:3" -"minecraft:brewing_stand[has_bottle_0=false,has_bottle_1=false,has_bottle_2=true]": "117:4" -"minecraft:brewing_stand[has_bottle_0=true,has_bottle_1=false,has_bottle_2=true]": "117:5" -"minecraft:brewing_stand[has_bottle_0=false,has_bottle_1=true,has_bottle_2=true]": "117:6" -"minecraft:brewing_stand[has_bottle_0=true,has_bottle_1=true,has_bottle_2=true]": "117:7" -"minecraft:cauldron[level=0]": "118:0" -"minecraft:cauldron[level=1]": "118:1" -"minecraft:cauldron[level=2]": "118:2" -"minecraft:cauldron[level=3]": "118:3" -"minecraft:end_portal": "119:0" -"minecraft:end_portal_frame[eye=false,facing=south]": "120:0" -"minecraft:end_portal_frame[eye=false,facing=west]": "120:1" -"minecraft:end_portal_frame[eye=false,facing=north]": "120:2" -"minecraft:end_portal_frame[eye=false,facing=east]": "120:3" -"minecraft:end_portal_frame[eye=true,facing=south]": "120:4" -"minecraft:end_portal_frame[eye=true,facing=west]": "120:5" -"minecraft:end_portal_frame[eye=true,facing=north]": "120:6" -"minecraft:end_portal_frame[eye=true,facing=east]": "120:7" -"minecraft:end_stone": "121:0" -"minecraft:dragon_egg": "122:0" -"minecraft:redstone_lamp[lit=false]": "123:0" -"minecraft:redstone_lamp[lit=true]": "124:0" -"minecraft:oak_slab[type=double]": "125:0" -"minecraft:spruce_slab[type=double]": "125:1" -"minecraft:birch_slab[type=double]": "125:2" -"minecraft:jungle_slab[type=double]": "125:3" -"minecraft:acacia_slab[type=double]": "125:4" -"minecraft:dark_oak_slab[type=double]": "125:5" -"minecraft:oak_slab[type=bottom]": "126:0" -"minecraft:spruce_slab[type=bottom]": "126:1" -"minecraft:birch_slab[type=bottom]": "126:2" -"minecraft:jungle_slab[type=bottom]": "126:3" -"minecraft:acacia_slab[type=bottom]": "126:4" -"minecraft:dark_oak_slab[type=bottom]": "126:5" -"minecraft:oak_slab[type=top]": "126:8" -"minecraft:spruce_slab[type=top]": "126:9" -"minecraft:birch_slab[type=top]": "126:10" -"minecraft:jungle_slab[type=top]": "126:11" -"minecraft:acacia_slab[type=top]": "126:12" -"minecraft:dark_oak_slab[type=top]": "126:13" -"minecraft:cocoa[facing=south,age=0]": "127:0" -"minecraft:cocoa[facing=west,age=0]": "127:1" -"minecraft:cocoa[facing=north,age=0]": "127:2" -"minecraft:cocoa[facing=east,age=0]": "127:3" -"minecraft:cocoa[facing=south,age=1]": "127:4" -"minecraft:cocoa[facing=west,age=1]": "127:5" -"minecraft:cocoa[facing=north,age=1]": "127:6" -"minecraft:cocoa[facing=east,age=1]": "127:7" -"minecraft:cocoa[facing=south,age=2]": "127:8" -"minecraft:cocoa[facing=west,age=2]": "127:9" -"minecraft:cocoa[facing=north,age=2]": "127:10" -"minecraft:cocoa[facing=east,age=2]": "127:11" -"minecraft:sandstone_stairs[half=bottom,shape=straight,facing=east]": "128:0" -"minecraft:sandstone_stairs[half=bottom,shape=straight,facing=west]": "128:1" -"minecraft:sandstone_stairs[half=bottom,shape=straight,facing=south]": "128:2" -"minecraft:sandstone_stairs[half=bottom,shape=straight,facing=north]": "128:3" -"minecraft:sandstone_stairs[half=top,shape=straight,facing=east]": "128:4" -"minecraft:sandstone_stairs[half=top,shape=straight,facing=west]": "128:5" -"minecraft:sandstone_stairs[half=top,shape=straight,facing=south]": "128:6" -"minecraft:sandstone_stairs[half=top,shape=straight,facing=north]": "128:7" -"minecraft:emerald_ore": "129:0" -"minecraft:ender_chest": "130:0" -"minecraft:ender_chest[facing=north]": "130:2" -"minecraft:ender_chest[facing=south]": "130:3" -"minecraft:ender_chest[facing=west]": "130:4" -"minecraft:ender_chest[facing=east]": "130:5" -"minecraft:tripwire_hook[powered=false,attached=false,facing=south]": "131:0" -"minecraft:tripwire_hook[powered=false,attached=false,facing=west]": "131:1" -"minecraft:tripwire_hook[powered=false,attached=false,facing=north]": "131:2" -"minecraft:tripwire_hook[powered=false,attached=false,facing=east]": "131:3" -"minecraft:tripwire_hook[powered=false,attached=true,facing=south]": "131:4" -"minecraft:tripwire_hook[powered=false,attached=true,facing=west]": "131:5" -"minecraft:tripwire_hook[powered=false,attached=true,facing=north]": "131:6" -"minecraft:tripwire_hook[powered=false,attached=true,facing=east]": "131:7" -"minecraft:tripwire_hook[powered=true,attached=false,facing=south]": "131:8" -"minecraft:tripwire_hook[powered=true,attached=false,facing=west]": "131:9" -"minecraft:tripwire_hook[powered=true,attached=false,facing=north]": "131:10" -"minecraft:tripwire_hook[powered=true,attached=false,facing=east]": "131:11" -"minecraft:tripwire_hook[powered=true,attached=true,facing=south]": "131:12" -"minecraft:tripwire_hook[powered=true,attached=true,facing=west]": "131:13" -"minecraft:tripwire_hook[powered=true,attached=true,facing=north]": "131:14" -"minecraft:tripwire_hook[powered=true,attached=true,facing=east]": "131:15" -"minecraft:tripwire[disarmed=false,east=false,powered=false,south=false,north=false,west=false,attached=false]": "132:0" -"minecraft:tripwire[disarmed=false,east=false,powered=true,south=false,north=false,west=false,attached=false]": "132:1" -"minecraft:tripwire[disarmed=false,east=false,powered=false,south=false,north=false,west=false,attached=true]": "132:4" -"minecraft:tripwire[disarmed=false,east=false,powered=true,south=false,north=false,west=false,attached=true]": "132:5" -"minecraft:tripwire[disarmed=true,east=false,powered=false,south=false,north=false,west=false,attached=false]": "132:8" -"minecraft:tripwire[disarmed=true,east=false,powered=true,south=false,north=false,west=false,attached=false]": "132:9" -"minecraft:tripwire[disarmed=true,east=false,powered=false,south=false,north=false,west=false,attached=true]": "132:12" -"minecraft:tripwire[disarmed=true,east=false,powered=true,south=false,north=false,west=false,attached=true]": "132:13" -"minecraft:emerald_block": "133:0" -"minecraft:spruce_stairs[half=bottom,shape=straight,facing=east]": "134:0" -"minecraft:spruce_stairs[half=bottom,shape=straight,facing=west]": "134:1" -"minecraft:spruce_stairs[half=bottom,shape=straight,facing=south]": "134:2" -"minecraft:spruce_stairs[half=bottom,shape=straight,facing=north]": "134:3" -"minecraft:spruce_stairs[half=top,shape=straight,facing=east]": "134:4" -"minecraft:spruce_stairs[half=top,shape=straight,facing=west]": "134:5" -"minecraft:spruce_stairs[half=top,shape=straight,facing=south]": "134:6" -"minecraft:spruce_stairs[half=top,shape=straight,facing=north]": "134:7" -"minecraft:birch_stairs[half=bottom,shape=straight,facing=east]": "135:0" -"minecraft:birch_stairs[half=bottom,shape=straight,facing=west]": "135:1" -"minecraft:birch_stairs[half=bottom,shape=straight,facing=south]": "135:2" -"minecraft:birch_stairs[half=bottom,shape=straight,facing=north]": "135:3" -"minecraft:birch_stairs[half=top,shape=straight,facing=east]": "135:4" -"minecraft:birch_stairs[half=top,shape=straight,facing=west]": "135:5" -"minecraft:birch_stairs[half=top,shape=straight,facing=south]": "135:6" -"minecraft:birch_stairs[half=top,shape=straight,facing=north]": "135:7" -"minecraft:jungle_stairs[half=bottom,shape=straight,facing=east]": "136:0" -"minecraft:jungle_stairs[half=bottom,shape=straight,facing=west]": "136:1" -"minecraft:jungle_stairs[half=bottom,shape=straight,facing=south]": "136:2" -"minecraft:jungle_stairs[half=bottom,shape=straight,facing=north]": "136:3" -"minecraft:jungle_stairs[half=top,shape=straight,facing=east]": "136:4" -"minecraft:jungle_stairs[half=top,shape=straight,facing=west]": "136:5" -"minecraft:jungle_stairs[half=top,shape=straight,facing=south]": "136:6" -"minecraft:jungle_stairs[half=top,shape=straight,facing=north]": "136:7" -"minecraft:command_block[conditional=false,facing=down]": "137:0" -"minecraft:command_block[conditional=false,facing=up]": "137:1" -"minecraft:command_block[conditional=false,facing=north]": "137:2" -"minecraft:command_block[conditional=false,facing=south]": "137:3" -"minecraft:command_block[conditional=false,facing=west]": "137:4" -"minecraft:command_block[conditional=false,facing=east]": "137:5" -"minecraft:command_block[conditional=true,facing=down]": "137:8" -"minecraft:command_block[conditional=true,facing=up]": "137:9" -"minecraft:command_block[conditional=true,facing=north]": "137:10" -"minecraft:command_block[conditional=true,facing=south]": "137:11" -"minecraft:command_block[conditional=true,facing=west]": "137:12" -"minecraft:command_block[conditional=true,facing=east]": "137:13" -"minecraft:beacon": "138:0" -"minecraft:cobblestone_wall[east=false,south=false,north=false,west=false,up=false]": "139:0" -"minecraft:mossy_cobblestone_wall[east=false,south=false,north=false,west=false,up=false]": "139:1" -"minecraft:flower_pot": "140:0" -"minecraft:potted_poppy": "140:1" -"minecraft:potted_dandelion": "140:2" -"minecraft:potted_oak_sapling": "140:3" -"minecraft:potted_spruce_sapling": "140:4" -"minecraft:potted_birch_sapling": "140:5" -"minecraft:potted_jungle_sapling": "140:6" -"minecraft:potted_red_mushroom": "140:7" -"minecraft:potted_brown_mushroom": "140:8" -"minecraft:potted_cactus": "140:9" -"minecraft:potted_dead_bush": "140:10" -"minecraft:potted_fern": "140:11" -"minecraft:potted_acacia_sapling": "140:12" -"minecraft:potted_dark_oak_sapling": "140:13" -"minecraft:potted_blue_orchid": "140:14" -"minecraft:potted_allium": "140:15" -"minecraft:carrots[age=0]": "141:0" -"minecraft:carrots[age=1]": "141:1" -"minecraft:carrots[age=2]": "141:2" -"minecraft:carrots[age=3]": "141:3" -"minecraft:carrots[age=4]": "141:4" -"minecraft:carrots[age=5]": "141:5" -"minecraft:carrots[age=6]": "141:6" -"minecraft:carrots[age=7]": "141:7" -"minecraft:potatoes[age=0]": "142:0" -"minecraft:potatoes[age=1]": "142:1" -"minecraft:potatoes[age=2]": "142:2" -"minecraft:potatoes[age=3]": "142:3" -"minecraft:potatoes[age=4]": "142:4" -"minecraft:potatoes[age=5]": "142:5" -"minecraft:potatoes[age=6]": "142:6" -"minecraft:potatoes[age=7]": "142:7" -"minecraft:oak_button[powered=false,facing=east,face=ceiling]": "143:0" -"minecraft:oak_button[powered=false,facing=east,face=wall]": "143:1" -"minecraft:oak_button[powered=false,facing=west,face=wall]": "143:2" -"minecraft:oak_button[powered=false,facing=south,face=wall]": "143:3" -"minecraft:oak_button[powered=false,facing=north,face=wall]": "143:4" -"minecraft:oak_button[powered=false,facing=east,face=floor]": "143:5" -"minecraft:oak_button[powered=true,facing=south,face=ceiling]": "143:8" -"minecraft:oak_button[powered=true,facing=east,face=wall]": "143:9" -"minecraft:oak_button[powered=true,facing=west,face=wall]": "143:10" -"minecraft:oak_button[powered=true,facing=south,face=wall]": "143:11" -"minecraft:oak_button[powered=true,facing=north,face=wall]": "143:12" -"minecraft:oak_button[powered=true,facing=south,face=floor]": "143:13" -"minecraft:skeleton_skull[rotation=0]": "144:0" -"minecraft:skeleton_skull[rotation=4]": "144:1" -"minecraft:skeleton_wall_skull[facing=north]": "144:2" -"minecraft:skeleton_wall_skull[facing=south]": "144:3" -"minecraft:skeleton_wall_skull[facing=west]": "144:4" -"minecraft:skeleton_wall_skull[facing=east]": "144:5" -"minecraft:skeleton_skull[rotation=8]": "144:8" -"minecraft:skeleton_skull[rotation=12]": "144:9" -"minecraft:anvil[facing=south]": "145:0" -"minecraft:anvil[facing=west]": "145:1" -"minecraft:anvil[facing=north]": "145:2" -"minecraft:anvil[facing=east]": "145:3" -"minecraft:chipped_anvil[facing=south]": "145:4" -"minecraft:chipped_anvil[facing=west]": "145:5" -"minecraft:chipped_anvil[facing=north]": "145:6" -"minecraft:chipped_anvil[facing=east]": "145:7" -"minecraft:damaged_anvil[facing=south]": "145:8" -"minecraft:damaged_anvil[facing=west]": "145:9" -"minecraft:damaged_anvil[facing=north]": "145:10" -"minecraft:damaged_anvil[facing=east]": "145:11" -"minecraft:trapped_chest": "146:0" -"minecraft:trapped_chest[facing=north,type=single]": "146:2" -"minecraft:trapped_chest[facing=south,type=single]": "146:3" -"minecraft:trapped_chest[facing=west,type=single]": "146:4" -"minecraft:trapped_chest[facing=east,type=single]": "146:5" -"minecraft:light_weighted_pressure_plate[power=0]": "147:0" -"minecraft:light_weighted_pressure_plate[power=1]": "147:1" -"minecraft:light_weighted_pressure_plate[power=2]": "147:2" -"minecraft:light_weighted_pressure_plate[power=3]": "147:3" -"minecraft:light_weighted_pressure_plate[power=4]": "147:4" -"minecraft:light_weighted_pressure_plate[power=5]": "147:5" -"minecraft:light_weighted_pressure_plate[power=6]": "147:6" -"minecraft:light_weighted_pressure_plate[power=7]": "147:7" -"minecraft:light_weighted_pressure_plate[power=8]": "147:8" -"minecraft:light_weighted_pressure_plate[power=9]": "147:9" -"minecraft:light_weighted_pressure_plate[power=10]": "147:10" -"minecraft:light_weighted_pressure_plate[power=11]": "147:11" -"minecraft:light_weighted_pressure_plate[power=12]": "147:12" -"minecraft:light_weighted_pressure_plate[power=13]": "147:13" -"minecraft:light_weighted_pressure_plate[power=14]": "147:14" -"minecraft:light_weighted_pressure_plate[power=15]": "147:15" -"minecraft:heavy_weighted_pressure_plate[power=0]": "148:0" -"minecraft:heavy_weighted_pressure_plate[power=1]": "148:1" -"minecraft:heavy_weighted_pressure_plate[power=2]": "148:2" -"minecraft:heavy_weighted_pressure_plate[power=3]": "148:3" -"minecraft:heavy_weighted_pressure_plate[power=4]": "148:4" -"minecraft:heavy_weighted_pressure_plate[power=5]": "148:5" -"minecraft:heavy_weighted_pressure_plate[power=6]": "148:6" -"minecraft:heavy_weighted_pressure_plate[power=7]": "148:7" -"minecraft:heavy_weighted_pressure_plate[power=8]": "148:8" -"minecraft:heavy_weighted_pressure_plate[power=9]": "148:9" -"minecraft:heavy_weighted_pressure_plate[power=10]": "148:10" -"minecraft:heavy_weighted_pressure_plate[power=11]": "148:11" -"minecraft:heavy_weighted_pressure_plate[power=12]": "148:12" -"minecraft:heavy_weighted_pressure_plate[power=13]": "148:13" -"minecraft:heavy_weighted_pressure_plate[power=14]": "148:14" -"minecraft:heavy_weighted_pressure_plate[power=15]": "148:15" -"minecraft:comparator[mode=compare,powered=false,facing=south]": "149:0" -"minecraft:comparator[mode=compare,powered=false,facing=west]": "149:1" -"minecraft:comparator[mode=compare,powered=false,facing=north]": "149:2" -"minecraft:comparator[mode=compare,powered=false,facing=east]": "149:3" -"minecraft:comparator[mode=subtract,powered=false,facing=south]": "149:4" -"minecraft:comparator[mode=subtract,powered=false,facing=west]": "149:5" -"minecraft:comparator[mode=subtract,powered=false,facing=north]": "149:6" -"minecraft:comparator[mode=subtract,powered=false,facing=east]": "149:7" -"minecraft:comparator[mode=compare,powered=true,facing=south]": "150:0" -"minecraft:comparator[mode=compare,powered=true,facing=west]": "150:1" -"minecraft:comparator[mode=compare,powered=true,facing=north]": "150:2" -"minecraft:comparator[mode=compare,powered=true,facing=east]": "150:3" -"minecraft:comparator[mode=subtract,powered=true,facing=south]": "150:4" -"minecraft:comparator[mode=subtract,powered=true,facing=west]": "150:5" -"minecraft:comparator[mode=subtract,powered=true,facing=north]": "150:6" -"minecraft:comparator[mode=subtract,powered=true,facing=east]": "150:7" -"minecraft:daylight_detector[inverted=false,power=0]": "151:0" -"minecraft:daylight_detector[inverted=false,power=1]": "151:1" -"minecraft:daylight_detector[inverted=false,power=2]": "151:2" -"minecraft:daylight_detector[inverted=false,power=3]": "151:3" -"minecraft:daylight_detector[inverted=false,power=4]": "151:4" -"minecraft:daylight_detector[inverted=false,power=5]": "151:5" -"minecraft:daylight_detector[inverted=false,power=6]": "151:6" -"minecraft:daylight_detector[inverted=false,power=7]": "151:7" -"minecraft:daylight_detector[inverted=false,power=8]": "151:8" -"minecraft:daylight_detector[inverted=false,power=9]": "151:9" -"minecraft:daylight_detector[inverted=false,power=10]": "151:10" -"minecraft:daylight_detector[inverted=false,power=11]": "151:11" -"minecraft:daylight_detector[inverted=false,power=12]": "151:12" -"minecraft:daylight_detector[inverted=false,power=13]": "151:13" -"minecraft:daylight_detector[inverted=false,power=14]": "151:14" -"minecraft:daylight_detector[inverted=false,power=15]": "151:15" -"minecraft:redstone_block": "152:0" -"minecraft:nether_quartz_ore": "153:0" -"minecraft:hopper[facing=down,enabled=true]": "154:0" -"minecraft:hopper[facing=north,enabled=true]": "154:2" -"minecraft:hopper[facing=south,enabled=true]": "154:3" -"minecraft:hopper[facing=west,enabled=true]": "154:4" -"minecraft:hopper[facing=east,enabled=true]": "154:5" -"minecraft:hopper[facing=down,enabled=false]": "154:8" -"minecraft:hopper[facing=north,enabled=false]": "154:10" -"minecraft:hopper[facing=south,enabled=false]": "154:11" -"minecraft:hopper[facing=west,enabled=false]": "154:12" -"minecraft:hopper[facing=east,enabled=false]": "154:13" -"minecraft:quartz_block": "155:0" -"minecraft:chiseled_quartz_block": "155:1" -"minecraft:quartz_pillar[axis=y]": "155:2" -"minecraft:quartz_pillar[axis=x]": "155:3" -"minecraft:quartz_pillar[axis=z]": "155:4" -"minecraft:quartz_stairs[half=bottom,shape=straight,facing=east]": "156:0" -"minecraft:quartz_stairs[half=bottom,shape=straight,facing=west]": "156:1" -"minecraft:quartz_stairs[half=bottom,shape=straight,facing=south]": "156:2" -"minecraft:quartz_stairs[half=bottom,shape=straight,facing=north]": "156:3" -"minecraft:quartz_stairs[half=top,shape=straight,facing=east]": "156:4" -"minecraft:quartz_stairs[half=top,shape=straight,facing=west]": "156:5" -"minecraft:quartz_stairs[half=top,shape=straight,facing=south]": "156:6" -"minecraft:quartz_stairs[half=top,shape=straight,facing=north]": "156:7" -"minecraft:activator_rail[shape=north_south,powered=false]": "157:0" -"minecraft:activator_rail[shape=east_west,powered=false]": "157:1" -"minecraft:activator_rail[shape=ascending_east,powered=false]": "157:2" -"minecraft:activator_rail[shape=ascending_west,powered=false]": "157:3" -"minecraft:activator_rail[shape=ascending_north,powered=false]": "157:4" -"minecraft:activator_rail[shape=ascending_south,powered=false]": "157:5" -"minecraft:activator_rail[shape=north_south,powered=true]": "157:8" -"minecraft:activator_rail[shape=east_west,powered=true]": "157:9" -"minecraft:activator_rail[shape=ascending_east,powered=true]": "157:10" -"minecraft:activator_rail[shape=ascending_west,powered=true]": "157:11" -"minecraft:activator_rail[shape=ascending_north,powered=true]": "157:12" -"minecraft:activator_rail[shape=ascending_south,powered=true]": "157:13" -"minecraft:dropper[triggered=false,facing=down]": "158:0" -"minecraft:dropper[triggered=false,facing=up]": "158:1" -"minecraft:dropper[triggered=false,facing=north]": "158:2" -"minecraft:dropper[triggered=false,facing=south]": "158:3" -"minecraft:dropper[triggered=false,facing=west]": "158:4" -"minecraft:dropper[triggered=false,facing=east]": "158:5" -"minecraft:dropper[triggered=true,facing=down]": "158:8" -"minecraft:dropper[triggered=true,facing=up]": "158:9" -"minecraft:dropper[triggered=true,facing=north]": "158:10" -"minecraft:dropper[triggered=true,facing=south]": "158:11" -"minecraft:dropper[triggered=true,facing=west]": "158:12" -"minecraft:dropper[triggered=true,facing=east]": "158:13" -"minecraft:white_terracotta": "159:0" -"minecraft:orange_terracotta": "159:1" -"minecraft:magenta_terracotta": "159:2" -"minecraft:light_blue_terracotta": "159:3" -"minecraft:yellow_terracotta": "159:4" -"minecraft:lime_terracotta": "159:5" -"minecraft:pink_terracotta": "159:6" -"minecraft:gray_terracotta": "159:7" -"minecraft:light_gray_terracotta": "159:8" -"minecraft:cyan_terracotta": "159:9" -"minecraft:purple_terracotta": "159:10" -"minecraft:blue_terracotta": "159:11" -"minecraft:brown_terracotta": "159:12" -"minecraft:green_terracotta": "159:13" -"minecraft:red_terracotta": "159:14" -"minecraft:black_terracotta": "159:15" -"minecraft:white_stained_glass_pane[east=false,south=false,north=false,west=false]": "160:0" -"minecraft:orange_stained_glass_pane[east=false,south=false,north=false,west=false]": "160:1" -"minecraft:magenta_stained_glass_pane[east=false,south=false,north=false,west=false]": "160:2" -"minecraft:light_blue_stained_glass_pane[east=false,south=false,north=false,west=false]": "160:3" -"minecraft:yellow_stained_glass_pane[east=false,south=false,north=false,west=false]": "160:4" -"minecraft:lime_stained_glass_pane[east=false,south=false,north=false,west=false]": "160:5" -"minecraft:pink_stained_glass_pane[east=false,south=false,north=false,west=false]": "160:6" -"minecraft:gray_stained_glass_pane[east=false,south=false,north=false,west=false]": "160:7" -"minecraft:light_gray_stained_glass_pane[east=false,south=false,north=false,west=false]": "160:8" -"minecraft:cyan_stained_glass_pane[east=false,south=false,north=false,west=false]": "160:9" -"minecraft:purple_stained_glass_pane[east=false,south=false,north=false,west=false]": "160:10" -"minecraft:blue_stained_glass_pane[east=false,south=false,north=false,west=false]": "160:11" -"minecraft:brown_stained_glass_pane[east=false,south=false,north=false,west=false]": "160:12" -"minecraft:green_stained_glass_pane[east=false,south=false,north=false,west=false]": "160:13" -"minecraft:red_stained_glass_pane[east=false,south=false,north=false,west=false]": "160:14" -"minecraft:black_stained_glass_pane[east=false,south=false,north=false,west=false]": "160:15" -"minecraft:acacia_leaves[persistent=false,distance=1]": "161:0" -"minecraft:dark_oak_leaves[persistent=false,distance=1]": "161:1" -"minecraft:acacia_leaves[persistent=true,distance=1]": "161:4" -"minecraft:dark_oak_leaves[persistent=true,distance=1]": "161:5" -"minecraft:acacia_log[axis=y]": "162:0" -"minecraft:dark_oak_log[axis=y]": "162:1" -"minecraft:acacia_log[axis=x]": "162:4" -"minecraft:dark_oak_log[axis=x]": "162:5" -"minecraft:acacia_log[axis=z]": "162:8" -"minecraft:dark_oak_log[axis=z]": "162:9" -"minecraft:acacia_wood": "162:12" -"minecraft:dark_oak_wood": "162:13" -"minecraft:acacia_stairs[half=bottom,shape=straight,facing=east]": "163:0" -"minecraft:acacia_stairs[half=bottom,shape=straight,facing=west]": "163:1" -"minecraft:acacia_stairs[half=bottom,shape=straight,facing=south]": "163:2" -"minecraft:acacia_stairs[half=bottom,shape=straight,facing=north]": "163:3" -"minecraft:acacia_stairs[half=top,shape=straight,facing=east]": "163:4" -"minecraft:acacia_stairs[half=top,shape=straight,facing=west]": "163:5" -"minecraft:acacia_stairs[half=top,shape=straight,facing=south]": "163:6" -"minecraft:acacia_stairs[half=top,shape=straight,facing=north]": "163:7" -"minecraft:dark_oak_stairs[half=bottom,shape=straight,facing=east]": "164:0" -"minecraft:dark_oak_stairs[half=bottom,shape=straight,facing=west]": "164:1" -"minecraft:dark_oak_stairs[half=bottom,shape=straight,facing=south]": "164:2" -"minecraft:dark_oak_stairs[half=bottom,shape=straight,facing=north]": "164:3" -"minecraft:dark_oak_stairs[half=top,shape=straight,facing=east]": "164:4" -"minecraft:dark_oak_stairs[half=top,shape=straight,facing=west]": "164:5" -"minecraft:dark_oak_stairs[half=top,shape=straight,facing=south]": "164:6" -"minecraft:dark_oak_stairs[half=top,shape=straight,facing=north]": "164:7" -"minecraft:slime_block": "165:0" -"minecraft:barrier": "166:0" -"minecraft:iron_trapdoor[half=bottom,facing=north,open=false]": "167:0" -"minecraft:iron_trapdoor[half=bottom,facing=south,open=false]": "167:1" -"minecraft:iron_trapdoor[half=bottom,facing=west,open=false]": "167:2" -"minecraft:iron_trapdoor[half=bottom,facing=east,open=false]": "167:3" -"minecraft:iron_trapdoor[half=bottom,facing=north,open=true]": "167:4" -"minecraft:iron_trapdoor[half=bottom,facing=south,open=true]": "167:5" -"minecraft:iron_trapdoor[half=bottom,facing=west,open=true]": "167:6" -"minecraft:iron_trapdoor[half=bottom,facing=east,open=true]": "167:7" -"minecraft:iron_trapdoor[half=top,facing=north,open=false]": "167:8" -"minecraft:iron_trapdoor[half=top,facing=south,open=false]": "167:9" -"minecraft:iron_trapdoor[half=top,facing=west,open=false]": "167:10" -"minecraft:iron_trapdoor[half=top,facing=east,open=false]": "167:11" -"minecraft:iron_trapdoor[half=top,facing=north,open=true]": "167:12" -"minecraft:iron_trapdoor[half=top,facing=south,open=true]": "167:13" -"minecraft:iron_trapdoor[half=top,facing=west,open=true]": "167:14" -"minecraft:iron_trapdoor[half=top,facing=east,open=true]": "167:15" -"minecraft:prismarine": "168:0" -"minecraft:prismarine_bricks": "168:1" -"minecraft:dark_prismarine": "168:2" -"minecraft:sea_lantern": "169:0" -"minecraft:hay_block[axis=y]": "170:0" -"minecraft:hay_block[axis=x]": "170:4" -"minecraft:hay_block[axis=z]": "170:8" -"minecraft:white_carpet": "171:0" -"minecraft:orange_carpet": "171:1" -"minecraft:magenta_carpet": "171:2" -"minecraft:light_blue_carpet": "171:3" -"minecraft:yellow_carpet": "171:4" -"minecraft:lime_carpet": "171:5" -"minecraft:pink_carpet": "171:6" -"minecraft:gray_carpet": "171:7" -"minecraft:light_gray_carpet": "171:8" -"minecraft:cyan_carpet": "171:9" -"minecraft:purple_carpet": "171:10" -"minecraft:blue_carpet": "171:11" -"minecraft:brown_carpet": "171:12" -"minecraft:green_carpet": "171:13" -"minecraft:red_carpet": "171:14" -"minecraft:black_carpet": "171:15" -"minecraft:terracotta": "172:0" -"minecraft:coal_block": "173:0" -"minecraft:packed_ice": "174:0" -"minecraft:sunflower[half=lower]": "175:0" -"minecraft:lilac[half=lower]": "175:1" -"minecraft:tall_grass[half=lower]": "175:2" -"minecraft:large_fern[half=lower]": "175:3" -"minecraft:rose_bush[half=lower]": "175:4" -"minecraft:peony[half=lower]": "175:5" -"minecraft:sunflower[half=upper]": "175:8" -"minecraft:lilac[half=upper]": "175:9" -"minecraft:tall_grass[half=upper]": "175:10" -"minecraft:large_fern[half=upper]": "175:11" -"minecraft:rose_bush[half=upper]": "175:12" -"minecraft:peony[half=upper]": "175:13" -"minecraft:white_banner[rotation=0]": "176:0" -"minecraft:white_banner[rotation=1]": "176:1" -"minecraft:white_banner[rotation=2]": "176:2" -"minecraft:white_banner[rotation=3]": "176:3" -"minecraft:white_banner[rotation=4]": "176:4" -"minecraft:white_banner[rotation=5]": "176:5" -"minecraft:white_banner[rotation=6]": "176:6" -"minecraft:white_banner[rotation=7]": "176:7" -"minecraft:white_banner[rotation=8]": "176:8" -"minecraft:white_banner[rotation=9]": "176:9" -"minecraft:white_banner[rotation=10]": "176:10" -"minecraft:white_banner[rotation=11]": "176:11" -"minecraft:white_banner[rotation=12]": "176:12" -"minecraft:white_banner[rotation=13]": "176:13" -"minecraft:white_banner[rotation=14]": "176:14" -"minecraft:white_banner[rotation=15]": "176:15" -"minecraft:white_wall_banner": "177:0" -"minecraft:white_wall_banner[facing=north]": "177:2" -"minecraft:white_wall_banner[facing=south]": "177:3" -"minecraft:white_wall_banner[facing=west]": "177:4" -"minecraft:white_wall_banner[facing=east]": "177:5" -"minecraft:daylight_detector[inverted=true,power=0]": "178:0" -"minecraft:daylight_detector[inverted=true,power=1]": "178:1" -"minecraft:daylight_detector[inverted=true,power=2]": "178:2" -"minecraft:daylight_detector[inverted=true,power=3]": "178:3" -"minecraft:daylight_detector[inverted=true,power=4]": "178:4" -"minecraft:daylight_detector[inverted=true,power=5]": "178:5" -"minecraft:daylight_detector[inverted=true,power=6]": "178:6" -"minecraft:daylight_detector[inverted=true,power=7]": "178:7" -"minecraft:daylight_detector[inverted=true,power=8]": "178:8" -"minecraft:daylight_detector[inverted=true,power=9]": "178:9" -"minecraft:daylight_detector[inverted=true,power=10]": "178:10" -"minecraft:daylight_detector[inverted=true,power=11]": "178:11" -"minecraft:daylight_detector[inverted=true,power=12]": "178:12" -"minecraft:daylight_detector[inverted=true,power=13]": "178:13" -"minecraft:daylight_detector[inverted=true,power=14]": "178:14" -"minecraft:daylight_detector[inverted=true,power=15]": "178:15" -"minecraft:red_sandstone": "179:0" -"minecraft:chiseled_red_sandstone": "179:1" -"minecraft:cut_red_sandstone": "179:2" -"minecraft:red_sandstone_stairs[half=bottom,shape=straight,facing=east]": "180:0" -"minecraft:red_sandstone_stairs[half=bottom,shape=straight,facing=west]": "180:1" -"minecraft:red_sandstone_stairs[half=bottom,shape=straight,facing=south]": "180:2" -"minecraft:red_sandstone_stairs[half=bottom,shape=straight,facing=north]": "180:3" -"minecraft:red_sandstone_stairs[half=top,shape=straight,facing=east]": "180:4" -"minecraft:red_sandstone_stairs[half=top,shape=straight,facing=west]": "180:5" -"minecraft:red_sandstone_stairs[half=top,shape=straight,facing=south]": "180:6" -"minecraft:red_sandstone_stairs[half=top,shape=straight,facing=north]": "180:7" -"minecraft:red_sandstone_slab[type=double]": "181:0" -"minecraft:smooth_red_sandstone": "181:8" -"minecraft:red_sandstone_slab[type=bottom]": "182:0" -"minecraft:red_sandstone_slab[type=top]": "182:8" -"minecraft:spruce_fence_gate[in_wall=false,powered=false,facing=south,open=false]": "183:0" -"minecraft:spruce_fence_gate[in_wall=false,powered=false,facing=west,open=false]": "183:1" -"minecraft:spruce_fence_gate[in_wall=false,powered=false,facing=north,open=false]": "183:2" -"minecraft:spruce_fence_gate[in_wall=false,powered=false,facing=east,open=false]": "183:3" -"minecraft:spruce_fence_gate[in_wall=false,powered=false,facing=south,open=true]": "183:4" -"minecraft:spruce_fence_gate[in_wall=false,powered=false,facing=west,open=true]": "183:5" -"minecraft:spruce_fence_gate[in_wall=false,powered=false,facing=north,open=true]": "183:6" -"minecraft:spruce_fence_gate[in_wall=false,powered=false,facing=east,open=true]": "183:7" -"minecraft:spruce_fence_gate[in_wall=false,powered=true,facing=south,open=false]": "183:8" -"minecraft:spruce_fence_gate[in_wall=false,powered=true,facing=west,open=false]": "183:9" -"minecraft:spruce_fence_gate[in_wall=false,powered=true,facing=north,open=false]": "183:10" -"minecraft:spruce_fence_gate[in_wall=false,powered=true,facing=east,open=false]": "183:11" -"minecraft:spruce_fence_gate[in_wall=false,powered=true,facing=south,open=true]": "183:12" -"minecraft:spruce_fence_gate[in_wall=false,powered=true,facing=west,open=true]": "183:13" -"minecraft:spruce_fence_gate[in_wall=false,powered=true,facing=north,open=true]": "183:14" -"minecraft:spruce_fence_gate[in_wall=false,powered=true,facing=east,open=true]": "183:15" -"minecraft:birch_fence_gate[in_wall=false,powered=false,facing=south,open=false]": "184:0" -"minecraft:birch_fence_gate[in_wall=false,powered=false,facing=west,open=false]": "184:1" -"minecraft:birch_fence_gate[in_wall=false,powered=false,facing=north,open=false]": "184:2" -"minecraft:birch_fence_gate[in_wall=false,powered=false,facing=east,open=false]": "184:3" -"minecraft:birch_fence_gate[in_wall=false,powered=false,facing=south,open=true]": "184:4" -"minecraft:birch_fence_gate[in_wall=false,powered=false,facing=west,open=true]": "184:5" -"minecraft:birch_fence_gate[in_wall=false,powered=false,facing=north,open=true]": "184:6" -"minecraft:birch_fence_gate[in_wall=false,powered=false,facing=east,open=true]": "184:7" -"minecraft:birch_fence_gate[in_wall=false,powered=true,facing=south,open=false]": "184:8" -"minecraft:birch_fence_gate[in_wall=false,powered=true,facing=west,open=false]": "184:9" -"minecraft:birch_fence_gate[in_wall=false,powered=true,facing=north,open=false]": "184:10" -"minecraft:birch_fence_gate[in_wall=false,powered=true,facing=east,open=false]": "184:11" -"minecraft:birch_fence_gate[in_wall=false,powered=true,facing=south,open=true]": "184:12" -"minecraft:birch_fence_gate[in_wall=false,powered=true,facing=west,open=true]": "184:13" -"minecraft:birch_fence_gate[in_wall=false,powered=true,facing=north,open=true]": "184:14" -"minecraft:birch_fence_gate[in_wall=false,powered=true,facing=east,open=true]": "184:15" -"minecraft:jungle_fence_gate[in_wall=false,powered=false,facing=south,open=false]": "185:0" -"minecraft:jungle_fence_gate[in_wall=false,powered=false,facing=west,open=false]": "185:1" -"minecraft:jungle_fence_gate[in_wall=false,powered=false,facing=north,open=false]": "185:2" -"minecraft:jungle_fence_gate[in_wall=false,powered=false,facing=east,open=false]": "185:3" -"minecraft:jungle_fence_gate[in_wall=false,powered=false,facing=south,open=true]": "185:4" -"minecraft:jungle_fence_gate[in_wall=false,powered=false,facing=west,open=true]": "185:5" -"minecraft:jungle_fence_gate[in_wall=false,powered=false,facing=north,open=true]": "185:6" -"minecraft:jungle_fence_gate[in_wall=false,powered=false,facing=east,open=true]": "185:7" -"minecraft:jungle_fence_gate[in_wall=false,powered=true,facing=south,open=false]": "185:8" -"minecraft:jungle_fence_gate[in_wall=false,powered=true,facing=west,open=false]": "185:9" -"minecraft:jungle_fence_gate[in_wall=false,powered=true,facing=north,open=false]": "185:10" -"minecraft:jungle_fence_gate[in_wall=false,powered=true,facing=east,open=false]": "185:11" -"minecraft:jungle_fence_gate[in_wall=false,powered=true,facing=south,open=true]": "185:12" -"minecraft:jungle_fence_gate[in_wall=false,powered=true,facing=west,open=true]": "185:13" -"minecraft:jungle_fence_gate[in_wall=false,powered=true,facing=north,open=true]": "185:14" -"minecraft:jungle_fence_gate[in_wall=false,powered=true,facing=east,open=true]": "185:15" -"minecraft:dark_oak_fence_gate[in_wall=false,powered=false,facing=south,open=false]": "186:0" -"minecraft:dark_oak_fence_gate[in_wall=false,powered=false,facing=west,open=false]": "186:1" -"minecraft:dark_oak_fence_gate[in_wall=false,powered=false,facing=north,open=false]": "186:2" -"minecraft:dark_oak_fence_gate[in_wall=false,powered=false,facing=east,open=false]": "186:3" -"minecraft:dark_oak_fence_gate[in_wall=false,powered=false,facing=south,open=true]": "186:4" -"minecraft:dark_oak_fence_gate[in_wall=false,powered=false,facing=west,open=true]": "186:5" -"minecraft:dark_oak_fence_gate[in_wall=false,powered=false,facing=north,open=true]": "186:6" -"minecraft:dark_oak_fence_gate[in_wall=false,powered=false,facing=east,open=true]": "186:7" -"minecraft:dark_oak_fence_gate[in_wall=false,powered=true,facing=south,open=false]": "186:8" -"minecraft:dark_oak_fence_gate[in_wall=false,powered=true,facing=west,open=false]": "186:9" -"minecraft:dark_oak_fence_gate[in_wall=false,powered=true,facing=north,open=false]": "186:10" -"minecraft:dark_oak_fence_gate[in_wall=false,powered=true,facing=east,open=false]": "186:11" -"minecraft:dark_oak_fence_gate[in_wall=false,powered=true,facing=south,open=true]": "186:12" -"minecraft:dark_oak_fence_gate[in_wall=false,powered=true,facing=west,open=true]": "186:13" -"minecraft:dark_oak_fence_gate[in_wall=false,powered=true,facing=north,open=true]": "186:14" -"minecraft:dark_oak_fence_gate[in_wall=false,powered=true,facing=east,open=true]": "186:15" -"minecraft:acacia_fence_gate[in_wall=false,powered=false,facing=south,open=false]": "187:0" -"minecraft:acacia_fence_gate[in_wall=false,powered=false,facing=west,open=false]": "187:1" -"minecraft:acacia_fence_gate[in_wall=false,powered=false,facing=north,open=false]": "187:2" -"minecraft:acacia_fence_gate[in_wall=false,powered=false,facing=east,open=false]": "187:3" -"minecraft:acacia_fence_gate[in_wall=false,powered=false,facing=south,open=true]": "187:4" -"minecraft:acacia_fence_gate[in_wall=false,powered=false,facing=west,open=true]": "187:5" -"minecraft:acacia_fence_gate[in_wall=false,powered=false,facing=north,open=true]": "187:6" -"minecraft:acacia_fence_gate[in_wall=false,powered=false,facing=east,open=true]": "187:7" -"minecraft:acacia_fence_gate[in_wall=false,powered=true,facing=south,open=false]": "187:8" -"minecraft:acacia_fence_gate[in_wall=false,powered=true,facing=west,open=false]": "187:9" -"minecraft:acacia_fence_gate[in_wall=false,powered=true,facing=north,open=false]": "187:10" -"minecraft:acacia_fence_gate[in_wall=false,powered=true,facing=east,open=false]": "187:11" -"minecraft:acacia_fence_gate[in_wall=false,powered=true,facing=south,open=true]": "187:12" -"minecraft:acacia_fence_gate[in_wall=false,powered=true,facing=west,open=true]": "187:13" -"minecraft:acacia_fence_gate[in_wall=false,powered=true,facing=north,open=true]": "187:14" -"minecraft:acacia_fence_gate[in_wall=false,powered=true,facing=east,open=true]": "187:15" -"minecraft:spruce_fence[east=false,south=false,north=false,west=false]": "188:0" -"minecraft:birch_fence[east=false,south=false,north=false,west=false]": "189:0" -"minecraft:jungle_fence[east=false,south=false,north=false,west=false]": "190:0" -"minecraft:dark_oak_fence[east=false,south=false,north=false,west=false]": "191:0" -"minecraft:acacia_fence[east=false,south=false,north=false,west=false]": "192:0" -"minecraft:spruce_door[hinge=right,half=lower,powered=false,facing=east,open=false]": "193:0" -"minecraft:spruce_door[hinge=right,half=lower,powered=false,facing=south,open=false]": "193:1" -"minecraft:spruce_door[hinge=right,half=lower,powered=false,facing=west,open=false]": "193:2" -"minecraft:spruce_door[hinge=right,half=lower,powered=false,facing=north,open=false]": "193:3" -"minecraft:spruce_door[hinge=right,half=lower,powered=false,facing=east,open=true]": "193:4" -"minecraft:spruce_door[hinge=right,half=lower,powered=false,facing=south,open=true]": "193:5" -"minecraft:spruce_door[hinge=right,half=lower,powered=false,facing=west,open=true]": "193:6" -"minecraft:spruce_door[hinge=right,half=lower,powered=false,facing=north,open=true]": "193:7" -"minecraft:spruce_door[hinge=left,half=upper,powered=false,facing=east,open=false]": "193:8" -"minecraft:spruce_door[hinge=right,half=upper,powered=false,facing=east,open=false]": "193:9" -"minecraft:spruce_door[hinge=left,half=upper,powered=true,facing=east,open=false]": "193:10" -"minecraft:spruce_door[hinge=right,half=upper,powered=true,facing=east,open=false]": "193:11" -"minecraft:birch_door[hinge=right,half=lower,powered=false,facing=east,open=false]": "194:0" -"minecraft:birch_door[hinge=right,half=lower,powered=false,facing=south,open=false]": "194:1" -"minecraft:birch_door[hinge=right,half=lower,powered=false,facing=west,open=false]": "194:2" -"minecraft:birch_door[hinge=right,half=lower,powered=false,facing=north,open=false]": "194:3" -"minecraft:birch_door[hinge=right,half=lower,powered=false,facing=east,open=true]": "194:4" -"minecraft:birch_door[hinge=right,half=lower,powered=false,facing=south,open=true]": "194:5" -"minecraft:birch_door[hinge=right,half=lower,powered=false,facing=west,open=true]": "194:6" -"minecraft:birch_door[hinge=right,half=lower,powered=false,facing=north,open=true]": "194:7" -"minecraft:birch_door[hinge=left,half=upper,powered=false,facing=east,open=false]": "194:8" -"minecraft:birch_door[hinge=right,half=upper,powered=false,facing=east,open=false]": "194:9" -"minecraft:birch_door[hinge=left,half=upper,powered=true,facing=east,open=false]": "194:10" -"minecraft:birch_door[hinge=right,half=upper,powered=true,facing=east,open=false]": "194:11" -"minecraft:jungle_door[hinge=right,half=lower,powered=false,facing=east,open=false]": "195:0" -"minecraft:jungle_door[hinge=right,half=lower,powered=false,facing=south,open=false]": "195:1" -"minecraft:jungle_door[hinge=right,half=lower,powered=false,facing=west,open=false]": "195:2" -"minecraft:jungle_door[hinge=right,half=lower,powered=false,facing=north,open=false]": "195:3" -"minecraft:jungle_door[hinge=right,half=lower,powered=false,facing=east,open=true]": "195:4" -"minecraft:jungle_door[hinge=right,half=lower,powered=false,facing=south,open=true]": "195:5" -"minecraft:jungle_door[hinge=right,half=lower,powered=false,facing=west,open=true]": "195:6" -"minecraft:jungle_door[hinge=right,half=lower,powered=false,facing=north,open=true]": "195:7" -"minecraft:jungle_door[hinge=left,half=upper,powered=false,facing=east,open=false]": "195:8" -"minecraft:jungle_door[hinge=right,half=upper,powered=false,facing=east,open=false]": "195:9" -"minecraft:jungle_door[hinge=left,half=upper,powered=true,facing=east,open=false]": "195:10" -"minecraft:jungle_door[hinge=right,half=upper,powered=true,facing=east,open=false]": "195:11" -"minecraft:acacia_door[hinge=right,half=lower,powered=false,facing=east,open=false]": "196:0" -"minecraft:acacia_door[hinge=right,half=lower,powered=false,facing=south,open=false]": "196:1" -"minecraft:acacia_door[hinge=right,half=lower,powered=false,facing=west,open=false]": "196:2" -"minecraft:acacia_door[hinge=right,half=lower,powered=false,facing=north,open=false]": "196:3" -"minecraft:acacia_door[hinge=right,half=lower,powered=false,facing=east,open=true]": "196:4" -"minecraft:acacia_door[hinge=right,half=lower,powered=false,facing=south,open=true]": "196:5" -"minecraft:acacia_door[hinge=right,half=lower,powered=false,facing=west,open=true]": "196:6" -"minecraft:acacia_door[hinge=right,half=lower,powered=false,facing=north,open=true]": "196:7" -"minecraft:acacia_door[hinge=left,half=upper,powered=false,facing=east,open=false]": "196:8" -"minecraft:acacia_door[hinge=right,half=upper,powered=false,facing=east,open=false]": "196:9" -"minecraft:acacia_door[hinge=left,half=upper,powered=true,facing=east,open=false]": "196:10" -"minecraft:acacia_door[hinge=right,half=upper,powered=true,facing=east,open=false]": "196:11" -"minecraft:dark_oak_door[hinge=right,half=lower,powered=false,facing=east,open=false]": "197:0" -"minecraft:dark_oak_door[hinge=right,half=lower,powered=false,facing=south,open=false]": "197:1" -"minecraft:dark_oak_door[hinge=right,half=lower,powered=false,facing=west,open=false]": "197:2" -"minecraft:dark_oak_door[hinge=right,half=lower,powered=false,facing=north,open=false]": "197:3" -"minecraft:dark_oak_door[hinge=right,half=lower,powered=false,facing=east,open=true]": "197:4" -"minecraft:dark_oak_door[hinge=right,half=lower,powered=false,facing=south,open=true]": "197:5" -"minecraft:dark_oak_door[hinge=right,half=lower,powered=false,facing=west,open=true]": "197:6" -"minecraft:dark_oak_door[hinge=right,half=lower,powered=false,facing=north,open=true]": "197:7" -"minecraft:dark_oak_door[hinge=left,half=upper,powered=false,facing=east,open=false]": "197:8" -"minecraft:dark_oak_door[hinge=right,half=upper,powered=false,facing=east,open=false]": "197:9" -"minecraft:dark_oak_door[hinge=left,half=upper,powered=true,facing=east,open=false]": "197:10" -"minecraft:dark_oak_door[hinge=right,half=upper,powered=true,facing=east,open=false]": "197:11" -"minecraft:end_rod[facing=down]": "198:0" -"minecraft:end_rod[facing=up]": "198:1" -"minecraft:end_rod[facing=north]": "198:2" -"minecraft:end_rod[facing=south]": "198:3" -"minecraft:end_rod[facing=west]": "198:4" -"minecraft:end_rod[facing=east]": "198:5" -"minecraft:chorus_plant[east=false,south=false,north=false,west=false,up=false,down=false]": "199:0" -"minecraft:chorus_flower[age=0]": "200:0" -"minecraft:chorus_flower[age=1]": "200:1" -"minecraft:chorus_flower[age=2]": "200:2" -"minecraft:chorus_flower[age=3]": "200:3" -"minecraft:chorus_flower[age=4]": "200:4" -"minecraft:chorus_flower[age=5]": "200:5" -"minecraft:purpur_block": "201:0" -"minecraft:purpur_pillar[axis=y]": "202:0" -"minecraft:purpur_pillar[axis=x]": "202:4" -"minecraft:purpur_pillar[axis=z]": "202:8" -"minecraft:purpur_stairs[half=bottom,shape=straight,facing=east]": "203:0" -"minecraft:purpur_stairs[half=bottom,shape=straight,facing=west]": "203:1" -"minecraft:purpur_stairs[half=bottom,shape=straight,facing=south]": "203:2" -"minecraft:purpur_stairs[half=bottom,shape=straight,facing=north]": "203:3" -"minecraft:purpur_stairs[half=top,shape=straight,facing=east]": "203:4" -"minecraft:purpur_stairs[half=top,shape=straight,facing=west]": "203:5" -"minecraft:purpur_stairs[half=top,shape=straight,facing=south]": "203:6" -"minecraft:purpur_stairs[half=top,shape=straight,facing=north]": "203:7" -"minecraft:purpur_slab[type=double]": "204:0" -"minecraft:purpur_slab[type=bottom]": "205:0" -"minecraft:purpur_slab[type=top]": "205:8" -"minecraft:end_stone_bricks": "206:0" -"minecraft:beetroots[age=0]": "207:0" -"minecraft:beetroots[age=1]": "207:1" -"minecraft:beetroots[age=2]": "207:2" -"minecraft:beetroots[age=3]": "207:3" -"minecraft:grass_path": "208:0" -"minecraft:end_gateway": "209:0" -"minecraft:repeating_command_block[conditional=false,facing=down]": "210:0" -"minecraft:repeating_command_block[conditional=false,facing=up]": "210:1" -"minecraft:repeating_command_block[conditional=false,facing=north]": "210:2" -"minecraft:repeating_command_block[conditional=false,facing=south]": "210:3" -"minecraft:repeating_command_block[conditional=false,facing=west]": "210:4" -"minecraft:repeating_command_block[conditional=false,facing=east]": "210:5" -"minecraft:repeating_command_block[conditional=true,facing=down]": "210:8" -"minecraft:repeating_command_block[conditional=true,facing=up]": "210:9" -"minecraft:repeating_command_block[conditional=true,facing=north]": "210:10" -"minecraft:repeating_command_block[conditional=true,facing=south]": "210:11" -"minecraft:repeating_command_block[conditional=true,facing=west]": "210:12" -"minecraft:repeating_command_block[conditional=true,facing=east]": "210:13" -"minecraft:chain_command_block[conditional=false,facing=down]": "211:0" -"minecraft:chain_command_block[conditional=false,facing=up]": "211:1" -"minecraft:chain_command_block[conditional=false,facing=north]": "211:2" -"minecraft:chain_command_block[conditional=false,facing=south]": "211:3" -"minecraft:chain_command_block[conditional=false,facing=west]": "211:4" -"minecraft:chain_command_block[conditional=false,facing=east]": "211:5" -"minecraft:chain_command_block[conditional=true,facing=down]": "211:8" -"minecraft:chain_command_block[conditional=true,facing=up]": "211:9" -"minecraft:chain_command_block[conditional=true,facing=north]": "211:10" -"minecraft:chain_command_block[conditional=true,facing=south]": "211:11" -"minecraft:chain_command_block[conditional=true,facing=west]": "211:12" -"minecraft:chain_command_block[conditional=true,facing=east]": "211:13" -"minecraft:frosted_ice[age=0]": "212:0" -"minecraft:frosted_ice[age=1]": "212:1" -"minecraft:frosted_ice[age=2]": "212:2" -"minecraft:frosted_ice[age=3]": "212:3" -"minecraft:magma_block": "213:0" -"minecraft:nether_wart_block": "214:0" -"minecraft:red_nether_bricks": "215:0" -"minecraft:bone_block[axis=y]": "216:0" -"minecraft:bone_block[axis=x]": "216:4" -"minecraft:bone_block[axis=z]": "216:8" -"minecraft:structure_void": "217:0" -"minecraft:observer[powered=false,facing=down]": "218:0" -"minecraft:observer[powered=false,facing=up]": "218:1" -"minecraft:observer[powered=false,facing=north]": "218:2" -"minecraft:observer[powered=false,facing=south]": "218:3" -"minecraft:observer[powered=false,facing=west]": "218:4" -"minecraft:observer[powered=false,facing=east]": "218:5" -"minecraft:observer[powered=true,facing=down]": "218:8" -"minecraft:observer[powered=true,facing=up]": "218:9" -"minecraft:observer[powered=true,facing=north]": "218:10" -"minecraft:observer[powered=true,facing=south]": "218:11" -"minecraft:observer[powered=true,facing=west]": "218:12" -"minecraft:observer[powered=true,facing=east]": "218:13" -"minecraft:white_shulker_box[facing=down]": "219:0" -"minecraft:white_shulker_box[facing=up]": "219:1" -"minecraft:white_shulker_box[facing=north]": "219:2" -"minecraft:white_shulker_box[facing=south]": "219:3" -"minecraft:white_shulker_box[facing=west]": "219:4" -"minecraft:white_shulker_box[facing=east]": "219:5" -"minecraft:orange_shulker_box[facing=down]": "220:0" -"minecraft:orange_shulker_box[facing=up]": "220:1" -"minecraft:orange_shulker_box[facing=north]": "220:2" -"minecraft:orange_shulker_box[facing=south]": "220:3" -"minecraft:orange_shulker_box[facing=west]": "220:4" -"minecraft:orange_shulker_box[facing=east]": "220:5" -"minecraft:magenta_shulker_box[facing=down]": "221:0" -"minecraft:magenta_shulker_box[facing=up]": "221:1" -"minecraft:magenta_shulker_box[facing=north]": "221:2" -"minecraft:magenta_shulker_box[facing=south]": "221:3" -"minecraft:magenta_shulker_box[facing=west]": "221:4" -"minecraft:magenta_shulker_box[facing=east]": "221:5" -"minecraft:light_blue_shulker_box[facing=down]": "222:0" -"minecraft:light_blue_shulker_box[facing=up]": "222:1" -"minecraft:light_blue_shulker_box[facing=north]": "222:2" -"minecraft:light_blue_shulker_box[facing=south]": "222:3" -"minecraft:light_blue_shulker_box[facing=west]": "222:4" -"minecraft:light_blue_shulker_box[facing=east]": "222:5" -"minecraft:yellow_shulker_box[facing=down]": "223:0" -"minecraft:yellow_shulker_box[facing=up]": "223:1" -"minecraft:yellow_shulker_box[facing=north]": "223:2" -"minecraft:yellow_shulker_box[facing=south]": "223:3" -"minecraft:yellow_shulker_box[facing=west]": "223:4" -"minecraft:yellow_shulker_box[facing=east]": "223:5" -"minecraft:lime_shulker_box[facing=down]": "224:0" -"minecraft:lime_shulker_box[facing=up]": "224:1" -"minecraft:lime_shulker_box[facing=north]": "224:2" -"minecraft:lime_shulker_box[facing=south]": "224:3" -"minecraft:lime_shulker_box[facing=west]": "224:4" -"minecraft:lime_shulker_box[facing=east]": "224:5" -"minecraft:pink_shulker_box[facing=down]": "225:0" -"minecraft:pink_shulker_box[facing=up]": "225:1" -"minecraft:pink_shulker_box[facing=north]": "225:2" -"minecraft:pink_shulker_box[facing=south]": "225:3" -"minecraft:pink_shulker_box[facing=west]": "225:4" -"minecraft:pink_shulker_box[facing=east]": "225:5" -"minecraft:gray_shulker_box[facing=down]": "226:0" -"minecraft:gray_shulker_box[facing=up]": "226:1" -"minecraft:gray_shulker_box[facing=north]": "226:2" -"minecraft:gray_shulker_box[facing=south]": "226:3" -"minecraft:gray_shulker_box[facing=west]": "226:4" -"minecraft:gray_shulker_box[facing=east]": "226:5" -"minecraft:light_gray_shulker_box[facing=down]": "227:0" -"minecraft:light_gray_shulker_box[facing=up]": "227:1" -"minecraft:light_gray_shulker_box[facing=north]": "227:2" -"minecraft:light_gray_shulker_box[facing=south]": "227:3" -"minecraft:light_gray_shulker_box[facing=west]": "227:4" -"minecraft:light_gray_shulker_box[facing=east]": "227:5" -"minecraft:cyan_shulker_box[facing=down]": "228:0" -"minecraft:cyan_shulker_box[facing=up]": "228:1" -"minecraft:cyan_shulker_box[facing=north]": "228:2" -"minecraft:cyan_shulker_box[facing=south]": "228:3" -"minecraft:cyan_shulker_box[facing=west]": "228:4" -"minecraft:cyan_shulker_box[facing=east]": "228:5" -"minecraft:purple_shulker_box[facing=down]": "229:0" -"minecraft:purple_shulker_box[facing=up]": "229:1" -"minecraft:purple_shulker_box[facing=north]": "229:2" -"minecraft:purple_shulker_box[facing=south]": "229:3" -"minecraft:purple_shulker_box[facing=west]": "229:4" -"minecraft:purple_shulker_box[facing=east]": "229:5" -"minecraft:blue_shulker_box[facing=down]": "230:0" -"minecraft:blue_shulker_box[facing=up]": "230:1" -"minecraft:blue_shulker_box[facing=north]": "230:2" -"minecraft:blue_shulker_box[facing=south]": "230:3" -"minecraft:blue_shulker_box[facing=west]": "230:4" -"minecraft:blue_shulker_box[facing=east]": "230:5" -"minecraft:brown_shulker_box[facing=down]": "231:0" -"minecraft:brown_shulker_box[facing=up]": "231:1" -"minecraft:brown_shulker_box[facing=north]": "231:2" -"minecraft:brown_shulker_box[facing=south]": "231:3" -"minecraft:brown_shulker_box[facing=west]": "231:4" -"minecraft:brown_shulker_box[facing=east]": "231:5" -"minecraft:green_shulker_box[facing=down]": "232:0" -"minecraft:green_shulker_box[facing=up]": "232:1" -"minecraft:green_shulker_box[facing=north]": "232:2" -"minecraft:green_shulker_box[facing=south]": "232:3" -"minecraft:green_shulker_box[facing=west]": "232:4" -"minecraft:green_shulker_box[facing=east]": "232:5" -"minecraft:red_shulker_box[facing=down]": "233:0" -"minecraft:red_shulker_box[facing=up]": "233:1" -"minecraft:red_shulker_box[facing=north]": "233:2" -"minecraft:red_shulker_box[facing=south]": "233:3" -"minecraft:red_shulker_box[facing=west]": "233:4" -"minecraft:red_shulker_box[facing=east]": "233:5" -"minecraft:black_shulker_box[facing=down]": "234:0" -"minecraft:black_shulker_box[facing=up]": "234:1" -"minecraft:black_shulker_box[facing=north]": "234:2" -"minecraft:black_shulker_box[facing=south]": "234:3" -"minecraft:black_shulker_box[facing=west]": "234:4" -"minecraft:black_shulker_box[facing=east]": "234:5" -"minecraft:white_glazed_terracotta[facing=south]": "235:0" -"minecraft:white_glazed_terracotta[facing=west]": "235:1" -"minecraft:white_glazed_terracotta[facing=north]": "235:2" -"minecraft:white_glazed_terracotta[facing=east]": "235:3" -"minecraft:orange_glazed_terracotta[facing=south]": "236:0" -"minecraft:orange_glazed_terracotta[facing=west]": "236:1" -"minecraft:orange_glazed_terracotta[facing=north]": "236:2" -"minecraft:orange_glazed_terracotta[facing=east]": "236:3" -"minecraft:magenta_glazed_terracotta[facing=south]": "237:0" -"minecraft:magenta_glazed_terracotta[facing=west]": "237:1" -"minecraft:magenta_glazed_terracotta[facing=north]": "237:2" -"minecraft:magenta_glazed_terracotta[facing=east]": "237:3" -"minecraft:light_blue_glazed_terracotta[facing=south]": "238:0" -"minecraft:light_blue_glazed_terracotta[facing=west]": "238:1" -"minecraft:light_blue_glazed_terracotta[facing=north]": "238:2" -"minecraft:light_blue_glazed_terracotta[facing=east]": "238:3" -"minecraft:yellow_glazed_terracotta[facing=south]": "239:0" -"minecraft:yellow_glazed_terracotta[facing=west]": "239:1" -"minecraft:yellow_glazed_terracotta[facing=north]": "239:2" -"minecraft:yellow_glazed_terracotta[facing=east]": "239:3" -"minecraft:lime_glazed_terracotta[facing=south]": "240:0" -"minecraft:lime_glazed_terracotta[facing=west]": "240:1" -"minecraft:lime_glazed_terracotta[facing=north]": "240:2" -"minecraft:lime_glazed_terracotta[facing=east]": "240:3" -"minecraft:pink_glazed_terracotta[facing=south]": "241:0" -"minecraft:pink_glazed_terracotta[facing=west]": "241:1" -"minecraft:pink_glazed_terracotta[facing=north]": "241:2" -"minecraft:pink_glazed_terracotta[facing=east]": "241:3" -"minecraft:gray_glazed_terracotta[facing=south]": "242:0" -"minecraft:gray_glazed_terracotta[facing=west]": "242:1" -"minecraft:gray_glazed_terracotta[facing=north]": "242:2" -"minecraft:gray_glazed_terracotta[facing=east]": "242:3" -"minecraft:light_gray_glazed_terracotta[facing=south]": "243:0" -"minecraft:light_gray_glazed_terracotta[facing=west]": "243:1" -"minecraft:light_gray_glazed_terracotta[facing=north]": "243:2" -"minecraft:light_gray_glazed_terracotta[facing=east]": "243:3" -"minecraft:cyan_glazed_terracotta[facing=south]": "244:0" -"minecraft:cyan_glazed_terracotta[facing=west]": "244:1" -"minecraft:cyan_glazed_terracotta[facing=north]": "244:2" -"minecraft:cyan_glazed_terracotta[facing=east]": "244:3" -"minecraft:purple_glazed_terracotta[facing=south]": "245:0" -"minecraft:purple_glazed_terracotta[facing=west]": "245:1" -"minecraft:purple_glazed_terracotta[facing=north]": "245:2" -"minecraft:purple_glazed_terracotta[facing=east]": "245:3" -"minecraft:blue_glazed_terracotta[facing=south]": "246:0" -"minecraft:blue_glazed_terracotta[facing=west]": "246:1" -"minecraft:blue_glazed_terracotta[facing=north]": "246:2" -"minecraft:blue_glazed_terracotta[facing=east]": "246:3" -"minecraft:brown_glazed_terracotta[facing=south]": "247:0" -"minecraft:brown_glazed_terracotta[facing=west]": "247:1" -"minecraft:brown_glazed_terracotta[facing=north]": "247:2" -"minecraft:brown_glazed_terracotta[facing=east]": "247:3" -"minecraft:green_glazed_terracotta[facing=south]": "248:0" -"minecraft:green_glazed_terracotta[facing=west]": "248:1" -"minecraft:green_glazed_terracotta[facing=north]": "248:2" -"minecraft:green_glazed_terracotta[facing=east]": "248:3" -"minecraft:red_glazed_terracotta[facing=south]": "249:0" -"minecraft:red_glazed_terracotta[facing=west]": "249:1" -"minecraft:red_glazed_terracotta[facing=north]": "249:2" -"minecraft:red_glazed_terracotta[facing=east]": "249:3" -"minecraft:black_glazed_terracotta[facing=south]": "250:0" -"minecraft:black_glazed_terracotta[facing=west]": "250:1" -"minecraft:black_glazed_terracotta[facing=north]": "250:2" -"minecraft:black_glazed_terracotta[facing=east]": "250:3" -"minecraft:white_concrete": "251:0" -"minecraft:orange_concrete": "251:1" -"minecraft:magenta_concrete": "251:2" -"minecraft:light_blue_concrete": "251:3" -"minecraft:yellow_concrete": "251:4" -"minecraft:lime_concrete": "251:5" -"minecraft:pink_concrete": "251:6" -"minecraft:gray_concrete": "251:7" -"minecraft:light_gray_concrete": "251:8" -"minecraft:cyan_concrete": "251:9" -"minecraft:purple_concrete": "251:10" -"minecraft:blue_concrete": "251:11" -"minecraft:brown_concrete": "251:12" -"minecraft:green_concrete": "251:13" -"minecraft:red_concrete": "251:14" -"minecraft:black_concrete": "251:15" -"minecraft:white_concrete_powder": "252:0" -"minecraft:orange_concrete_powder": "252:1" -"minecraft:magenta_concrete_powder": "252:2" -"minecraft:light_blue_concrete_powder": "252:3" -"minecraft:yellow_concrete_powder": "252:4" -"minecraft:lime_concrete_powder": "252:5" -"minecraft:pink_concrete_powder": "252:6" -"minecraft:gray_concrete_powder": "252:7" -"minecraft:light_gray_concrete_powder": "252:8" -"minecraft:cyan_concrete_powder": "252:9" -"minecraft:purple_concrete_powder": "252:10" -"minecraft:blue_concrete_powder": "252:11" -"minecraft:brown_concrete_powder": "252:12" -"minecraft:green_concrete_powder": "252:13" -"minecraft:red_concrete_powder": "252:14" -"minecraft:black_concrete_powder": "252:15" -"minecraft:structure_block[mode=save]": "255:0" -"minecraft:structure_block[mode=load]": "255:1" -"minecraft:structure_block[mode=corner]": "255:2" -"minecraft:structure_block[mode=data]": "255:3" \ No newline at end of file diff --git a/SpigotCore/SpigotCore_9/build.gradle.kts b/SpigotCore/SpigotCore_9/build.gradle.kts deleted file mode 100644 index 1abca6d1..00000000 --- a/SpigotCore/SpigotCore_9/build.gradle.kts +++ /dev/null @@ -1,30 +0,0 @@ -/* - * This file is a part of the SteamWar software. - * - * Copyright (C) 2025 SteamWar.de-Serverteam - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero 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 Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see . - */ - -plugins { - steamwar.java -} - -dependencies { - compileOnly(project(":SpigotCore:SpigotCore_Main", "default")) - compileOnly(project(":SpigotCore:SpigotCore_8", "default")) - - compileOnly(libs.nms9) - compileOnly(libs.worldedit12) -} diff --git a/SpigotCore/SpigotCore_9/src/de/steamwar/core/BountifulWrapper9.java b/SpigotCore/SpigotCore_9/src/de/steamwar/core/BountifulWrapper9.java deleted file mode 100644 index a77a0abe..00000000 --- a/SpigotCore/SpigotCore_9/src/de/steamwar/core/BountifulWrapper9.java +++ /dev/null @@ -1,110 +0,0 @@ -/* - * This file is a part of the SteamWar software. - * - * Copyright (C) 2025 SteamWar.de-Serverteam - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero 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 Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see . - */ - -package de.steamwar.core; - -import de.steamwar.Reflection; -import net.md_5.bungee.api.ChatMessageType; -import net.md_5.bungee.api.chat.BaseComponent; -import org.bukkit.Sound; -import org.bukkit.entity.Player; - -import java.util.UUID; - -public class BountifulWrapper9 implements BountifulWrapper.IBountifulWrapper { - - @Override - public void playPling(Player player) { - player.playSound(player.getLocation(), Sound.ENTITY_EXPERIENCE_ORB_PICKUP, 1, 1); - } - - @Override - public void sendMessage(Player player, ChatMessageType type, BaseComponent... msg) { - if(type == ChatMessageType.CHAT) - type = ChatMessageType.SYSTEM; - - player.spigot().sendMessage(type, msg); - } - - private static final Class dataWatcherObject = Reflection.getClass("net.minecraft.network.syncher.EntityDataAccessor"); - private static final Class dataWatcherRegistry = Reflection.getClass("net.minecraft.network.syncher.EntityDataSerializers"); - private static final Class dataWatcherSerializer = Reflection.getClass("net.minecraft.network.syncher.EntityDataSerializer"); - private static final Reflection.Constructor dataWatcherObjectConstructor = Reflection.getConstructor(dataWatcherObject, int.class, dataWatcherSerializer); - @Override - public Object getDataWatcherObject(int index, Class type) { - return dataWatcherObjectConstructor.invoke(index, Reflection.getField(dataWatcherRegistry, dataWatcherSerializer, 0, type).get(null)); - } - - private static final Class item = Reflection.getClass("net.minecraft.network.syncher.SynchedEntityData$DataItem"); - private static final Reflection.Constructor itemConstructor = Reflection.getConstructor(item, dataWatcherObject, Object.class); - @Override - public Object getDataWatcherItem(Object dwo, Object value) { - return itemConstructor.invoke(dwo, value); - } - - @Override - public BountifulWrapper.PositionSetter getPositionSetter(Class packetClass, int fieldOffset) { - Reflection.Field posX = Reflection.getField(packetClass, double.class, fieldOffset); - Reflection.Field posY = Reflection.getField(packetClass, double.class, fieldOffset+1); - Reflection.Field posZ = Reflection.getField(packetClass, double.class, fieldOffset+2); - boolean isByteClass = packetClass.getSimpleName().contains("PacketPlayOutEntityTeleport") || packetClass.getSimpleName().contains("PacketPlayOutNamedEntitySpawn"); - Class pitchYawType = isByteClass ? byte.class : int.class; - Reflection.Field lookYaw = Reflection.getField(packetClass, pitchYawType, isByteClass ? 0 : 1); - Reflection.Field lookPitch = Reflection.getField(packetClass, pitchYawType, isByteClass ? 1 : 2); - - return (packet, x, y, z, pitch, yaw) -> { - posX.set(packet, x); - posY.set(packet, y); - posZ.set(packet, z); - if (isByteClass) { - lookYaw.set(packet, (byte) (yaw*256/360)); - lookPitch.set(packet, (byte) (pitch*256/360)); - } else { - lookYaw.set(packet, (int) (yaw*256/360)); - lookPitch.set(packet, (int) (pitch*256/360)); - } - }; - } - - @Override - public BountifulWrapper.PositionSetter getRelMoveSetter(Class packetClass) { - Class type = Core.getVersion() > 12 ? short.class : int.class; - int fieldOffset = Core.getVersion() > 12 ? 0 : 1; - Reflection.Field moveX = Reflection.getField(packetClass, type, 0 + fieldOffset); - Reflection.Field moveY = Reflection.getField(packetClass, type, 1 + fieldOffset); - Reflection.Field moveZ = Reflection.getField(packetClass, type, 2 + fieldOffset); - Reflection.Field moveYaw = Reflection.getField(packetClass, byte.class, 0); - Reflection.Field movePitch = Reflection.getField(packetClass, byte.class, 1); - - return (packet, x, y, z, pitch, yaw) -> { - moveX.set(packet, (short)(x*4096)); - moveY.set(packet, (short)(y*4096)); - moveZ.set(packet, (short)(z*4096)); - moveYaw.set(packet, (byte)(yaw*256/360)); - movePitch.set(packet, (byte)(pitch*256/360)); - }; - } - - @Override - public BountifulWrapper.UUIDSetter getUUIDSetter(Class packetClass) { - Reflection.Field uuidField = Reflection.getField(packetClass, UUID.class, 0); - - return uuidField::set; - } -} diff --git a/SpigotCore/SpigotCore_9/src/de/steamwar/core/CraftbukkitWrapper9.java b/SpigotCore/SpigotCore_9/src/de/steamwar/core/CraftbukkitWrapper9.java deleted file mode 100644 index 847036cc..00000000 --- a/SpigotCore/SpigotCore_9/src/de/steamwar/core/CraftbukkitWrapper9.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * This file is a part of the SteamWar software. - * - * Copyright (C) 2025 SteamWar.de-Serverteam - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero 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 Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see . - */ - -package de.steamwar.core; - -import de.steamwar.Reflection; -import com.comphenix.tinyprotocol.TinyProtocol; -import org.bukkit.entity.Player; - -public class CraftbukkitWrapper9 implements CraftbukkitWrapper.ICraftbukkitWrapper { - - private static final Class chunk = Reflection.getClass("net.minecraft.world.level.chunk.LevelChunk"); - private static final Class packetPlayOutMapChunk = Reflection.getClass("net.minecraft.network.protocol.game.PacketPlayOutMapChunk"); - private static final Reflection.Constructor newPacketPlayOutMapChunk = Reflection.getConstructor(packetPlayOutMapChunk, chunk, int.class); - private static final Reflection.Method getHandle = Reflection.getMethod("org.bukkit.craftbukkit.CraftChunk", "getHandle"); - - @Override - public void sendChunk(Player p, int chunkX, int chunkZ) { - TinyProtocol.instance.sendPacket(p, newPacketPlayOutMapChunk.invoke(getHandle.invoke(p.getWorld().getChunkAt(chunkX, chunkZ)), 65535)); - } -} diff --git a/SpigotCore/SpigotCore_9/src/de/steamwar/core/TrickyParticleWrapper9.java b/SpigotCore/SpigotCore_9/src/de/steamwar/core/TrickyParticleWrapper9.java deleted file mode 100644 index 2304ee3c..00000000 --- a/SpigotCore/SpigotCore_9/src/de/steamwar/core/TrickyParticleWrapper9.java +++ /dev/null @@ -1,29 +0,0 @@ -/* - * This file is a part of the SteamWar software. - * - * Copyright (C) 2025 SteamWar.de-Serverteam - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero 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 Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see . - */ - -package de.steamwar.core; - -import org.bukkit.Particle; - -public class TrickyParticleWrapper9 implements TrickyParticleWrapper { - @Override - public Particle getVillagerHappy() { - return Particle.VILLAGER_HAPPY; - } -} diff --git a/SpigotCore/SpigotCore_9/src/de/steamwar/techhider/ChunkHider9.java b/SpigotCore/SpigotCore_9/src/de/steamwar/techhider/ChunkHider9.java deleted file mode 100644 index 71b47743..00000000 --- a/SpigotCore/SpigotCore_9/src/de/steamwar/techhider/ChunkHider9.java +++ /dev/null @@ -1,158 +0,0 @@ -/* - * This file is a part of the SteamWar software. - * - * Copyright (C) 2025 SteamWar.de-Serverteam - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero 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 Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see . - */ - -package de.steamwar.techhider; - -import de.steamwar.Reflection; -import io.netty.buffer.ByteBuf; -import io.netty.buffer.Unpooled; -import org.bukkit.entity.Player; - -import java.util.List; -import java.util.Set; -import java.util.function.BiFunction; -import java.util.function.UnaryOperator; -import java.util.stream.Collectors; - -public class ChunkHider9 extends ChunkHider8 { - - private static final UnaryOperator mapChunkCloner = ProtocolUtils.shallowCloneGenerator(mapChunkPacket); - - private static final Reflection.Field mapChunkX = Reflection.getField(mapChunkPacket, int.class, 0); - private static final Reflection.Field mapChunkZ = Reflection.getField(mapChunkPacket, int.class, 1); - private static final Reflection.Field mapChunkBitMask = Reflection.getField(mapChunkPacket, int.class, 2); - private static final Reflection.Field mapChunkBlockEntities = Reflection.getField(mapChunkPacket, List.class, 0); - private static final Reflection.Field mapChunkData = Reflection.getField(mapChunkPacket, byte[].class, 0); - - private static final Class nbtTagCompound = Reflection.getClass("net.minecraft.nbt.CompoundTag"); - private static final Reflection.Method nbtTagGetString = Reflection.getTypedMethod(nbtTagCompound, null, String.class, String.class); - - @Override - public BiFunction chunkHiderGenerator(TechHider techHider) { - return (p, packet) -> { - int chunkX = mapChunkX.get(packet); - int chunkZ = mapChunkZ.get(packet); - if (techHider.getLocationEvaluator().skipChunk(p, chunkX, chunkZ)) - return packet; - - packet = mapChunkCloner.apply(packet); - Set hiddenBlockEntities = techHider.getHiddenBlockEntities(); - mapChunkBlockEntities.set(packet, ((List)mapChunkBlockEntities.get(packet)).stream().filter( - nbttag -> !hiddenBlockEntities.contains((String) nbtTagGetString.invoke(nbttag, "id")) - ).collect(Collectors.toList())); - - int primaryBitMask = mapChunkBitMask.get(packet); - ByteBuf in = Unpooled.wrappedBuffer(mapChunkData.get(packet)); - ByteBuf out = Unpooled.buffer(in.readableBytes() + 64); - for(int chunkY = 0; chunkY < p.getWorld().getMaxHeight()/16; chunkY++) { - if(((1 << chunkY) & primaryBitMask) == 0) - continue; - - SectionHider section = new SectionHider(p, techHider, in, out, chunkX, chunkY, chunkZ); - dataHider(section); - } - byte[] data = new byte[out.readableBytes()]; - out.readBytes(data); - mapChunkData.set(packet, data); - - return packet; - }; - } - - protected void dataHider(SectionHider section) { - section.copyBitsPerBlock(); - section.processPalette(); - - if(section.isSkipSection() || (!section.blockPrecise() && section.isPaletted())) { //section.getBitsPerBlock() < 9 - section.skipDataArray(); - } else { - processDataArray(section); - } - - section.getOut().writeBytes(section.getIn(), 4096); //Skylight (Not in Nether/End!!!) 2048 + Blocklight 2048 - } - - protected void processDataArray(SectionHider section) { - VariableValueArray values = new VariableValueArray(section.getBitsPerBlock(), section.readDataArray()); - - for (int y = 0; y < 16; y++) { - for (int z = 0; z < 16; z++) { - for (int x = 0; x < 16; x++) { - int pos = (((y * 16) + z) * 16) + x; - - switch (section.test(x, y, z)) { - case SKIP: - break; - case CHECK: - if(!section.getObfuscate().contains(values.get(pos))) - break; - case HIDE: - values.set(pos, section.getTarget()); - break; - case HIDE_AIR: - default: - values.set(pos, section.getAir()); - } - } - } - } - - section.writeDataArray(values.backing); - } - - private static class VariableValueArray { - private final long[] backing; - private final int bitsPerValue; - private final long valueMask; - - public VariableValueArray(int bitsPerEntry, long[] dataArray) { - this.bitsPerValue = bitsPerEntry; - this.valueMask = (1L << this.bitsPerValue) - 1; - this.backing = dataArray; - } - - public int get(int index) { - index *= bitsPerValue; - int i0 = index >> 6; - int i1 = index & 0x3f; - - long value = backing[i0] >>> i1; - - // The value is divided over two long values - if (i1 + bitsPerValue > 64) - value |= backing[++i0] << 64 - i1; - - return (int) (value & valueMask); - } - - public void set(int index, int value) { - index *= bitsPerValue; - int i0 = index >> 6; - int i1 = index & 0x3f; - - backing[i0] = backing[i0] & ~(valueMask << i1) | (value & valueMask) << i1; - int i2 = i1 + bitsPerValue; - // The value is divided over two long values - if (i2 > 64) { - i0++; - backing[i0] = backing[i0] & -(1L << i2 - 64) | value >> 64 - i1; - } - } - } -} diff --git a/SpigotCore/SpigotCore_Main/build.gradle.kts b/SpigotCore/SpigotCore_Main/build.gradle.kts index 85ff16cc..bbb389c2 100644 --- a/SpigotCore/SpigotCore_Main/build.gradle.kts +++ b/SpigotCore/SpigotCore_Main/build.gradle.kts @@ -25,6 +25,21 @@ tasks.compileJava { options.isWarnings = false } +java { + sourceCompatibility = JavaVersion.VERSION_21 + targetCompatibility = JavaVersion.VERSION_21 +} + +tasks.withType().configureEach { + options.compilerArgs.addAll(listOf( + "--add-exports", "java.base/jdk.internal.misc=ALL-UNNAMED" + )) +} + +tasks.withType().configureEach { + jvmArgs("--add-exports", "java.base/jdk.internal.misc=ALL-UNNAMED") +} + dependencies { compileOnly(libs.classindex) annotationProcessor(libs.classindex) @@ -32,11 +47,15 @@ dependencies { compileOnly(project(":CommandFramework", "default")) compileOnly(project(":SpigotCore:CRIUDummy", "default")) - compileOnly(libs.worldedit12) + compileOnly(libs.fawe21) - compileOnly(libs.spigotapi) + compileOnly(libs.paperapi21) + compileOnly(libs.nms21) + compileOnly(libs.authlib2) + compileOnly(libs.datafixer) compileOnly(libs.netty) compileOnly(libs.authlib) + compileOnly(libs.brigadier) compileOnly(libs.fastutil) implementation(libs.anvilgui) diff --git a/SpigotCore/SpigotCore_Main/src/de/steamwar/core/BountifulWrapper.java b/SpigotCore/SpigotCore_Main/src/de/steamwar/core/BountifulWrapper.java index 4cf64ac7..0ff13595 100644 --- a/SpigotCore/SpigotCore_Main/src/de/steamwar/core/BountifulWrapper.java +++ b/SpigotCore/SpigotCore_Main/src/de/steamwar/core/BountifulWrapper.java @@ -19,28 +19,100 @@ package de.steamwar.core; +import de.steamwar.Reflection; import net.md_5.bungee.api.ChatMessageType; import net.md_5.bungee.api.chat.BaseComponent; +import net.minecraft.world.entity.PositionMoveRotation; +import net.minecraft.world.phys.Vec3; +import org.bukkit.Sound; import org.bukkit.entity.Player; import java.util.UUID; public class BountifulWrapper { - private BountifulWrapper() {} + public static final BountifulWrapper impl = new BountifulWrapper(); - public static final IBountifulWrapper impl = VersionDependent.getVersionImpl(Core.getInstance()); + public void playPling(Player player) { + player.playSound(player.getLocation(), Sound.ENTITY_EXPERIENCE_ORB_PICKUP, 1, 1); + } - public interface IBountifulWrapper { - void playPling(Player player); + public void sendMessage(Player player, ChatMessageType type, BaseComponent... msg) { + if(type == ChatMessageType.CHAT) + type = ChatMessageType.SYSTEM; - void sendMessage(Player player, ChatMessageType type, BaseComponent... msg); + player.spigot().sendMessage(type, msg); + } - Object getDataWatcherObject(int index, Class type); - Object getDataWatcherItem(Object dataWatcherObject, Object value); + private static final Class dataWatcherObject = Reflection.getClass("net.minecraft.network.syncher.EntityDataAccessor"); + private static final Class dataWatcherRegistry = Reflection.getClass("net.minecraft.network.syncher.EntityDataSerializers"); + private static final Class dataWatcherSerializer = Reflection.getClass("net.minecraft.network.syncher.EntityDataSerializer"); + private static final Reflection.Constructor dataWatcherObjectConstructor = Reflection.getConstructor(dataWatcherObject, int.class, dataWatcherSerializer); + public Object getDataWatcherObject(int index, Class type) { + return dataWatcherObjectConstructor.invoke(index, Reflection.getField(dataWatcherRegistry, dataWatcherSerializer, 0, type).get(null)); + } - PositionSetter getPositionSetter(Class packetClass, int fieldOffset); - PositionSetter getRelMoveSetter(Class packetClass); - UUIDSetter getUUIDSetter(Class packetClass); + private static final Class item = Reflection.getClass("net.minecraft.network.syncher.SynchedEntityData$DataItem"); + private static final Reflection.Constructor itemConstructor = Reflection.getConstructor(item, dataWatcherObject, Object.class); + public Object getDataWatcherItem(Object dwo, Object value) { + return itemConstructor.invoke(dwo, value); + } + + public BountifulWrapper.PositionSetter getPositionSetter(Class packetClass, int fieldOffset) { + try { + Reflection.Field field = Reflection.getField(packetClass, PositionMoveRotation.class, 0); + + return (packet, x, y, z, pitch, yaw) -> { + PositionMoveRotation pos = field.get(packet); + + field.set(packet, new PositionMoveRotation(new Vec3(x, y, z), pos.deltaMovement(), yaw, pitch)); + }; + } catch (IllegalArgumentException e) { + Reflection.Field posX = Reflection.getField(packetClass, double.class, fieldOffset); + Reflection.Field posY = Reflection.getField(packetClass, double.class, fieldOffset+1); + Reflection.Field posZ = Reflection.getField(packetClass, double.class, fieldOffset+2); + boolean isByteClass = packetClass.getSimpleName().contains("PacketPlayOutEntityTeleport") || packetClass.getSimpleName().contains("PacketPlayOutNamedEntitySpawn"); + Class pitchYawType = isByteClass ? byte.class : int.class; + Reflection.Field lookYaw = Reflection.getField(packetClass, pitchYawType, isByteClass ? 0 : 1); + Reflection.Field lookPitch = Reflection.getField(packetClass, pitchYawType, isByteClass ? 1 : 2); + + return (packet, x, y, z, pitch, yaw) -> { + posX.set(packet, x); + posY.set(packet, y); + posZ.set(packet, z); + if (isByteClass) { + lookYaw.set(packet, (byte) (yaw*256/360)); + lookPitch.set(packet, (byte) (pitch*256/360)); + } else { + lookYaw.set(packet, (int) (yaw*256/360)); + lookPitch.set(packet, (int) (pitch*256/360)); + } + }; + } + } + + + public BountifulWrapper.PositionSetter getRelMoveSetter(Class packetClass) { + Class type = Core.getVersion() > 12 ? short.class : int.class; + int fieldOffset = Core.getVersion() > 12 ? 0 : 1; + Reflection.Field moveX = Reflection.getField(packetClass, type, 0 + fieldOffset); + Reflection.Field moveY = Reflection.getField(packetClass, type, 1 + fieldOffset); + Reflection.Field moveZ = Reflection.getField(packetClass, type, 2 + fieldOffset); + Reflection.Field moveYaw = Reflection.getField(packetClass, byte.class, 0); + Reflection.Field movePitch = Reflection.getField(packetClass, byte.class, 1); + + return (packet, x, y, z, pitch, yaw) -> { + moveX.set(packet, (short)(x*4096)); + moveY.set(packet, (short)(y*4096)); + moveZ.set(packet, (short)(z*4096)); + moveYaw.set(packet, (byte)(yaw*256/360)); + movePitch.set(packet, (byte)(pitch*256/360)); + }; + } + + public BountifulWrapper.UUIDSetter getUUIDSetter(Class packetClass) { + Reflection.Field uuidField = Reflection.getField(packetClass, UUID.class, 0); + + return uuidField::set; } public interface PositionSetter { diff --git a/SpigotCore/SpigotCore_Main/src/de/steamwar/core/ChatWrapper.java b/SpigotCore/SpigotCore_Main/src/de/steamwar/core/ChatWrapper.java index 668a47a7..57e90970 100644 --- a/SpigotCore/SpigotCore_Main/src/de/steamwar/core/ChatWrapper.java +++ b/SpigotCore/SpigotCore_Main/src/de/steamwar/core/ChatWrapper.java @@ -19,11 +19,26 @@ package de.steamwar.core; -public interface ChatWrapper { - ChatWrapper impl = VersionDependent.getVersionImpl(Core.getInstance()); +import net.minecraft.network.chat.MutableComponent; +import net.minecraft.network.chat.contents.PlainTextContents; +import net.minecraft.network.protocol.game.ClientboundSetEntityDataPacket; +import net.minecraft.network.syncher.SynchedEntityData; +import java.util.ArrayList; - Object stringToChatComponent(String text); +public class ChatWrapper { + public static final ChatWrapper impl = new ChatWrapper(); - Object getDataWatcherPacket(int entityId, Object... dataWatcherKeyValues); + public Object stringToChatComponent(String text) { + return MutableComponent.create(PlainTextContents.create(text)); + } + + public Object getDataWatcherPacket(int entityId, Object... dataWatcherKeyValues) { + ArrayList> nativeWatchers = new ArrayList<>(1); + for(int i = 0; i < dataWatcherKeyValues.length; i+=2) { + nativeWatchers.add(((SynchedEntityData.DataItem) BountifulWrapper.impl.getDataWatcherItem(dataWatcherKeyValues[i], dataWatcherKeyValues[i+1])).value()); + } + + return new ClientboundSetEntityDataPacket(entityId, nativeWatchers); + } } diff --git a/SpigotCore/SpigotCore_Main/src/de/steamwar/core/CommandRemover.java b/SpigotCore/SpigotCore_Main/src/de/steamwar/core/CommandRemover.java index 8b6aa992..b2da8b75 100644 --- a/SpigotCore/SpigotCore_Main/src/de/steamwar/core/CommandRemover.java +++ b/SpigotCore/SpigotCore_Main/src/de/steamwar/core/CommandRemover.java @@ -19,22 +19,20 @@ package de.steamwar.core; -import de.steamwar.Reflection; import lombok.experimental.UtilityClass; import org.bukkit.Bukkit; import org.bukkit.command.Command; -import org.bukkit.command.SimpleCommandMap; +import org.bukkit.craftbukkit.CraftServer; import java.util.Map; @UtilityClass public class CommandRemover { - private static final Reflection.Field commandMap = Reflection.getField("org.bukkit.craftbukkit.CraftServer", "commandMap", SimpleCommandMap.class); - private static final Reflection.Field knownCommands = Reflection.getField(SimpleCommandMap.class, "knownCommands", Map.class); + private static final Map knownCommands = ((CraftServer) Bukkit.getServer()).getCommandMap().getKnownCommands(); + public static void removeAll(String... cmds) { - Map knownCmds = knownCommands.get(commandMap.get(Bukkit.getServer())); for (String cmd : cmds) { - knownCmds.remove(cmd.toLowerCase()); + knownCommands.remove(cmd.toLowerCase()); } } } diff --git a/SpigotCore/SpigotCore_Main/src/de/steamwar/core/Core.java b/SpigotCore/SpigotCore_Main/src/de/steamwar/core/Core.java index e632ca45..e25f9728 100644 --- a/SpigotCore/SpigotCore_Main/src/de/steamwar/core/Core.java +++ b/SpigotCore/SpigotCore_Main/src/de/steamwar/core/Core.java @@ -21,16 +21,11 @@ package de.steamwar.core; import com.comphenix.tinyprotocol.TinyProtocol; import de.steamwar.Reflection; -import de.steamwar.command.*; -import de.steamwar.core.authlib.SteamwarGameProfileRepository; -import de.steamwar.core.events.AntiNocom; -import de.steamwar.core.events.ChattingEvent; -import de.steamwar.core.events.PlayerJoinedEvent; -import de.steamwar.core.events.WorldLoadEvent; import de.steamwar.command.SWCommandUtils; import de.steamwar.command.SWTypeMapperCreator; import de.steamwar.command.TabCompletionCache; import de.steamwar.command.TypeMapper; +import de.steamwar.core.authlib.SteamwarGameProfileRepository; import de.steamwar.linkage.AbstractLinker; import de.steamwar.linkage.SpigotLinker; import de.steamwar.message.Message; @@ -54,6 +49,7 @@ public class Core extends JavaPlugin { public static final Message MESSAGE = new Message("SpigotCore", Core.class.getClassLoader()); + @Deprecated public static int getVersion(){ return Reflection.MAJOR_VERSION; } @@ -108,9 +104,8 @@ public class Core extends JavaPlugin { return; } - Bukkit.getServer().getPluginManager().registerEvents(RecipeDiscoverWrapper.impl, this); if(!Statement.productionDatabase()) { - getServer().getPluginManager().registerEvents(LocaleChangeWrapper.impl, this); + getServer().getPluginManager().registerEvents(new LocaleChangeWrapper(), this); } getServer().getMessenger().registerIncomingPluginChannel(this, "sw:bridge", new NetworkReceiver()); diff --git a/SpigotCore/SpigotCore_Main/src/de/steamwar/core/CraftbukkitWrapper.java b/SpigotCore/SpigotCore_Main/src/de/steamwar/core/CraftbukkitWrapper.java index dfeed83c..17efee53 100644 --- a/SpigotCore/SpigotCore_Main/src/de/steamwar/core/CraftbukkitWrapper.java +++ b/SpigotCore/SpigotCore_Main/src/de/steamwar/core/CraftbukkitWrapper.java @@ -19,14 +19,18 @@ package de.steamwar.core; +import com.comphenix.tinyprotocol.TinyProtocol; +import net.minecraft.network.protocol.game.ClientboundLevelChunkWithLightPacket; +import net.minecraft.world.level.chunk.LevelChunk; +import net.minecraft.world.level.chunk.status.ChunkStatus; +import org.bukkit.craftbukkit.CraftChunk; import org.bukkit.entity.Player; public class CraftbukkitWrapper { - private CraftbukkitWrapper() {} + public static final CraftbukkitWrapper impl = new CraftbukkitWrapper(); - public static final ICraftbukkitWrapper impl = VersionDependent.getVersionImpl(Core.getInstance()); - - public interface ICraftbukkitWrapper { - void sendChunk(Player p, int chunkX, int chunkZ); + public void sendChunk(Player p, int chunkX, int chunkZ) { + LevelChunk chunk = (LevelChunk) ((CraftChunk) p.getWorld().getChunkAt(chunkX, chunkZ)).getHandle(ChunkStatus.FULL); + TinyProtocol.instance.sendPacket(p, new ClientboundLevelChunkWithLightPacket(chunk, chunk.level.getLightEngine(), null, null, true)); } } diff --git a/SpigotCore/SpigotCore_Main/src/de/steamwar/core/ErrorHandler.java b/SpigotCore/SpigotCore_Main/src/de/steamwar/core/ErrorHandler.java index 640d7ac0..969a65d8 100644 --- a/SpigotCore/SpigotCore_Main/src/de/steamwar/core/ErrorHandler.java +++ b/SpigotCore/SpigotCore_Main/src/de/steamwar/core/ErrorHandler.java @@ -21,6 +21,7 @@ package de.steamwar.core; import de.steamwar.Reflection; import de.steamwar.sql.SWException; +import org.spigotmc.WatchdogThread; import java.io.ByteArrayOutputStream; import java.io.PrintStream; @@ -39,10 +40,8 @@ public class ErrorHandler extends Handler { public ErrorHandler(){ Logger.getLogger("").addHandler(this); - Class watchdogThread = Reflection.getClass("org.spigotmc.WatchdogThread"); - Reflection.Field getInstance = Reflection.getField(watchdogThread, watchdogThread, 0); - Thread watchdog = (Thread) getInstance.get(null); - watchdogThreadId = watchdog.getId(); + Reflection.Field getInstance = Reflection.getField(WatchdogThread.class, WatchdogThread.class, 0); + watchdogThreadId = getInstance.get(null).getId(); } void unregister() { diff --git a/SpigotCore/SpigotCore_Main/src/de/steamwar/core/FlatteningWrapper.java b/SpigotCore/SpigotCore_Main/src/de/steamwar/core/FlatteningWrapper.java index f98646f5..0befeb68 100644 --- a/SpigotCore/SpigotCore_Main/src/de/steamwar/core/FlatteningWrapper.java +++ b/SpigotCore/SpigotCore_Main/src/de/steamwar/core/FlatteningWrapper.java @@ -19,38 +19,343 @@ package de.steamwar.core; +import com.destroystokyo.paper.profile.PlayerProfile; import de.steamwar.Reflection; -import org.bukkit.Material; -import org.bukkit.World; +import net.minecraft.network.protocol.game.ClientboundSetObjectivePacket; +import net.minecraft.network.protocol.game.ClientboundSetScorePacket; +import org.bukkit.*; import org.bukkit.entity.EntityType; import org.bukkit.entity.Player; import org.bukkit.inventory.ItemStack; +import org.bukkit.inventory.meta.SkullMeta; + +import java.util.HashMap; +import java.util.Map; +import java.util.Optional; public class FlatteningWrapper { private FlatteningWrapper() {} - public static final Class scoreboardObjective = Reflection.getClass("net.minecraft.network.protocol.game.ClientboundSetObjectivePacket"); - public static final Class scoreboardScore = Reflection.getClass("net.minecraft.network.protocol.game.ClientboundSetScorePacket"); + public static final FlatteningWrapper impl = new FlatteningWrapper(); - public static final IFlatteningWrapper impl = VersionDependent.getVersionImpl(Core.getInstance()); + private static final Map renamedLegacy = new HashMap<>(); - public interface IFlatteningWrapper { - void setScoreboardTitle(Object packet, String title); - void setScoreAction(Object packet); + static{ + renamedLegacy.put("WOOD", Material.OAK_WOOD); + renamedLegacy.put("SAPLING", Material.OAK_SAPLING); + renamedLegacy.put("STATIONARY_WATER", Material.WATER); + renamedLegacy.put("STATIONARY_LAVA", Material.LAVA); + renamedLegacy.put("LOG", Material.OAK_LOG); + renamedLegacy.put("LEAVES", Material.OAK_LEAVES); + renamedLegacy.put("BED_BLOCK", Material.RED_BED); + renamedLegacy.put("BED", Material.RED_BED); + renamedLegacy.put("PISTON_STICKY_BASE", Material.STICKY_PISTON); + renamedLegacy.put("WEB", Material.COBWEB); + renamedLegacy.put("LONG_GRASS", Material.TALL_GRASS); + renamedLegacy.put("PISTON_BASE", Material.PISTON); + renamedLegacy.put("PISTON_EXTENSION", Material.PISTON_HEAD); + renamedLegacy.put("WOOL", Material.WHITE_WOOL); + renamedLegacy.put("PISTON_MOVING_PIECE", Material.MOVING_PISTON); + renamedLegacy.put("YELLOW_FLOWER", Material.DANDELION); + renamedLegacy.put("RED_ROSE", Material.POPPY); + renamedLegacy.put("DOUBLE_STEP", Material.SMOOTH_STONE); + renamedLegacy.put("STEP", Material.SMOOTH_STONE_SLAB); + renamedLegacy.put("MOB_SPAWNER", Material.SPAWNER); + renamedLegacy.put("WOOD_STAIRS", Material.OAK_STAIRS); + renamedLegacy.put("WORKBENCH", Material.CRAFTING_TABLE); + renamedLegacy.put("CROPS", Material.WHEAT_SEEDS); + renamedLegacy.put("SEEDS", Material.WHEAT_SEEDS); + renamedLegacy.put("SOIL", Material.FARMLAND); + renamedLegacy.put("BURNING_FURNACE", Material.FURNACE); + renamedLegacy.put("SIGN_POST", Material.OAK_SIGN); + renamedLegacy.put("SIGN", Material.OAK_SIGN); + renamedLegacy.put("WOODEN_DOOR", Material.OAK_DOOR); + renamedLegacy.put("WOOD_DOOR", Material.OAK_DOOR); + renamedLegacy.put("RAILS", Material.RAIL); + renamedLegacy.put("WALL_SIGN", Material.OAK_WALL_SIGN); + renamedLegacy.put("STONE_PLATE", Material.STONE_PRESSURE_PLATE); + renamedLegacy.put("WOOD_PLATE", Material.OAK_PRESSURE_PLATE); + renamedLegacy.put("GLOWING_REDSTONE_ORE", Material.REDSTONE_ORE); + renamedLegacy.put("REDSTONE_TORCH_OFF", Material.REDSTONE_TORCH); + renamedLegacy.put("REDSTONE_TORCH_ON", Material.REDSTONE_TORCH); + renamedLegacy.put("IRON_DOOR_BLOCK", Material.IRON_DOOR); + renamedLegacy.put("SUGAR_CANE_BLOCK", Material.SUGAR_CANE); + renamedLegacy.put("CAKE_BLOCK", Material.CAKE); + renamedLegacy.put("MELON_BLOCK", Material.MELON); + renamedLegacy.put("BEETROOT_BLOCK", Material.BEETROOT); + renamedLegacy.put("FENCE", Material.OAK_FENCE); + renamedLegacy.put("PORTAL", Material.NETHER_PORTAL); + renamedLegacy.put("DIODE_BLOCK_OFF", Material.REPEATER); + renamedLegacy.put("DIODE_BLOCK_ON", Material.REPEATER); + renamedLegacy.put("DIODE", Material.REPEATER); + renamedLegacy.put("STAINED_GLASS", Material.WHITE_STAINED_GLASS); + renamedLegacy.put("TRAP_DOOR", Material.OAK_TRAPDOOR); + renamedLegacy.put("MONSTER_EGGS", Material.SKELETON_SPAWN_EGG); + renamedLegacy.put("MONSTER_EGG", Material.SKELETON_SPAWN_EGG); + renamedLegacy.put("SMOOTH_BRICK", Material.STONE_BRICKS); + renamedLegacy.put("HUGE_MUSHROOM_1", Material.MUSHROOM_STEM); + renamedLegacy.put("HUGE_MUSHROOM_2", Material.RED_MUSHROOM); + renamedLegacy.put("IRON_FENCE", Material.IRON_BARS); + renamedLegacy.put("THIN_GLASS", Material.GLASS_PANE); + renamedLegacy.put("FENCE_GATE", Material.OAK_FENCE_GATE); + renamedLegacy.put("SMOOTH_STAIRS", Material.STONE_BRICK_STAIRS); + renamedLegacy.put("MYCEL", Material.MYCELIUM); + renamedLegacy.put("WATER_LILY", Material.LILY_PAD); + renamedLegacy.put("NETHER_FENCE", Material.NETHER_BRICK_FENCE); + renamedLegacy.put("NETHER_WARTS", Material.NETHER_WART); + renamedLegacy.put("NETHER_STALK", Material.NETHER_WART); + renamedLegacy.put("ENCHANTMENT_TABLE", Material.ENCHANTING_TABLE); + renamedLegacy.put("ENDER_PORTAL", Material.END_PORTAL); + renamedLegacy.put("ENDER_PORTAL_FRAME", Material.END_PORTAL_FRAME); + renamedLegacy.put("ENDER_STONE", Material.END_STONE); + renamedLegacy.put("REDSTONE_LAMP_OFF", Material.REDSTONE_LAMP); + renamedLegacy.put("REDSTONE_LAMP_ON", Material.REDSTONE_LAMP); + renamedLegacy.put("WOOD_DOUBLE_STEP", Material.OAK_SLAB); + renamedLegacy.put("WOOD_STEP", Material.OAK_SLAB); + renamedLegacy.put("SPRUCE_WOOD_STAIRS", Material.SPRUCE_STAIRS); + renamedLegacy.put("BIRCH_WOOD_STAIRS", Material.BIRCH_STAIRS); + renamedLegacy.put("JUNGLE_WOOD_STAIRS", Material.JUNGLE_STAIRS); + renamedLegacy.put("COMMAND", Material.COMMAND_BLOCK); + renamedLegacy.put("COBBLE_WALL", Material.COBBLESTONE_WALL); + renamedLegacy.put("WOOD_BUTTON", Material.OAK_BUTTON); + renamedLegacy.put("SKULL", Material.SKELETON_SKULL); + renamedLegacy.put("SKULL_ITEM", Material.SKELETON_SKULL); + renamedLegacy.put("GOLD_PLATE", Material.LIGHT_WEIGHTED_PRESSURE_PLATE); + renamedLegacy.put("IRON_PLATE", Material.HEAVY_WEIGHTED_PRESSURE_PLATE); + renamedLegacy.put("REDSTONE_COMPARATOR_OFF", Material.COMPARATOR); + renamedLegacy.put("REDSTONE_COMPARATOR_ON", Material.COMPARATOR); + renamedLegacy.put("REDSTONE_COMPARATOR", Material.COMPARATOR); + renamedLegacy.put("QUARTZ_ORE", Material.QUARTZ); + renamedLegacy.put("STAINED_CLAY", Material.WHITE_TERRACOTTA); + renamedLegacy.put("STAINED_GLASS_PANE", Material.WHITE_STAINED_GLASS_PANE); + renamedLegacy.put("LEAVES_2", Material.ACACIA_LEAVES); + renamedLegacy.put("LOG_2", Material.ACACIA_LOG); + renamedLegacy.put("CARPET", Material.WHITE_CARPET); + renamedLegacy.put("HARD_CLAY", Material.TERRACOTTA); + renamedLegacy.put("DOUBLE_PLANT", Material.SUNFLOWER); + renamedLegacy.put("STANDING_BANNER", Material.WHITE_BANNER); + renamedLegacy.put("BANNER", Material.WHITE_BANNER); + renamedLegacy.put("WALL_BANNER", Material.WHITE_WALL_BANNER); + renamedLegacy.put("DAYLIGHT_DETECTOR_INVERTED", Material.DAYLIGHT_DETECTOR); + renamedLegacy.put("DOUBLE_STONE_SLAB2", Material.RED_SANDSTONE_SLAB); + renamedLegacy.put("STONE_SLAB2", Material.RED_SANDSTONE_SLAB); + renamedLegacy.put("PURPUR_DOUBLE_SLAB", Material.PURPUR_SLAB); + renamedLegacy.put("END_BRICKS", Material.END_STONE_BRICKS); + renamedLegacy.put("COMMAND_REPEATING", Material.REPEATING_COMMAND_BLOCK); + renamedLegacy.put("COMMAND_CHAIN", Material.CHAIN_COMMAND_BLOCK); + renamedLegacy.put("MAGMA", Material.MAGMA_BLOCK); + renamedLegacy.put("RED_NETHER_BRICK", Material.RED_NETHER_BRICKS); + renamedLegacy.put("SILVER_SHULKER_BOX", Material.LIGHT_GRAY_SHULKER_BOX); + renamedLegacy.put("SILVER_GLAZED_TERRACOTTA", Material.LIGHT_GRAY_TERRACOTTA); + renamedLegacy.put("CONCRETE", Material.WHITE_CONCRETE); + renamedLegacy.put("CONCRETE_POWDER", Material.WHITE_CONCRETE_POWDER); + renamedLegacy.put("IRON_SPADE", Material.IRON_SHOVEL); + renamedLegacy.put("WOOD_SWORD", Material.WOODEN_SWORD); + renamedLegacy.put("WOOD_SPADE", Material.WOODEN_SHOVEL); + renamedLegacy.put("WOOD_PICKAXE", Material.WOODEN_PICKAXE); + renamedLegacy.put("WOOD_AXE", Material.WOODEN_AXE); + renamedLegacy.put("STONE_SPADE", Material.STONE_SHOVEL); + renamedLegacy.put("DIAMOND_SPADE", Material.DIAMOND_SHOVEL); + renamedLegacy.put("MUSHROOM_SOUP", Material.MUSHROOM_STEW); + renamedLegacy.put("GOLD_SWORD", Material.GOLDEN_SWORD); + renamedLegacy.put("GOLD_SPADE", Material.GOLDEN_SHOVEL); + renamedLegacy.put("GOLD_PICKAXE", Material.GOLDEN_PICKAXE); + renamedLegacy.put("GOLD_AXE", Material.GOLDEN_AXE); + renamedLegacy.put("SULPHUR", Material.GUNPOWDER); + renamedLegacy.put("WOOD_HOE", Material.WOODEN_HOE); + renamedLegacy.put("GOLD_HOE", Material.GOLDEN_HOE); + renamedLegacy.put("GOLD_HELMET", Material.GOLDEN_HELMET); + renamedLegacy.put("GOLD_CHESTPLATE", Material.GOLDEN_CHESTPLATE); + renamedLegacy.put("GOLD_LEGGINGS", Material.GOLDEN_LEGGINGS); + renamedLegacy.put("GOLD_BOOTS", Material.GOLDEN_BOOTS); + renamedLegacy.put("PORK", Material.PORKCHOP); + renamedLegacy.put("GRILLED_PORK", Material.COOKED_PORKCHOP); + renamedLegacy.put("SNOW_BALL", Material.SNOWBALL); + renamedLegacy.put("BOAT", Material.OAK_BOAT); + renamedLegacy.put("CLAY_BRICK", Material.BRICKS); + renamedLegacy.put("STORAGE_MINECART", Material.CHEST_MINECART); + renamedLegacy.put("POWERED_MINECART", Material.FURNACE_MINECART); + renamedLegacy.put("WATCH", Material.CLOCK); + renamedLegacy.put("RAW_FISH", Material.SALMON); + renamedLegacy.put("COOKED_FISH", Material.COOKED_SALMON); + renamedLegacy.put("INK_SACK", Material.INK_SAC); + renamedLegacy.put("RAW_BEEF", Material.BEEF); + renamedLegacy.put("RAW_CHICKEN", Material.CHICKEN); + renamedLegacy.put("EYE_OF_ENDER", Material.ENDER_EYE); + renamedLegacy.put("SPECKLED_MELON", Material.GLISTERING_MELON_SLICE); + renamedLegacy.put("EXP_BOTTLE", Material.EXPERIENCE_BOTTLE); + renamedLegacy.put("FIREBALL", Material.FIRE_CHARGE); + renamedLegacy.put("BOOK_AND_QUILL", Material.WRITABLE_BOOK); + renamedLegacy.put("FLOWER_POT_ITEM", Material.FLOWER_POT); + renamedLegacy.put("EMPTY_MAP", Material.MAP); + renamedLegacy.put("BREWING_STAND_ITEM", Material.BREWING_STAND); + renamedLegacy.put("CAULDRON_ITEM", Material.CAULDRON); + renamedLegacy.put("CARROT_ITEM", Material.CARROT); + renamedLegacy.put("POTATO_ITEM", Material.POTATO); + renamedLegacy.put("SPRUCE_DOOR_ITEM", Material.SPRUCE_DOOR); + renamedLegacy.put("BIRCH_DOOR_ITEM", Material.BIRCH_DOOR); + renamedLegacy.put("JUNGLE_DOOR_ITEM", Material.JUNGLE_DOOR); + renamedLegacy.put("ACACIA_DOOR_ITEM", Material.ACACIA_DOOR); + renamedLegacy.put("DARK_OAK_DOOR_ITEM", Material.DARK_OAK_DOOR); + renamedLegacy.put("CARROT_STICK", Material.CARROT_ON_A_STICK); + renamedLegacy.put("FIREWORK", Material.FIREWORK_ROCKET); + renamedLegacy.put("FIREWORK_CHARGE", Material.FIREWORK_STAR); + renamedLegacy.put("NETHER_BRICK_ITEM", Material.NETHER_BRICKS); + renamedLegacy.put("EXPLOSIVE_MINECART", Material.TNT_MINECART); + renamedLegacy.put("IRON_BARDING", Material.IRON_HORSE_ARMOR); + renamedLegacy.put("GOLD_BARDING", Material.GOLDEN_HORSE_ARMOR); + renamedLegacy.put("DIAMOND_BARDING", Material.DIAMOND_HORSE_ARMOR); + renamedLegacy.put("LEASH", Material.LEAD); + renamedLegacy.put("COMMAND_MINECART", Material.COMMAND_BLOCK_MINECART); + renamedLegacy.put("CHORUS_FRUIT_POPPED", Material.POPPED_CHORUS_FRUIT); + renamedLegacy.put("DRAGONS_BREATH", Material.DRAGON_BREATH); + renamedLegacy.put("BOAT_SPRUCE", Material.SPRUCE_BOAT); + renamedLegacy.put("BOAT_BIRCH", Material.BIRCH_BOAT); + renamedLegacy.put("BOAT_JUNGLE", Material.JUNGLE_BOAT); + renamedLegacy.put("BOAT_ACACIA", Material.ACACIA_BOAT); + renamedLegacy.put("BOAT_DARK_OAK", Material.DARK_OAK_BOAT); + renamedLegacy.put("TOTEM", Material.TOTEM_OF_UNDYING); + renamedLegacy.put("GOLD_RECORD", Material.MUSIC_DISC_13); + renamedLegacy.put("GREEN_RECORD", Material.MUSIC_DISC_CAT); + renamedLegacy.put("RECORD_3", Material.MUSIC_DISC_BLOCKS); + renamedLegacy.put("RECORD_4", Material.MUSIC_DISC_CHIRP); + renamedLegacy.put("RECORD_5", Material.MUSIC_DISC_FAR); + renamedLegacy.put("RECORD_6", Material.MUSIC_DISC_MALL); + renamedLegacy.put("RECORD_7", Material.MUSIC_DISC_MELLOHI); + renamedLegacy.put("RECORD_8", Material.MUSIC_DISC_STAL); + renamedLegacy.put("RECORD_9", Material.MUSIC_DISC_STRAD); + renamedLegacy.put("RECORD_10", Material.MUSIC_DISC_WARD); + renamedLegacy.put("RECORD_11", Material.MUSIC_DISC_11); + renamedLegacy.put("RECORD_12", Material.MUSIC_DISC_WAIT); + } - Material getMaterial(String material); - Material getDye(int colorCode); - ItemStack setSkullOwner(String player); + private static final Reflection.Field scoreboardName = Reflection.getField(ClientboundSetObjectivePacket.class, Reflection.getClass("net.minecraft.network.chat.Component"), 0); + public void setScoreboardTitle(Object packet, String title) { + scoreboardName.set(packet, ChatWrapper.impl.stringToChatComponent(title)); + } - Object getPose(EntityPose pose); - void setNamedSpawnPacketDataWatcher(Object packet); - Object formatDisplayName(String displayName); + private static final Class scoreActionEnum = Core.getVersion() < 21 ? Reflection.getClass("net.minecraft.server.ServerScoreboard$Method") : null; + private static final Reflection.Field scoreAction = Core.getVersion() < 21 ? Reflection.getField(ClientboundSetScorePacket.class, scoreActionEnum, 0) : null; + private static final Object scoreActionChange = Core.getVersion() < 21 ? scoreActionEnum.getEnumConstants()[0] : null; - void setSpawnPacketType(Object packet, EntityType type); + public void setScoreAction(Object packet) { + scoreAction.set(packet, scoreActionChange); + } - int getViewDistance(Player player); + public Material getMaterial(String material) { + try{ + return Material.valueOf(material); + }catch(IllegalArgumentException e){ + return renamedLegacy.get(material); + } + } - void syncSave(World world); + public Material getDye(int colorCode) { + switch(colorCode){ + case 1: + return Material.RED_DYE; + case 2: + return Material.GREEN_DYE; + case 3: + return Material.BROWN_DYE; + case 4: + return Material.LAPIS_LAZULI; + case 5: + return Material.PURPLE_DYE; + case 6: + return Material.CYAN_DYE; + case 7: + return Material.LIGHT_GRAY_DYE; + case 8: + return Material.GRAY_DYE; + case 9: + return Material.PINK_DYE; + case 10: + return Material.LIME_DYE; + case 11: + return Material.YELLOW_DYE; + case 12: + return Material.LIGHT_BLUE_DYE; + case 13: + return Material.MAGENTA_DYE; + case 14: + return Material.ORANGE_DYE; + case 15: + return Material.WHITE_DYE; + default: + return Material.BLACK_DYE; + } + } + + public ItemStack setSkullOwner(String player) { + ItemStack head = new ItemStack(Material.PLAYER_HEAD, 1); + head.editMeta(SkullMeta.class, skullMeta -> { + try { + OfflinePlayer offlinePlayer = Bukkit.getOfflinePlayer(player.startsWith(".") ? player.substring(1) : player); + PlayerProfile playerProfile = offlinePlayer.getPlayerProfile(); + playerProfile.complete(); + skullMeta.setPlayerProfile(playerProfile); + } catch (Exception e) { + // Ignore + } + }); + return head; + } + + protected static final Class entityPose = Reflection.getClass("net.minecraft.world.entity.Pose"); + protected static final Object shooting = entityPose.getEnumConstants()[16]; + protected static final Object standing = entityPose.getEnumConstants()[0]; + protected static final Object swimming = entityPose.getEnumConstants()[3]; + protected static final Object sneaking = entityPose.getEnumConstants()[5]; + public Object getPose(FlatteningWrapper.EntityPose pose) { + switch (pose) { + case SHOOTING: + return shooting; + case SNEAKING: + return sneaking; + case SWIMMING: + return swimming; + case NORMAL: + default: + return standing; + } + } + + public void setNamedSpawnPacketDataWatcher(Object packet) { + // field not present + } + + public Object formatDisplayName(String displayName) { + return displayName != null ? Optional.of(ChatWrapper.impl.stringToChatComponent(displayName)) : Optional.empty(); + } + + private static final Class registryBlocks = Reflection.getClass("net.minecraft.core.DefaultedRegistry"); + private static final Class entityTypes = Reflection.getClass("net.minecraft.world.entity.EntityType"); + private static final Object entityTypesRegistry = Reflection.getField(Reflection.getClass(Core.getVersion() > 18 ? "net.minecraft.core.registries.BuiltInRegistries" : "net.minecraft.core.IRegistry"), registryBlocks, 0, entityTypes).get(null); + private static final Reflection.Method get = Reflection.getMethod(registryBlocks, null, Reflection.getClass("net.minecraft.resources.ResourceLocation")); + private static final Reflection.Field spawnType = Reflection.getField(ProtocolWrapper.spawnPacket, entityTypes, 0); + private static final Reflection.Field spawnLivingType = Core.getVersion() > 18 ? spawnType : Reflection.getField(ProtocolWrapper.spawnLivingPacket, int.class, 1); + private static final Reflection.Method toMinecraft = Reflection.getMethod("org.bukkit.craftbukkit.util.CraftNamespacedKey", "toMinecraft", NamespacedKey.class); + private static final Map types = new HashMap<>(); + static { + types.put(EntityType.ARMOR_STAND, 1); + } + public void setSpawnPacketType(Object packet, EntityType type) { + if(type.isAlive()) { + spawnLivingType.set(packet, Core.getVersion() > 18 ? get.invoke(entityTypesRegistry, toMinecraft.invoke(null, type.getKey())) : types.get(type)); + } else { + spawnType.set(packet, get.invoke(entityTypesRegistry, toMinecraft.invoke(null, type.getKey()))); + } + } + + public int getViewDistance(Player player) { + return player.getClientViewDistance(); + } + + private static final Reflection.Method getHandle = Reflection.getMethod("org.bukkit.craftbukkit.CraftWorld", "getHandle"); + private static final Reflection.Method save = Reflection.getMethod("net.minecraft.server.level.ServerLevel", null, Reflection.getClass("net.minecraft.util.ProgressListener"), boolean.class, boolean.class); + public void syncSave(World world) { + save.invoke(getHandle.invoke(world), null, true, false); } public enum EntityPose { diff --git a/SpigotCore/SpigotCore_Main/src/de/steamwar/core/LocaleChangeWrapper.java b/SpigotCore/SpigotCore_Main/src/de/steamwar/core/LocaleChangeWrapper.java index 0726dfb2..79e49cd1 100644 --- a/SpigotCore/SpigotCore_Main/src/de/steamwar/core/LocaleChangeWrapper.java +++ b/SpigotCore/SpigotCore_Main/src/de/steamwar/core/LocaleChangeWrapper.java @@ -19,8 +19,17 @@ package de.steamwar.core; +import de.steamwar.sql.SteamwarUser; +import org.bukkit.event.EventHandler; import org.bukkit.event.Listener; +import org.bukkit.event.player.PlayerLocaleChangeEvent; -public interface LocaleChangeWrapper extends Listener { - LocaleChangeWrapper impl = VersionDependent.getVersionImpl(Core.getInstance()); +import java.util.Locale; + +public class LocaleChangeWrapper implements Listener { + + @EventHandler + private void onLocale(PlayerLocaleChangeEvent event) { + SteamwarUser.get(event.getPlayer().getUniqueId()).setLocale(Locale.forLanguageTag(event.getLocale()), false); + } } diff --git a/SpigotCore/SpigotCore_Main/src/de/steamwar/core/ProtocolWrapper.java b/SpigotCore/SpigotCore_Main/src/de/steamwar/core/ProtocolWrapper.java index dcdb1791..c61bdfaf 100644 --- a/SpigotCore/SpigotCore_Main/src/de/steamwar/core/ProtocolWrapper.java +++ b/SpigotCore/SpigotCore_Main/src/de/steamwar/core/ProtocolWrapper.java @@ -19,37 +19,50 @@ package de.steamwar.core; -import de.steamwar.Reflection; import com.mojang.authlib.GameProfile; +import com.mojang.datafixers.util.Pair; +import de.steamwar.Reflection; +import net.minecraft.network.protocol.game.ClientboundPlayerInfoRemovePacket; +import net.minecraft.network.protocol.game.ClientboundPlayerInfoUpdatePacket; +import net.minecraft.network.protocol.game.ClientboundSetEquipmentPacket; +import net.minecraft.world.entity.EquipmentSlot; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.level.GameType; import org.bukkit.GameMode; -import java.util.function.LongSupplier; +import java.util.Collections; +import java.util.EnumSet; -public interface ProtocolWrapper { +public class ProtocolWrapper { - Class itemStack = Reflection.getClass("net.minecraft.world.item.ItemStack"); - Class spawnPacket = Reflection.getClass("net.minecraft.network.protocol.game.ClientboundAddEntityPacket"); - Class spawnLivingPacket = Core.getVersion() > 18 ? ProtocolWrapper.spawnPacket : Reflection.getClass("net.minecraft.network.protocol.game.PacketPlayOutSpawnEntityLiving"); - Class equipmentPacket = Reflection.getClass("net.minecraft.network.protocol.game.ClientboundSetEquipmentPacket"); + public static final Class itemStack = Reflection.getClass("net.minecraft.world.item.ItemStack"); + public static final Class spawnPacket = Reflection.getClass("net.minecraft.network.protocol.game.ClientboundAddEntityPacket"); + public static final Class spawnLivingPacket = Core.getVersion() > 18 ? ProtocolWrapper.spawnPacket : Reflection.getClass("net.minecraft.network.protocol.game.PacketPlayOutSpawnEntityLiving"); + public static final Class equipmentPacket = Reflection.getClass("net.minecraft.network.protocol.game.ClientboundSetEquipmentPacket"); - Class enumGamemode = Reflection.getClass(Core.getVersion() > 9 ? "net.minecraft.world.level.GameType" : "net.minecraft.WorldSettings$EnumGamemode"); - Reflection.Method getGameModeById = Reflection.getTypedMethod(enumGamemode, null, enumGamemode, int.class); + public static final Class enumGamemode = Reflection.getClass(Core.getVersion() > 9 ? "net.minecraft.world.level.GameType" : "net.minecraft.WorldSettings$EnumGamemode"); + public static final Reflection.Method getGameModeById = Reflection.getTypedMethod(enumGamemode, null, enumGamemode, int.class); // 0: hand, 1: offhand, 2: feet, 3: legs, 4: chest, 5: head - Object[] itemSlots = Core.getVersion() > 8 ? Reflection.getClass("net.minecraft.world.entity.EnumItemSlot").getEnumConstants() : new Integer[]{0, 0, 1, 2, 3, 4}; + public static final Object[] itemSlots = Core.getVersion() > 8 ? Reflection.getClass("net.minecraft.world.entity.EnumItemSlot").getEnumConstants() : new Integer[]{0, 0, 1, 2, 3, 4}; - ProtocolWrapper impl = VersionDependent.getVersionImpl(Core.getInstance()); + public static final ProtocolWrapper impl = new ProtocolWrapper(); - void setEquipmentPacketStack(Object packet, Object slot, Object stack); - - Object playerInfoPacketConstructor(PlayerInfoAction action, GameProfile profile, GameMode mode); - - default void initTPSWarp(LongSupplier longSupplier) { - Class systemUtils = Reflection.getClass("net.minecraft.Util"); - Reflection.getField(systemUtils, LongSupplier.class, 0).set(systemUtils, (LongSupplier) () -> System.nanoTime() + longSupplier.getAsLong()); + public void setEquipmentPacketStack(Object packet, Object slot, Object stack) { + ClientboundSetEquipmentPacket setEquipmentPacket = (ClientboundSetEquipmentPacket) packet; + setEquipmentPacket.getSlots().add(Pair.of((EquipmentSlot) slot, (ItemStack) stack)); } - enum PlayerInfoAction { + public Object playerInfoPacketConstructor(PlayerInfoAction action, GameProfile profile, GameMode mode) { + if(action == PlayerInfoAction.REMOVE) + return new ClientboundPlayerInfoRemovePacket(Collections.singletonList(profile.getId())); + + return new ClientboundPlayerInfoUpdatePacket(action == PlayerInfoAction.ADD ? + EnumSet.of(ClientboundPlayerInfoUpdatePacket.Action.ADD_PLAYER, ClientboundPlayerInfoUpdatePacket.Action.UPDATE_GAME_MODE) : EnumSet.of(ClientboundPlayerInfoUpdatePacket.Action.UPDATE_GAME_MODE), + Collections.singletonList(new ClientboundPlayerInfoUpdatePacket.Entry(profile.getId(), profile, false, 0, GameType.byId(mode.getValue()), null, false, 0, null))); + } + + public enum PlayerInfoAction { ADD, GAMEMODE, REMOVE diff --git a/SpigotCore/SpigotCore_Main/src/de/steamwar/core/RecipeDiscoverWrapper.java b/SpigotCore/SpigotCore_Main/src/de/steamwar/core/RecipeDiscoverWrapper.java index 53b27d65..53cfaa79 100644 --- a/SpigotCore/SpigotCore_Main/src/de/steamwar/core/RecipeDiscoverWrapper.java +++ b/SpigotCore/SpigotCore_Main/src/de/steamwar/core/RecipeDiscoverWrapper.java @@ -19,8 +19,15 @@ package de.steamwar.core; +import de.steamwar.linkage.Linked; +import org.bukkit.event.EventHandler; import org.bukkit.event.Listener; +import org.bukkit.event.player.PlayerRecipeDiscoverEvent; -public interface RecipeDiscoverWrapper extends Listener { - RecipeDiscoverWrapper impl = VersionDependent.getVersionImpl(Core.getInstance()); +@Linked +public class RecipeDiscoverWrapper implements Listener { + @EventHandler + public void onRecipeDiscover(PlayerRecipeDiscoverEvent e) { + e.setCancelled(true); + } } diff --git a/SpigotCore/SpigotCore_Main/src/de/steamwar/core/TPSWarpUtils.java b/SpigotCore/SpigotCore_Main/src/de/steamwar/core/TPSWarpUtils.java deleted file mode 100644 index c5979bcf..00000000 --- a/SpigotCore/SpigotCore_Main/src/de/steamwar/core/TPSWarpUtils.java +++ /dev/null @@ -1,52 +0,0 @@ -/* - * This file is a part of the SteamWar software. - * - * Copyright (C) 2025 SteamWar.de-Serverteam - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero 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 Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see . - */ - -package de.steamwar.core; - -import lombok.experimental.UtilityClass; -import org.bukkit.Bukkit; -import org.bukkit.scheduler.BukkitTask; - -@UtilityClass -public class TPSWarpUtils { - - private static long nanoOffset = 0; - private static long nanoDOffset = 0; - private static BukkitTask bukkitTask = null; - - static { - ProtocolWrapper.impl.initTPSWarp(() -> nanoOffset); - } - - public static void warp(double tps) { - double d = 50 - (50 / (tps / 20.0)); - nanoDOffset = Math.max(0, (long) (d * 1000000)); - if (nanoDOffset == 0) { - if (bukkitTask == null) return; - bukkitTask.cancel(); - bukkitTask = null; - } else if (bukkitTask == null) { - bukkitTask = Bukkit.getScheduler().runTaskTimer(Core.getInstance(), () -> nanoOffset += nanoDOffset, 1, 1); - } - } - - public static boolean isWarping() { - return nanoDOffset > 0; - } -} diff --git a/SpigotCore/SpigotCore_Main/src/de/steamwar/core/TrickyParticleWrapper.java b/SpigotCore/SpigotCore_Main/src/de/steamwar/core/TrickyParticleWrapper.java index 7b86bacf..6ada7e0f 100644 --- a/SpigotCore/SpigotCore_Main/src/de/steamwar/core/TrickyParticleWrapper.java +++ b/SpigotCore/SpigotCore_Main/src/de/steamwar/core/TrickyParticleWrapper.java @@ -21,8 +21,10 @@ package de.steamwar.core; import org.bukkit.Particle; -public interface TrickyParticleWrapper { - public TrickyParticleWrapper impl = VersionDependent.getVersionImpl(Core.getInstance()); +public class TrickyParticleWrapper { + public static final TrickyParticleWrapper impl = new TrickyParticleWrapper(); - Particle getVillagerHappy(); + public Particle getVillagerHappy() { + return Particle.HAPPY_VILLAGER; + } } diff --git a/SpigotCore/SpigotCore_Main/src/de/steamwar/core/TrickyTrialsWrapper.java b/SpigotCore/SpigotCore_Main/src/de/steamwar/core/TrickyTrialsWrapper.java index 98900f4a..f529fe9e 100644 --- a/SpigotCore/SpigotCore_Main/src/de/steamwar/core/TrickyTrialsWrapper.java +++ b/SpigotCore/SpigotCore_Main/src/de/steamwar/core/TrickyTrialsWrapper.java @@ -24,14 +24,22 @@ import org.bukkit.Material; import org.bukkit.enchantments.Enchantment; import org.bukkit.entity.EntityType; -public interface TrickyTrialsWrapper { - TrickyTrialsWrapper impl = VersionDependent.getVersionImpl(Core.getInstance()); +public class TrickyTrialsWrapper { + public static final TrickyTrialsWrapper impl = new TrickyTrialsWrapper(); - EntityType getTntEntityType(); + public EntityType getTntEntityType() { + return EntityType.TNT; + } - Enchantment getUnbreakingEnchantment(); + public Enchantment getUnbreakingEnchantment() { + return Enchantment.UNBREAKING; + } - Material getTurtleScute(); + public Material getTurtleScute() { + return Material.TURTLE_SCUTE; + } - String getValue(Property property); + public String getValue(Property property) { + return property.value(); + } } diff --git a/SpigotCore/SpigotCore_Main/src/de/steamwar/core/VersionDependent.java b/SpigotCore/SpigotCore_Main/src/de/steamwar/core/VersionDependent.java index d31e9a24..edaf26d5 100644 --- a/SpigotCore/SpigotCore_Main/src/de/steamwar/core/VersionDependent.java +++ b/SpigotCore/SpigotCore_Main/src/de/steamwar/core/VersionDependent.java @@ -1,7 +1,7 @@ /* * This file is a part of the SteamWar software. * - * Copyright (C) 2025 SteamWar.de-Serverteam + * Copyright (C) 2026 SteamWar.de-Serverteam * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as published by @@ -23,6 +23,7 @@ import org.bukkit.plugin.Plugin; import java.lang.reflect.InvocationTargetException; +@Deprecated public class VersionDependent { private VersionDependent() {} diff --git a/SpigotCore/SpigotCore_9/src/de/steamwar/core/WorldEditRendererWrapper9.java b/SpigotCore/SpigotCore_Main/src/de/steamwar/core/WorldEditRendererFallback.java similarity index 91% rename from SpigotCore/SpigotCore_9/src/de/steamwar/core/WorldEditRendererWrapper9.java rename to SpigotCore/SpigotCore_Main/src/de/steamwar/core/WorldEditRendererFallback.java index 7c39b7ff..4f2579c6 100644 --- a/SpigotCore/SpigotCore_9/src/de/steamwar/core/WorldEditRendererWrapper9.java +++ b/SpigotCore/SpigotCore_Main/src/de/steamwar/core/WorldEditRendererFallback.java @@ -1,7 +1,7 @@ /* * This file is a part of the SteamWar software. * - * Copyright (C) 2025 SteamWar.de-Serverteam + * Copyright (C) 2026 SteamWar.de-Serverteam * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as published by @@ -24,7 +24,7 @@ import org.bukkit.Particle; import org.bukkit.entity.Player; import org.bukkit.util.Vector; -public class WorldEditRendererWrapper9 implements WorldEditRendererWrapper { +public class WorldEditRendererFallback { private static final int VIEW_DISTANCE = 64; private static final int SQ_VIEW_DISTANCE = VIEW_DISTANCE * VIEW_DISTANCE; @@ -33,7 +33,6 @@ public class WorldEditRendererWrapper9 implements WorldEditRendererWrapper { private static final Vector ONES = new Vector(1, 1, 1); private static final Vector STEPS = new Vector(STEP_SIZE, STEP_SIZE, STEP_SIZE); - @Override public void draw(Player player, boolean scheduled, boolean clipboard, Vector min, Vector max) { if (!scheduled) return; @@ -77,16 +76,4 @@ public class WorldEditRendererWrapper9 implements WorldEditRendererWrapper { min.add(stepSize); } } - - @Override - public void tick(Player player) { - } - - @Override - public void hide(Player player, boolean clipboard, boolean hide) { - } - - @Override - public void remove(Player player) { - } } diff --git a/SpigotCore/SpigotCore_Main/src/de/steamwar/core/WorldEditRendererWrapper.java b/SpigotCore/SpigotCore_Main/src/de/steamwar/core/WorldEditRendererWrapper.java index 4651cb06..6d93d0b1 100644 --- a/SpigotCore/SpigotCore_Main/src/de/steamwar/core/WorldEditRendererWrapper.java +++ b/SpigotCore/SpigotCore_Main/src/de/steamwar/core/WorldEditRendererWrapper.java @@ -19,12 +19,19 @@ package de.steamwar.core; +import de.steamwar.entity.CWireframe; +import de.steamwar.entity.REntityServer; +import org.bukkit.Material; +import org.bukkit.block.data.BlockData; import org.bukkit.entity.Player; import org.bukkit.util.Vector; -public interface WorldEditRendererWrapper { - WorldEditRendererWrapper fallback = VersionDependent.getVersionImpl(Core.getInstance(), 9); - WorldEditRendererWrapper impl = VersionDependent.getVersionImpl(Core.getInstance()); +import java.util.HashMap; +import java.util.Map; + +public class WorldEditRendererWrapper { + public static final WorldEditRendererFallback fallback = new WorldEditRendererFallback(); + public static final WorldEditRendererWrapper impl = new WorldEditRendererWrapper(); static void safeDraw(Player player, boolean scheduled, boolean clipboard, Vector pos1, Vector pos2) { if (PlayerVersion.isBedrock(player) || PlayerVersion.getVersion(player) < 20) { @@ -34,11 +41,83 @@ public interface WorldEditRendererWrapper { } } - void draw(Player player, boolean scheduled, boolean clipboard, Vector pos1, Vector pos2); + private static final class BoxPair { + private CWireframe regionBox; + private CWireframe clipboardBox; - void tick(Player player); + public CWireframe get(boolean clipboard) { + if (clipboard) { + return clipboardBox; + } else { + return regionBox; + } + } - void hide(Player player, boolean clipboard, boolean hide); + public void set(boolean clipboard, CWireframe box) { + if (clipboard) { + this.clipboardBox = box; + } else { + this.regionBox = box; + } + } - void remove(Player player); + public void die() { + if (clipboardBox != null) { + clipboardBox.die(); + } + if (regionBox != null) { + regionBox.die(); + } + } + } + + private static final Map servers = new HashMap<>(); + private static final Map boxes = new HashMap<>(); + + public void draw(Player player, boolean scheduled, boolean clipboard, Vector pos1, Vector pos2) { + REntityServer server = servers.computeIfAbsent(player, __ -> { + REntityServer entityServer = new REntityServer(); + entityServer.addPlayer(player); + return entityServer; + }); + + WorldEditRendererCUIEditor.Type type = clipboard ? WorldEditRendererCUIEditor.Type.CLIPBOARD : WorldEditRendererCUIEditor.Type.SELECTION; + float width = type.getWidth(player).value; + Material material = type.getMaterial(player); + if (material == Material.BARRIER) { + hide(player, clipboard, true); + return; + } + BlockData block = material.createBlockData(); + + BoxPair boxPair = boxes.computeIfAbsent(player, __ -> new BoxPair()); + CWireframe box = boxPair.get(clipboard); + if (box == null) { + box = new CWireframe(server); + boxPair.set(clipboard, box); + } + box.setPos1And2(pos1.toLocation(player.getWorld()), pos2.toLocation(player.getWorld())); + box.setWidth(width); + box.setBlock(block); + } + + public void tick(Player player) { + REntityServer server = servers.get(player); + if (server != null) server.tick(); + } + + public void hide(Player player, boolean clipboard, boolean hide) { + BoxPair boxPair = boxes.get(player); + if (boxPair == null) return; + CWireframe box = boxPair.get(clipboard); + if (box == null) return; + box.hide(hide); + } + + public void remove(Player player) { + BoxPair boxPair = boxes.remove(player); + if (boxPair != null) boxPair.die(); + REntityServer server = servers.remove(player); + if (server != null) server.close(); + } } diff --git a/SpigotCore/SpigotCore_Main/src/de/steamwar/core/WorldEditWrapper.java b/SpigotCore/SpigotCore_Main/src/de/steamwar/core/WorldEditWrapper.java index 724f8184..f637d5dc 100644 --- a/SpigotCore/SpigotCore_Main/src/de/steamwar/core/WorldEditWrapper.java +++ b/SpigotCore/SpigotCore_Main/src/de/steamwar/core/WorldEditWrapper.java @@ -19,9 +19,18 @@ package de.steamwar.core; +import com.fastasyncworldedit.core.extent.clipboard.io.FastSchematicReaderV2; +import com.fastasyncworldedit.core.extent.clipboard.io.FastSchematicReaderV3; +import com.sk89q.jnbt.NBTInputStream; import com.sk89q.worldedit.EmptyClipboardException; import com.sk89q.worldedit.bukkit.WorldEditPlugin; +import com.sk89q.worldedit.extension.platform.Actor; import com.sk89q.worldedit.extent.clipboard.Clipboard; +import com.sk89q.worldedit.extent.clipboard.io.*; +import com.sk89q.worldedit.extent.clipboard.io.sponge.SpongeSchematicV1Reader; +import com.sk89q.worldedit.extent.clipboard.io.sponge.SpongeSchematicV2Reader; +import com.sk89q.worldedit.extent.clipboard.io.sponge.SpongeSchematicV3Reader; +import com.sk89q.worldedit.math.Vector3; import com.sk89q.worldedit.math.transform.Transform; import com.sk89q.worldedit.regions.Region; import com.sk89q.worldedit.session.ClipboardHolder; @@ -30,25 +39,140 @@ import de.steamwar.sql.NodeData; import org.bukkit.Bukkit; import org.bukkit.entity.Player; import org.bukkit.util.Vector; +import org.enginehub.linbus.stream.LinBinaryIO; import java.io.*; +import java.util.ArrayList; +import java.util.List; +import java.util.function.Function; import java.util.logging.Level; -public interface WorldEditWrapper { - WorldEditWrapper impl = VersionDependent.getVersionImpl(Core.getInstance()); +public class WorldEditWrapper { + public static final WorldEditWrapper impl = new WorldEditWrapper(); - InputStream getPlayerClipboard(Player player); + public InputStream getPlayerClipboard(Player player) { + return WorldEditWrapper.getPlayerClipboard(player, (outputStream, clipboard, clipboardHolder) -> { + ClipboardWriter writer = BuiltInClipboardFormat.FAST_V3.getWriter(outputStream); + writer.write(clipboard); + writer.close(); + }); + } - void setPlayerClipboard(Player player, Clipboard clipboard); - Clipboard getClipboard(NodeData data) throws IOException; - Clipboard getClipboard(InputStream inputStream) throws IOException; + public void setPlayerClipboard(Player player, Clipboard clipboard) { + Actor actor = WorldEditWrapper.getWorldEditPlugin().wrapCommandSender(player); + WorldEditWrapper.getWorldEditPlugin().getWorldEdit().getSessionManager().get(actor).setClipboard(new ClipboardHolder(clipboard)); + } - Vector getOrigin(Clipboard clipboard); - Vector getMinimum(Region region); - Vector getMaximum(Region region); - Vector applyTransform(Vector vector, Transform transform); + public Clipboard getClipboard(NodeData data) throws IOException { + ResetableInputStream is = new ResetableInputStream(data.schemData(false)); + for (ClipboardFormat clipboardFormat : ClipboardFormats.getAll()) { + FilterInputStream fis = new FilterInputStream(is) { + @Override + public void close() throws IOException { + // Ignore close call! + } + }; + boolean canBeRead = clipboardFormat.isFormat(fis); + is.reset(); + if (!canBeRead) continue; + return clipboardFormat.load(is); + } + throw new IOException("No clipboard found"); + } - NodeData.SchematicFormat getNativeFormat(); + private static final Function FastV3 = FastSchematicReaderV3::new; + @SuppressWarnings("removal") + private static final Function FastV2 = inputStream -> new FastSchematicReaderV2(new NBTInputStream(inputStream)); + @SuppressWarnings("removal") + private static final Function McEdit = inputStream -> new MCEditSchematicReader(new NBTInputStream(inputStream)); + private static final Function SpongeV3 = inputStream -> new SpongeSchematicV3Reader(LinBinaryIO.read(new DataInputStream(inputStream))); + private static final Function SpongeV2 = inputStream -> new SpongeSchematicV2Reader(LinBinaryIO.read(new DataInputStream(inputStream))); + private static final Function SpongeV1 = inputStream -> new SpongeSchematicV1Reader(LinBinaryIO.read(new DataInputStream(inputStream))); + + private static final Function[] READERS = new Function[]{ + FastV3, + FastV2, + SpongeV3, + SpongeV2, + SpongeV1, + McEdit + }; + + public Clipboard getClipboard(InputStream inputStream) throws IOException { + ResetableInputStream is = new ResetableInputStream(inputStream); + for (Function reader : READERS) { + FilterInputStream fis = new FilterInputStream(is) { + @Override + public void close() throws IOException { + // Ignore close call! + } + }; + try { + return reader.apply(fis).read(); + } catch (Exception e) { + is.reset(); + } + } + is.close(); + throw new IOException("No clipboard found"); + } + + private static class ResetableInputStream extends InputStream { + + private InputStream inputStream; + private int pointer = 0; + private List list = new ArrayList<>(); + + public ResetableInputStream(InputStream in) { + this.inputStream = in; + } + + @Override + public int read() throws IOException { + if (pointer >= list.size()) { + int data = inputStream.read(); + list.add(data); + pointer++; + return data; + } + int data = list.get(pointer); + pointer++; + return data; + } + + @Override + public void reset() throws IOException { + pointer = 0; + } + + @Override + public void close() throws IOException { + list.clear(); + pointer = -1; + } + } + + public org.bukkit.util.Vector getOrigin(Clipboard clipboard) { + return new org.bukkit.util.Vector(clipboard.getOrigin().x(), clipboard.getOrigin().y(), clipboard.getOrigin().z()); + } + + public Vector getMinimum(Region region) { + return new Vector(region.getMinimumPoint().x(), region.getMinimumPoint().y(), region.getMinimumPoint().z()); + } + + public Vector getMaximum(Region region) { + return new Vector(region.getMaximumPoint().x(), region.getMaximumPoint().y(), region.getMaximumPoint().z()); + } + + public Vector applyTransform(Vector vector, Transform transform) { + Vector3 v = Vector3.at(vector.getX(), vector.getY(), vector.getZ()); + v = transform.apply(v); + return new org.bukkit.util.Vector(v.x(), v.y(), v.z()); + } + + public NodeData.SchematicFormat getNativeFormat() { + return NodeData.SchematicFormat.SPONGE_V3; + } static WorldEditPlugin getWorldEditPlugin() { return (WorldEditPlugin) Bukkit.getPluginManager().getPlugin("WorldEdit"); diff --git a/SpigotCore/SpigotCore_Main/src/de/steamwar/core/WorldIdentifier.java b/SpigotCore/SpigotCore_Main/src/de/steamwar/core/WorldIdentifier.java index 14e3db31..6e6a8de3 100644 --- a/SpigotCore/SpigotCore_Main/src/de/steamwar/core/WorldIdentifier.java +++ b/SpigotCore/SpigotCore_Main/src/de/steamwar/core/WorldIdentifier.java @@ -19,15 +19,56 @@ package de.steamwar.core; +import com.comphenix.tinyprotocol.TinyProtocol; +import de.steamwar.Reflection; +import de.steamwar.linkage.Linked; +import net.minecraft.network.protocol.game.ClientboundLoginPacket; +import net.minecraft.network.protocol.game.CommonPlayerSpawnInfo; +import net.minecraft.resources.ResourceKey; +import net.minecraft.world.level.Level; + +@Linked public class WorldIdentifier { - private static final IWorldIdentifier impl = VersionDependent.getVersionImpl(Core.getInstance()); + private static ResourceKey resourceKey = null; + + private static final Class resourceKeyClass = Reflection.getClass("net.minecraft.resources.ResourceKey"); + private static final Class minecraftKeyClass = Reflection.getClass("net.minecraft.resources.MinecraftKey"); + private static final Reflection.Constructor resourceKeyConstructor = Reflection.getConstructor(resourceKeyClass, minecraftKeyClass, minecraftKeyClass); + private static final Reflection.Constructor minecraftKeyConstructor = Reflection.getConstructor(minecraftKeyClass, String.class, String.class); public static void set(String name) { - impl.setResourceKey(name); + resourceKey = (ResourceKey) resourceKeyConstructor.invoke(minecraftKeyConstructor.invoke("minecraft", "dimension"), minecraftKeyConstructor.invoke("steamwar", name)); } - protected interface IWorldIdentifier { - void setResourceKey(String name); + public WorldIdentifier() { + TinyProtocol.instance.addFilter(ClientboundLoginPacket.class, (player, o) -> { + if (resourceKey == null) return o; + ClientboundLoginPacket packet = (ClientboundLoginPacket) o; + + return new ClientboundLoginPacket(packet.playerId(), + packet.hardcore(), + packet.levels(), + packet.maxPlayers(), + packet.chunkRadius(), + packet.simulationDistance(), + packet.reducedDebugInfo(), + packet.showDeathScreen(), + packet.doLimitedCrafting(), + new CommonPlayerSpawnInfo( + packet.commonPlayerSpawnInfo().dimensionType(), + resourceKey, + packet.commonPlayerSpawnInfo().seed(), + packet.commonPlayerSpawnInfo().gameType(), + packet.commonPlayerSpawnInfo().previousGameType(), + packet.commonPlayerSpawnInfo().isDebug(), + packet.commonPlayerSpawnInfo().isFlat(), + packet.commonPlayerSpawnInfo().lastDeathLocation(), + packet.commonPlayerSpawnInfo().portalCooldown(), + packet.commonPlayerSpawnInfo().seaLevel() + ), + packet.enforcesSecureChat() + ); + }); } } diff --git a/SpigotCore/SpigotCore_Main/src/de/steamwar/core/authlib/SteamwarGameProfileRepository.java b/SpigotCore/SpigotCore_Main/src/de/steamwar/core/authlib/SteamwarGameProfileRepository.java index 85a2ca26..f5f8c8fa 100644 --- a/SpigotCore/SpigotCore_Main/src/de/steamwar/core/authlib/SteamwarGameProfileRepository.java +++ b/SpigotCore/SpigotCore_Main/src/de/steamwar/core/authlib/SteamwarGameProfileRepository.java @@ -19,12 +19,56 @@ package de.steamwar.core.authlib; +import com.mojang.authlib.GameProfile; import com.mojang.authlib.GameProfileRepository; -import de.steamwar.core.Core; -import de.steamwar.core.VersionDependent; +import com.mojang.authlib.ProfileLookupCallback; +import de.steamwar.Reflection; +import de.steamwar.sql.SteamwarUser; +import net.minecraft.server.MinecraftServer; +import net.minecraft.server.Services; -public abstract class SteamwarGameProfileRepository implements GameProfileRepository { - public static final SteamwarGameProfileRepository impl = VersionDependent.getVersionImpl(Core.getInstance()); +import java.util.ArrayList; +import java.util.List; +import java.util.Optional; - public abstract void inject(); +public class SteamwarGameProfileRepository implements GameProfileRepository { + public static final SteamwarGameProfileRepository impl = new SteamwarGameProfileRepository(); + + private static final GameProfileRepository fallback; + private static final Reflection.Field field; + private static final Services current; + + static { + Class clazz = MinecraftServer.getServer().getClass(); + field = Reflection.getField(clazz, Services.class, 0); + current = field.get(MinecraftServer.getServer()); + fallback = current.profileRepository(); + } + + @Override + public void findProfilesByNames(String[] strings, ProfileLookupCallback profileLookupCallback) { + List unknownNames = new ArrayList<>(); + for (String name:strings) { + SteamwarUser user = SteamwarUser.get(name); + if(user == null) { + unknownNames.add(name); + continue; + } + + profileLookupCallback.onProfileLookupSucceeded(new GameProfile(user.getUUID(), user.getUserName())); + } + if(!unknownNames.isEmpty()) { + fallback.findProfilesByNames(unknownNames.toArray(new String[0]), profileLookupCallback); + } + } + + @Override + public Optional findProfileByName(String s) { + return fallback.findProfileByName(s); + } + + public void inject() { + Services newServices = new Services(current.sessionService(), current.servicesKeySet(), this, current.profileCache(), current.paperConfigurations()); + field.set(MinecraftServer.getServer(), newServices); + } } diff --git a/SpigotCore/SpigotCore_Main/src/de/steamwar/entity/PacketConstructor.java b/SpigotCore/SpigotCore_Main/src/de/steamwar/entity/PacketConstructor.java index 070b975e..da4944a6 100644 --- a/SpigotCore/SpigotCore_Main/src/de/steamwar/entity/PacketConstructor.java +++ b/SpigotCore/SpigotCore_Main/src/de/steamwar/entity/PacketConstructor.java @@ -19,12 +19,35 @@ package de.steamwar.entity; -import de.steamwar.core.Core; -import de.steamwar.core.VersionDependent; +import net.minecraft.network.protocol.game.ClientboundAddEntityPacket; +import net.minecraft.network.protocol.game.ClientboundTeleportEntityPacket; +import net.minecraft.world.entity.EntityType; +import net.minecraft.world.entity.PositionMoveRotation; +import net.minecraft.world.phys.Vec3; -public interface PacketConstructor { - PacketConstructor impl = VersionDependent.getVersionImpl(Core.getInstance()); +import java.util.Collections; - Object teleportPacket(int entityId, double x, double y, double z, float yaw, float pitch); - Object createRPlayerSpawn(RPlayer player); +public class PacketConstructor { + public static final PacketConstructor impl = new PacketConstructor(); + + public Object teleportPacket(int entityId, double x, double y, double z, float yaw, float pitch) { + PositionMoveRotation rot = new PositionMoveRotation(new Vec3(x, y, z), Vec3.ZERO, pitch, yaw); + return new ClientboundTeleportEntityPacket(entityId, rot, Collections.emptySet(), false); + } + + public Object createRPlayerSpawn(RPlayer player) { + return new ClientboundAddEntityPacket( + player.entityId, + player.uuid, + player.x, + player.y, + player.z, + player.yaw, + player.pitch, + EntityType.PLAYER, + 0, + Vec3.ZERO, + player.headYaw + ); + } } diff --git a/SpigotCore/SpigotCore_Main/src/de/steamwar/scoreboard/SWScoreboard.java b/SpigotCore/SpigotCore_Main/src/de/steamwar/scoreboard/SWScoreboard.java index 06ea4346..2991c94c 100644 --- a/SpigotCore/SpigotCore_Main/src/de/steamwar/scoreboard/SWScoreboard.java +++ b/SpigotCore/SpigotCore_Main/src/de/steamwar/scoreboard/SWScoreboard.java @@ -21,11 +21,54 @@ package de.steamwar.scoreboard; import de.steamwar.core.Core; import de.steamwar.core.VersionDependent; +import net.kyori.adventure.text.Component; +import org.bukkit.Bukkit; import org.bukkit.entity.Player; +import org.bukkit.scoreboard.DisplaySlot; +import org.bukkit.scoreboard.Objective; +import org.bukkit.scoreboard.Scoreboard; -public interface SWScoreboard { - public static final SWScoreboard impl = VersionDependent.getVersionImpl(Core.getInstance()); +import java.util.HashMap; +import java.util.Map; - boolean createScoreboard(Player player, ScoreboardCallback callback); - void removeScoreboard(Player player); +public class SWScoreboard { + public static final SWScoreboard impl = new SWScoreboard(); + + private static final HashMap playerBoards = new HashMap<>(); + private static final String SIDEBAR = "sw-sidebar"; + + static { + Bukkit.getScheduler().runTaskTimer(Core.getInstance(), () -> { + for(Map.Entry scoreboard : playerBoards.entrySet()) { + render(scoreboard.getKey(), scoreboard.getValue()); + } + }, 10, 5); + } + + private static void render(Player player, ScoreboardCallback callback) { + if (player.getScoreboard().getObjective(SIDEBAR) != null) { + player.getScoreboard().getObjective(SIDEBAR).unregister(); + } + + Objective objective = player.getScoreboard().registerNewObjective(SIDEBAR, "dummy", Component.text(callback.getTitle())); + objective.setAutoUpdateDisplay(true); + objective.setDisplaySlot(DisplaySlot.SIDEBAR); + + callback.getData().forEach((text, score) -> objective.getScore(text).setScore(score)); + } + + public boolean createScoreboard(Player player, ScoreboardCallback callback) { + Scoreboard scoreboard = Bukkit.getScoreboardManager().getNewScoreboard(); + player.setScoreboard(scoreboard); + + render(player, callback); + + playerBoards.put(player, callback); + return true; + } + + public void removeScoreboard(Player player) { + player.getScoreboard().getObjective(SIDEBAR).unregister(); + playerBoards.remove(player); + } } diff --git a/SpigotCore/SpigotCore_Main/src/de/steamwar/techhider/BlockIds.java b/SpigotCore/SpigotCore_Main/src/de/steamwar/techhider/BlockIds.java index 168b87da..e0ec9a14 100644 --- a/SpigotCore/SpigotCore_Main/src/de/steamwar/techhider/BlockIds.java +++ b/SpigotCore/SpigotCore_Main/src/de/steamwar/techhider/BlockIds.java @@ -19,19 +19,55 @@ package de.steamwar.techhider; +import com.google.common.collect.ImmutableList; import de.steamwar.Reflection; -import de.steamwar.core.Core; -import de.steamwar.core.VersionDependent; import org.bukkit.Material; +import java.util.HashSet; import java.util.Set; -public interface BlockIds { - BlockIds impl = VersionDependent.getVersionImpl(Core.getInstance()); +public class BlockIds { + public static final BlockIds impl = new BlockIds(); Reflection.Method getCombinedId = Reflection.getTypedMethod(TechHider.block, null, int.class, TechHider.iBlockData); - int getCombinedId(Object iBlockData); - int materialToId(Material material); - Set materialToAllIds(Material material); + private static final Class blockStateList = Reflection.getClass("net.minecraft.world.level.block.state.StateDefinition"); + private static final Class fluidTypeFlowing = Reflection.getClass("net.minecraft.world.level.material.FlowingFluid"); + private static final Class fluid = Reflection.getClass("net.minecraft.world.level.material.FluidState"); + + private static final Reflection.Method getBlockData = Reflection.getTypedMethod(TechHider.block, null, TechHider.iBlockData); + public int materialToId(Material material) { + return getCombinedId(getBlockData.invoke(getBlock(material))); + } + + private static final Reflection.Method getStates = Reflection.getTypedMethod(TechHider.block, null, blockStateList); + private static final Reflection.Method getStateList = Reflection.getTypedMethod(blockStateList, null, ImmutableList.class); + private static final Object water = Reflection.getTypedMethod(fluidTypeFlowing, null, fluid, boolean.class).invoke(Reflection.getField(Reflection.getClass("net.minecraft.world.level.material.Fluids"), fluidTypeFlowing, 1).get(null), false); + private static final Iterable registryBlockId = (Iterable) Reflection.getField(TechHider.block, Reflection.getClass("net.minecraft.core.IdMapper"), 0).get(null); + private static final Reflection.Method getFluid = Reflection.getTypedMethod(TechHider.iBlockData, null, fluid); + public Set materialToAllIds(Material material) { + Set ids = new HashSet<>(); + for(Object data : (ImmutableList) getStateList.invoke(getStates.invoke(getBlock(material)))) { + ids.add(getCombinedId(data)); + } + + if(material == Material.WATER) { + for(Object data : registryBlockId) { + if(getFluid.invoke(data) == water) { + ids.add(getCombinedId(data)); + } + } + } + + return ids; + } + + private static final Reflection.Method getBlock = Reflection.getTypedMethod(TechHider.craftMagicNumbers, "getBlock", TechHider.block, Material.class); + private Object getBlock(Material material) { + return getBlock.invoke(null, material); + } + + public int getCombinedId(Object blockData) { + return (int) getCombinedId.invoke(null, blockData); + } } diff --git a/SpigotCore/SpigotCore_Main/src/de/steamwar/techhider/ChunkHider.java b/SpigotCore/SpigotCore_Main/src/de/steamwar/techhider/ChunkHider.java index bdc8cdd3..c1ff1e3f 100644 --- a/SpigotCore/SpigotCore_Main/src/de/steamwar/techhider/ChunkHider.java +++ b/SpigotCore/SpigotCore_Main/src/de/steamwar/techhider/ChunkHider.java @@ -19,21 +19,147 @@ package de.steamwar.techhider; -import de.steamwar.core.Core; -import de.steamwar.core.VersionDependent; +import de.steamwar.Reflection; import io.netty.buffer.ByteBuf; +import io.netty.buffer.Unpooled; import lombok.Getter; +import net.minecraft.network.protocol.game.ClientboundLevelChunkPacketData; +import net.minecraft.network.protocol.game.ClientboundLevelChunkWithLightPacket; +import net.minecraft.util.SimpleBitStorage; +import net.minecraft.world.level.block.entity.BlockEntityType; import org.bukkit.entity.Player; import java.util.Collections; +import java.util.List; import java.util.Set; import java.util.function.BiFunction; +import java.util.function.UnaryOperator; +import java.util.stream.Collectors; -public interface ChunkHider { - ChunkHider impl = VersionDependent.getVersionImpl(Core.getInstance()); +public class ChunkHider { + public static final ChunkHider impl = new ChunkHider(); - Class mapChunkPacket(); - BiFunction chunkHiderGenerator(TechHider techHider); + public Class mapChunkPacket() { + return ClientboundLevelChunkWithLightPacket.class; + } + + private static final UnaryOperator chunkPacketCloner = ProtocolUtils.shallowCloneGenerator(ClientboundLevelChunkWithLightPacket.class); + private static final UnaryOperator chunkDataCloner = ProtocolUtils.shallowCloneGenerator(ClientboundLevelChunkPacketData.class); + + private static final Reflection.Field chunkXField = Reflection.getField(ClientboundLevelChunkWithLightPacket.class, int.class, 0); + private static final Reflection.Field chunkZField = Reflection.getField(ClientboundLevelChunkWithLightPacket.class, int.class, 1); + private static final Reflection.Field chunkData = Reflection.getField(ClientboundLevelChunkWithLightPacket.class, ClientboundLevelChunkPacketData.class, 0); + + private static final Reflection.Field dataField = Reflection.getField(ClientboundLevelChunkPacketData.class, byte[].class, 0); + private static final Reflection.Field tileEntities = Reflection.getField(ClientboundLevelChunkPacketData.class, List.class, 0); + + public BiFunction chunkHiderGenerator(TechHider techHider) { + return (p, packet) -> { + int chunkX = chunkXField.get(packet); + int chunkZ = chunkZField.get(packet); + if (techHider.getLocationEvaluator().skipChunk(p, chunkX, chunkZ)) + return packet; + + packet = chunkPacketCloner.apply(packet); + Object dataWrapper = chunkDataCloner.apply(chunkData.get(packet)); + + Set hiddenBlockEntities = techHider.getHiddenBlockEntities(); + tileEntities.set(dataWrapper, ((List)tileEntities.get(dataWrapper)).stream().filter(te -> tileEntityVisible(hiddenBlockEntities, te)).collect(Collectors.toList())); + + ByteBuf in = Unpooled.wrappedBuffer(dataField.get(dataWrapper)); + ByteBuf out = Unpooled.buffer(in.readableBytes() + 64); + for(int yOffset = p.getWorld().getMinHeight(); yOffset < p.getWorld().getMaxHeight(); yOffset += 16) { + SectionHider section = new SectionHider(p, techHider, in, out, chunkX, yOffset/16, chunkZ); + section.copyBlockCount(); + + blocks(section); + biomes(section); + } + + if (in.readableBytes() != 0) { + throw new IllegalStateException("ChunkHider21: Incomplete chunk data, " + in.readableBytes() + " bytes left"); + } + + byte[] data = new byte[out.readableBytes()]; + out.readBytes(data); + dataField.set(dataWrapper, data); + + chunkData.set(packet, dataWrapper); + return packet; + }; + } + + public static final Class tileEntity = Reflection.getClass("net.minecraft.network.protocol.game.ClientboundLevelChunkPacketData$BlockEntityInfo"); + protected static final Reflection.Field entityType = Reflection.getField(tileEntity, BlockEntityType.class, 0); + private static final Class builtInRegestries = Reflection.getClass("net.minecraft.core.registries.BuiltInRegistries"); + private static final Class registry = Reflection.getClass("net.minecraft.core.Registry"); + private static final Reflection.Field nameField = Reflection.getField(builtInRegestries, "BLOCK_ENTITY_TYPE", registry); + private static final Class resourceLocation = Reflection.getClass("net.minecraft.resources.ResourceLocation"); + private static final Reflection.Method getKey = Reflection.getTypedMethod(registry, "getKey", resourceLocation, Object.class); + private static final Reflection.Method getName = Reflection.getTypedMethod(resourceLocation, "getPath", String.class); + protected boolean tileEntityVisible(Set hiddenBlockEntities, Object tile) { + return !hiddenBlockEntities.contains(getName.invoke(getKey.invoke(nameField.get(null), entityType.get(tile)))); + } + + private void blocks(SectionHider section) { + section.copyBitsPerBlock(); + + boolean singleValued = section.getBitsPerBlock() == 0; + if (singleValued) { + int value = ProtocolUtils.readVarInt(section.getIn()); + ProtocolUtils.writeVarInt(section.getOut(), !section.isSkipSection() && section.getObfuscate().contains(value) ? section.getTarget() : value); + return; + } else if (section.getBitsPerBlock() < 9) { + // Indirect (paletted) storage – only present when bitsPerBlock < 9 in 1.21+ + section.processPalette(); + } + + if (section.isSkipSection() || (!section.blockPrecise() && section.isPaletted())) { + section.skipNewDataArray(4096); + return; + } + + SimpleBitStorage values = new SimpleBitStorage(section.getBitsPerBlock(), 4096, section.readNewDataArray(4096)); + + for (int y = 0; y < 16; y++) { + for (int z = 0; z < 16; z++) { + for (int x = 0; x < 16; x++) { + int pos = (((y * 16) + z) * 16) + x; + + TechHider.State test = section.test(x, y, z); + + switch (test) { + case SKIP: + break; + case CHECK: + if (!section.getObfuscate().contains(values.get(pos))) + break; + case HIDE: + values.set(pos, section.getTarget()); + break; + case HIDE_AIR: + default: + values.set(pos, section.getAir()); + } + } + } + } + + section.writeDataArray(values.getRaw()); + } + + private void biomes(SectionHider section) { + section.copyBitsPerBlock(); + if(section.getBitsPerBlock() == 0) { + section.copyVarInt(); + } else if(section.getBitsPerBlock() < 6) { + section.skipPalette(); + section.skipNewDataArray(64); + } else { + // Direct (global) biome IDs – no palette present + section.skipNewDataArray(64); + } + } @Getter class SectionHider { diff --git a/SpigotCore/SpigotCore_Main/src/de/steamwar/techhider/ProtocolWrapper.java b/SpigotCore/SpigotCore_Main/src/de/steamwar/techhider/ProtocolWrapper.java index aec71941..2c17dbb7 100644 --- a/SpigotCore/SpigotCore_Main/src/de/steamwar/techhider/ProtocolWrapper.java +++ b/SpigotCore/SpigotCore_Main/src/de/steamwar/techhider/ProtocolWrapper.java @@ -19,19 +19,74 @@ package de.steamwar.techhider; -import de.steamwar.core.Core; -import de.steamwar.core.VersionDependent; +import de.steamwar.Reflection; +import net.minecraft.core.SectionPos; +import net.minecraft.world.level.block.entity.BlockEntityType; +import net.minecraft.world.level.block.entity.SignBlockEntity; +import net.minecraft.world.level.block.state.BlockState; import org.bukkit.entity.Player; +import java.util.ArrayList; import java.util.function.BiFunction; -public interface ProtocolWrapper { - ProtocolWrapper impl = VersionDependent.getVersionImpl(Core.getInstance()); +public class ProtocolWrapper { + public static final ProtocolWrapper impl = new ProtocolWrapper(); + private static final Reflection.Field multiBlockChangeChunk = Reflection.getField(TechHider.multiBlockChangePacket, SectionPos.class, 0); + private static final Reflection.Field multiBlockChangePos = Reflection.getField(TechHider.multiBlockChangePacket, short[].class, 0); + private static final Reflection.Field multiBlockChangeBlocks = Reflection.getField(TechHider.multiBlockChangePacket, BlockState[].class, 0); + public BiFunction multiBlockChangeGenerator(TechHider techHider) { + return (p, packet) -> { + TechHider.LocationEvaluator locationEvaluator = techHider.getLocationEvaluator(); + Object chunkCoords = multiBlockChangeChunk.get(packet); + int chunkX = TechHider.blockPositionX.get(chunkCoords); + int chunkY = TechHider.blockPositionY.get(chunkCoords); + int chunkZ = TechHider.blockPositionZ.get(chunkCoords); + if(locationEvaluator.skipChunkSection(p, chunkX, chunkY, chunkZ)) + return packet; - boolean unfilteredTileEntityDataAction(Object packet); + packet = TechHider.multiBlockChangeCloner.apply(packet); + final short[] oldPos = multiBlockChangePos.get(packet); + final BlockState[] oldBlocks = multiBlockChangeBlocks.get(packet); + ArrayList poss = new ArrayList<>(oldPos.length); + ArrayList blocks = new ArrayList<>(oldPos.length); + for(int i = 0; i < oldPos.length; i++) { + short pos = oldPos[i]; + BlockState block = oldBlocks[i]; + switch(locationEvaluator.check(p, 16*chunkX + (pos >> 8 & 0xF), 16*chunkY + (pos & 0xF), 16*chunkZ + (pos >> 4 & 0xF))) { + case SKIP: + poss.add(pos); + blocks.add(block); + break; + case CHECK: + poss.add(pos); + blocks.add(techHider.iBlockDataHidden(block) ? (BlockState) techHider.getObfuscationTarget() : block); + break; + default: + break; + } + } - BiFunction blockBreakHiderGenerator(Class blockBreakPacket, TechHider techHider); + if(blocks.isEmpty()) + return null; - BiFunction multiBlockChangeGenerator(TechHider techHider); + short[] newPos = new short[poss.size()]; + for(int i = 0; i < newPos.length; i++) + newPos[i] = poss.get(i); + + multiBlockChangePos.set(packet, newPos); + multiBlockChangeBlocks.set(packet, blocks.toArray(new BlockState[0])); + return packet; + }; + } + + private static final Reflection.Field tileEntityType = Reflection.getField(TechHider.tileEntityDataPacket, BlockEntityType.class, 0); + private static final BlockEntityType signType = Reflection.getField(BlockEntityType.class, BlockEntityType.class, 0, SignBlockEntity.class).get(null); + public boolean unfilteredTileEntityDataAction(Object packet) { + return tileEntityType.get(packet) != signType; + } + + public BiFunction blockBreakHiderGenerator(Class blockBreakPacket, TechHider techHider) { + return null; + } } diff --git a/SpigotCore/build.gradle.kts b/SpigotCore/build.gradle.kts index 22e65b20..88c99684 100644 --- a/SpigotCore/build.gradle.kts +++ b/SpigotCore/build.gradle.kts @@ -30,20 +30,4 @@ dependencies { api(project(":CommonCore")) api(project(":CommandFramework")) api(project(":SpigotCore:SpigotCore_Main")) - - implementation(project(":SpigotCore:SpigotCore_8")) - implementation(project(":SpigotCore:SpigotCore_9")) - implementation(project(":SpigotCore:SpigotCore_10")) - implementation(project(":SpigotCore:SpigotCore_12")) - implementation(project(":SpigotCore:SpigotCore_14")) - implementation(project(":SpigotCore:SpigotCore_15")) - implementation(project(":SpigotCore:SpigotCore_18")) - implementation(project(":SpigotCore:SpigotCore_19")) - implementation(project(":SpigotCore:SpigotCore_20")) - implementation(project(":SpigotCore:SpigotCore_21")) { - attributes { - // Very Hacky, but it works - attribute(TargetJvmVersion.TARGET_JVM_VERSION_ATTRIBUTE, 21) - } - } } diff --git a/settings.gradle.kts b/settings.gradle.kts index b6aead74..62a6bd03 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -219,16 +219,6 @@ include("SchematicSystem") include( "SpigotCore", "SpigotCore:CRIUDummy", - "SpigotCore:SpigotCore_8", - "SpigotCore:SpigotCore_9", - "SpigotCore:SpigotCore_10", - "SpigotCore:SpigotCore_12", - "SpigotCore:SpigotCore_14", - "SpigotCore:SpigotCore_15", - "SpigotCore:SpigotCore_18", - "SpigotCore:SpigotCore_19", - "SpigotCore:SpigotCore_20", - "SpigotCore:SpigotCore_21", "SpigotCore:SpigotCore_Main" )