diff --git a/level/block/block.go b/level/block/block.go index ac7642e..8b759e1 100644 --- a/level/block/block.go +++ b/level/block/block.go @@ -2,7 +2,7 @@ package block import ( "bytes" - "compress/zlib" + "compress/gzip" _ "embed" "fmt" "math/bits" @@ -14,7 +14,7 @@ type Block interface { ID() string } -// This file stores all possible block states into a TAG_List with zlib compressed. +// This file stores all possible block states into a TAG_List with gzip compressed. //go:embed block_states.nbt var blockStates []byte @@ -33,7 +33,7 @@ type State struct { func init() { var states []State // decompress - z, err := zlib.NewReader(bytes.NewReader(blockStates)) + z, err := gzip.NewReader(bytes.NewReader(blockStates)) if err != nil { panic(err) } diff --git a/level/block/block_states.nbt b/level/block/block_states.nbt index b47edb9..3deaa3b 100644 Binary files a/level/block/block_states.nbt and b/level/block/block_states.nbt differ diff --git a/level/block/blocks.go b/level/block/blocks.go index f9a1196..c427625 100644 --- a/level/block/blocks.go +++ b/level/block/blocks.go @@ -1,4 +1,4 @@ -// Code generated by generator/main.go; DO NOT EDIT. +// Code generated by generator/blocks/main.go; DO NOT EDIT. package block type Air struct{} @@ -174,145 +174,145 @@ type NetherGoldOre struct{} func (NetherGoldOre) ID() string { return "minecraft:nether_gold_ore" } type OakLog struct { - Axis string `nbt:"axis"` + Axis Axis `nbt:"axis"` } func (OakLog) ID() string { return "minecraft:oak_log" } type SpruceLog struct { - Axis string `nbt:"axis"` + Axis Axis `nbt:"axis"` } func (SpruceLog) ID() string { return "minecraft:spruce_log" } type BirchLog struct { - Axis string `nbt:"axis"` + Axis Axis `nbt:"axis"` } func (BirchLog) ID() string { return "minecraft:birch_log" } type JungleLog struct { - Axis string `nbt:"axis"` + Axis Axis `nbt:"axis"` } func (JungleLog) ID() string { return "minecraft:jungle_log" } type AcaciaLog struct { - Axis string `nbt:"axis"` + Axis Axis `nbt:"axis"` } func (AcaciaLog) ID() string { return "minecraft:acacia_log" } type DarkOakLog struct { - Axis string `nbt:"axis"` + Axis Axis `nbt:"axis"` } func (DarkOakLog) ID() string { return "minecraft:dark_oak_log" } type StrippedSpruceLog struct { - Axis string `nbt:"axis"` + Axis Axis `nbt:"axis"` } func (StrippedSpruceLog) ID() string { return "minecraft:stripped_spruce_log" } type StrippedBirchLog struct { - Axis string `nbt:"axis"` + Axis Axis `nbt:"axis"` } func (StrippedBirchLog) ID() string { return "minecraft:stripped_birch_log" } type StrippedJungleLog struct { - Axis string `nbt:"axis"` + Axis Axis `nbt:"axis"` } func (StrippedJungleLog) ID() string { return "minecraft:stripped_jungle_log" } type StrippedAcaciaLog struct { - Axis string `nbt:"axis"` + Axis Axis `nbt:"axis"` } func (StrippedAcaciaLog) ID() string { return "minecraft:stripped_acacia_log" } type StrippedDarkOakLog struct { - Axis string `nbt:"axis"` + Axis Axis `nbt:"axis"` } func (StrippedDarkOakLog) ID() string { return "minecraft:stripped_dark_oak_log" } type StrippedOakLog struct { - Axis string `nbt:"axis"` + Axis Axis `nbt:"axis"` } func (StrippedOakLog) ID() string { return "minecraft:stripped_oak_log" } type OakWood struct { - Axis string `nbt:"axis"` + Axis Axis `nbt:"axis"` } func (OakWood) ID() string { return "minecraft:oak_wood" } type SpruceWood struct { - Axis string `nbt:"axis"` + Axis Axis `nbt:"axis"` } func (SpruceWood) ID() string { return "minecraft:spruce_wood" } type BirchWood struct { - Axis string `nbt:"axis"` + Axis Axis `nbt:"axis"` } func (BirchWood) ID() string { return "minecraft:birch_wood" } type JungleWood struct { - Axis string `nbt:"axis"` + Axis Axis `nbt:"axis"` } func (JungleWood) ID() string { return "minecraft:jungle_wood" } type AcaciaWood struct { - Axis string `nbt:"axis"` + Axis Axis `nbt:"axis"` } func (AcaciaWood) ID() string { return "minecraft:acacia_wood" } type DarkOakWood struct { - Axis string `nbt:"axis"` + Axis Axis `nbt:"axis"` } func (DarkOakWood) ID() string { return "minecraft:dark_oak_wood" } type StrippedOakWood struct { - Axis string `nbt:"axis"` + Axis Axis `nbt:"axis"` } func (StrippedOakWood) ID() string { return "minecraft:stripped_oak_wood" } type StrippedSpruceWood struct { - Axis string `nbt:"axis"` + Axis Axis `nbt:"axis"` } func (StrippedSpruceWood) ID() string { return "minecraft:stripped_spruce_wood" } type StrippedBirchWood struct { - Axis string `nbt:"axis"` + Axis Axis `nbt:"axis"` } func (StrippedBirchWood) ID() string { return "minecraft:stripped_birch_wood" } type StrippedJungleWood struct { - Axis string `nbt:"axis"` + Axis Axis `nbt:"axis"` } func (StrippedJungleWood) ID() string { return "minecraft:stripped_jungle_wood" } type StrippedAcaciaWood struct { - Axis string `nbt:"axis"` + Axis Axis `nbt:"axis"` } func (StrippedAcaciaWood) ID() string { return "minecraft:stripped_acacia_wood" } type StrippedDarkOakWood struct { - Axis string `nbt:"axis"` + Axis Axis `nbt:"axis"` } func (StrippedDarkOakWood) ID() string { return "minecraft:stripped_dark_oak_wood" } @@ -417,9 +417,9 @@ type CutSandstone struct{} func (CutSandstone) ID() string { return "minecraft:cut_sandstone" } type NoteBlock struct { - Instrument string `nbt:"instrument"` - Note Integer `nbt:"note"` - Powered Boolean `nbt:"powered"` + Instrument NoteBlockInstrument `nbt:"instrument"` + Note Integer `nbt:"note"` + Powered Boolean `nbt:"powered"` } func (NoteBlock) ID() string { return "minecraft:note_block" } @@ -427,7 +427,7 @@ func (NoteBlock) ID() string { return "minecraft:note_block" } type WhiteBed struct { Facing Direction `nbt:"facing"` Occupied Boolean `nbt:"occupied"` - Part string `nbt:"part"` + Part BedPart `nbt:"part"` } func (WhiteBed) ID() string { return "minecraft:white_bed" } @@ -435,7 +435,7 @@ func (WhiteBed) ID() string { return "minecraft:white_bed" } type OrangeBed struct { Facing Direction `nbt:"facing"` Occupied Boolean `nbt:"occupied"` - Part string `nbt:"part"` + Part BedPart `nbt:"part"` } func (OrangeBed) ID() string { return "minecraft:orange_bed" } @@ -443,7 +443,7 @@ func (OrangeBed) ID() string { return "minecraft:orange_bed" } type MagentaBed struct { Facing Direction `nbt:"facing"` Occupied Boolean `nbt:"occupied"` - Part string `nbt:"part"` + Part BedPart `nbt:"part"` } func (MagentaBed) ID() string { return "minecraft:magenta_bed" } @@ -451,7 +451,7 @@ func (MagentaBed) ID() string { return "minecraft:magenta_bed" } type LightBlueBed struct { Facing Direction `nbt:"facing"` Occupied Boolean `nbt:"occupied"` - Part string `nbt:"part"` + Part BedPart `nbt:"part"` } func (LightBlueBed) ID() string { return "minecraft:light_blue_bed" } @@ -459,7 +459,7 @@ func (LightBlueBed) ID() string { return "minecraft:light_blue_bed" } type YellowBed struct { Facing Direction `nbt:"facing"` Occupied Boolean `nbt:"occupied"` - Part string `nbt:"part"` + Part BedPart `nbt:"part"` } func (YellowBed) ID() string { return "minecraft:yellow_bed" } @@ -467,7 +467,7 @@ func (YellowBed) ID() string { return "minecraft:yellow_bed" } type LimeBed struct { Facing Direction `nbt:"facing"` Occupied Boolean `nbt:"occupied"` - Part string `nbt:"part"` + Part BedPart `nbt:"part"` } func (LimeBed) ID() string { return "minecraft:lime_bed" } @@ -475,7 +475,7 @@ func (LimeBed) ID() string { return "minecraft:lime_bed" } type PinkBed struct { Facing Direction `nbt:"facing"` Occupied Boolean `nbt:"occupied"` - Part string `nbt:"part"` + Part BedPart `nbt:"part"` } func (PinkBed) ID() string { return "minecraft:pink_bed" } @@ -483,7 +483,7 @@ func (PinkBed) ID() string { return "minecraft:pink_bed" } type GrayBed struct { Facing Direction `nbt:"facing"` Occupied Boolean `nbt:"occupied"` - Part string `nbt:"part"` + Part BedPart `nbt:"part"` } func (GrayBed) ID() string { return "minecraft:gray_bed" } @@ -491,7 +491,7 @@ func (GrayBed) ID() string { return "minecraft:gray_bed" } type LightGrayBed struct { Facing Direction `nbt:"facing"` Occupied Boolean `nbt:"occupied"` - Part string `nbt:"part"` + Part BedPart `nbt:"part"` } func (LightGrayBed) ID() string { return "minecraft:light_gray_bed" } @@ -499,7 +499,7 @@ func (LightGrayBed) ID() string { return "minecraft:light_gray_bed" } type CyanBed struct { Facing Direction `nbt:"facing"` Occupied Boolean `nbt:"occupied"` - Part string `nbt:"part"` + Part BedPart `nbt:"part"` } func (CyanBed) ID() string { return "minecraft:cyan_bed" } @@ -507,7 +507,7 @@ func (CyanBed) ID() string { return "minecraft:cyan_bed" } type PurpleBed struct { Facing Direction `nbt:"facing"` Occupied Boolean `nbt:"occupied"` - Part string `nbt:"part"` + Part BedPart `nbt:"part"` } func (PurpleBed) ID() string { return "minecraft:purple_bed" } @@ -515,7 +515,7 @@ func (PurpleBed) ID() string { return "minecraft:purple_bed" } type BlueBed struct { Facing Direction `nbt:"facing"` Occupied Boolean `nbt:"occupied"` - Part string `nbt:"part"` + Part BedPart `nbt:"part"` } func (BlueBed) ID() string { return "minecraft:blue_bed" } @@ -523,7 +523,7 @@ func (BlueBed) ID() string { return "minecraft:blue_bed" } type BrownBed struct { Facing Direction `nbt:"facing"` Occupied Boolean `nbt:"occupied"` - Part string `nbt:"part"` + Part BedPart `nbt:"part"` } func (BrownBed) ID() string { return "minecraft:brown_bed" } @@ -531,7 +531,7 @@ func (BrownBed) ID() string { return "minecraft:brown_bed" } type GreenBed struct { Facing Direction `nbt:"facing"` Occupied Boolean `nbt:"occupied"` - Part string `nbt:"part"` + Part BedPart `nbt:"part"` } func (GreenBed) ID() string { return "minecraft:green_bed" } @@ -539,7 +539,7 @@ func (GreenBed) ID() string { return "minecraft:green_bed" } type RedBed struct { Facing Direction `nbt:"facing"` Occupied Boolean `nbt:"occupied"` - Part string `nbt:"part"` + Part BedPart `nbt:"part"` } func (RedBed) ID() string { return "minecraft:red_bed" } @@ -547,23 +547,23 @@ func (RedBed) ID() string { return "minecraft:red_bed" } type BlackBed struct { Facing Direction `nbt:"facing"` Occupied Boolean `nbt:"occupied"` - Part string `nbt:"part"` + Part BedPart `nbt:"part"` } func (BlackBed) ID() string { return "minecraft:black_bed" } type PoweredRail struct { - Powered Boolean `nbt:"powered"` - Shape string `nbt:"shape"` - Waterlogged Boolean `nbt:"waterlogged"` + Powered Boolean `nbt:"powered"` + Shape RailShape `nbt:"shape"` + Waterlogged Boolean `nbt:"waterlogged"` } func (PoweredRail) ID() string { return "minecraft:powered_rail" } type DetectorRail struct { - Powered Boolean `nbt:"powered"` - Shape string `nbt:"shape"` - Waterlogged Boolean `nbt:"waterlogged"` + Powered Boolean `nbt:"powered"` + Shape RailShape `nbt:"shape"` + Waterlogged Boolean `nbt:"waterlogged"` } func (DetectorRail) ID() string { return "minecraft:detector_rail" } @@ -596,7 +596,7 @@ type Seagrass struct{} func (Seagrass) ID() string { return "minecraft:seagrass" } type TallSeagrass struct { - Half string `nbt:"half"` + Half DoubleBlockHalf `nbt:"half"` } func (TallSeagrass) ID() string { return "minecraft:tall_seagrass" } @@ -609,9 +609,9 @@ type Piston struct { func (Piston) ID() string { return "minecraft:piston" } type PistonHead struct { - Facing Direction `nbt:"facing"` - Short Boolean `nbt:"short"` - Type string `nbt:"type"` + Facing Direction `nbt:"facing"` + Short Boolean `nbt:"short"` + Type PistonType `nbt:"type"` } func (PistonHead) ID() string { return "minecraft:piston_head" } @@ -681,8 +681,8 @@ type BlackWool struct{} func (BlackWool) ID() string { return "minecraft:black_wool" } type MovingPiston struct { - Facing Direction `nbt:"facing"` - Type string `nbt:"type"` + Facing Direction `nbt:"facing"` + Type PistonType `nbt:"type"` } func (MovingPiston) ID() string { return "minecraft:moving_piston" } @@ -807,28 +807,28 @@ type Spawner struct{} func (Spawner) ID() string { return "minecraft:spawner" } type OakStairs struct { - Facing Direction `nbt:"facing"` - Half string `nbt:"half"` - Shape string `nbt:"shape"` - Waterlogged Boolean `nbt:"waterlogged"` + Facing Direction `nbt:"facing"` + Half Half `nbt:"half"` + Shape StairsShape `nbt:"shape"` + Waterlogged Boolean `nbt:"waterlogged"` } func (OakStairs) ID() string { return "minecraft:oak_stairs" } type Chest struct { Facing Direction `nbt:"facing"` - Type string `nbt:"type"` + Type ChestType `nbt:"type"` Waterlogged Boolean `nbt:"waterlogged"` } func (Chest) ID() string { return "minecraft:chest" } type RedstoneWire struct { - East string `nbt:"east"` - North string `nbt:"north"` - Power Integer `nbt:"power"` - South string `nbt:"south"` - West string `nbt:"west"` + East RedstoneSide `nbt:"east"` + North RedstoneSide `nbt:"north"` + Power Integer `nbt:"power"` + South RedstoneSide `nbt:"south"` + West RedstoneSide `nbt:"west"` } func (RedstoneWire) ID() string { return "minecraft:redstone_wire" } @@ -911,11 +911,11 @@ type DarkOakSign struct { func (DarkOakSign) ID() string { return "minecraft:dark_oak_sign" } type OakDoor struct { - Facing Direction `nbt:"facing"` - Half string `nbt:"half"` - Hinge string `nbt:"hinge"` - Open Boolean `nbt:"open"` - Powered Boolean `nbt:"powered"` + Facing Direction `nbt:"facing"` + Half DoubleBlockHalf `nbt:"half"` + Hinge DoorHingeSide `nbt:"hinge"` + Open Boolean `nbt:"open"` + Powered Boolean `nbt:"powered"` } func (OakDoor) ID() string { return "minecraft:oak_door" } @@ -928,17 +928,17 @@ type Ladder struct { func (Ladder) ID() string { return "minecraft:ladder" } type Rail struct { - Shape string `nbt:"shape"` - Waterlogged Boolean `nbt:"waterlogged"` + Shape RailShape `nbt:"shape"` + Waterlogged Boolean `nbt:"waterlogged"` } func (Rail) ID() string { return "minecraft:rail" } type CobblestoneStairs struct { - Facing Direction `nbt:"facing"` - Half string `nbt:"half"` - Shape string `nbt:"shape"` - Waterlogged Boolean `nbt:"waterlogged"` + Facing Direction `nbt:"facing"` + Half Half `nbt:"half"` + Shape StairsShape `nbt:"shape"` + Waterlogged Boolean `nbt:"waterlogged"` } func (CobblestoneStairs) ID() string { return "minecraft:cobblestone_stairs" } @@ -986,9 +986,9 @@ type DarkOakWallSign struct { func (DarkOakWallSign) ID() string { return "minecraft:dark_oak_wall_sign" } type Lever struct { - Face string `nbt:"face"` - Facing Direction `nbt:"facing"` - Powered Boolean `nbt:"powered"` + Face AttachFace `nbt:"face"` + Facing Direction `nbt:"facing"` + Powered Boolean `nbt:"powered"` } func (Lever) ID() string { return "minecraft:lever" } @@ -1000,11 +1000,11 @@ type StonePressurePlate struct { func (StonePressurePlate) ID() string { return "minecraft:stone_pressure_plate" } type IronDoor struct { - Facing Direction `nbt:"facing"` - Half string `nbt:"half"` - Hinge string `nbt:"hinge"` - Open Boolean `nbt:"open"` - Powered Boolean `nbt:"powered"` + Facing Direction `nbt:"facing"` + Half DoubleBlockHalf `nbt:"half"` + Hinge DoorHingeSide `nbt:"hinge"` + Open Boolean `nbt:"open"` + Powered Boolean `nbt:"powered"` } func (IronDoor) ID() string { return "minecraft:iron_door" } @@ -1071,9 +1071,9 @@ type RedstoneWallTorch struct { func (RedstoneWallTorch) ID() string { return "minecraft:redstone_wall_torch" } type StoneButton struct { - Face string `nbt:"face"` - Facing Direction `nbt:"facing"` - Powered Boolean `nbt:"powered"` + Face AttachFace `nbt:"face"` + Facing Direction `nbt:"facing"` + Powered Boolean `nbt:"powered"` } func (StoneButton) ID() string { return "minecraft:stone_button" } @@ -1141,13 +1141,13 @@ type SoulSoil struct{} func (SoulSoil) ID() string { return "minecraft:soul_soil" } type Basalt struct { - Axis string `nbt:"axis"` + Axis Axis `nbt:"axis"` } func (Basalt) ID() string { return "minecraft:basalt" } type PolishedBasalt struct { - Axis string `nbt:"axis"` + Axis Axis `nbt:"axis"` } func (PolishedBasalt) ID() string { return "minecraft:polished_basalt" } @@ -1167,7 +1167,7 @@ type Glowstone struct{} func (Glowstone) ID() string { return "minecraft:glowstone" } type NetherPortal struct { - Axis string `nbt:"axis"` + Axis Axis `nbt:"axis"` } func (NetherPortal) ID() string { return "minecraft:nether_portal" } @@ -1265,7 +1265,7 @@ func (BlackStainedGlass) ID() string { return "minecraft:black_stained_glass" } type OakTrapdoor struct { Facing Direction `nbt:"facing"` - Half string `nbt:"half"` + Half Half `nbt:"half"` Open Boolean `nbt:"open"` Powered Boolean `nbt:"powered"` Waterlogged Boolean `nbt:"waterlogged"` @@ -1275,7 +1275,7 @@ func (OakTrapdoor) ID() string { return "minecraft:oak_trapdoor" } type SpruceTrapdoor struct { Facing Direction `nbt:"facing"` - Half string `nbt:"half"` + Half Half `nbt:"half"` Open Boolean `nbt:"open"` Powered Boolean `nbt:"powered"` Waterlogged Boolean `nbt:"waterlogged"` @@ -1285,7 +1285,7 @@ func (SpruceTrapdoor) ID() string { return "minecraft:spruce_trapdoor" } type BirchTrapdoor struct { Facing Direction `nbt:"facing"` - Half string `nbt:"half"` + Half Half `nbt:"half"` Open Boolean `nbt:"open"` Powered Boolean `nbt:"powered"` Waterlogged Boolean `nbt:"waterlogged"` @@ -1295,7 +1295,7 @@ func (BirchTrapdoor) ID() string { return "minecraft:birch_trapdoor" } type JungleTrapdoor struct { Facing Direction `nbt:"facing"` - Half string `nbt:"half"` + Half Half `nbt:"half"` Open Boolean `nbt:"open"` Powered Boolean `nbt:"powered"` Waterlogged Boolean `nbt:"waterlogged"` @@ -1305,7 +1305,7 @@ func (JungleTrapdoor) ID() string { return "minecraft:jungle_trapdoor" } type AcaciaTrapdoor struct { Facing Direction `nbt:"facing"` - Half string `nbt:"half"` + Half Half `nbt:"half"` Open Boolean `nbt:"open"` Powered Boolean `nbt:"powered"` Waterlogged Boolean `nbt:"waterlogged"` @@ -1315,7 +1315,7 @@ func (AcaciaTrapdoor) ID() string { return "minecraft:acacia_trapdoor" } type DarkOakTrapdoor struct { Facing Direction `nbt:"facing"` - Half string `nbt:"half"` + Half Half `nbt:"half"` Open Boolean `nbt:"open"` Powered Boolean `nbt:"powered"` Waterlogged Boolean `nbt:"waterlogged"` @@ -1407,7 +1407,7 @@ type IronBars struct { func (IronBars) ID() string { return "minecraft:iron_bars" } type Chain struct { - Axis string `nbt:"axis"` + Axis Axis `nbt:"axis"` Waterlogged Boolean `nbt:"waterlogged"` } @@ -1483,19 +1483,19 @@ type OakFenceGate struct { func (OakFenceGate) ID() string { return "minecraft:oak_fence_gate" } type BrickStairs struct { - Facing Direction `nbt:"facing"` - Half string `nbt:"half"` - Shape string `nbt:"shape"` - Waterlogged Boolean `nbt:"waterlogged"` + Facing Direction `nbt:"facing"` + Half Half `nbt:"half"` + Shape StairsShape `nbt:"shape"` + Waterlogged Boolean `nbt:"waterlogged"` } func (BrickStairs) ID() string { return "minecraft:brick_stairs" } type StoneBrickStairs struct { - Facing Direction `nbt:"facing"` - Half string `nbt:"half"` - Shape string `nbt:"shape"` - Waterlogged Boolean `nbt:"waterlogged"` + Facing Direction `nbt:"facing"` + Half Half `nbt:"half"` + Shape StairsShape `nbt:"shape"` + Waterlogged Boolean `nbt:"waterlogged"` } func (StoneBrickStairs) ID() string { return "minecraft:stone_brick_stairs" } @@ -1525,10 +1525,10 @@ type NetherBrickFence struct { func (NetherBrickFence) ID() string { return "minecraft:nether_brick_fence" } type NetherBrickStairs struct { - Facing Direction `nbt:"facing"` - Half string `nbt:"half"` - Shape string `nbt:"shape"` - Waterlogged Boolean `nbt:"waterlogged"` + Facing Direction `nbt:"facing"` + Half Half `nbt:"half"` + Shape StairsShape `nbt:"shape"` + Waterlogged Boolean `nbt:"waterlogged"` } func (NetherBrickStairs) ID() string { return "minecraft:nether_brick_stairs" } @@ -1604,10 +1604,10 @@ type Cocoa struct { func (Cocoa) ID() string { return "minecraft:cocoa" } type SandstoneStairs struct { - Facing Direction `nbt:"facing"` - Half string `nbt:"half"` - Shape string `nbt:"shape"` - Waterlogged Boolean `nbt:"waterlogged"` + Facing Direction `nbt:"facing"` + Half Half `nbt:"half"` + Shape StairsShape `nbt:"shape"` + Waterlogged Boolean `nbt:"waterlogged"` } func (SandstoneStairs) ID() string { return "minecraft:sandstone_stairs" } @@ -1652,28 +1652,28 @@ type EmeraldBlock struct{} func (EmeraldBlock) ID() string { return "minecraft:emerald_block" } type SpruceStairs struct { - Facing Direction `nbt:"facing"` - Half string `nbt:"half"` - Shape string `nbt:"shape"` - Waterlogged Boolean `nbt:"waterlogged"` + Facing Direction `nbt:"facing"` + Half Half `nbt:"half"` + Shape StairsShape `nbt:"shape"` + Waterlogged Boolean `nbt:"waterlogged"` } func (SpruceStairs) ID() string { return "minecraft:spruce_stairs" } type BirchStairs struct { - Facing Direction `nbt:"facing"` - Half string `nbt:"half"` - Shape string `nbt:"shape"` - Waterlogged Boolean `nbt:"waterlogged"` + Facing Direction `nbt:"facing"` + Half Half `nbt:"half"` + Shape StairsShape `nbt:"shape"` + Waterlogged Boolean `nbt:"waterlogged"` } func (BirchStairs) ID() string { return "minecraft:birch_stairs" } type JungleStairs struct { - Facing Direction `nbt:"facing"` - Half string `nbt:"half"` - Shape string `nbt:"shape"` - Waterlogged Boolean `nbt:"waterlogged"` + Facing Direction `nbt:"facing"` + Half Half `nbt:"half"` + Shape StairsShape `nbt:"shape"` + Waterlogged Boolean `nbt:"waterlogged"` } func (JungleStairs) ID() string { return "minecraft:jungle_stairs" } @@ -1690,23 +1690,23 @@ type Beacon struct{} func (Beacon) ID() string { return "minecraft:beacon" } type CobblestoneWall struct { - East string `nbt:"east"` - North string `nbt:"north"` - South string `nbt:"south"` - Up Boolean `nbt:"up"` - Waterlogged Boolean `nbt:"waterlogged"` - West string `nbt:"west"` + East WallSide `nbt:"east"` + North WallSide `nbt:"north"` + South WallSide `nbt:"south"` + Up Boolean `nbt:"up"` + Waterlogged Boolean `nbt:"waterlogged"` + West WallSide `nbt:"west"` } func (CobblestoneWall) ID() string { return "minecraft:cobblestone_wall" } type MossyCobblestoneWall struct { - East string `nbt:"east"` - North string `nbt:"north"` - South string `nbt:"south"` - Up Boolean `nbt:"up"` - Waterlogged Boolean `nbt:"waterlogged"` - West string `nbt:"west"` + East WallSide `nbt:"east"` + North WallSide `nbt:"north"` + South WallSide `nbt:"south"` + Up Boolean `nbt:"up"` + Waterlogged Boolean `nbt:"waterlogged"` + West WallSide `nbt:"west"` } func (MossyCobblestoneWall) ID() string { return "minecraft:mossy_cobblestone_wall" } @@ -1824,49 +1824,49 @@ type Potatoes struct { func (Potatoes) ID() string { return "minecraft:potatoes" } type OakButton struct { - Face string `nbt:"face"` - Facing Direction `nbt:"facing"` - Powered Boolean `nbt:"powered"` + Face AttachFace `nbt:"face"` + Facing Direction `nbt:"facing"` + Powered Boolean `nbt:"powered"` } func (OakButton) ID() string { return "minecraft:oak_button" } type SpruceButton struct { - Face string `nbt:"face"` - Facing Direction `nbt:"facing"` - Powered Boolean `nbt:"powered"` + Face AttachFace `nbt:"face"` + Facing Direction `nbt:"facing"` + Powered Boolean `nbt:"powered"` } func (SpruceButton) ID() string { return "minecraft:spruce_button" } type BirchButton struct { - Face string `nbt:"face"` - Facing Direction `nbt:"facing"` - Powered Boolean `nbt:"powered"` + Face AttachFace `nbt:"face"` + Facing Direction `nbt:"facing"` + Powered Boolean `nbt:"powered"` } func (BirchButton) ID() string { return "minecraft:birch_button" } type JungleButton struct { - Face string `nbt:"face"` - Facing Direction `nbt:"facing"` - Powered Boolean `nbt:"powered"` + Face AttachFace `nbt:"face"` + Facing Direction `nbt:"facing"` + Powered Boolean `nbt:"powered"` } func (JungleButton) ID() string { return "minecraft:jungle_button" } type AcaciaButton struct { - Face string `nbt:"face"` - Facing Direction `nbt:"facing"` - Powered Boolean `nbt:"powered"` + Face AttachFace `nbt:"face"` + Facing Direction `nbt:"facing"` + Powered Boolean `nbt:"powered"` } func (AcaciaButton) ID() string { return "minecraft:acacia_button" } type DarkOakButton struct { - Face string `nbt:"face"` - Facing Direction `nbt:"facing"` - Powered Boolean `nbt:"powered"` + Face AttachFace `nbt:"face"` + Facing Direction `nbt:"facing"` + Powered Boolean `nbt:"powered"` } func (DarkOakButton) ID() string { return "minecraft:dark_oak_button" } @@ -1963,7 +1963,7 @@ func (DamagedAnvil) ID() string { return "minecraft:damaged_anvil" } type TrappedChest struct { Facing Direction `nbt:"facing"` - Type string `nbt:"type"` + Type ChestType `nbt:"type"` Waterlogged Boolean `nbt:"waterlogged"` } @@ -1982,9 +1982,9 @@ type HeavyWeightedPressurePlate struct { func (HeavyWeightedPressurePlate) ID() string { return "minecraft:heavy_weighted_pressure_plate" } type Comparator struct { - Facing Direction `nbt:"facing"` - Mode string `nbt:"mode"` - Powered Boolean `nbt:"powered"` + Facing Direction `nbt:"facing"` + Mode ComparatorMode `nbt:"mode"` + Powered Boolean `nbt:"powered"` } func (Comparator) ID() string { return "minecraft:comparator" } @@ -2020,24 +2020,24 @@ type ChiseledQuartzBlock struct{} func (ChiseledQuartzBlock) ID() string { return "minecraft:chiseled_quartz_block" } type QuartzPillar struct { - Axis string `nbt:"axis"` + Axis Axis `nbt:"axis"` } func (QuartzPillar) ID() string { return "minecraft:quartz_pillar" } type QuartzStairs struct { - Facing Direction `nbt:"facing"` - Half string `nbt:"half"` - Shape string `nbt:"shape"` - Waterlogged Boolean `nbt:"waterlogged"` + Facing Direction `nbt:"facing"` + Half Half `nbt:"half"` + Shape StairsShape `nbt:"shape"` + Waterlogged Boolean `nbt:"waterlogged"` } func (QuartzStairs) ID() string { return "minecraft:quartz_stairs" } type ActivatorRail struct { - Powered Boolean `nbt:"powered"` - Shape string `nbt:"shape"` - Waterlogged Boolean `nbt:"waterlogged"` + Powered Boolean `nbt:"powered"` + Shape RailShape `nbt:"shape"` + Waterlogged Boolean `nbt:"waterlogged"` } func (ActivatorRail) ID() string { return "minecraft:activator_rail" } @@ -2274,19 +2274,19 @@ type BlackStainedGlassPane struct { func (BlackStainedGlassPane) ID() string { return "minecraft:black_stained_glass_pane" } type AcaciaStairs struct { - Facing Direction `nbt:"facing"` - Half string `nbt:"half"` - Shape string `nbt:"shape"` - Waterlogged Boolean `nbt:"waterlogged"` + Facing Direction `nbt:"facing"` + Half Half `nbt:"half"` + Shape StairsShape `nbt:"shape"` + Waterlogged Boolean `nbt:"waterlogged"` } func (AcaciaStairs) ID() string { return "minecraft:acacia_stairs" } type DarkOakStairs struct { - Facing Direction `nbt:"facing"` - Half string `nbt:"half"` - Shape string `nbt:"shape"` - Waterlogged Boolean `nbt:"waterlogged"` + Facing Direction `nbt:"facing"` + Half Half `nbt:"half"` + Shape StairsShape `nbt:"shape"` + Waterlogged Boolean `nbt:"waterlogged"` } func (DarkOakStairs) ID() string { return "minecraft:dark_oak_stairs" } @@ -2308,7 +2308,7 @@ func (Light) ID() string { return "minecraft:light" } type IronTrapdoor struct { Facing Direction `nbt:"facing"` - Half string `nbt:"half"` + Half Half `nbt:"half"` Open Boolean `nbt:"open"` Powered Boolean `nbt:"powered"` Waterlogged Boolean `nbt:"waterlogged"` @@ -2329,49 +2329,49 @@ type DarkPrismarine struct{} func (DarkPrismarine) ID() string { return "minecraft:dark_prismarine" } type PrismarineStairs struct { - Facing Direction `nbt:"facing"` - Half string `nbt:"half"` - Shape string `nbt:"shape"` - Waterlogged Boolean `nbt:"waterlogged"` + Facing Direction `nbt:"facing"` + Half Half `nbt:"half"` + Shape StairsShape `nbt:"shape"` + Waterlogged Boolean `nbt:"waterlogged"` } func (PrismarineStairs) ID() string { return "minecraft:prismarine_stairs" } type PrismarineBrickStairs struct { - Facing Direction `nbt:"facing"` - Half string `nbt:"half"` - Shape string `nbt:"shape"` - Waterlogged Boolean `nbt:"waterlogged"` + Facing Direction `nbt:"facing"` + Half Half `nbt:"half"` + Shape StairsShape `nbt:"shape"` + Waterlogged Boolean `nbt:"waterlogged"` } func (PrismarineBrickStairs) ID() string { return "minecraft:prismarine_brick_stairs" } type DarkPrismarineStairs struct { - Facing Direction `nbt:"facing"` - Half string `nbt:"half"` - Shape string `nbt:"shape"` - Waterlogged Boolean `nbt:"waterlogged"` + Facing Direction `nbt:"facing"` + Half Half `nbt:"half"` + Shape StairsShape `nbt:"shape"` + Waterlogged Boolean `nbt:"waterlogged"` } func (DarkPrismarineStairs) ID() string { return "minecraft:dark_prismarine_stairs" } type PrismarineSlab struct { - Type string `nbt:"type"` - Waterlogged Boolean `nbt:"waterlogged"` + Type SlabType `nbt:"type"` + Waterlogged Boolean `nbt:"waterlogged"` } func (PrismarineSlab) ID() string { return "minecraft:prismarine_slab" } type PrismarineBrickSlab struct { - Type string `nbt:"type"` - Waterlogged Boolean `nbt:"waterlogged"` + Type SlabType `nbt:"type"` + Waterlogged Boolean `nbt:"waterlogged"` } func (PrismarineBrickSlab) ID() string { return "minecraft:prismarine_brick_slab" } type DarkPrismarineSlab struct { - Type string `nbt:"type"` - Waterlogged Boolean `nbt:"waterlogged"` + Type SlabType `nbt:"type"` + Waterlogged Boolean `nbt:"waterlogged"` } func (DarkPrismarineSlab) ID() string { return "minecraft:dark_prismarine_slab" } @@ -2381,7 +2381,7 @@ type SeaLantern struct{} func (SeaLantern) ID() string { return "minecraft:sea_lantern" } type HayBlock struct { - Axis string `nbt:"axis"` + Axis Axis `nbt:"axis"` } func (HayBlock) ID() string { return "minecraft:hay_block" } @@ -2463,37 +2463,37 @@ type PackedIce struct{} func (PackedIce) ID() string { return "minecraft:packed_ice" } type Sunflower struct { - Half string `nbt:"half"` + Half DoubleBlockHalf `nbt:"half"` } func (Sunflower) ID() string { return "minecraft:sunflower" } type Lilac struct { - Half string `nbt:"half"` + Half DoubleBlockHalf `nbt:"half"` } func (Lilac) ID() string { return "minecraft:lilac" } type RoseBush struct { - Half string `nbt:"half"` + Half DoubleBlockHalf `nbt:"half"` } func (RoseBush) ID() string { return "minecraft:rose_bush" } type Peony struct { - Half string `nbt:"half"` + Half DoubleBlockHalf `nbt:"half"` } func (Peony) ID() string { return "minecraft:peony" } type TallGrass struct { - Half string `nbt:"half"` + Half DoubleBlockHalf `nbt:"half"` } func (TallGrass) ID() string { return "minecraft:tall_grass" } type LargeFern struct { - Half string `nbt:"half"` + Half DoubleBlockHalf `nbt:"half"` } func (LargeFern) ID() string { return "minecraft:large_fern" } @@ -2703,143 +2703,143 @@ type CutRedSandstone struct{} func (CutRedSandstone) ID() string { return "minecraft:cut_red_sandstone" } type RedSandstoneStairs struct { - Facing Direction `nbt:"facing"` - Half string `nbt:"half"` - Shape string `nbt:"shape"` - Waterlogged Boolean `nbt:"waterlogged"` + Facing Direction `nbt:"facing"` + Half Half `nbt:"half"` + Shape StairsShape `nbt:"shape"` + Waterlogged Boolean `nbt:"waterlogged"` } func (RedSandstoneStairs) ID() string { return "minecraft:red_sandstone_stairs" } type OakSlab struct { - Type string `nbt:"type"` - Waterlogged Boolean `nbt:"waterlogged"` + Type SlabType `nbt:"type"` + Waterlogged Boolean `nbt:"waterlogged"` } func (OakSlab) ID() string { return "minecraft:oak_slab" } type SpruceSlab struct { - Type string `nbt:"type"` - Waterlogged Boolean `nbt:"waterlogged"` + Type SlabType `nbt:"type"` + Waterlogged Boolean `nbt:"waterlogged"` } func (SpruceSlab) ID() string { return "minecraft:spruce_slab" } type BirchSlab struct { - Type string `nbt:"type"` - Waterlogged Boolean `nbt:"waterlogged"` + Type SlabType `nbt:"type"` + Waterlogged Boolean `nbt:"waterlogged"` } func (BirchSlab) ID() string { return "minecraft:birch_slab" } type JungleSlab struct { - Type string `nbt:"type"` - Waterlogged Boolean `nbt:"waterlogged"` + Type SlabType `nbt:"type"` + Waterlogged Boolean `nbt:"waterlogged"` } func (JungleSlab) ID() string { return "minecraft:jungle_slab" } type AcaciaSlab struct { - Type string `nbt:"type"` - Waterlogged Boolean `nbt:"waterlogged"` + Type SlabType `nbt:"type"` + Waterlogged Boolean `nbt:"waterlogged"` } func (AcaciaSlab) ID() string { return "minecraft:acacia_slab" } type DarkOakSlab struct { - Type string `nbt:"type"` - Waterlogged Boolean `nbt:"waterlogged"` + Type SlabType `nbt:"type"` + Waterlogged Boolean `nbt:"waterlogged"` } func (DarkOakSlab) ID() string { return "minecraft:dark_oak_slab" } type StoneSlab struct { - Type string `nbt:"type"` - Waterlogged Boolean `nbt:"waterlogged"` + Type SlabType `nbt:"type"` + Waterlogged Boolean `nbt:"waterlogged"` } func (StoneSlab) ID() string { return "minecraft:stone_slab" } type SmoothStoneSlab struct { - Type string `nbt:"type"` - Waterlogged Boolean `nbt:"waterlogged"` + Type SlabType `nbt:"type"` + Waterlogged Boolean `nbt:"waterlogged"` } func (SmoothStoneSlab) ID() string { return "minecraft:smooth_stone_slab" } type SandstoneSlab struct { - Type string `nbt:"type"` - Waterlogged Boolean `nbt:"waterlogged"` + Type SlabType `nbt:"type"` + Waterlogged Boolean `nbt:"waterlogged"` } func (SandstoneSlab) ID() string { return "minecraft:sandstone_slab" } type CutSandstoneSlab struct { - Type string `nbt:"type"` - Waterlogged Boolean `nbt:"waterlogged"` + Type SlabType `nbt:"type"` + Waterlogged Boolean `nbt:"waterlogged"` } func (CutSandstoneSlab) ID() string { return "minecraft:cut_sandstone_slab" } type PetrifiedOakSlab struct { - Type string `nbt:"type"` - Waterlogged Boolean `nbt:"waterlogged"` + Type SlabType `nbt:"type"` + Waterlogged Boolean `nbt:"waterlogged"` } func (PetrifiedOakSlab) ID() string { return "minecraft:petrified_oak_slab" } type CobblestoneSlab struct { - Type string `nbt:"type"` - Waterlogged Boolean `nbt:"waterlogged"` + Type SlabType `nbt:"type"` + Waterlogged Boolean `nbt:"waterlogged"` } func (CobblestoneSlab) ID() string { return "minecraft:cobblestone_slab" } type BrickSlab struct { - Type string `nbt:"type"` - Waterlogged Boolean `nbt:"waterlogged"` + Type SlabType `nbt:"type"` + Waterlogged Boolean `nbt:"waterlogged"` } func (BrickSlab) ID() string { return "minecraft:brick_slab" } type StoneBrickSlab struct { - Type string `nbt:"type"` - Waterlogged Boolean `nbt:"waterlogged"` + Type SlabType `nbt:"type"` + Waterlogged Boolean `nbt:"waterlogged"` } func (StoneBrickSlab) ID() string { return "minecraft:stone_brick_slab" } type NetherBrickSlab struct { - Type string `nbt:"type"` - Waterlogged Boolean `nbt:"waterlogged"` + Type SlabType `nbt:"type"` + Waterlogged Boolean `nbt:"waterlogged"` } func (NetherBrickSlab) ID() string { return "minecraft:nether_brick_slab" } type QuartzSlab struct { - Type string `nbt:"type"` - Waterlogged Boolean `nbt:"waterlogged"` + Type SlabType `nbt:"type"` + Waterlogged Boolean `nbt:"waterlogged"` } func (QuartzSlab) ID() string { return "minecraft:quartz_slab" } type RedSandstoneSlab struct { - Type string `nbt:"type"` - Waterlogged Boolean `nbt:"waterlogged"` + Type SlabType `nbt:"type"` + Waterlogged Boolean `nbt:"waterlogged"` } func (RedSandstoneSlab) ID() string { return "minecraft:red_sandstone_slab" } type CutRedSandstoneSlab struct { - Type string `nbt:"type"` - Waterlogged Boolean `nbt:"waterlogged"` + Type SlabType `nbt:"type"` + Waterlogged Boolean `nbt:"waterlogged"` } func (CutRedSandstoneSlab) ID() string { return "minecraft:cut_red_sandstone_slab" } type PurpurSlab struct { - Type string `nbt:"type"` - Waterlogged Boolean `nbt:"waterlogged"` + Type SlabType `nbt:"type"` + Waterlogged Boolean `nbt:"waterlogged"` } func (PurpurSlab) ID() string { return "minecraft:purpur_slab" } @@ -2956,51 +2956,51 @@ type DarkOakFence struct { func (DarkOakFence) ID() string { return "minecraft:dark_oak_fence" } type SpruceDoor struct { - Facing Direction `nbt:"facing"` - Half string `nbt:"half"` - Hinge string `nbt:"hinge"` - Open Boolean `nbt:"open"` - Powered Boolean `nbt:"powered"` + Facing Direction `nbt:"facing"` + Half DoubleBlockHalf `nbt:"half"` + Hinge DoorHingeSide `nbt:"hinge"` + Open Boolean `nbt:"open"` + Powered Boolean `nbt:"powered"` } func (SpruceDoor) ID() string { return "minecraft:spruce_door" } type BirchDoor struct { - Facing Direction `nbt:"facing"` - Half string `nbt:"half"` - Hinge string `nbt:"hinge"` - Open Boolean `nbt:"open"` - Powered Boolean `nbt:"powered"` + Facing Direction `nbt:"facing"` + Half DoubleBlockHalf `nbt:"half"` + Hinge DoorHingeSide `nbt:"hinge"` + Open Boolean `nbt:"open"` + Powered Boolean `nbt:"powered"` } func (BirchDoor) ID() string { return "minecraft:birch_door" } type JungleDoor struct { - Facing Direction `nbt:"facing"` - Half string `nbt:"half"` - Hinge string `nbt:"hinge"` - Open Boolean `nbt:"open"` - Powered Boolean `nbt:"powered"` + Facing Direction `nbt:"facing"` + Half DoubleBlockHalf `nbt:"half"` + Hinge DoorHingeSide `nbt:"hinge"` + Open Boolean `nbt:"open"` + Powered Boolean `nbt:"powered"` } func (JungleDoor) ID() string { return "minecraft:jungle_door" } type AcaciaDoor struct { - Facing Direction `nbt:"facing"` - Half string `nbt:"half"` - Hinge string `nbt:"hinge"` - Open Boolean `nbt:"open"` - Powered Boolean `nbt:"powered"` + Facing Direction `nbt:"facing"` + Half DoubleBlockHalf `nbt:"half"` + Hinge DoorHingeSide `nbt:"hinge"` + Open Boolean `nbt:"open"` + Powered Boolean `nbt:"powered"` } func (AcaciaDoor) ID() string { return "minecraft:acacia_door" } type DarkOakDoor struct { - Facing Direction `nbt:"facing"` - Half string `nbt:"half"` - Hinge string `nbt:"hinge"` - Open Boolean `nbt:"open"` - Powered Boolean `nbt:"powered"` + Facing Direction `nbt:"facing"` + Half DoubleBlockHalf `nbt:"half"` + Hinge DoorHingeSide `nbt:"hinge"` + Open Boolean `nbt:"open"` + Powered Boolean `nbt:"powered"` } func (DarkOakDoor) ID() string { return "minecraft:dark_oak_door" } @@ -3033,16 +3033,16 @@ type PurpurBlock struct{} func (PurpurBlock) ID() string { return "minecraft:purpur_block" } type PurpurPillar struct { - Axis string `nbt:"axis"` + Axis Axis `nbt:"axis"` } func (PurpurPillar) ID() string { return "minecraft:purpur_pillar" } type PurpurStairs struct { - Facing Direction `nbt:"facing"` - Half string `nbt:"half"` - Shape string `nbt:"shape"` - Waterlogged Boolean `nbt:"waterlogged"` + Facing Direction `nbt:"facing"` + Half Half `nbt:"half"` + Shape StairsShape `nbt:"shape"` + Waterlogged Boolean `nbt:"waterlogged"` } func (PurpurStairs) ID() string { return "minecraft:purpur_stairs" } @@ -3098,7 +3098,7 @@ type RedNetherBricks struct{} func (RedNetherBricks) ID() string { return "minecraft:red_nether_bricks" } type BoneBlock struct { - Axis string `nbt:"axis"` + Axis Axis `nbt:"axis"` } func (BoneBlock) ID() string { return "minecraft:bone_block" } @@ -3713,9 +3713,9 @@ type BambooSapling struct{} func (BambooSapling) ID() string { return "minecraft:bamboo_sapling" } type Bamboo struct { - Age Integer `nbt:"age"` - Leaves string `nbt:"leaves"` - Stage Integer `nbt:"stage"` + Age Integer `nbt:"age"` + Leaves BambooLeaves `nbt:"leaves"` + Stage Integer `nbt:"stage"` } func (Bamboo) ID() string { return "minecraft:bamboo" } @@ -3739,350 +3739,350 @@ type BubbleColumn struct { func (BubbleColumn) ID() string { return "minecraft:bubble_column" } type PolishedGraniteStairs struct { - Facing Direction `nbt:"facing"` - Half string `nbt:"half"` - Shape string `nbt:"shape"` - Waterlogged Boolean `nbt:"waterlogged"` + Facing Direction `nbt:"facing"` + Half Half `nbt:"half"` + Shape StairsShape `nbt:"shape"` + Waterlogged Boolean `nbt:"waterlogged"` } func (PolishedGraniteStairs) ID() string { return "minecraft:polished_granite_stairs" } type SmoothRedSandstoneStairs struct { - Facing Direction `nbt:"facing"` - Half string `nbt:"half"` - Shape string `nbt:"shape"` - Waterlogged Boolean `nbt:"waterlogged"` + Facing Direction `nbt:"facing"` + Half Half `nbt:"half"` + Shape StairsShape `nbt:"shape"` + Waterlogged Boolean `nbt:"waterlogged"` } func (SmoothRedSandstoneStairs) ID() string { return "minecraft:smooth_red_sandstone_stairs" } type MossyStoneBrickStairs struct { - Facing Direction `nbt:"facing"` - Half string `nbt:"half"` - Shape string `nbt:"shape"` - Waterlogged Boolean `nbt:"waterlogged"` + Facing Direction `nbt:"facing"` + Half Half `nbt:"half"` + Shape StairsShape `nbt:"shape"` + Waterlogged Boolean `nbt:"waterlogged"` } func (MossyStoneBrickStairs) ID() string { return "minecraft:mossy_stone_brick_stairs" } type PolishedDioriteStairs struct { - Facing Direction `nbt:"facing"` - Half string `nbt:"half"` - Shape string `nbt:"shape"` - Waterlogged Boolean `nbt:"waterlogged"` + Facing Direction `nbt:"facing"` + Half Half `nbt:"half"` + Shape StairsShape `nbt:"shape"` + Waterlogged Boolean `nbt:"waterlogged"` } func (PolishedDioriteStairs) ID() string { return "minecraft:polished_diorite_stairs" } type MossyCobblestoneStairs struct { - Facing Direction `nbt:"facing"` - Half string `nbt:"half"` - Shape string `nbt:"shape"` - Waterlogged Boolean `nbt:"waterlogged"` + Facing Direction `nbt:"facing"` + Half Half `nbt:"half"` + Shape StairsShape `nbt:"shape"` + Waterlogged Boolean `nbt:"waterlogged"` } func (MossyCobblestoneStairs) ID() string { return "minecraft:mossy_cobblestone_stairs" } type EndStoneBrickStairs struct { - Facing Direction `nbt:"facing"` - Half string `nbt:"half"` - Shape string `nbt:"shape"` - Waterlogged Boolean `nbt:"waterlogged"` + Facing Direction `nbt:"facing"` + Half Half `nbt:"half"` + Shape StairsShape `nbt:"shape"` + Waterlogged Boolean `nbt:"waterlogged"` } func (EndStoneBrickStairs) ID() string { return "minecraft:end_stone_brick_stairs" } type StoneStairs struct { - Facing Direction `nbt:"facing"` - Half string `nbt:"half"` - Shape string `nbt:"shape"` - Waterlogged Boolean `nbt:"waterlogged"` + Facing Direction `nbt:"facing"` + Half Half `nbt:"half"` + Shape StairsShape `nbt:"shape"` + Waterlogged Boolean `nbt:"waterlogged"` } func (StoneStairs) ID() string { return "minecraft:stone_stairs" } type SmoothSandstoneStairs struct { - Facing Direction `nbt:"facing"` - Half string `nbt:"half"` - Shape string `nbt:"shape"` - Waterlogged Boolean `nbt:"waterlogged"` + Facing Direction `nbt:"facing"` + Half Half `nbt:"half"` + Shape StairsShape `nbt:"shape"` + Waterlogged Boolean `nbt:"waterlogged"` } func (SmoothSandstoneStairs) ID() string { return "minecraft:smooth_sandstone_stairs" } type SmoothQuartzStairs struct { - Facing Direction `nbt:"facing"` - Half string `nbt:"half"` - Shape string `nbt:"shape"` - Waterlogged Boolean `nbt:"waterlogged"` + Facing Direction `nbt:"facing"` + Half Half `nbt:"half"` + Shape StairsShape `nbt:"shape"` + Waterlogged Boolean `nbt:"waterlogged"` } func (SmoothQuartzStairs) ID() string { return "minecraft:smooth_quartz_stairs" } type GraniteStairs struct { - Facing Direction `nbt:"facing"` - Half string `nbt:"half"` - Shape string `nbt:"shape"` - Waterlogged Boolean `nbt:"waterlogged"` + Facing Direction `nbt:"facing"` + Half Half `nbt:"half"` + Shape StairsShape `nbt:"shape"` + Waterlogged Boolean `nbt:"waterlogged"` } func (GraniteStairs) ID() string { return "minecraft:granite_stairs" } type AndesiteStairs struct { - Facing Direction `nbt:"facing"` - Half string `nbt:"half"` - Shape string `nbt:"shape"` - Waterlogged Boolean `nbt:"waterlogged"` + Facing Direction `nbt:"facing"` + Half Half `nbt:"half"` + Shape StairsShape `nbt:"shape"` + Waterlogged Boolean `nbt:"waterlogged"` } func (AndesiteStairs) ID() string { return "minecraft:andesite_stairs" } type RedNetherBrickStairs struct { - Facing Direction `nbt:"facing"` - Half string `nbt:"half"` - Shape string `nbt:"shape"` - Waterlogged Boolean `nbt:"waterlogged"` + Facing Direction `nbt:"facing"` + Half Half `nbt:"half"` + Shape StairsShape `nbt:"shape"` + Waterlogged Boolean `nbt:"waterlogged"` } func (RedNetherBrickStairs) ID() string { return "minecraft:red_nether_brick_stairs" } type PolishedAndesiteStairs struct { - Facing Direction `nbt:"facing"` - Half string `nbt:"half"` - Shape string `nbt:"shape"` - Waterlogged Boolean `nbt:"waterlogged"` + Facing Direction `nbt:"facing"` + Half Half `nbt:"half"` + Shape StairsShape `nbt:"shape"` + Waterlogged Boolean `nbt:"waterlogged"` } func (PolishedAndesiteStairs) ID() string { return "minecraft:polished_andesite_stairs" } type DioriteStairs struct { - Facing Direction `nbt:"facing"` - Half string `nbt:"half"` - Shape string `nbt:"shape"` - Waterlogged Boolean `nbt:"waterlogged"` + Facing Direction `nbt:"facing"` + Half Half `nbt:"half"` + Shape StairsShape `nbt:"shape"` + Waterlogged Boolean `nbt:"waterlogged"` } func (DioriteStairs) ID() string { return "minecraft:diorite_stairs" } type PolishedGraniteSlab struct { - Type string `nbt:"type"` - Waterlogged Boolean `nbt:"waterlogged"` + Type SlabType `nbt:"type"` + Waterlogged Boolean `nbt:"waterlogged"` } func (PolishedGraniteSlab) ID() string { return "minecraft:polished_granite_slab" } type SmoothRedSandstoneSlab struct { - Type string `nbt:"type"` - Waterlogged Boolean `nbt:"waterlogged"` + Type SlabType `nbt:"type"` + Waterlogged Boolean `nbt:"waterlogged"` } func (SmoothRedSandstoneSlab) ID() string { return "minecraft:smooth_red_sandstone_slab" } type MossyStoneBrickSlab struct { - Type string `nbt:"type"` - Waterlogged Boolean `nbt:"waterlogged"` + Type SlabType `nbt:"type"` + Waterlogged Boolean `nbt:"waterlogged"` } func (MossyStoneBrickSlab) ID() string { return "minecraft:mossy_stone_brick_slab" } type PolishedDioriteSlab struct { - Type string `nbt:"type"` - Waterlogged Boolean `nbt:"waterlogged"` + Type SlabType `nbt:"type"` + Waterlogged Boolean `nbt:"waterlogged"` } func (PolishedDioriteSlab) ID() string { return "minecraft:polished_diorite_slab" } type MossyCobblestoneSlab struct { - Type string `nbt:"type"` - Waterlogged Boolean `nbt:"waterlogged"` + Type SlabType `nbt:"type"` + Waterlogged Boolean `nbt:"waterlogged"` } func (MossyCobblestoneSlab) ID() string { return "minecraft:mossy_cobblestone_slab" } type EndStoneBrickSlab struct { - Type string `nbt:"type"` - Waterlogged Boolean `nbt:"waterlogged"` + Type SlabType `nbt:"type"` + Waterlogged Boolean `nbt:"waterlogged"` } func (EndStoneBrickSlab) ID() string { return "minecraft:end_stone_brick_slab" } type SmoothSandstoneSlab struct { - Type string `nbt:"type"` - Waterlogged Boolean `nbt:"waterlogged"` + Type SlabType `nbt:"type"` + Waterlogged Boolean `nbt:"waterlogged"` } func (SmoothSandstoneSlab) ID() string { return "minecraft:smooth_sandstone_slab" } type SmoothQuartzSlab struct { - Type string `nbt:"type"` - Waterlogged Boolean `nbt:"waterlogged"` + Type SlabType `nbt:"type"` + Waterlogged Boolean `nbt:"waterlogged"` } func (SmoothQuartzSlab) ID() string { return "minecraft:smooth_quartz_slab" } type GraniteSlab struct { - Type string `nbt:"type"` - Waterlogged Boolean `nbt:"waterlogged"` + Type SlabType `nbt:"type"` + Waterlogged Boolean `nbt:"waterlogged"` } func (GraniteSlab) ID() string { return "minecraft:granite_slab" } type AndesiteSlab struct { - Type string `nbt:"type"` - Waterlogged Boolean `nbt:"waterlogged"` + Type SlabType `nbt:"type"` + Waterlogged Boolean `nbt:"waterlogged"` } func (AndesiteSlab) ID() string { return "minecraft:andesite_slab" } type RedNetherBrickSlab struct { - Type string `nbt:"type"` - Waterlogged Boolean `nbt:"waterlogged"` + Type SlabType `nbt:"type"` + Waterlogged Boolean `nbt:"waterlogged"` } func (RedNetherBrickSlab) ID() string { return "minecraft:red_nether_brick_slab" } type PolishedAndesiteSlab struct { - Type string `nbt:"type"` - Waterlogged Boolean `nbt:"waterlogged"` + Type SlabType `nbt:"type"` + Waterlogged Boolean `nbt:"waterlogged"` } func (PolishedAndesiteSlab) ID() string { return "minecraft:polished_andesite_slab" } type DioriteSlab struct { - Type string `nbt:"type"` - Waterlogged Boolean `nbt:"waterlogged"` + Type SlabType `nbt:"type"` + Waterlogged Boolean `nbt:"waterlogged"` } func (DioriteSlab) ID() string { return "minecraft:diorite_slab" } type BrickWall struct { - East string `nbt:"east"` - North string `nbt:"north"` - South string `nbt:"south"` - Up Boolean `nbt:"up"` - Waterlogged Boolean `nbt:"waterlogged"` - West string `nbt:"west"` + East WallSide `nbt:"east"` + North WallSide `nbt:"north"` + South WallSide `nbt:"south"` + Up Boolean `nbt:"up"` + Waterlogged Boolean `nbt:"waterlogged"` + West WallSide `nbt:"west"` } func (BrickWall) ID() string { return "minecraft:brick_wall" } type PrismarineWall struct { - East string `nbt:"east"` - North string `nbt:"north"` - South string `nbt:"south"` - Up Boolean `nbt:"up"` - Waterlogged Boolean `nbt:"waterlogged"` - West string `nbt:"west"` + East WallSide `nbt:"east"` + North WallSide `nbt:"north"` + South WallSide `nbt:"south"` + Up Boolean `nbt:"up"` + Waterlogged Boolean `nbt:"waterlogged"` + West WallSide `nbt:"west"` } func (PrismarineWall) ID() string { return "minecraft:prismarine_wall" } type RedSandstoneWall struct { - East string `nbt:"east"` - North string `nbt:"north"` - South string `nbt:"south"` - Up Boolean `nbt:"up"` - Waterlogged Boolean `nbt:"waterlogged"` - West string `nbt:"west"` + East WallSide `nbt:"east"` + North WallSide `nbt:"north"` + South WallSide `nbt:"south"` + Up Boolean `nbt:"up"` + Waterlogged Boolean `nbt:"waterlogged"` + West WallSide `nbt:"west"` } func (RedSandstoneWall) ID() string { return "minecraft:red_sandstone_wall" } type MossyStoneBrickWall struct { - East string `nbt:"east"` - North string `nbt:"north"` - South string `nbt:"south"` - Up Boolean `nbt:"up"` - Waterlogged Boolean `nbt:"waterlogged"` - West string `nbt:"west"` + East WallSide `nbt:"east"` + North WallSide `nbt:"north"` + South WallSide `nbt:"south"` + Up Boolean `nbt:"up"` + Waterlogged Boolean `nbt:"waterlogged"` + West WallSide `nbt:"west"` } func (MossyStoneBrickWall) ID() string { return "minecraft:mossy_stone_brick_wall" } type GraniteWall struct { - East string `nbt:"east"` - North string `nbt:"north"` - South string `nbt:"south"` - Up Boolean `nbt:"up"` - Waterlogged Boolean `nbt:"waterlogged"` - West string `nbt:"west"` + East WallSide `nbt:"east"` + North WallSide `nbt:"north"` + South WallSide `nbt:"south"` + Up Boolean `nbt:"up"` + Waterlogged Boolean `nbt:"waterlogged"` + West WallSide `nbt:"west"` } func (GraniteWall) ID() string { return "minecraft:granite_wall" } type StoneBrickWall struct { - East string `nbt:"east"` - North string `nbt:"north"` - South string `nbt:"south"` - Up Boolean `nbt:"up"` - Waterlogged Boolean `nbt:"waterlogged"` - West string `nbt:"west"` + East WallSide `nbt:"east"` + North WallSide `nbt:"north"` + South WallSide `nbt:"south"` + Up Boolean `nbt:"up"` + Waterlogged Boolean `nbt:"waterlogged"` + West WallSide `nbt:"west"` } func (StoneBrickWall) ID() string { return "minecraft:stone_brick_wall" } type NetherBrickWall struct { - East string `nbt:"east"` - North string `nbt:"north"` - South string `nbt:"south"` - Up Boolean `nbt:"up"` - Waterlogged Boolean `nbt:"waterlogged"` - West string `nbt:"west"` + East WallSide `nbt:"east"` + North WallSide `nbt:"north"` + South WallSide `nbt:"south"` + Up Boolean `nbt:"up"` + Waterlogged Boolean `nbt:"waterlogged"` + West WallSide `nbt:"west"` } func (NetherBrickWall) ID() string { return "minecraft:nether_brick_wall" } type AndesiteWall struct { - East string `nbt:"east"` - North string `nbt:"north"` - South string `nbt:"south"` - Up Boolean `nbt:"up"` - Waterlogged Boolean `nbt:"waterlogged"` - West string `nbt:"west"` + East WallSide `nbt:"east"` + North WallSide `nbt:"north"` + South WallSide `nbt:"south"` + Up Boolean `nbt:"up"` + Waterlogged Boolean `nbt:"waterlogged"` + West WallSide `nbt:"west"` } func (AndesiteWall) ID() string { return "minecraft:andesite_wall" } type RedNetherBrickWall struct { - East string `nbt:"east"` - North string `nbt:"north"` - South string `nbt:"south"` - Up Boolean `nbt:"up"` - Waterlogged Boolean `nbt:"waterlogged"` - West string `nbt:"west"` + East WallSide `nbt:"east"` + North WallSide `nbt:"north"` + South WallSide `nbt:"south"` + Up Boolean `nbt:"up"` + Waterlogged Boolean `nbt:"waterlogged"` + West WallSide `nbt:"west"` } func (RedNetherBrickWall) ID() string { return "minecraft:red_nether_brick_wall" } type SandstoneWall struct { - East string `nbt:"east"` - North string `nbt:"north"` - South string `nbt:"south"` - Up Boolean `nbt:"up"` - Waterlogged Boolean `nbt:"waterlogged"` - West string `nbt:"west"` + East WallSide `nbt:"east"` + North WallSide `nbt:"north"` + South WallSide `nbt:"south"` + Up Boolean `nbt:"up"` + Waterlogged Boolean `nbt:"waterlogged"` + West WallSide `nbt:"west"` } func (SandstoneWall) ID() string { return "minecraft:sandstone_wall" } type EndStoneBrickWall struct { - East string `nbt:"east"` - North string `nbt:"north"` - South string `nbt:"south"` - Up Boolean `nbt:"up"` - Waterlogged Boolean `nbt:"waterlogged"` - West string `nbt:"west"` + East WallSide `nbt:"east"` + North WallSide `nbt:"north"` + South WallSide `nbt:"south"` + Up Boolean `nbt:"up"` + Waterlogged Boolean `nbt:"waterlogged"` + West WallSide `nbt:"west"` } func (EndStoneBrickWall) ID() string { return "minecraft:end_stone_brick_wall" } type DioriteWall struct { - East string `nbt:"east"` - North string `nbt:"north"` - South string `nbt:"south"` - Up Boolean `nbt:"up"` - Waterlogged Boolean `nbt:"waterlogged"` - West string `nbt:"west"` + East WallSide `nbt:"east"` + North WallSide `nbt:"north"` + South WallSide `nbt:"south"` + Up Boolean `nbt:"up"` + Waterlogged Boolean `nbt:"waterlogged"` + West WallSide `nbt:"west"` } func (DioriteWall) ID() string { return "minecraft:diorite_wall" } @@ -4131,8 +4131,8 @@ type FletchingTable struct{} func (FletchingTable) ID() string { return "minecraft:fletching_table" } type Grindstone struct { - Face string `nbt:"face"` - Facing Direction `nbt:"facing"` + Face AttachFace `nbt:"face"` + Facing Direction `nbt:"facing"` } func (Grindstone) ID() string { return "minecraft:grindstone" } @@ -4156,9 +4156,9 @@ type Stonecutter struct { func (Stonecutter) ID() string { return "minecraft:stonecutter" } type Bell struct { - Attachment string `nbt:"attachment"` - Facing Direction `nbt:"facing"` - Powered Boolean `nbt:"powered"` + Attachment BellAttachType `nbt:"attachment"` + Facing Direction `nbt:"facing"` + Powered Boolean `nbt:"powered"` } func (Bell) ID() string { return "minecraft:bell" } @@ -4202,25 +4202,25 @@ type SweetBerryBush struct { func (SweetBerryBush) ID() string { return "minecraft:sweet_berry_bush" } type WarpedStem struct { - Axis string `nbt:"axis"` + Axis Axis `nbt:"axis"` } func (WarpedStem) ID() string { return "minecraft:warped_stem" } type StrippedWarpedStem struct { - Axis string `nbt:"axis"` + Axis Axis `nbt:"axis"` } func (StrippedWarpedStem) ID() string { return "minecraft:stripped_warped_stem" } type WarpedHyphae struct { - Axis string `nbt:"axis"` + Axis Axis `nbt:"axis"` } func (WarpedHyphae) ID() string { return "minecraft:warped_hyphae" } type StrippedWarpedHyphae struct { - Axis string `nbt:"axis"` + Axis Axis `nbt:"axis"` } func (StrippedWarpedHyphae) ID() string { return "minecraft:stripped_warped_hyphae" } @@ -4246,25 +4246,25 @@ type NetherSprouts struct{} func (NetherSprouts) ID() string { return "minecraft:nether_sprouts" } type CrimsonStem struct { - Axis string `nbt:"axis"` + Axis Axis `nbt:"axis"` } func (CrimsonStem) ID() string { return "minecraft:crimson_stem" } type StrippedCrimsonStem struct { - Axis string `nbt:"axis"` + Axis Axis `nbt:"axis"` } func (StrippedCrimsonStem) ID() string { return "minecraft:stripped_crimson_stem" } type CrimsonHyphae struct { - Axis string `nbt:"axis"` + Axis Axis `nbt:"axis"` } func (CrimsonHyphae) ID() string { return "minecraft:crimson_hyphae" } type StrippedCrimsonHyphae struct { - Axis string `nbt:"axis"` + Axis Axis `nbt:"axis"` } func (StrippedCrimsonHyphae) ID() string { return "minecraft:stripped_crimson_hyphae" } @@ -4314,15 +4314,15 @@ type WarpedPlanks struct{} func (WarpedPlanks) ID() string { return "minecraft:warped_planks" } type CrimsonSlab struct { - Type string `nbt:"type"` - Waterlogged Boolean `nbt:"waterlogged"` + Type SlabType `nbt:"type"` + Waterlogged Boolean `nbt:"waterlogged"` } func (CrimsonSlab) ID() string { return "minecraft:crimson_slab" } type WarpedSlab struct { - Type string `nbt:"type"` - Waterlogged Boolean `nbt:"waterlogged"` + Type SlabType `nbt:"type"` + Waterlogged Boolean `nbt:"waterlogged"` } func (WarpedSlab) ID() string { return "minecraft:warped_slab" } @@ -4361,7 +4361,7 @@ func (WarpedFence) ID() string { return "minecraft:warped_fence" } type CrimsonTrapdoor struct { Facing Direction `nbt:"facing"` - Half string `nbt:"half"` + Half Half `nbt:"half"` Open Boolean `nbt:"open"` Powered Boolean `nbt:"powered"` Waterlogged Boolean `nbt:"waterlogged"` @@ -4371,7 +4371,7 @@ func (CrimsonTrapdoor) ID() string { return "minecraft:crimson_trapdoor" } type WarpedTrapdoor struct { Facing Direction `nbt:"facing"` - Half string `nbt:"half"` + Half Half `nbt:"half"` Open Boolean `nbt:"open"` Powered Boolean `nbt:"powered"` Waterlogged Boolean `nbt:"waterlogged"` @@ -4398,55 +4398,55 @@ type WarpedFenceGate struct { func (WarpedFenceGate) ID() string { return "minecraft:warped_fence_gate" } type CrimsonStairs struct { - Facing Direction `nbt:"facing"` - Half string `nbt:"half"` - Shape string `nbt:"shape"` - Waterlogged Boolean `nbt:"waterlogged"` + Facing Direction `nbt:"facing"` + Half Half `nbt:"half"` + Shape StairsShape `nbt:"shape"` + Waterlogged Boolean `nbt:"waterlogged"` } func (CrimsonStairs) ID() string { return "minecraft:crimson_stairs" } type WarpedStairs struct { - Facing Direction `nbt:"facing"` - Half string `nbt:"half"` - Shape string `nbt:"shape"` - Waterlogged Boolean `nbt:"waterlogged"` + Facing Direction `nbt:"facing"` + Half Half `nbt:"half"` + Shape StairsShape `nbt:"shape"` + Waterlogged Boolean `nbt:"waterlogged"` } func (WarpedStairs) ID() string { return "minecraft:warped_stairs" } type CrimsonButton struct { - Face string `nbt:"face"` - Facing Direction `nbt:"facing"` - Powered Boolean `nbt:"powered"` + Face AttachFace `nbt:"face"` + Facing Direction `nbt:"facing"` + Powered Boolean `nbt:"powered"` } func (CrimsonButton) ID() string { return "minecraft:crimson_button" } type WarpedButton struct { - Face string `nbt:"face"` - Facing Direction `nbt:"facing"` - Powered Boolean `nbt:"powered"` + Face AttachFace `nbt:"face"` + Facing Direction `nbt:"facing"` + Powered Boolean `nbt:"powered"` } func (WarpedButton) ID() string { return "minecraft:warped_button" } type CrimsonDoor struct { - Facing Direction `nbt:"facing"` - Half string `nbt:"half"` - Hinge string `nbt:"hinge"` - Open Boolean `nbt:"open"` - Powered Boolean `nbt:"powered"` + Facing Direction `nbt:"facing"` + Half DoubleBlockHalf `nbt:"half"` + Hinge DoorHingeSide `nbt:"hinge"` + Open Boolean `nbt:"open"` + Powered Boolean `nbt:"powered"` } func (CrimsonDoor) ID() string { return "minecraft:crimson_door" } type WarpedDoor struct { - Facing Direction `nbt:"facing"` - Half string `nbt:"half"` - Hinge string `nbt:"hinge"` - Open Boolean `nbt:"open"` - Powered Boolean `nbt:"powered"` + Facing Direction `nbt:"facing"` + Half DoubleBlockHalf `nbt:"half"` + Hinge DoorHingeSide `nbt:"hinge"` + Open Boolean `nbt:"open"` + Powered Boolean `nbt:"powered"` } func (WarpedDoor) ID() string { return "minecraft:warped_door" } @@ -4480,13 +4480,13 @@ type WarpedWallSign struct { func (WarpedWallSign) ID() string { return "minecraft:warped_wall_sign" } type StructureBlock struct { - Mode string `nbt:"mode"` + Mode StructureMode `nbt:"mode"` } func (StructureBlock) ID() string { return "minecraft:structure_block" } type Jigsaw struct { - Orientation string `nbt:"orientation"` + Orientation FrontAndTop `nbt:"orientation"` } func (Jigsaw) ID() string { return "minecraft:jigsaw" } @@ -4568,28 +4568,28 @@ type Blackstone struct{} func (Blackstone) ID() string { return "minecraft:blackstone" } type BlackstoneStairs struct { - Facing Direction `nbt:"facing"` - Half string `nbt:"half"` - Shape string `nbt:"shape"` - Waterlogged Boolean `nbt:"waterlogged"` + Facing Direction `nbt:"facing"` + Half Half `nbt:"half"` + Shape StairsShape `nbt:"shape"` + Waterlogged Boolean `nbt:"waterlogged"` } func (BlackstoneStairs) ID() string { return "minecraft:blackstone_stairs" } type BlackstoneWall struct { - East string `nbt:"east"` - North string `nbt:"north"` - South string `nbt:"south"` - Up Boolean `nbt:"up"` - Waterlogged Boolean `nbt:"waterlogged"` - West string `nbt:"west"` + East WallSide `nbt:"east"` + North WallSide `nbt:"north"` + South WallSide `nbt:"south"` + Up Boolean `nbt:"up"` + Waterlogged Boolean `nbt:"waterlogged"` + West WallSide `nbt:"west"` } func (BlackstoneWall) ID() string { return "minecraft:blackstone_wall" } type BlackstoneSlab struct { - Type string `nbt:"type"` - Waterlogged Boolean `nbt:"waterlogged"` + Type SlabType `nbt:"type"` + Waterlogged Boolean `nbt:"waterlogged"` } func (BlackstoneSlab) ID() string { return "minecraft:blackstone_slab" } @@ -4613,28 +4613,28 @@ type ChiseledPolishedBlackstone struct{} func (ChiseledPolishedBlackstone) ID() string { return "minecraft:chiseled_polished_blackstone" } type PolishedBlackstoneBrickSlab struct { - Type string `nbt:"type"` - Waterlogged Boolean `nbt:"waterlogged"` + Type SlabType `nbt:"type"` + Waterlogged Boolean `nbt:"waterlogged"` } func (PolishedBlackstoneBrickSlab) ID() string { return "minecraft:polished_blackstone_brick_slab" } type PolishedBlackstoneBrickStairs struct { - Facing Direction `nbt:"facing"` - Half string `nbt:"half"` - Shape string `nbt:"shape"` - Waterlogged Boolean `nbt:"waterlogged"` + Facing Direction `nbt:"facing"` + Half Half `nbt:"half"` + Shape StairsShape `nbt:"shape"` + Waterlogged Boolean `nbt:"waterlogged"` } func (PolishedBlackstoneBrickStairs) ID() string { return "minecraft:polished_blackstone_brick_stairs" } type PolishedBlackstoneBrickWall struct { - East string `nbt:"east"` - North string `nbt:"north"` - South string `nbt:"south"` - Up Boolean `nbt:"up"` - Waterlogged Boolean `nbt:"waterlogged"` - West string `nbt:"west"` + East WallSide `nbt:"east"` + North WallSide `nbt:"north"` + South WallSide `nbt:"south"` + Up Boolean `nbt:"up"` + Waterlogged Boolean `nbt:"waterlogged"` + West WallSide `nbt:"west"` } func (PolishedBlackstoneBrickWall) ID() string { return "minecraft:polished_blackstone_brick_wall" } @@ -4644,17 +4644,17 @@ type GildedBlackstone struct{} func (GildedBlackstone) ID() string { return "minecraft:gilded_blackstone" } type PolishedBlackstoneStairs struct { - Facing Direction `nbt:"facing"` - Half string `nbt:"half"` - Shape string `nbt:"shape"` - Waterlogged Boolean `nbt:"waterlogged"` + Facing Direction `nbt:"facing"` + Half Half `nbt:"half"` + Shape StairsShape `nbt:"shape"` + Waterlogged Boolean `nbt:"waterlogged"` } func (PolishedBlackstoneStairs) ID() string { return "minecraft:polished_blackstone_stairs" } type PolishedBlackstoneSlab struct { - Type string `nbt:"type"` - Waterlogged Boolean `nbt:"waterlogged"` + Type SlabType `nbt:"type"` + Waterlogged Boolean `nbt:"waterlogged"` } func (PolishedBlackstoneSlab) ID() string { return "minecraft:polished_blackstone_slab" } @@ -4668,20 +4668,20 @@ func (PolishedBlackstonePressurePlate) ID() string { } type PolishedBlackstoneButton struct { - Face string `nbt:"face"` - Facing Direction `nbt:"facing"` - Powered Boolean `nbt:"powered"` + Face AttachFace `nbt:"face"` + Facing Direction `nbt:"facing"` + Powered Boolean `nbt:"powered"` } func (PolishedBlackstoneButton) ID() string { return "minecraft:polished_blackstone_button" } type PolishedBlackstoneWall struct { - East string `nbt:"east"` - North string `nbt:"north"` - South string `nbt:"south"` - Up Boolean `nbt:"up"` - Waterlogged Boolean `nbt:"waterlogged"` - West string `nbt:"west"` + East WallSide `nbt:"east"` + North WallSide `nbt:"north"` + South WallSide `nbt:"south"` + Up Boolean `nbt:"up"` + Waterlogged Boolean `nbt:"waterlogged"` + West WallSide `nbt:"west"` } func (PolishedBlackstoneWall) ID() string { return "minecraft:polished_blackstone_wall" } @@ -4989,9 +4989,9 @@ type PowderSnow struct{} func (PowderSnow) ID() string { return "minecraft:powder_snow" } type SculkSensor struct { - Power Integer `nbt:"power"` - Sculk_sensor_phase string `nbt:"sculk_sensor_phase"` - Waterlogged Boolean `nbt:"waterlogged"` + Power Integer `nbt:"power"` + Sculk_sensor_phase SculkSensorPhase `nbt:"sculk_sensor_phase"` + Waterlogged Boolean `nbt:"waterlogged"` } func (SculkSensor) ID() string { return "minecraft:sculk_sensor" } @@ -5037,65 +5037,65 @@ type CutCopper struct{} func (CutCopper) ID() string { return "minecraft:cut_copper" } type OxidizedCutCopperStairs struct { - Facing Direction `nbt:"facing"` - Half string `nbt:"half"` - Shape string `nbt:"shape"` - Waterlogged Boolean `nbt:"waterlogged"` + Facing Direction `nbt:"facing"` + Half Half `nbt:"half"` + Shape StairsShape `nbt:"shape"` + Waterlogged Boolean `nbt:"waterlogged"` } func (OxidizedCutCopperStairs) ID() string { return "minecraft:oxidized_cut_copper_stairs" } type WeatheredCutCopperStairs struct { - Facing Direction `nbt:"facing"` - Half string `nbt:"half"` - Shape string `nbt:"shape"` - Waterlogged Boolean `nbt:"waterlogged"` + Facing Direction `nbt:"facing"` + Half Half `nbt:"half"` + Shape StairsShape `nbt:"shape"` + Waterlogged Boolean `nbt:"waterlogged"` } func (WeatheredCutCopperStairs) ID() string { return "minecraft:weathered_cut_copper_stairs" } type ExposedCutCopperStairs struct { - Facing Direction `nbt:"facing"` - Half string `nbt:"half"` - Shape string `nbt:"shape"` - Waterlogged Boolean `nbt:"waterlogged"` + Facing Direction `nbt:"facing"` + Half Half `nbt:"half"` + Shape StairsShape `nbt:"shape"` + Waterlogged Boolean `nbt:"waterlogged"` } func (ExposedCutCopperStairs) ID() string { return "minecraft:exposed_cut_copper_stairs" } type CutCopperStairs struct { - Facing Direction `nbt:"facing"` - Half string `nbt:"half"` - Shape string `nbt:"shape"` - Waterlogged Boolean `nbt:"waterlogged"` + Facing Direction `nbt:"facing"` + Half Half `nbt:"half"` + Shape StairsShape `nbt:"shape"` + Waterlogged Boolean `nbt:"waterlogged"` } func (CutCopperStairs) ID() string { return "minecraft:cut_copper_stairs" } type OxidizedCutCopperSlab struct { - Type string `nbt:"type"` - Waterlogged Boolean `nbt:"waterlogged"` + Type SlabType `nbt:"type"` + Waterlogged Boolean `nbt:"waterlogged"` } func (OxidizedCutCopperSlab) ID() string { return "minecraft:oxidized_cut_copper_slab" } type WeatheredCutCopperSlab struct { - Type string `nbt:"type"` - Waterlogged Boolean `nbt:"waterlogged"` + Type SlabType `nbt:"type"` + Waterlogged Boolean `nbt:"waterlogged"` } func (WeatheredCutCopperSlab) ID() string { return "minecraft:weathered_cut_copper_slab" } type ExposedCutCopperSlab struct { - Type string `nbt:"type"` - Waterlogged Boolean `nbt:"waterlogged"` + Type SlabType `nbt:"type"` + Waterlogged Boolean `nbt:"waterlogged"` } func (ExposedCutCopperSlab) ID() string { return "minecraft:exposed_cut_copper_slab" } type CutCopperSlab struct { - Type string `nbt:"type"` - Waterlogged Boolean `nbt:"waterlogged"` + Type SlabType `nbt:"type"` + Waterlogged Boolean `nbt:"waterlogged"` } func (CutCopperSlab) ID() string { return "minecraft:cut_copper_slab" } @@ -5133,19 +5133,19 @@ type WaxedCutCopper struct{} func (WaxedCutCopper) ID() string { return "minecraft:waxed_cut_copper" } type WaxedOxidizedCutCopperStairs struct { - Facing Direction `nbt:"facing"` - Half string `nbt:"half"` - Shape string `nbt:"shape"` - Waterlogged Boolean `nbt:"waterlogged"` + Facing Direction `nbt:"facing"` + Half Half `nbt:"half"` + Shape StairsShape `nbt:"shape"` + Waterlogged Boolean `nbt:"waterlogged"` } func (WaxedOxidizedCutCopperStairs) ID() string { return "minecraft:waxed_oxidized_cut_copper_stairs" } type WaxedWeatheredCutCopperStairs struct { - Facing Direction `nbt:"facing"` - Half string `nbt:"half"` - Shape string `nbt:"shape"` - Waterlogged Boolean `nbt:"waterlogged"` + Facing Direction `nbt:"facing"` + Half Half `nbt:"half"` + Shape StairsShape `nbt:"shape"` + Waterlogged Boolean `nbt:"waterlogged"` } func (WaxedWeatheredCutCopperStairs) ID() string { @@ -5153,47 +5153,47 @@ func (WaxedWeatheredCutCopperStairs) ID() string { } type WaxedExposedCutCopperStairs struct { - Facing Direction `nbt:"facing"` - Half string `nbt:"half"` - Shape string `nbt:"shape"` - Waterlogged Boolean `nbt:"waterlogged"` + Facing Direction `nbt:"facing"` + Half Half `nbt:"half"` + Shape StairsShape `nbt:"shape"` + Waterlogged Boolean `nbt:"waterlogged"` } func (WaxedExposedCutCopperStairs) ID() string { return "minecraft:waxed_exposed_cut_copper_stairs" } type WaxedCutCopperStairs struct { - Facing Direction `nbt:"facing"` - Half string `nbt:"half"` - Shape string `nbt:"shape"` - Waterlogged Boolean `nbt:"waterlogged"` + Facing Direction `nbt:"facing"` + Half Half `nbt:"half"` + Shape StairsShape `nbt:"shape"` + Waterlogged Boolean `nbt:"waterlogged"` } func (WaxedCutCopperStairs) ID() string { return "minecraft:waxed_cut_copper_stairs" } type WaxedOxidizedCutCopperSlab struct { - Type string `nbt:"type"` - Waterlogged Boolean `nbt:"waterlogged"` + Type SlabType `nbt:"type"` + Waterlogged Boolean `nbt:"waterlogged"` } func (WaxedOxidizedCutCopperSlab) ID() string { return "minecraft:waxed_oxidized_cut_copper_slab" } type WaxedWeatheredCutCopperSlab struct { - Type string `nbt:"type"` - Waterlogged Boolean `nbt:"waterlogged"` + Type SlabType `nbt:"type"` + Waterlogged Boolean `nbt:"waterlogged"` } func (WaxedWeatheredCutCopperSlab) ID() string { return "minecraft:waxed_weathered_cut_copper_slab" } type WaxedExposedCutCopperSlab struct { - Type string `nbt:"type"` - Waterlogged Boolean `nbt:"waterlogged"` + Type SlabType `nbt:"type"` + Waterlogged Boolean `nbt:"waterlogged"` } func (WaxedExposedCutCopperSlab) ID() string { return "minecraft:waxed_exposed_cut_copper_slab" } type WaxedCutCopperSlab struct { - Type string `nbt:"type"` - Waterlogged Boolean `nbt:"waterlogged"` + Type SlabType `nbt:"type"` + Waterlogged Boolean `nbt:"waterlogged"` } func (WaxedCutCopperSlab) ID() string { return "minecraft:waxed_cut_copper_slab" } @@ -5207,9 +5207,9 @@ type LightningRod struct { func (LightningRod) ID() string { return "minecraft:lightning_rod" } type PointedDripstone struct { - Thickness string `nbt:"thickness"` - Vertical_direction Direction `nbt:"vertical_direction"` - Waterlogged Boolean `nbt:"waterlogged"` + Thickness DripstoneThickness `nbt:"thickness"` + Vertical_direction Direction `nbt:"vertical_direction"` + Waterlogged Boolean `nbt:"waterlogged"` } func (PointedDripstone) ID() string { return "minecraft:pointed_dripstone" } @@ -5253,7 +5253,7 @@ func (MossBlock) ID() string { return "minecraft:moss_block" } type BigDripleaf struct { Facing Direction `nbt:"facing"` - Tilt string `nbt:"tilt"` + Tilt Tilt `nbt:"tilt"` Waterlogged Boolean `nbt:"waterlogged"` } @@ -5267,9 +5267,9 @@ type BigDripleafStem struct { func (BigDripleafStem) ID() string { return "minecraft:big_dripleaf_stem" } type SmallDripleaf struct { - Facing Direction `nbt:"facing"` - Half string `nbt:"half"` - Waterlogged Boolean `nbt:"waterlogged"` + Facing Direction `nbt:"facing"` + Half DoubleBlockHalf `nbt:"half"` + Waterlogged Boolean `nbt:"waterlogged"` } func (SmallDripleaf) ID() string { return "minecraft:small_dripleaf" } @@ -5285,7 +5285,7 @@ type RootedDirt struct{} func (RootedDirt) ID() string { return "minecraft:rooted_dirt" } type Deepslate struct { - Axis string `nbt:"axis"` + Axis Axis `nbt:"axis"` } func (Deepslate) ID() string { return "minecraft:deepslate" } @@ -5295,28 +5295,28 @@ type CobbledDeepslate struct{} func (CobbledDeepslate) ID() string { return "minecraft:cobbled_deepslate" } type CobbledDeepslateStairs struct { - Facing Direction `nbt:"facing"` - Half string `nbt:"half"` - Shape string `nbt:"shape"` - Waterlogged Boolean `nbt:"waterlogged"` + Facing Direction `nbt:"facing"` + Half Half `nbt:"half"` + Shape StairsShape `nbt:"shape"` + Waterlogged Boolean `nbt:"waterlogged"` } func (CobbledDeepslateStairs) ID() string { return "minecraft:cobbled_deepslate_stairs" } type CobbledDeepslateSlab struct { - Type string `nbt:"type"` - Waterlogged Boolean `nbt:"waterlogged"` + Type SlabType `nbt:"type"` + Waterlogged Boolean `nbt:"waterlogged"` } func (CobbledDeepslateSlab) ID() string { return "minecraft:cobbled_deepslate_slab" } type CobbledDeepslateWall struct { - East string `nbt:"east"` - North string `nbt:"north"` - South string `nbt:"south"` - Up Boolean `nbt:"up"` - Waterlogged Boolean `nbt:"waterlogged"` - West string `nbt:"west"` + East WallSide `nbt:"east"` + North WallSide `nbt:"north"` + South WallSide `nbt:"south"` + Up Boolean `nbt:"up"` + Waterlogged Boolean `nbt:"waterlogged"` + West WallSide `nbt:"west"` } func (CobbledDeepslateWall) ID() string { return "minecraft:cobbled_deepslate_wall" } @@ -5326,28 +5326,28 @@ type PolishedDeepslate struct{} func (PolishedDeepslate) ID() string { return "minecraft:polished_deepslate" } type PolishedDeepslateStairs struct { - Facing Direction `nbt:"facing"` - Half string `nbt:"half"` - Shape string `nbt:"shape"` - Waterlogged Boolean `nbt:"waterlogged"` + Facing Direction `nbt:"facing"` + Half Half `nbt:"half"` + Shape StairsShape `nbt:"shape"` + Waterlogged Boolean `nbt:"waterlogged"` } func (PolishedDeepslateStairs) ID() string { return "minecraft:polished_deepslate_stairs" } type PolishedDeepslateSlab struct { - Type string `nbt:"type"` - Waterlogged Boolean `nbt:"waterlogged"` + Type SlabType `nbt:"type"` + Waterlogged Boolean `nbt:"waterlogged"` } func (PolishedDeepslateSlab) ID() string { return "minecraft:polished_deepslate_slab" } type PolishedDeepslateWall struct { - East string `nbt:"east"` - North string `nbt:"north"` - South string `nbt:"south"` - Up Boolean `nbt:"up"` - Waterlogged Boolean `nbt:"waterlogged"` - West string `nbt:"west"` + East WallSide `nbt:"east"` + North WallSide `nbt:"north"` + South WallSide `nbt:"south"` + Up Boolean `nbt:"up"` + Waterlogged Boolean `nbt:"waterlogged"` + West WallSide `nbt:"west"` } func (PolishedDeepslateWall) ID() string { return "minecraft:polished_deepslate_wall" } @@ -5357,28 +5357,28 @@ type DeepslateTiles struct{} func (DeepslateTiles) ID() string { return "minecraft:deepslate_tiles" } type DeepslateTileStairs struct { - Facing Direction `nbt:"facing"` - Half string `nbt:"half"` - Shape string `nbt:"shape"` - Waterlogged Boolean `nbt:"waterlogged"` + Facing Direction `nbt:"facing"` + Half Half `nbt:"half"` + Shape StairsShape `nbt:"shape"` + Waterlogged Boolean `nbt:"waterlogged"` } func (DeepslateTileStairs) ID() string { return "minecraft:deepslate_tile_stairs" } type DeepslateTileSlab struct { - Type string `nbt:"type"` - Waterlogged Boolean `nbt:"waterlogged"` + Type SlabType `nbt:"type"` + Waterlogged Boolean `nbt:"waterlogged"` } func (DeepslateTileSlab) ID() string { return "minecraft:deepslate_tile_slab" } type DeepslateTileWall struct { - East string `nbt:"east"` - North string `nbt:"north"` - South string `nbt:"south"` - Up Boolean `nbt:"up"` - Waterlogged Boolean `nbt:"waterlogged"` - West string `nbt:"west"` + East WallSide `nbt:"east"` + North WallSide `nbt:"north"` + South WallSide `nbt:"south"` + Up Boolean `nbt:"up"` + Waterlogged Boolean `nbt:"waterlogged"` + West WallSide `nbt:"west"` } func (DeepslateTileWall) ID() string { return "minecraft:deepslate_tile_wall" } @@ -5388,28 +5388,28 @@ type DeepslateBricks struct{} func (DeepslateBricks) ID() string { return "minecraft:deepslate_bricks" } type DeepslateBrickStairs struct { - Facing Direction `nbt:"facing"` - Half string `nbt:"half"` - Shape string `nbt:"shape"` - Waterlogged Boolean `nbt:"waterlogged"` + Facing Direction `nbt:"facing"` + Half Half `nbt:"half"` + Shape StairsShape `nbt:"shape"` + Waterlogged Boolean `nbt:"waterlogged"` } func (DeepslateBrickStairs) ID() string { return "minecraft:deepslate_brick_stairs" } type DeepslateBrickSlab struct { - Type string `nbt:"type"` - Waterlogged Boolean `nbt:"waterlogged"` + Type SlabType `nbt:"type"` + Waterlogged Boolean `nbt:"waterlogged"` } func (DeepslateBrickSlab) ID() string { return "minecraft:deepslate_brick_slab" } type DeepslateBrickWall struct { - East string `nbt:"east"` - North string `nbt:"north"` - South string `nbt:"south"` - Up Boolean `nbt:"up"` - Waterlogged Boolean `nbt:"waterlogged"` - West string `nbt:"west"` + East WallSide `nbt:"east"` + North WallSide `nbt:"north"` + South WallSide `nbt:"south"` + Up Boolean `nbt:"up"` + Waterlogged Boolean `nbt:"waterlogged"` + West WallSide `nbt:"west"` } func (DeepslateBrickWall) ID() string { return "minecraft:deepslate_brick_wall" } @@ -5427,7 +5427,7 @@ type CrackedDeepslateTiles struct{} func (CrackedDeepslateTiles) ID() string { return "minecraft:cracked_deepslate_tiles" } type InfestedDeepslate struct { - Axis string `nbt:"axis"` + Axis Axis `nbt:"axis"` } func (InfestedDeepslate) ID() string { return "minecraft:infested_deepslate" } diff --git a/level/block/blocks.nbt b/level/block/blocks.nbt index 2e4659e..e6c0b2c 100644 Binary files a/level/block/blocks.nbt and b/level/block/blocks.nbt differ diff --git a/level/block/generator/blocks.go.tmpl b/level/block/generator/blocks/blocks.go.tmpl similarity index 100% rename from level/block/generator/blocks.go.tmpl rename to level/block/generator/blocks/blocks.go.tmpl diff --git a/level/block/generator/main.go b/level/block/generator/blocks/main.go similarity index 76% rename from level/block/generator/main.go rename to level/block/generator/blocks/main.go index 757c0ec..1f34619 100644 --- a/level/block/generator/main.go +++ b/level/block/generator/blocks/main.go @@ -1,7 +1,10 @@ package main import ( + "bytes" + "compress/gzip" _ "embed" + "go/format" "log" "os" "strings" @@ -20,7 +23,7 @@ var temp = template.Must(template. "UpperTheFirst": UpperTheFirst, "ToGoTypeName": ToGoTypeName, "GetType": GetType, - "Generator": func() string { return "generator/main.go" }, + "Generator": func() string { return "generator/blocks/main.go" }, }). Parse(tempSource)) @@ -45,25 +48,31 @@ func readBlockStates(states *[]State) { } defer f.Close() + r, err := gzip.NewReader(f) + if err != nil { + log.Panic(err) + } + // parse the nbt format - if _, err := nbt.NewDecoder(f).Decode(states); err != nil { + if _, err := nbt.NewDecoder(r).Decode(states); err != nil { log.Panic(err) } } func genSourceFile(states []State) { - file, err := os.Create("blocks.go") - if err != nil { + var source bytes.Buffer + if err := temp.Execute(&source, states); err != nil { log.Panic(err) } - defer file.Close() - // clean up the file - if err := file.Truncate(0); err != nil { - return - } - if err := temp.Execute(file, states); err != nil { - log.Panic(err) + formattedSource, err := format.Source(source.Bytes()) + if err != nil { + panic(err) + } + + err = os.WriteFile("blocks.go", formattedSource, 0666) + if err != nil { + panic(err) } } @@ -79,7 +88,6 @@ func ToGoTypeName(name string) string { var typeMaps = map[string]string{ "BooleanProperty": "Boolean", "DirectionProperty": "Direction", - "EnumProperty": "string", "IntegerProperty": "Integer", } diff --git a/level/block/generator/properties/main.go b/level/block/generator/properties/main.go new file mode 100644 index 0000000..116289a --- /dev/null +++ b/level/block/generator/properties/main.go @@ -0,0 +1,97 @@ +package main + +import ( + "bytes" + _ "embed" + "go/format" + "log" + "os" + "strings" + "text/template" + "unicode" +) + +type EnumProperty struct { + Name string + TrimPrefix bool + Values []string +} + +var EnumProperties = []EnumProperty{ + {Name: "AttachFace", Values: []string{"floor", "wall", "ceiling"}}, + {Name: "BambooLeaves", Values: []string{"none", "small", "large"}}, + {Name: "BedPart", Values: []string{"head", "foot"}}, + {Name: "BellAttachType", Values: []string{"floor", "ceiling", "single_wall", "double_wall"}}, + {Name: "ChestType", Values: []string{"single", "left", "right"}}, + {Name: "ComparatorMode", Values: []string{"compare", "subtract"}}, + {Name: "Direction", TrimPrefix: true, Values: []string{"down", "up", "north", "south", "west", "east"}}, + {Name: "Axis", TrimPrefix: true, Values: []string{"x", "y", "z"}}, + {Name: "DoorHingeSide", Values: []string{"left", "right"}}, + {Name: "DoubleBlockHalf", Values: []string{"upper", "lower"}}, + {Name: "DripstoneThickness", Values: []string{"tip_merge", "tip", "frustum", "middle", "base"}}, + {Name: "Half", TrimPrefix: true, Values: []string{"top", "bottom"}}, + {Name: "NoteBlockInstrument", Values: []string{ + "harp", "basedrum", "snare", "hat", + "bass", "flute", "bell", "guitar", + "chime", "xylophone", "iron_xylophone", "cow_bell", + "didgeridoo", "bit", "banjo", "pling", + }}, + {Name: "PistonType", Values: []string{"normal", "sticky"}}, + {Name: "RailShape", Values: []string{ + "north_south", "east_west", + "ascending_east", "ascending_west", "ascending_north", "ascending_south", + "south_east", "south_west", "north_west", "north_east", + }}, + {Name: "RedstoneSide", Values: []string{"up", "side", "none"}}, + {Name: "SculkSensorPhase", Values: []string{"inactive", "active", "cooldown"}}, + {Name: "SlabType", Values: []string{"top", "bottom", "double"}}, + {Name: "StairsShape", Values: []string{"straight", "inner_left", "inner_right", "outer_left", "outer_right"}}, + {Name: "StructureMode", Values: []string{"save", "load", "corner", "data"}}, + {Name: "Tilt", Values: []string{"none", "unstable", "partial", "full"}}, + {Name: "WallSide", Values: []string{"none", "low", "tall"}}, + {Name: "FrontAndTop", TrimPrefix: true, Values: []string{ + "down_east", "down_north", "down_south", "down_west", + "up_east", "up_north", "up_south", "up_west", + "west_up", "east_up", "north_up", "south_up", + }}, +} + +//go:embed properties_enum.go.tmpl +var tempSource string + +func main() { + var source bytes.Buffer + err := template.Must(template. + New("properties_enum"). + Funcs(template.FuncMap{ + "UpperTheFirst": UpperTheFirst, + "ToLower": strings.ToLower, + "Generator": func() string { return "generator/properties/main.go" }, + }). + Parse(tempSource)). + Execute(&source, EnumProperties) + if err != nil { + log.Panic(err) + } + + formattedSource, err := format.Source(source.Bytes()) + if err != nil { + log.Panic(err) + } + err = os.WriteFile("properties_enum.go", formattedSource, 0666) + if err != nil { + log.Panic(err) + } +} + +func UpperTheFirst(word string) string { + var sb strings.Builder + for _, word := range strings.Split(word, "_") { + runes := []rune(word) + if len(runes) > 0 { + runes[0] = unicode.ToUpper(runes[0]) + } + sb.WriteString(string(runes)) + } + return sb.String() +} diff --git a/level/block/generator/properties/properties_enum.go.tmpl b/level/block/generator/properties/properties_enum.go.tmpl new file mode 100644 index 0000000..6a47a86 --- /dev/null +++ b/level/block/generator/properties/properties_enum.go.tmpl @@ -0,0 +1,45 @@ +// Code generated by {{Generator}}; DO NOT EDIT. +package block + +import ( + "errors" + "strconv" +) +{{range $prop := .}} +type {{.Name}} byte + +const ( +{{- range $index, $element := .Values}} + {{if not $prop.TrimPrefix}}{{$prop.Name}}{{end}}{{$element | UpperTheFirst}}{{if eq $index 0 }} {{$prop.Name}} = iota{{end}} +{{- end}} +) + +{{- $v := slice (.Name | ToLower) 0 1 }} +var str{{.Name}} = [...]string{ {{- range $index, $elem := .Values }}{{$elem | printf "%q"}}{{if ne $index (len $prop.Values)}}, {{end}}{{end -}} } + +func ({{$v}} {{.Name}}) String() string { + if int({{$v}}) < len(str{{.Name}}) { + return str{{.Name}}[{{$v}}] + } + return "invalid {{.Name}}" +} + +func ({{$v}} {{.Name}}) MarshalText() (text []byte, err error) { + if int({{$v}}) < len(str{{.Name}}) { + return []byte(str{{.Name}}[{{$v}}]), nil + } + return nil, errors.New("invalid {{.Name}}: " + strconv.Itoa(int({{$v}}))) +} + +func ({{$v}} *{{.Name}}) UnmarshalText(text []byte) error { + switch str := string(text); str { +{{- range .Values}} + case {{. | printf "%q"}}: + *{{$v}} = {{if not $prop.TrimPrefix}}{{$prop.Name}}{{end}}{{. | UpperTheFirst}} +{{- end}} + default: + return errors.New("unknown {{.Name}}: " + str) + } + return nil +} +{{end}} \ No newline at end of file diff --git a/level/block/properties.go b/level/block/properties.go index 07f95ee..469a58b 100644 --- a/level/block/properties.go +++ b/level/block/properties.go @@ -1,14 +1,8 @@ package block -import ( - "strconv" -) +import "strconv" -type ( - Boolean bool - Direction string - Integer int -) +type Boolean bool func (b Boolean) MarshalText() (text []byte, err error) { return []byte(strconv.FormatBool(bool(b))), nil @@ -19,14 +13,7 @@ func (b *Boolean) UnmarshalText(text []byte) (err error) { return } -func (d Direction) MarshalText() (text []byte, err error) { - return []byte(d), nil -} - -func (d *Direction) UnmarshalText(text []byte) error { - *d = Direction(text) - return nil -} +type Integer int func (i Integer) MarshalText() (text []byte, err error) { return []byte(strconv.Itoa(int(i))), nil @@ -36,3 +23,34 @@ func (i *Integer) UnmarshalText(text []byte) (err error) { *((*int)(i)), err = strconv.Atoi(string(text)) return } + +func (f FrontAndTop) Directions() (front, top Direction) { + switch f { + case DownEast: + return Down, East + case DownNorth: + return Down, North + case DownSouth: + return Down, South + case DownWest: + return Down, West + case UpEast: + return Up, East + case UpNorth: + return Up, North + case UpSouth: + return Up, South + case UpWest: + return Up, West + case WestUp: + return West, Up + case EastUp: + return East, Up + case NorthUp: + return North, Up + case SouthUp: + return South, Up + default: + panic("invalid FrontAndTop") + } +} diff --git a/level/block/properties_enum.go b/level/block/properties_enum.go new file mode 100644 index 0000000..5e9a63d --- /dev/null +++ b/level/block/properties_enum.go @@ -0,0 +1,980 @@ +// Code generated by generator/properties/main.go; DO NOT EDIT. +package block + +import ( + "errors" + "strconv" +) + +type AttachFace byte + +const ( + AttachFaceFloor AttachFace = iota + AttachFaceWall + AttachFaceCeiling +) + +var strAttachFace = [...]string{"floor", "wall", "ceiling"} + +func (a AttachFace) String() string { + if int(a) < len(strAttachFace) { + return strAttachFace[a] + } + return "invalid AttachFace" +} + +func (a AttachFace) MarshalText() (text []byte, err error) { + if int(a) < len(strAttachFace) { + return []byte(strAttachFace[a]), nil + } + return nil, errors.New("invalid AttachFace: " + strconv.Itoa(int(a))) +} + +func (a *AttachFace) UnmarshalText(text []byte) error { + switch str := string(text); str { + case "floor": + *a = AttachFaceFloor + case "wall": + *a = AttachFaceWall + case "ceiling": + *a = AttachFaceCeiling + default: + return errors.New("unknown AttachFace: " + str) + } + return nil +} + +type BambooLeaves byte + +const ( + BambooLeavesNone BambooLeaves = iota + BambooLeavesSmall + BambooLeavesLarge +) + +var strBambooLeaves = [...]string{"none", "small", "large"} + +func (b BambooLeaves) String() string { + if int(b) < len(strBambooLeaves) { + return strBambooLeaves[b] + } + return "invalid BambooLeaves" +} + +func (b BambooLeaves) MarshalText() (text []byte, err error) { + if int(b) < len(strBambooLeaves) { + return []byte(strBambooLeaves[b]), nil + } + return nil, errors.New("invalid BambooLeaves: " + strconv.Itoa(int(b))) +} + +func (b *BambooLeaves) UnmarshalText(text []byte) error { + switch str := string(text); str { + case "none": + *b = BambooLeavesNone + case "small": + *b = BambooLeavesSmall + case "large": + *b = BambooLeavesLarge + default: + return errors.New("unknown BambooLeaves: " + str) + } + return nil +} + +type BedPart byte + +const ( + BedPartHead BedPart = iota + BedPartFoot +) + +var strBedPart = [...]string{"head", "foot"} + +func (b BedPart) String() string { + if int(b) < len(strBedPart) { + return strBedPart[b] + } + return "invalid BedPart" +} + +func (b BedPart) MarshalText() (text []byte, err error) { + if int(b) < len(strBedPart) { + return []byte(strBedPart[b]), nil + } + return nil, errors.New("invalid BedPart: " + strconv.Itoa(int(b))) +} + +func (b *BedPart) UnmarshalText(text []byte) error { + switch str := string(text); str { + case "head": + *b = BedPartHead + case "foot": + *b = BedPartFoot + default: + return errors.New("unknown BedPart: " + str) + } + return nil +} + +type BellAttachType byte + +const ( + BellAttachTypeFloor BellAttachType = iota + BellAttachTypeCeiling + BellAttachTypeSingleWall + BellAttachTypeDoubleWall +) + +var strBellAttachType = [...]string{"floor", "ceiling", "single_wall", "double_wall"} + +func (b BellAttachType) String() string { + if int(b) < len(strBellAttachType) { + return strBellAttachType[b] + } + return "invalid BellAttachType" +} + +func (b BellAttachType) MarshalText() (text []byte, err error) { + if int(b) < len(strBellAttachType) { + return []byte(strBellAttachType[b]), nil + } + return nil, errors.New("invalid BellAttachType: " + strconv.Itoa(int(b))) +} + +func (b *BellAttachType) UnmarshalText(text []byte) error { + switch str := string(text); str { + case "floor": + *b = BellAttachTypeFloor + case "ceiling": + *b = BellAttachTypeCeiling + case "single_wall": + *b = BellAttachTypeSingleWall + case "double_wall": + *b = BellAttachTypeDoubleWall + default: + return errors.New("unknown BellAttachType: " + str) + } + return nil +} + +type ChestType byte + +const ( + ChestTypeSingle ChestType = iota + ChestTypeLeft + ChestTypeRight +) + +var strChestType = [...]string{"single", "left", "right"} + +func (c ChestType) String() string { + if int(c) < len(strChestType) { + return strChestType[c] + } + return "invalid ChestType" +} + +func (c ChestType) MarshalText() (text []byte, err error) { + if int(c) < len(strChestType) { + return []byte(strChestType[c]), nil + } + return nil, errors.New("invalid ChestType: " + strconv.Itoa(int(c))) +} + +func (c *ChestType) UnmarshalText(text []byte) error { + switch str := string(text); str { + case "single": + *c = ChestTypeSingle + case "left": + *c = ChestTypeLeft + case "right": + *c = ChestTypeRight + default: + return errors.New("unknown ChestType: " + str) + } + return nil +} + +type ComparatorMode byte + +const ( + ComparatorModeCompare ComparatorMode = iota + ComparatorModeSubtract +) + +var strComparatorMode = [...]string{"compare", "subtract"} + +func (c ComparatorMode) String() string { + if int(c) < len(strComparatorMode) { + return strComparatorMode[c] + } + return "invalid ComparatorMode" +} + +func (c ComparatorMode) MarshalText() (text []byte, err error) { + if int(c) < len(strComparatorMode) { + return []byte(strComparatorMode[c]), nil + } + return nil, errors.New("invalid ComparatorMode: " + strconv.Itoa(int(c))) +} + +func (c *ComparatorMode) UnmarshalText(text []byte) error { + switch str := string(text); str { + case "compare": + *c = ComparatorModeCompare + case "subtract": + *c = ComparatorModeSubtract + default: + return errors.New("unknown ComparatorMode: " + str) + } + return nil +} + +type Direction byte + +const ( + Down Direction = iota + Up + North + South + West + East +) + +var strDirection = [...]string{"down", "up", "north", "south", "west", "east"} + +func (d Direction) String() string { + if int(d) < len(strDirection) { + return strDirection[d] + } + return "invalid Direction" +} + +func (d Direction) MarshalText() (text []byte, err error) { + if int(d) < len(strDirection) { + return []byte(strDirection[d]), nil + } + return nil, errors.New("invalid Direction: " + strconv.Itoa(int(d))) +} + +func (d *Direction) UnmarshalText(text []byte) error { + switch str := string(text); str { + case "down": + *d = Down + case "up": + *d = Up + case "north": + *d = North + case "south": + *d = South + case "west": + *d = West + case "east": + *d = East + default: + return errors.New("unknown Direction: " + str) + } + return nil +} + +type Axis byte + +const ( + X Axis = iota + Y + Z +) + +var strAxis = [...]string{"x", "y", "z"} + +func (a Axis) String() string { + if int(a) < len(strAxis) { + return strAxis[a] + } + return "invalid Axis" +} + +func (a Axis) MarshalText() (text []byte, err error) { + if int(a) < len(strAxis) { + return []byte(strAxis[a]), nil + } + return nil, errors.New("invalid Axis: " + strconv.Itoa(int(a))) +} + +func (a *Axis) UnmarshalText(text []byte) error { + switch str := string(text); str { + case "x": + *a = X + case "y": + *a = Y + case "z": + *a = Z + default: + return errors.New("unknown Axis: " + str) + } + return nil +} + +type DoorHingeSide byte + +const ( + DoorHingeSideLeft DoorHingeSide = iota + DoorHingeSideRight +) + +var strDoorHingeSide = [...]string{"left", "right"} + +func (d DoorHingeSide) String() string { + if int(d) < len(strDoorHingeSide) { + return strDoorHingeSide[d] + } + return "invalid DoorHingeSide" +} + +func (d DoorHingeSide) MarshalText() (text []byte, err error) { + if int(d) < len(strDoorHingeSide) { + return []byte(strDoorHingeSide[d]), nil + } + return nil, errors.New("invalid DoorHingeSide: " + strconv.Itoa(int(d))) +} + +func (d *DoorHingeSide) UnmarshalText(text []byte) error { + switch str := string(text); str { + case "left": + *d = DoorHingeSideLeft + case "right": + *d = DoorHingeSideRight + default: + return errors.New("unknown DoorHingeSide: " + str) + } + return nil +} + +type DoubleBlockHalf byte + +const ( + DoubleBlockHalfUpper DoubleBlockHalf = iota + DoubleBlockHalfLower +) + +var strDoubleBlockHalf = [...]string{"upper", "lower"} + +func (d DoubleBlockHalf) String() string { + if int(d) < len(strDoubleBlockHalf) { + return strDoubleBlockHalf[d] + } + return "invalid DoubleBlockHalf" +} + +func (d DoubleBlockHalf) MarshalText() (text []byte, err error) { + if int(d) < len(strDoubleBlockHalf) { + return []byte(strDoubleBlockHalf[d]), nil + } + return nil, errors.New("invalid DoubleBlockHalf: " + strconv.Itoa(int(d))) +} + +func (d *DoubleBlockHalf) UnmarshalText(text []byte) error { + switch str := string(text); str { + case "upper": + *d = DoubleBlockHalfUpper + case "lower": + *d = DoubleBlockHalfLower + default: + return errors.New("unknown DoubleBlockHalf: " + str) + } + return nil +} + +type DripstoneThickness byte + +const ( + DripstoneThicknessTipMerge DripstoneThickness = iota + DripstoneThicknessTip + DripstoneThicknessFrustum + DripstoneThicknessMiddle + DripstoneThicknessBase +) + +var strDripstoneThickness = [...]string{"tip_merge", "tip", "frustum", "middle", "base"} + +func (d DripstoneThickness) String() string { + if int(d) < len(strDripstoneThickness) { + return strDripstoneThickness[d] + } + return "invalid DripstoneThickness" +} + +func (d DripstoneThickness) MarshalText() (text []byte, err error) { + if int(d) < len(strDripstoneThickness) { + return []byte(strDripstoneThickness[d]), nil + } + return nil, errors.New("invalid DripstoneThickness: " + strconv.Itoa(int(d))) +} + +func (d *DripstoneThickness) UnmarshalText(text []byte) error { + switch str := string(text); str { + case "tip_merge": + *d = DripstoneThicknessTipMerge + case "tip": + *d = DripstoneThicknessTip + case "frustum": + *d = DripstoneThicknessFrustum + case "middle": + *d = DripstoneThicknessMiddle + case "base": + *d = DripstoneThicknessBase + default: + return errors.New("unknown DripstoneThickness: " + str) + } + return nil +} + +type Half byte + +const ( + Top Half = iota + Bottom +) + +var strHalf = [...]string{"top", "bottom"} + +func (h Half) String() string { + if int(h) < len(strHalf) { + return strHalf[h] + } + return "invalid Half" +} + +func (h Half) MarshalText() (text []byte, err error) { + if int(h) < len(strHalf) { + return []byte(strHalf[h]), nil + } + return nil, errors.New("invalid Half: " + strconv.Itoa(int(h))) +} + +func (h *Half) UnmarshalText(text []byte) error { + switch str := string(text); str { + case "top": + *h = Top + case "bottom": + *h = Bottom + default: + return errors.New("unknown Half: " + str) + } + return nil +} + +type NoteBlockInstrument byte + +const ( + NoteBlockInstrumentHarp NoteBlockInstrument = iota + NoteBlockInstrumentBasedrum + NoteBlockInstrumentSnare + NoteBlockInstrumentHat + NoteBlockInstrumentBass + NoteBlockInstrumentFlute + NoteBlockInstrumentBell + NoteBlockInstrumentGuitar + NoteBlockInstrumentChime + NoteBlockInstrumentXylophone + NoteBlockInstrumentIronXylophone + NoteBlockInstrumentCowBell + NoteBlockInstrumentDidgeridoo + NoteBlockInstrumentBit + NoteBlockInstrumentBanjo + NoteBlockInstrumentPling +) + +var strNoteBlockInstrument = [...]string{"harp", "basedrum", "snare", "hat", "bass", "flute", "bell", "guitar", "chime", "xylophone", "iron_xylophone", "cow_bell", "didgeridoo", "bit", "banjo", "pling"} + +func (n NoteBlockInstrument) String() string { + if int(n) < len(strNoteBlockInstrument) { + return strNoteBlockInstrument[n] + } + return "invalid NoteBlockInstrument" +} + +func (n NoteBlockInstrument) MarshalText() (text []byte, err error) { + if int(n) < len(strNoteBlockInstrument) { + return []byte(strNoteBlockInstrument[n]), nil + } + return nil, errors.New("invalid NoteBlockInstrument: " + strconv.Itoa(int(n))) +} + +func (n *NoteBlockInstrument) UnmarshalText(text []byte) error { + switch str := string(text); str { + case "harp": + *n = NoteBlockInstrumentHarp + case "basedrum": + *n = NoteBlockInstrumentBasedrum + case "snare": + *n = NoteBlockInstrumentSnare + case "hat": + *n = NoteBlockInstrumentHat + case "bass": + *n = NoteBlockInstrumentBass + case "flute": + *n = NoteBlockInstrumentFlute + case "bell": + *n = NoteBlockInstrumentBell + case "guitar": + *n = NoteBlockInstrumentGuitar + case "chime": + *n = NoteBlockInstrumentChime + case "xylophone": + *n = NoteBlockInstrumentXylophone + case "iron_xylophone": + *n = NoteBlockInstrumentIronXylophone + case "cow_bell": + *n = NoteBlockInstrumentCowBell + case "didgeridoo": + *n = NoteBlockInstrumentDidgeridoo + case "bit": + *n = NoteBlockInstrumentBit + case "banjo": + *n = NoteBlockInstrumentBanjo + case "pling": + *n = NoteBlockInstrumentPling + default: + return errors.New("unknown NoteBlockInstrument: " + str) + } + return nil +} + +type PistonType byte + +const ( + PistonTypeNormal PistonType = iota + PistonTypeSticky +) + +var strPistonType = [...]string{"normal", "sticky"} + +func (p PistonType) String() string { + if int(p) < len(strPistonType) { + return strPistonType[p] + } + return "invalid PistonType" +} + +func (p PistonType) MarshalText() (text []byte, err error) { + if int(p) < len(strPistonType) { + return []byte(strPistonType[p]), nil + } + return nil, errors.New("invalid PistonType: " + strconv.Itoa(int(p))) +} + +func (p *PistonType) UnmarshalText(text []byte) error { + switch str := string(text); str { + case "normal": + *p = PistonTypeNormal + case "sticky": + *p = PistonTypeSticky + default: + return errors.New("unknown PistonType: " + str) + } + return nil +} + +type RailShape byte + +const ( + RailShapeNorthSouth RailShape = iota + RailShapeEastWest + RailShapeAscendingEast + RailShapeAscendingWest + RailShapeAscendingNorth + RailShapeAscendingSouth + RailShapeSouthEast + RailShapeSouthWest + RailShapeNorthWest + RailShapeNorthEast +) + +var strRailShape = [...]string{"north_south", "east_west", "ascending_east", "ascending_west", "ascending_north", "ascending_south", "south_east", "south_west", "north_west", "north_east"} + +func (r RailShape) String() string { + if int(r) < len(strRailShape) { + return strRailShape[r] + } + return "invalid RailShape" +} + +func (r RailShape) MarshalText() (text []byte, err error) { + if int(r) < len(strRailShape) { + return []byte(strRailShape[r]), nil + } + return nil, errors.New("invalid RailShape: " + strconv.Itoa(int(r))) +} + +func (r *RailShape) UnmarshalText(text []byte) error { + switch str := string(text); str { + case "north_south": + *r = RailShapeNorthSouth + case "east_west": + *r = RailShapeEastWest + case "ascending_east": + *r = RailShapeAscendingEast + case "ascending_west": + *r = RailShapeAscendingWest + case "ascending_north": + *r = RailShapeAscendingNorth + case "ascending_south": + *r = RailShapeAscendingSouth + case "south_east": + *r = RailShapeSouthEast + case "south_west": + *r = RailShapeSouthWest + case "north_west": + *r = RailShapeNorthWest + case "north_east": + *r = RailShapeNorthEast + default: + return errors.New("unknown RailShape: " + str) + } + return nil +} + +type RedstoneSide byte + +const ( + RedstoneSideUp RedstoneSide = iota + RedstoneSideSide + RedstoneSideNone +) + +var strRedstoneSide = [...]string{"up", "side", "none"} + +func (r RedstoneSide) String() string { + if int(r) < len(strRedstoneSide) { + return strRedstoneSide[r] + } + return "invalid RedstoneSide" +} + +func (r RedstoneSide) MarshalText() (text []byte, err error) { + if int(r) < len(strRedstoneSide) { + return []byte(strRedstoneSide[r]), nil + } + return nil, errors.New("invalid RedstoneSide: " + strconv.Itoa(int(r))) +} + +func (r *RedstoneSide) UnmarshalText(text []byte) error { + switch str := string(text); str { + case "up": + *r = RedstoneSideUp + case "side": + *r = RedstoneSideSide + case "none": + *r = RedstoneSideNone + default: + return errors.New("unknown RedstoneSide: " + str) + } + return nil +} + +type SculkSensorPhase byte + +const ( + SculkSensorPhaseInactive SculkSensorPhase = iota + SculkSensorPhaseActive + SculkSensorPhaseCooldown +) + +var strSculkSensorPhase = [...]string{"inactive", "active", "cooldown"} + +func (s SculkSensorPhase) String() string { + if int(s) < len(strSculkSensorPhase) { + return strSculkSensorPhase[s] + } + return "invalid SculkSensorPhase" +} + +func (s SculkSensorPhase) MarshalText() (text []byte, err error) { + if int(s) < len(strSculkSensorPhase) { + return []byte(strSculkSensorPhase[s]), nil + } + return nil, errors.New("invalid SculkSensorPhase: " + strconv.Itoa(int(s))) +} + +func (s *SculkSensorPhase) UnmarshalText(text []byte) error { + switch str := string(text); str { + case "inactive": + *s = SculkSensorPhaseInactive + case "active": + *s = SculkSensorPhaseActive + case "cooldown": + *s = SculkSensorPhaseCooldown + default: + return errors.New("unknown SculkSensorPhase: " + str) + } + return nil +} + +type SlabType byte + +const ( + SlabTypeTop SlabType = iota + SlabTypeBottom + SlabTypeDouble +) + +var strSlabType = [...]string{"top", "bottom", "double"} + +func (s SlabType) String() string { + if int(s) < len(strSlabType) { + return strSlabType[s] + } + return "invalid SlabType" +} + +func (s SlabType) MarshalText() (text []byte, err error) { + if int(s) < len(strSlabType) { + return []byte(strSlabType[s]), nil + } + return nil, errors.New("invalid SlabType: " + strconv.Itoa(int(s))) +} + +func (s *SlabType) UnmarshalText(text []byte) error { + switch str := string(text); str { + case "top": + *s = SlabTypeTop + case "bottom": + *s = SlabTypeBottom + case "double": + *s = SlabTypeDouble + default: + return errors.New("unknown SlabType: " + str) + } + return nil +} + +type StairsShape byte + +const ( + StairsShapeStraight StairsShape = iota + StairsShapeInnerLeft + StairsShapeInnerRight + StairsShapeOuterLeft + StairsShapeOuterRight +) + +var strStairsShape = [...]string{"straight", "inner_left", "inner_right", "outer_left", "outer_right"} + +func (s StairsShape) String() string { + if int(s) < len(strStairsShape) { + return strStairsShape[s] + } + return "invalid StairsShape" +} + +func (s StairsShape) MarshalText() (text []byte, err error) { + if int(s) < len(strStairsShape) { + return []byte(strStairsShape[s]), nil + } + return nil, errors.New("invalid StairsShape: " + strconv.Itoa(int(s))) +} + +func (s *StairsShape) UnmarshalText(text []byte) error { + switch str := string(text); str { + case "straight": + *s = StairsShapeStraight + case "inner_left": + *s = StairsShapeInnerLeft + case "inner_right": + *s = StairsShapeInnerRight + case "outer_left": + *s = StairsShapeOuterLeft + case "outer_right": + *s = StairsShapeOuterRight + default: + return errors.New("unknown StairsShape: " + str) + } + return nil +} + +type StructureMode byte + +const ( + StructureModeSave StructureMode = iota + StructureModeLoad + StructureModeCorner + StructureModeData +) + +var strStructureMode = [...]string{"save", "load", "corner", "data"} + +func (s StructureMode) String() string { + if int(s) < len(strStructureMode) { + return strStructureMode[s] + } + return "invalid StructureMode" +} + +func (s StructureMode) MarshalText() (text []byte, err error) { + if int(s) < len(strStructureMode) { + return []byte(strStructureMode[s]), nil + } + return nil, errors.New("invalid StructureMode: " + strconv.Itoa(int(s))) +} + +func (s *StructureMode) UnmarshalText(text []byte) error { + switch str := string(text); str { + case "save": + *s = StructureModeSave + case "load": + *s = StructureModeLoad + case "corner": + *s = StructureModeCorner + case "data": + *s = StructureModeData + default: + return errors.New("unknown StructureMode: " + str) + } + return nil +} + +type Tilt byte + +const ( + TiltNone Tilt = iota + TiltUnstable + TiltPartial + TiltFull +) + +var strTilt = [...]string{"none", "unstable", "partial", "full"} + +func (t Tilt) String() string { + if int(t) < len(strTilt) { + return strTilt[t] + } + return "invalid Tilt" +} + +func (t Tilt) MarshalText() (text []byte, err error) { + if int(t) < len(strTilt) { + return []byte(strTilt[t]), nil + } + return nil, errors.New("invalid Tilt: " + strconv.Itoa(int(t))) +} + +func (t *Tilt) UnmarshalText(text []byte) error { + switch str := string(text); str { + case "none": + *t = TiltNone + case "unstable": + *t = TiltUnstable + case "partial": + *t = TiltPartial + case "full": + *t = TiltFull + default: + return errors.New("unknown Tilt: " + str) + } + return nil +} + +type WallSide byte + +const ( + WallSideNone WallSide = iota + WallSideLow + WallSideTall +) + +var strWallSide = [...]string{"none", "low", "tall"} + +func (w WallSide) String() string { + if int(w) < len(strWallSide) { + return strWallSide[w] + } + return "invalid WallSide" +} + +func (w WallSide) MarshalText() (text []byte, err error) { + if int(w) < len(strWallSide) { + return []byte(strWallSide[w]), nil + } + return nil, errors.New("invalid WallSide: " + strconv.Itoa(int(w))) +} + +func (w *WallSide) UnmarshalText(text []byte) error { + switch str := string(text); str { + case "none": + *w = WallSideNone + case "low": + *w = WallSideLow + case "tall": + *w = WallSideTall + default: + return errors.New("unknown WallSide: " + str) + } + return nil +} + +type FrontAndTop byte + +const ( + DownEast FrontAndTop = iota + DownNorth + DownSouth + DownWest + UpEast + UpNorth + UpSouth + UpWest + WestUp + EastUp + NorthUp + SouthUp +) + +var strFrontAndTop = [...]string{"down_east", "down_north", "down_south", "down_west", "up_east", "up_north", "up_south", "up_west", "west_up", "east_up", "north_up", "south_up"} + +func (f FrontAndTop) String() string { + if int(f) < len(strFrontAndTop) { + return strFrontAndTop[f] + } + return "invalid FrontAndTop" +} + +func (f FrontAndTop) MarshalText() (text []byte, err error) { + if int(f) < len(strFrontAndTop) { + return []byte(strFrontAndTop[f]), nil + } + return nil, errors.New("invalid FrontAndTop: " + strconv.Itoa(int(f))) +} + +func (f *FrontAndTop) UnmarshalText(text []byte) error { + switch str := string(text); str { + case "down_east": + *f = DownEast + case "down_north": + *f = DownNorth + case "down_south": + *f = DownSouth + case "down_west": + *f = DownWest + case "up_east": + *f = UpEast + case "up_north": + *f = UpNorth + case "up_south": + *f = UpSouth + case "up_west": + *f = UpWest + case "west_up": + *f = WestUp + case "east_up": + *f = EastUp + case "north_up": + *f = NorthUp + case "south_up": + *f = SouthUp + default: + return errors.New("unknown FrontAndTop: " + str) + } + return nil +} diff --git a/nbt/decode.go b/nbt/decode.go index 234fa67..b23c0a8 100644 --- a/nbt/decode.go +++ b/nbt/decode.go @@ -23,6 +23,9 @@ func Unmarshal(data []byte, v interface{}) error { // For example, you can decode an NBT value which root tag is TagCompound(0x0a) // into a struct or map, but not a string. // +// If v implement Unmarshaler, the method will be called and override the default behavior. +// Else if v implement encoding.TextUnmarshaler, the value will be encoded as TagString. +// // This method also return tag name of the root tag. // In real world, it is often empty, but the API should allow you to get it when ever you want. func (d *Decoder) Decode(v interface{}) (string, error) { diff --git a/nbt/decode_test.go b/nbt/decode_test.go index 0e03bf3..8f27907 100644 --- a/nbt/decode_test.go +++ b/nbt/decode_test.go @@ -405,72 +405,3 @@ func TestDecoder_Decode_textUnmarshaler(t *testing.T) { t.Errorf("b should be true") } } - -func TestRawMessage_Decode(t *testing.T) { - data := []byte{ - TagCompound, 0, 2, 'a', 'b', - TagInt, 0, 3, 'K', 'e', 'y', 0, 0, 0, 12, - TagString, 0, 5, 'V', 'a', 'l', 'u', 'e', 0, 4, 'T', 'n', 'z', 'e', - TagList, 0, 4, 'L', 'i', 's', 't', TagCompound, 0, 0, 0, 2, 0, 0, - TagEnd, - } - var container struct { - Key int32 - Value RawMessage - List RawMessage - } - - if tag, err := NewDecoder(bytes.NewReader(data)).Decode(&container); err != nil { - t.Fatal(tag) - } else { - if tag != "ab" { - t.Fatalf("Decode tag name error: want %s, get: %s", "ab", tag) - } - if container.Key != 12 { - t.Fatalf("Decode Key error: want %v, get: %v", 12, container.Key) - } - if !bytes.Equal(container.Value.Data, []byte{ - 0, 4, 'T', 'n', 'z', 'e', - }) { - t.Fatalf("Decode Key error: get: %v", container.Value) - } - if !bytes.Equal(container.List.Data, []byte{ - TagCompound, 0, 0, 0, 2, - 0, 0, - }) { - t.Fatalf("Decode List error: get: %v", container.List) - } - } -} - -func TestStringifiedMessage_Decode(t *testing.T) { - data := []byte{ - TagCompound, 0, 2, 'a', 'b', - TagInt, 0, 3, 'K', 'e', 'y', 0, 0, 0, 12, - TagString, 0, 5, 'V', 'a', 'l', 'u', 'e', 0, 5, 'T', 'n', ' ', 'z', 'e', - TagList, 0, 4, 'L', 'i', 's', 't', TagCompound, 0, 0, 0, 2, 0, 0, - TagEnd, - } - var container struct { - Key int32 - Value StringifiedMessage - List StringifiedMessage - } - - if tag, err := NewDecoder(bytes.NewReader(data)).Decode(&container); err != nil { - t.Fatal(tag, err) - } else { - if tag != "ab" { - t.Fatalf("UnmarshalNBT tag name error: want %s, get: %s", "ab", tag) - } - if container.Key != 12 { - t.Fatalf("UnmarshalNBT Key error: want %v, get: %v", 12, container.Key) - } - if container.Value != `"Tn ze"` { - t.Fatalf("UnmarshalNBT Key error: get: %v", container.Value) - } - if container.List != "[{},{}]" { - t.Fatalf("UnmarshalNBT List error: get: %v", container.List) - } - } -} diff --git a/nbt/encode.go b/nbt/encode.go index a0b0468..c230335 100644 --- a/nbt/encode.go +++ b/nbt/encode.go @@ -2,6 +2,7 @@ package nbt import ( "bytes" + "encoding" "errors" "fmt" "io" @@ -37,8 +38,8 @@ func NewEncoder(w io.Writer) *Encoder { // expect `[]int8`, `[]int32`, `[]int64`, `[]uint8`, `[]uint32` and `[]uint64`, // which TagByteArray, TagIntArray and TagLongArray. // To force encode them as TagList, add a struct field tag. -// You haven't ability to encode them as TagList as root element at this time, -// issue or pull-request is welcome. +// +// func (e *Encoder) Encode(v interface{}, tagName string) error { t, val := getTagType(reflect.ValueOf(v)) return e.marshal(val, t, tagName) @@ -129,10 +130,22 @@ func (e *Encoder) writeValue(val reflect.Value, tagType byte) error { } case TagString: - if err := e.writeInt16(int16(val.Len())); err != nil { + var str []byte + if val.NumMethod() > 0 && val.CanInterface() { + if t, ok := val.Interface().(encoding.TextMarshaler); ok { + var err error + str, err = t.MarshalText() + if err != nil { + return err + } + } + } else { + str = []byte(val.String()) + } + if err := e.writeInt16(int16(len(str))); err != nil { return err } - _, err := e.w.Write([]byte(val.String())) + _, err := e.w.Write(str) return err case TagCompound: @@ -205,17 +218,23 @@ func getTagType(v reflect.Value) (byte, reflect.Value) { v.Set(reflect.New(v.Type().Elem())) } if v.Type().NumMethod() > 0 && v.CanInterface() { - if u, ok := v.Interface().(Marshaler); ok { + i := v.Interface() + if u, ok := i.(Marshaler); ok { return u.TagType(), v + } else if _, ok := i.(encoding.TextMarshaler); ok { + return TagString, v } } v = v.Elem() } - if v.CanInterface() { - if encoder, ok := v.Interface().(Marshaler); ok { - return encoder.TagType(), v + if v.Type().NumMethod() > 0 && v.CanInterface() { + i := v.Interface() + if u, ok := i.(Marshaler); ok { + return u.TagType(), v + } else if _, ok := i.(encoding.TextMarshaler); ok { + return TagString, v } } diff --git a/nbt/encode_test.go b/nbt/encode_test.go index 6f7f721..fd488b8 100644 --- a/nbt/encode_test.go +++ b/nbt/encode_test.go @@ -208,29 +208,6 @@ func TestEncoder_Encode_map(t *testing.T) { } } -func TestRawMessage_Encode(t *testing.T) { - data := []byte{ - TagCompound, 0, 2, 'a', 'b', - TagInt, 0, 3, 'K', 'e', 'y', 0, 0, 0, 12, - TagString, 0, 5, 'V', 'a', 'l', 'u', 'e', 0, 4, 'T', 'n', 'z', 'e', - TagEnd, - } - var container struct { - Key int32 - Value RawMessage - } - container.Key = 12 - container.Value.Type = TagString - container.Value.Data = []byte{0, 4, 'T', 'n', 'z', 'e'} - - var buf bytes.Buffer - if err := NewEncoder(&buf).Encode(container, "ab"); err != nil { - t.Fatalf("Encode error: %v", err) - } else if !bytes.Equal(data, buf.Bytes()) { - t.Fatalf("Encode error: want %v, get: %v", data, buf.Bytes()) - } -} - func TestEncoder_Encode_interface(t *testing.T) { data := map[string]interface{}{ "Key": int32(12), @@ -253,3 +230,18 @@ func TestEncoder_Encode_interface(t *testing.T) { t.Fatalf("want: (%v, %v), but got (%v, %v)", 12, "Tnze", container.Key, container.Value) } } + +func TestEncoder_Encode_textMarshaler(t *testing.T) { + var b TextBool = true + data, err := Marshal(&b) + if err != nil { + t.Fatal(err) + } + wants := []byte{ + TagString, 0, 0, + 0, 4, 't', 'r', 'u', 'e', + } + if !bytes.Equal(data, wants) { + t.Errorf("get %v, want %v", data, wants) + } +} diff --git a/nbt/rawmsg_test.go b/nbt/rawmsg_test.go new file mode 100644 index 0000000..e994616 --- /dev/null +++ b/nbt/rawmsg_test.go @@ -0,0 +1,66 @@ +package nbt + +import ( + "bytes" + "testing" +) + +func TestRawMessage_Encode(t *testing.T) { + data := []byte{ + TagCompound, 0, 2, 'a', 'b', + TagInt, 0, 3, 'K', 'e', 'y', 0, 0, 0, 12, + TagString, 0, 5, 'V', 'a', 'l', 'u', 'e', 0, 4, 'T', 'n', 'z', 'e', + TagEnd, + } + var container struct { + Key int32 + Value RawMessage + } + container.Key = 12 + container.Value.Type = TagString + container.Value.Data = []byte{0, 4, 'T', 'n', 'z', 'e'} + + var buf bytes.Buffer + if err := NewEncoder(&buf).Encode(container, "ab"); err != nil { + t.Fatalf("Encode error: %v", err) + } else if !bytes.Equal(data, buf.Bytes()) { + t.Fatalf("Encode error: want %v, get: %v", data, buf.Bytes()) + } +} + +func TestRawMessage_Decode(t *testing.T) { + data := []byte{ + TagCompound, 0, 2, 'a', 'b', + TagInt, 0, 3, 'K', 'e', 'y', 0, 0, 0, 12, + TagString, 0, 5, 'V', 'a', 'l', 'u', 'e', 0, 4, 'T', 'n', 'z', 'e', + TagList, 0, 4, 'L', 'i', 's', 't', TagCompound, 0, 0, 0, 2, 0, 0, + TagEnd, + } + var container struct { + Key int32 + Value RawMessage + List RawMessage + } + + if tag, err := NewDecoder(bytes.NewReader(data)).Decode(&container); err != nil { + t.Fatal(tag) + } else { + if tag != "ab" { + t.Fatalf("Decode tag name error: want %s, get: %s", "ab", tag) + } + if container.Key != 12 { + t.Fatalf("Decode Key error: want %v, get: %v", 12, container.Key) + } + if !bytes.Equal(container.Value.Data, []byte{ + 0, 4, 'T', 'n', 'z', 'e', + }) { + t.Fatalf("Decode Key error: get: %v", container.Value) + } + if !bytes.Equal(container.List.Data, []byte{ + TagCompound, 0, 0, 0, 2, + 0, 0, + }) { + t.Fatalf("Decode List error: get: %v", container.List) + } + } +} diff --git a/nbt/snbt_encode_test.go b/nbt/snbt_encode_test.go index 9235409..77ec6aa 100644 --- a/nbt/snbt_encode_test.go +++ b/nbt/snbt_encode_test.go @@ -1,3 +1,38 @@ package nbt -//TODO: Test SNBT encode +import ( + "bytes" + "testing" +) + +func TestStringifiedMessage_Decode(t *testing.T) { + data := []byte{ + TagCompound, 0, 2, 'a', 'b', + TagInt, 0, 3, 'K', 'e', 'y', 0, 0, 0, 12, + TagString, 0, 5, 'V', 'a', 'l', 'u', 'e', 0, 5, 'T', 'n', ' ', 'z', 'e', + TagList, 0, 4, 'L', 'i', 's', 't', TagCompound, 0, 0, 0, 2, 0, 0, + TagEnd, + } + var container struct { + Key int32 + Value StringifiedMessage + List StringifiedMessage + } + + if tag, err := NewDecoder(bytes.NewReader(data)).Decode(&container); err != nil { + t.Fatal(tag, err) + } else { + if tag != "ab" { + t.Fatalf("UnmarshalNBT tag name error: want %s, get: %s", "ab", tag) + } + if container.Key != 12 { + t.Fatalf("UnmarshalNBT Key error: want %v, get: %v", 12, container.Key) + } + if container.Value != `"Tn ze"` { + t.Fatalf("UnmarshalNBT Key error: get: %v", container.Value) + } + if container.List != "[{},{}]" { + t.Fatalf("UnmarshalNBT List error: get: %v", container.List) + } + } +} diff --git a/server/gameplay.go b/server/gameplay.go index d325d7d..c7a75f8 100644 --- a/server/gameplay.go +++ b/server/gameplay.go @@ -45,10 +45,10 @@ type PacketHandler struct { type packetHandlerFunc func(player *Player, packet Packet758) error //go:embed DimensionCodec.snbt -var dimensionCodecSNBT string +var dimensionCodecSNBT nbt.StringifiedMessage //go:embed Dimension.snbt -var dimensionSNBT string +var dimensionSNBT nbt.StringifiedMessage func NewGame(dim Level, components ...Component) *Game { g := &Game{ @@ -91,8 +91,8 @@ func (g *Game) AcceptPlayer(name string, id uuid.UUID, protocol int32, conn *net pk.Array([]pk.Identifier{ pk.Identifier(dimInfo.Name), }), - pk.NBT(nbt.StringifiedMessage(dimensionCodecSNBT)), - pk.NBT(nbt.StringifiedMessage(dimensionSNBT)), + pk.NBT(dimensionCodecSNBT), + pk.NBT(dimensionSNBT), pk.Identifier(dimInfo.Name), // World Name pk.Long(dimInfo.HashedSeed), // Hashed seed pk.VarInt(0), // Max Players (Ignored by client)