Skip to content

Commit

Permalink
fix: problem with alphabetical order + addition of IDs that should no…
Browse files Browse the repository at this point in the history
…t normally be used
  • Loading branch information
AzaleeX committed Oct 28, 2024
1 parent 1dbc058 commit 57b5043
Show file tree
Hide file tree
Showing 7 changed files with 23 additions and 21 deletions.
2 changes: 2 additions & 0 deletions src/block/BlockTypeIds.php
Original file line number Diff line number Diff line change
Expand Up @@ -757,6 +757,8 @@ private function __construct(){
public const BAMBOO_STAIRS = 10726;
public const BAMBOO_TRAPDOOR = 10727;
public const BAMBOO_WALL_SIGN = 10728;
public const NO_BAMBOO_LOG = 10729;
public const NO_BAMBOO_WOOD = 10730;

public const FIRST_UNUSED_BLOCK_ID = 10718;

Expand Down
24 changes: 13 additions & 11 deletions src/block/VanillaBlocks.php
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,20 @@
* @method static Leaves AZALEA_LEAVES()
* @method static Flower AZURE_BLUET()
* @method static Bamboo BAMBOO()
* @method static WoodenButton BAMBOO_BUTTON()
* @method static WoodenDoor BAMBOO_DOOR()
* @method static WoodenFence BAMBOO_FENCE()
* @method static FenceGate BAMBOO_FENCE_GATE()
* @method static Wood BAMBOO_LOG()
* @method static Planks BAMBOO_PLANKS()
* @method static WoodenPressurePlate BAMBOO_PRESSURE_PLATE()
* @method static BambooSapling BAMBOO_SAPLING()
* @method static FloorSign BAMBOO_SIGN()
* @method static WoodenSlab BAMBOO_SLAB()
* @method static WoodenStairs BAMBOO_STAIRS()
* @method static WoodenTrapdoor BAMBOO_TRAPDOOR()
* @method static WallSign BAMBOO_WALL_SIGN()
* @method static Wood BAMBOO_WOOD()
* @method static FloorBanner BANNER()
* @method static Barrel BARREL()
* @method static Transparent BARRIER()
Expand Down Expand Up @@ -754,17 +767,6 @@
* @method static Wood WARPED_STEM()
* @method static WoodenTrapdoor WARPED_TRAPDOOR()
* @method static WallSign WARPED_WALL_SIGN()
* @method static WoodenButton BAMBOO_BUTTON()
* @method static WoodenDoor BAMBOO_DOOR()
* @method static WoodenFence BAMBOO_FENCE()
* @method static FenceGate BAMBOO_FENCE_GATE()
* @method static Planks BAMBOO_PLANKS()
* @method static WoodenPressurePlate BAMBOO_PRESSURE_PLATE()
* @method static FloorSign BAMBOO_SIGN()
* @method static WoodenSlab BAMBOO_SLAB()
* @method static WoodenStairs BAMBOO_STAIRS()
* @method static WoodenTrapdoor BAMBOO_TRAPDOOR()
* @method static WallSign BAMBOO_WALL_SIGN()
* @method static Opaque WARPED_WART_BLOCK()
* @method static Water WATER()
* @method static WaterCauldron WATER_CAULDRON()
Expand Down
7 changes: 2 additions & 5 deletions src/block/WoodLikeBlockIdHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -94,9 +94,6 @@ public static function getSlabIdentifier(WoodType $type) : BID{
});
}

/**
* @throws \Exception
*/
public static function getLogIdentifier(WoodType $treeType) : BID{
return new BID(match($treeType){
WoodType::OAK => Ids::OAK_LOG,
Expand All @@ -109,7 +106,7 @@ public static function getLogIdentifier(WoodType $treeType) : BID{
WoodType::CRIMSON => Ids::CRIMSON_STEM,
WoodType::WARPED => Ids::WARPED_STEM,
WoodType::CHERRY => Ids::CHERRY_LOG,
WoodType::BAMBOO => 59000,
WoodType::BAMBOO => Ids::NO_BAMBOO_LOG,
});
}

Expand All @@ -125,7 +122,7 @@ public static function getAllSidedLogIdentifier(WoodType $treeType) : BID{
WoodType::CRIMSON => Ids::CRIMSON_HYPHAE,
WoodType::WARPED => Ids::WARPED_HYPHAE,
WoodType::CHERRY => Ids::CHERRY_WOOD,
WoodType::BAMBOO => 59001,
WoodType::BAMBOO => Ids::NO_BAMBOO_WOOD,
});
}

Expand Down
1 change: 1 addition & 0 deletions src/block/utils/WoodType.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
* @method static WoodType OAK()
* @method static WoodType SPRUCE()
* @method static WoodType WARPED()
* @method static WoodType BAMBOO()
*/
enum WoodType{
use LegacyEnumShimTrait;
Expand Down
4 changes: 2 additions & 2 deletions src/data/bedrock/item/ItemSerializerDeserializerRegistrar.php
Original file line number Diff line number Diff line change
Expand Up @@ -128,13 +128,13 @@ public function map1ToNItem(string $id, array $items) : void{
*/
private function register1to1BlockMappings() : void{
$this->map1to1Block(Ids::ACACIA_DOOR, Blocks::ACACIA_DOOR());
$this->map1to1Block(Ids::BAMBOO_DOOR, Blocks::BAMBOO_DOOR());
$this->map1to1Block(Ids::BIRCH_DOOR, Blocks::BIRCH_DOOR());
$this->map1to1Block(Ids::BREWING_STAND, Blocks::BREWING_STAND());
$this->map1to1Block(Ids::CAKE, Blocks::CAKE());
$this->map1to1Block(Ids::CAULDRON, Blocks::CAULDRON());
$this->map1to1Block(Ids::CHAIN, Blocks::CHAIN());
$this->map1to1Block(Ids::CHERRY_DOOR, Blocks::CHERRY_DOOR());
$this->map1to1Block(Ids::BAMBOO_DOOR, Blocks::BAMBOO_DOOR());
$this->map1to1Block(Ids::COMPARATOR, Blocks::REDSTONE_COMPARATOR());
$this->map1to1Block(Ids::CRIMSON_DOOR, Blocks::CRIMSON_DOOR());
$this->map1to1Block(Ids::DARK_OAK_DOOR, Blocks::DARK_OAK_DOOR());
Expand Down Expand Up @@ -162,6 +162,7 @@ private function register1to1ItemMappings() : void{
$this->map1to1Item(Ids::AMETHYST_SHARD, Items::AMETHYST_SHARD());
$this->map1to1Item(Ids::APPLE, Items::APPLE());
$this->map1to1Item(Ids::BAKED_POTATO, Items::BAKED_POTATO());
$this->map1to1Item(Ids::BAMBOO_SIGN, Items::BAMBOO_SIGN());
$this->map1to1Item(Ids::BEEF, Items::RAW_BEEF());
$this->map1to1Item(Ids::BEETROOT, Items::BEETROOT());
$this->map1to1Item(Ids::BEETROOT_SEEDS, Items::BEETROOT_SEEDS());
Expand All @@ -186,7 +187,6 @@ private function register1to1ItemMappings() : void{
$this->map1to1Item(Ids::CHAINMAIL_LEGGINGS, Items::CHAINMAIL_LEGGINGS());
$this->map1to1Item(Ids::CHARCOAL, Items::CHARCOAL());
$this->map1to1Item(Ids::CHERRY_SIGN, Items::CHERRY_SIGN());
$this->map1to1Item(Ids::BAMBOO_SIGN, Items::BAMBOO_SIGN());
$this->map1to1Item(Ids::CHICKEN, Items::RAW_CHICKEN());
$this->map1to1Item(Ids::CHORUS_FRUIT, Items::CHORUS_FRUIT());
$this->map1to1Item(Ids::CLAY_BALL, Items::CLAY());
Expand Down
2 changes: 1 addition & 1 deletion src/item/StringToItemParser.php
Original file line number Diff line number Diff line change
Expand Up @@ -146,13 +146,13 @@ private static function registerBlocks(self $result) : void{
$result->registerBlock("azalea_leaves", fn() => Blocks::AZALEA_LEAVES());
$result->registerBlock("azure_bluet", fn() => Blocks::AZURE_BLUET());
$result->registerBlock("bamboo", fn() => Blocks::BAMBOO());
$result->registerBlock("bamboo_sapling", fn() => Blocks::BAMBOO_SAPLING());
$result->registerBlock("bamboo_button", fn() => Blocks::BAMBOO_BUTTON());
$result->registerBlock("bamboo_door", fn() => Blocks::BAMBOO_DOOR());
$result->registerBlock("bamboo_fence", fn() => Blocks::BAMBOO_FENCE());
$result->registerBlock("bamboo_fence_gate", fn() => Blocks::BAMBOO_FENCE_GATE());
$result->registerBlock("bamboo_planks", fn() => Blocks::BAMBOO_PLANKS());
$result->registerBlock("bamboo_pressure_plate", fn() => Blocks::BAMBOO_PRESSURE_PLATE());
$result->registerBlock("bamboo_sapling", fn() => Blocks::BAMBOO_SAPLING());
$result->registerBlock("bamboo_sign", fn() => Blocks::BAMBOO_SIGN());
$result->registerBlock("bamboo_slab", fn() => Blocks::BAMBOO_SLAB());
$result->registerBlock("bamboo_stairs", fn() => Blocks::BAMBOO_STAIRS());
Expand Down
4 changes: 2 additions & 2 deletions src/item/VanillaItems.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@
* @method static Arrow ARROW()
* @method static BakedPotato BAKED_POTATO()
* @method static Bamboo BAMBOO()
* @method static ItemBlockWallOrFloor BAMBOO_SIGN()
* @method static Banner BANNER()
* @method static Beetroot BEETROOT()
* @method static BeetrootSeeds BEETROOT_SEEDS()
Expand Down Expand Up @@ -331,7 +332,6 @@
* @method static WritableBook WRITABLE_BOOK()
* @method static WrittenBook WRITTEN_BOOK()
* @method static SpawnEgg ZOMBIE_SPAWN_EGG()
* @method static ItemBlockWallOrFloor BAMBOO_SIGN()
*/
final class VanillaItems{
use CloningRegistryTrait;
Expand Down Expand Up @@ -369,6 +369,7 @@ protected static function setup() : void{
self::register("arrow", new Arrow(new IID(Ids::ARROW), "Arrow"));
self::register("baked_potato", new BakedPotato(new IID(Ids::BAKED_POTATO), "Baked Potato"));
self::register("bamboo", new Bamboo(new IID(Ids::BAMBOO), "Bamboo"));
self::register("bamboo_sign", new ItemBlockWallOrFloor(new IID(Ids::BAMBOO_SIGN), Blocks::BAMBOO_SIGN(), Blocks::BAMBOO_WALL_SIGN()));
self::register("banner", new Banner(new IID(Ids::BANNER), Blocks::BANNER(), Blocks::WALL_BANNER()));
self::register("beetroot", new Beetroot(new IID(Ids::BEETROOT), "Beetroot"));
self::register("beetroot_seeds", new BeetrootSeeds(new IID(Ids::BEETROOT_SEEDS), "Beetroot Seeds"));
Expand All @@ -388,7 +389,6 @@ protected static function setup() : void{
self::register("carrot", new Carrot(new IID(Ids::CARROT), "Carrot"));
self::register("charcoal", new Coal(new IID(Ids::CHARCOAL), "Charcoal"));
self::register("cherry_sign", new ItemBlockWallOrFloor(new IID(Ids::CHERRY_SIGN), Blocks::CHERRY_SIGN(), Blocks::CHERRY_WALL_SIGN()));
self::register("bamboo_sign", new ItemBlockWallOrFloor(new IID(Ids::BAMBOO_SIGN), Blocks::BAMBOO_SIGN(), Blocks::BAMBOO_WALL_SIGN()));
self::register("chemical_aluminium_oxide", new Item(new IID(Ids::CHEMICAL_ALUMINIUM_OXIDE), "Aluminium Oxide"));
self::register("chemical_ammonia", new Item(new IID(Ids::CHEMICAL_AMMONIA), "Ammonia"));
self::register("chemical_barium_sulphate", new Item(new IID(Ids::CHEMICAL_BARIUM_SULPHATE), "Barium Sulphate"));
Expand Down

0 comments on commit 57b5043

Please sign in to comment.