Files
BluTac10-Xbox_Neo/Minecraft.Server.FourKit/Material.cs
itsRevela 42a582fb9f feat: add FourKit plugin host with dual server build
Adds the FourKit .NET 10 plugin host as a second dedicated server
build flavour alongside the existing vanilla server. Both flavours
build from the same source tree, with FourKit gated by the
MINECRAFT_SERVER_FOURKIT_BUILD preprocessor define.

Build layout:

  Minecraft.Server         vanilla, no plugin support, no .NET dep
  Minecraft.Server.FourKit FourKit-enabled, ships with bundled
                           .NET 10 self-contained runtime in runtime/
                           and an empty plugins/ folder

Both produce a Minecraft.Server.exe in their own per-target output
dir. The variant identity lives in the directory name, not the
binary name, so either flavour can be shipped as a drop-in.

Native bridge (Minecraft.Server/FourKit*.{cpp,h}):

* FourKitRuntime: hosts CoreCLR via hostfxr's command-line init API
  (the runtime-config API does not support self-contained components)
* FourKitBridge: ~50 Fire* event entry points, with inline no-op
  stubs for the standalone build so gameplay code can call them
  unconditionally
* FourKitNatives: ~80 native callbacks the managed side invokes
  for player/world/inventory mutations
* FourKitMappers: type and enum mapping helpers

Managed plugin host (Minecraft.Server.FourKit/):

* Bukkit-style API: Player, World, Block, Inventory, Command,
  Listener, EventHandler attribute, ~54 event classes
* PluginLoader with per-plugin AssemblyLoadContext
* FourKitHost as the [UnmanagedCallersOnly] entry point table
* Runtime resolves plugins relative to the host process so they
  always live next to Minecraft.Server.exe regardless of where the
  managed assembly itself is loaded from

Engine hooks (Minecraft.Client/, Minecraft.World/):

* Player lifecycle (PreLogin, Login, Join, Quit, Kick, Move,
  Teleport, Portal, Death) wired into PendingConnection and
  PlayerConnection without disturbing the cipher handshake or
  identity-token security flow
* Inventory open/click/drop hooks across every container menu type
* Block place/break/grow/burn/spread/from-to hooks across the
  full tile family
* Bed enter/leave, sign change, entity damage/death, ender pearl
  teleport hooks

Regression fixes preserved while applying donor diffs:

* ServerPlayer::die() retains the LCE-Revelations hardcore branch
  (setGameMode(ADVENTURE) + banPlayerForHardcoreDeath) in both the
  FourKit and non-FourKit code paths
* ServerLevel::entityAdded() retains the sub-entity ID reassignment
  loop required by the client's handleAddMob offset, fixing Ender
  Dragon and Wither boss multi-part hit detection
* LivingEntity::travel() retains the raw Player* cast and the
  cached frictionTile, both Revelations perf wins that the donor
  silently reverted
* ServerLogger.cpp keeps the file-logging code donor stripped
* PlayerList.cpp end portal transition fix and UIScene_EndPoem
  bounds-check are intact

Build system:

* Top-level CMakeLists.txt adds the Minecraft.Server.FourKit
  subdirectory and pulls in the new shared cmake/ServerTarget.cmake
  helper
* Minecraft.Server/cmake/sources/Common.cmake is now location
  independent (uses CMAKE_CURRENT_LIST_DIR) so the source list
  can be consumed from either server target's CMakeLists.txt
* The seven FourKit*.cpp/h files live in their own
  _MINECRAFT_SERVER_COMMON_SERVER_FOURKIT variable so the
  standalone target omits them
* configure-time .NET 10 SDK check fails fast with a clear
  download link if the SDK is missing
* global.json pins the SDK to 10.0.100 with latestFeature
  rollforward

Sample plugin (samples/HelloPlugin/) demonstrates the loader and
the PlayerJoinEvent listener pattern.

CI:

* nightly.yml builds both server flavours, ships
  LCE-Revelations-Server-Win64.zip and
  LCE-Revelations-Server-Win64-FourKit.zip, attests both, and
  updates release notes for the dual-flavour layout
* pull-request.yml pulls in actions/setup-dotnet so the FourKit
  publish step works in PR validation
* All zip artifacts and the client zip are renamed from
  LCREWindows64 to LCE-Revelations-{Client,Server}-Win64

Documentation:

* COMPILE.md gets a VS 2022 quick start, .NET 10 prereq section,
  server flavours explanation, and a troubleshooting section
* docs/FOURKIT_PORT_RECON.md captures the file-by-file recon that
  drove the port
* docs/FOURKIT_PARITY.md is the canonical reference for which
  events FourKit fires

Docker:

* docker-compose.dedicated-server.yml MC_RUNTIME_DIR default points
  at the vanilla CMake output. The FourKit Docker image is
  intentionally NOT shipped yet because hosting .NET 10 self
  contained inside Wine has not been smoke-tested
2026-04-08 03:02:48 -05:00

344 lines
7.3 KiB
C#

namespace Minecraft.Server.FourKit;
/// <summary>
/// An enum of all material IDs accepted by the official server and client.
/// </summary>
public enum Material
{
AIR = 0,
STONE = 1,
GRASS = 2,
DIRT = 3,
COBBLESTONE = 4,
WOOD = 5,
SAPLING = 6,
BEDROCK = 7,
WATER = 8,
STATIONARY_WATER = 9,
LAVA = 10,
STATIONARY_LAVA = 11,
SAND = 12,
GRAVEL = 13,
GOLD_ORE = 14,
IRON_ORE = 15,
COAL_ORE = 16,
LOG = 17,
LEAVES = 18,
SPONGE = 19,
GLASS = 20,
LAPIS_ORE = 21,
LAPIS_BLOCK = 22,
DISPENSER = 23,
SANDSTONE = 24,
NOTE_BLOCK = 25,
BED_BLOCK = 26,
POWERED_RAIL = 27,
DETECTOR_RAIL = 28,
PISTON_STICKY_BASE = 29,
WEB = 30,
LONG_GRASS = 31,
DEAD_BUSH = 32,
PISTON_BASE = 33,
PISTON_EXTENSION = 34,
WOOL = 35,
PISTON_MOVING_PIECE = 36,
YELLOW_FLOWER = 37,
RED_ROSE = 38,
BROWN_MUSHROOM = 39,
RED_MUSHROOM = 40,
GOLD_BLOCK = 41,
IRON_BLOCK = 42,
DOUBLE_STEP = 43,
STEP = 44,
BRICK = 45,
TNT = 46,
BOOKSHELF = 47,
MOSSY_COBBLESTONE = 48,
OBSIDIAN = 49,
TORCH = 50,
FIRE = 51,
MOB_SPAWNER = 52,
WOOD_STAIRS = 53,
CHEST = 54,
REDSTONE_WIRE = 55,
DIAMOND_ORE = 56,
DIAMOND_BLOCK = 57,
WORKBENCH = 58,
CROPS = 59,
SOIL = 60,
FURNACE = 61,
BURNING_FURNACE = 62,
SIGN_POST = 63,
WOODEN_DOOR = 64,
LADDER = 65,
RAILS = 66,
COBBLESTONE_STAIRS = 67,
WALL_SIGN = 68,
LEVER = 69,
STONE_PLATE = 70,
IRON_DOOR_BLOCK = 71,
WOOD_PLATE = 72,
REDSTONE_ORE = 73,
GLOWING_REDSTONE_ORE = 74,
REDSTONE_TORCH_OFF = 75,
REDSTONE_TORCH_ON = 76,
STONE_BUTTON = 77,
SNOW = 78,
ICE = 79,
SNOW_BLOCK = 80,
CACTUS = 81,
CLAY = 82,
SUGAR_CANE_BLOCK = 83,
JUKEBOX = 84,
FENCE = 85,
PUMPKIN = 86,
NETHERRACK = 87,
SOUL_SAND = 88,
GLOWSTONE = 89,
PORTAL = 90,
JACK_O_LANTERN = 91,
CAKE_BLOCK = 92,
DIODE_BLOCK_OFF = 93,
DIODE_BLOCK_ON = 94,
STAINED_GLASS = 95,
TRAP_DOOR = 96,
MONSTER_EGGS = 97,
SMOOTH_BRICK = 98,
HUGE_MUSHROOM_1 = 99,
HUGE_MUSHROOM_2 = 100,
IRON_FENCE = 101,
THIN_GLASS = 102,
MELON_BLOCK = 103,
PUMPKIN_STEM = 104,
MELON_STEM = 105,
VINE = 106,
FENCE_GATE = 107,
BRICK_STAIRS = 108,
SMOOTH_STAIRS = 109,
MYCEL = 110,
WATER_LILY = 111,
NETHER_BRICK = 112,
NETHER_FENCE = 113,
NETHER_BRICK_STAIRS = 114,
NETHER_WARTS = 115,
ENCHANTMENT_TABLE = 116,
BREWING_STAND = 117,
CAULDRON = 118,
ENDER_PORTAL = 119,
ENDER_PORTAL_FRAME = 120,
ENDER_STONE = 121,
DRAGON_EGG = 122,
REDSTONE_LAMP_OFF = 123,
REDSTONE_LAMP_ON = 124,
WOOD_DOUBLE_STEP = 125,
WOOD_STEP = 126,
COCOA = 127,
SANDSTONE_STAIRS = 128,
EMERALD_ORE = 129,
ENDER_CHEST = 130,
TRIPWIRE_HOOK = 131,
TRIPWIRE = 132,
EMERALD_BLOCK = 133,
SPRUCE_WOOD_STAIRS = 134,
BIRCH_WOOD_STAIRS = 135,
JUNGLE_WOOD_STAIRS = 136,
COMMAND = 137,
BEACON = 138,
COBBLE_WALL = 139,
FLOWER_POT = 140,
CARROT = 141,
POTATO = 142,
WOOD_BUTTON = 143,
SKULL = 144,
ANVIL = 145,
TRAPPED_CHEST = 146,
GOLD_PLATE = 147,
IRON_PLATE = 148,
REDSTONE_COMPARATOR_OFF = 149,
REDSTONE_COMPARATOR_ON = 150,
DAYLIGHT_DETECTOR = 151,
REDSTONE_BLOCK = 152,
QUARTZ_ORE = 153,
HOPPER = 154,
QUARTZ_BLOCK = 155,
QUARTZ_STAIRS = 156,
ACTIVATOR_RAIL = 157,
DROPPER = 158,
STAINED_CLAY = 159,
STAINED_GLASS_PANE = 160,
HAY_BLOCK = 170,
CARPET = 171,
HARD_CLAY = 172,
COAL_BLOCK = 173,
// items
IRON_SPADE = 256,
IRON_PICKAXE = 257,
IRON_AXE = 258,
FLINT_AND_STEEL = 259,
APPLE = 260,
BOW = 261,
ARROW = 262,
COAL_ITEM = 263,
DIAMOND = 264,
IRON_INGOT = 265,
GOLD_INGOT = 266,
IRON_SWORD = 267,
WOOD_SWORD = 268,
WOOD_SPADE = 269,
WOOD_PICKAXE = 270,
WOOD_AXE = 271,
STONE_SWORD = 272,
STONE_SPADE = 273,
STONE_PICKAXE = 274,
STONE_AXE = 275,
DIAMOND_SWORD = 276,
DIAMOND_SPADE = 277,
DIAMOND_PICKAXE = 278,
DIAMOND_AXE = 279,
STICK = 280,
BOWL = 281,
MUSHROOM_SOUP = 282,
GOLD_SWORD = 283,
GOLD_SPADE = 284,
GOLD_PICKAXE = 285,
GOLD_AXE = 286,
STRING = 287,
FEATHER = 288,
SULPHUR = 289,
WOOD_HOE = 290,
STONE_HOE = 291,
IRON_HOE = 292,
DIAMOND_HOE = 293,
GOLD_HOE = 294,
SEEDS = 295,
WHEAT = 296,
BREAD = 297,
LEATHER_HELMET = 298,
LEATHER_CHESTPLATE = 299,
LEATHER_LEGGINGS = 300,
LEATHER_BOOTS = 301,
CHAINMAIL_HELMET = 302,
CHAINMAIL_CHESTPLATE = 303,
CHAINMAIL_LEGGINGS = 304,
CHAINMAIL_BOOTS = 305,
IRON_HELMET = 306,
IRON_CHESTPLATE = 307,
IRON_LEGGINGS = 308,
IRON_BOOTS = 309,
DIAMOND_HELMET = 310,
DIAMOND_CHESTPLATE = 311,
DIAMOND_LEGGINGS = 312,
DIAMOND_BOOTS = 313,
GOLD_HELMET = 314,
GOLD_CHESTPLATE = 315,
GOLD_LEGGINGS = 316,
GOLD_BOOTS = 317,
FLINT = 318,
PORK = 319,
GRILLED_PORK = 320,
PAINTING = 321,
GOLDEN_APPLE = 322,
SIGN = 323,
WOOD_DOOR = 324,
BUCKET = 325,
WATER_BUCKET = 326,
LAVA_BUCKET = 327,
MINECART = 328,
SADDLE = 329,
IRON_DOOR = 330,
REDSTONE = 331,
SNOW_BALL = 332,
BOAT = 333,
LEATHER = 334,
MILK_BUCKET = 335,
CLAY_BRICK = 336,
CLAY_BALL = 337,
SUGAR_CANE = 338,
PAPER = 339,
BOOK = 340,
SLIME_BALL = 341,
STORAGE_MINECART = 342,
POWERED_MINECART = 343,
EGG = 344,
COMPASS = 345,
FISHING_ROD = 346,
WATCH = 347,
GLOWSTONE_DUST = 348,
RAW_FISH = 349,
COOKED_FISH = 350,
INK_SACK = 351,
BONE = 352,
SUGAR = 353,
CAKE = 354,
BED = 355,
DIODE = 356,
COOKIE = 357,
MAP = 358,
SHEARS = 359,
MELON = 360,
PUMPKIN_SEEDS = 361,
MELON_SEEDS = 362,
RAW_BEEF = 363,
COOKED_BEEF = 364,
RAW_CHICKEN = 365,
COOKED_CHICKEN = 366,
ROTTEN_FLESH = 367,
ENDER_PEARL = 368,
BLAZE_ROD = 369,
GHAST_TEAR = 370,
GOLD_NUGGET = 371,
NETHER_STALK = 372,
POTION = 373,
GLASS_BOTTLE = 374,
SPIDER_EYE = 375,
FERMENTED_SPIDER_EYE = 376,
BLAZE_POWDER = 377,
MAGMA_CREAM = 378,
BREWING_STAND_ITEM = 379,
CAULDRON_ITEM = 380,
EYE_OF_ENDER = 381,
SPECKLED_MELON = 382,
MONSTER_EGG = 383,
EXP_BOTTLE = 384,
FIREBALL = 385,
EMERALD = 388,
ITEM_FRAME = 389,
FLOWER_POT_ITEM = 390,
CARROT_ITEM = 391,
POTATO_ITEM = 392,
BAKED_POTATO = 393,
POISONOUS_POTATO = 394,
EMPTY_MAP = 395,
GOLDEN_CARROT = 396,
SKULL_ITEM = 397,
CARROT_STICK = 398,
NETHER_STAR = 399,
PUMPKIN_PIE = 400,
FIREWORK = 401,
FIREWORK_CHARGE = 402,
ENCHANTED_BOOK = 403,
REDSTONE_COMPARATOR = 404,
NETHER_BRICK_ITEM = 405,
QUARTZ = 406,
EXPLOSIVE_MINECART = 407,
HOPPER_MINECART = 408,
IRON_BARDING = 417,
GOLD_BARDING = 418,
DIAMOND_BARDING = 419,
LEASH = 420,
NAME_TAG = 421,
GOLD_RECORD = 2256,
GREEN_RECORD = 2257,
RECORD_3 = 2258,
RECORD_4 = 2259,
RECORD_5 = 2260,
RECORD_6 = 2261,
RECORD_7 = 2262,
RECORD_9 = 2263,
RECORD_10 = 2264,
RECORD_11 = 2265,
RECORD_12 = 2266,
RECORD_8 = 2267,
}