Skip to content

Commit c46af5c

Browse files
committed
Added copper tools
1 parent 4cb45f7 commit c46af5c

4 files changed

Lines changed: 32 additions & 30 deletions

File tree

src/data/bedrock/item/ItemSerializerDeserializerRegistrar.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -216,12 +216,17 @@ private function register1to1ItemMappings() : void{
216216
$this->map1to1Item(Ids::COOKED_RABBIT, Items::COOKED_RABBIT());
217217
$this->map1to1Item(Ids::COOKED_SALMON, Items::COOKED_SALMON());
218218
$this->map1to1Item(Ids::COOKIE, Items::COOKIE());
219+
$this->map1to1Item(Ids::COPPER_AXE, Items::COPPER_AXE());
219220
$this->map1to1Item(Ids::COPPER_BOOTS, Items::COPPER_BOOTS());
220221
$this->map1to1Item(Ids::COPPER_CHESTPLATE, Items::COPPER_CHESTPLATE());
221222
$this->map1to1Item(Ids::COPPER_HELMET, Items::COPPER_HELMET());
223+
$this->map1to1Item(Ids::COPPER_HOE, Items::COPPER_HOE());
222224
$this->map1to1Item(Ids::COPPER_INGOT, Items::COPPER_INGOT());
223225
$this->map1to1Item(Ids::COPPER_LEGGINGS, Items::COPPER_LEGGINGS());
224226
$this->map1to1Item(Ids::COPPER_NUGGET, Items::COPPER_NUGGET());
227+
$this->map1to1Item(Ids::COPPER_PICKAXE, Items::COPPER_PICKAXE());
228+
$this->map1to1Item(Ids::COPPER_SHOVEL, Items::COPPER_SHOVEL());
229+
$this->map1to1Item(Ids::COPPER_SWORD, Items::COPPER_SWORD());
225230
$this->map1to1Item(Ids::CRIMSON_HANGING_SIGN, Items::CRIMSON_HANGING_SIGN());
226231
$this->map1to1Item(Ids::CRIMSON_SIGN, Items::CRIMSON_SIGN());
227232
$this->map1to1Item(Ids::DARK_OAK_BOAT, Items::DARK_OAK_BOAT());

src/item/StringToItemParser.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1347,12 +1347,17 @@ private static function registerItems(self $result) : void{
13471347
$result->register("cooked_rabbit", fn() => Items::COOKED_RABBIT());
13481348
$result->register("cooked_salmon", fn() => Items::COOKED_SALMON());
13491349
$result->register("cookie", fn() => Items::COOKIE());
1350+
$result->register("copper_axe", fn() => Items::COPPER_AXE());
13501351
$result->register("copper_boots", fn() => Items::COPPER_BOOTS());
13511352
$result->register("copper_chestplate", fn() => Items::COPPER_CHESTPLATE());
13521353
$result->register("copper_helmet", fn() => Items::COPPER_HELMET());
1354+
$result->register("copper_hoe", fn() => Items::COPPER_HOE());
13531355
$result->register("copper_ingot", fn() => Items::COPPER_INGOT());
13541356
$result->register("copper_leggings", fn() => Items::COPPER_LEGGINGS());
13551357
$result->register("copper_nugget", fn() => Items::COPPER_NUGGET());
1358+
$result->register("copper_pickaxe", fn() => Items::COPPER_PICKAXE());
1359+
$result->register("copper_shovel", fn() => Items::COPPER_SHOVEL());
1360+
$result->register("copper_sword", fn() => Items::COPPER_SWORD());
13561361
$result->register("crimson_hanging_sign", fn() => Items::CRIMSON_HANGING_SIGN());
13571362
$result->register("dark_oak_boat", fn() => Items::DARK_OAK_BOAT());
13581363
$result->register("dark_oak_hanging_sign", fn() => Items::DARK_OAK_HANGING_SIGN());

src/item/ToolTier.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ enum ToolTier{
4444
case WOOD;
4545
case GOLD;
4646
case STONE;
47+
case COPPER;
4748
case IRON;
4849
case DIAMOND;
4950
case NETHERITE;
@@ -64,6 +65,7 @@ private function getMetadata() : array{
6465
self::WOOD => self::meta(1, 60, 5, 2, 15),
6566
self::GOLD => self::meta(2, 33, 5, 12, 22),
6667
self::STONE => self::meta(3, 132, 6, 4, 5),
68+
self::COPPER => self::meta(3, 191, 6, 5, 13),
6769
self::IRON => self::meta(4, 251, 7, 6, 14),
6870
self::DIAMOND => self::meta(5, 1562, 8, 8, 10),
6971
self::NETHERITE => self::meta(6, 2032, 9, 9, 15)

src/item/VanillaItems.php

Lines changed: 20 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -135,12 +135,17 @@
135135
* @method static CookedRabbit COOKED_RABBIT()
136136
* @method static CookedSalmon COOKED_SALMON()
137137
* @method static Cookie COOKIE()
138+
* @method static Axe COPPER_AXE()
138139
* @method static Armor COPPER_BOOTS()
139140
* @method static Armor COPPER_CHESTPLATE()
140141
* @method static Armor COPPER_HELMET()
142+
* @method static Hoe COPPER_HOE()
141143
* @method static Item COPPER_INGOT()
142144
* @method static Armor COPPER_LEGGINGS()
143145
* @method static Item COPPER_NUGGET()
146+
* @method static Pickaxe COPPER_PICKAXE()
147+
* @method static Shovel COPPER_SHOVEL()
148+
* @method static Sword COPPER_SWORD()
144149
* @method static CoralFan CORAL_FAN()
145150
* @method static HangingSign CRIMSON_HANGING_SIGN()
146151
* @method static ItemBlockWallOrFloor CRIMSON_SIGN()
@@ -677,36 +682,21 @@ protected function createEntity(World $world, Vector3 $pos, float $yaw, float $p
677682
}
678683

679684
private static function registerTierToolItems() : void{
680-
self::register("diamond_axe", fn(IID $id) => new Axe($id, "Diamond Axe", ToolTier::DIAMOND, [EnchantmentTags::AXE]));
681-
self::register("golden_axe", fn(IID $id) => new Axe($id, "Golden Axe", ToolTier::GOLD, [EnchantmentTags::AXE]));
682-
self::register("iron_axe", fn(IID $id) => new Axe($id, "Iron Axe", ToolTier::IRON, [EnchantmentTags::AXE]));
683-
self::register("netherite_axe", fn(IID $id) => new Axe($id, "Netherite Axe", ToolTier::NETHERITE, [EnchantmentTags::AXE]));
684-
self::register("stone_axe", fn(IID $id) => new Axe($id, "Stone Axe", ToolTier::STONE, [EnchantmentTags::AXE]));
685-
self::register("wooden_axe", fn(IID $id) => new Axe($id, "Wooden Axe", ToolTier::WOOD, [EnchantmentTags::AXE]));
686-
self::register("diamond_hoe", fn(IID $id) => new Hoe($id, "Diamond Hoe", ToolTier::DIAMOND, [EnchantmentTags::HOE]));
687-
self::register("golden_hoe", fn(IID $id) => new Hoe($id, "Golden Hoe", ToolTier::GOLD, [EnchantmentTags::HOE]));
688-
self::register("iron_hoe", fn(IID $id) => new Hoe($id, "Iron Hoe", ToolTier::IRON, [EnchantmentTags::HOE]));
689-
self::register("netherite_hoe", fn(IID $id) => new Hoe($id, "Netherite Hoe", ToolTier::NETHERITE, [EnchantmentTags::HOE]));
690-
self::register("stone_hoe", fn(IID $id) => new Hoe($id, "Stone Hoe", ToolTier::STONE, [EnchantmentTags::HOE]));
691-
self::register("wooden_hoe", fn(IID $id) => new Hoe($id, "Wooden Hoe", ToolTier::WOOD, [EnchantmentTags::HOE]));
692-
self::register("diamond_pickaxe", fn(IID $id) => new Pickaxe($id, "Diamond Pickaxe", ToolTier::DIAMOND, [EnchantmentTags::PICKAXE]));
693-
self::register("golden_pickaxe", fn(IID $id) => new Pickaxe($id, "Golden Pickaxe", ToolTier::GOLD, [EnchantmentTags::PICKAXE]));
694-
self::register("iron_pickaxe", fn(IID $id) => new Pickaxe($id, "Iron Pickaxe", ToolTier::IRON, [EnchantmentTags::PICKAXE]));
695-
self::register("netherite_pickaxe", fn(IID $id) => new Pickaxe($id, "Netherite Pickaxe", ToolTier::NETHERITE, [EnchantmentTags::PICKAXE]));
696-
self::register("stone_pickaxe", fn(IID $id) => new Pickaxe($id, "Stone Pickaxe", ToolTier::STONE, [EnchantmentTags::PICKAXE]));
697-
self::register("wooden_pickaxe", fn(IID $id) => new Pickaxe($id, "Wooden Pickaxe", ToolTier::WOOD, [EnchantmentTags::PICKAXE]));
698-
self::register("diamond_shovel", fn(IID $id) => new Shovel($id, "Diamond Shovel", ToolTier::DIAMOND, [EnchantmentTags::SHOVEL]));
699-
self::register("golden_shovel", fn(IID $id) => new Shovel($id, "Golden Shovel", ToolTier::GOLD, [EnchantmentTags::SHOVEL]));
700-
self::register("iron_shovel", fn(IID $id) => new Shovel($id, "Iron Shovel", ToolTier::IRON, [EnchantmentTags::SHOVEL]));
701-
self::register("netherite_shovel", fn(IID $id) => new Shovel($id, "Netherite Shovel", ToolTier::NETHERITE, [EnchantmentTags::SHOVEL]));
702-
self::register("stone_shovel", fn(IID $id) => new Shovel($id, "Stone Shovel", ToolTier::STONE, [EnchantmentTags::SHOVEL]));
703-
self::register("wooden_shovel", fn(IID $id) => new Shovel($id, "Wooden Shovel", ToolTier::WOOD, [EnchantmentTags::SHOVEL]));
704-
self::register("diamond_sword", fn(IID $id) => new Sword($id, "Diamond Sword", ToolTier::DIAMOND, [EnchantmentTags::SWORD]));
705-
self::register("golden_sword", fn(IID $id) => new Sword($id, "Golden Sword", ToolTier::GOLD, [EnchantmentTags::SWORD]));
706-
self::register("iron_sword", fn(IID $id) => new Sword($id, "Iron Sword", ToolTier::IRON, [EnchantmentTags::SWORD]));
707-
self::register("netherite_sword", fn(IID $id) => new Sword($id, "Netherite Sword", ToolTier::NETHERITE, [EnchantmentTags::SWORD]));
708-
self::register("stone_sword", fn(IID $id) => new Sword($id, "Stone Sword", ToolTier::STONE, [EnchantmentTags::SWORD]));
709-
self::register("wooden_sword", fn(IID $id) => new Sword($id, "Wooden Sword", ToolTier::WOOD, [EnchantmentTags::SWORD]));
685+
foreach([
686+
[ToolTier::COPPER, "copper", "Copper"],
687+
[ToolTier::DIAMOND, "diamond", "Diamond"],
688+
[ToolTier::GOLD, "golden", "Golden"],
689+
[ToolTier::IRON, "iron", "Iron"],
690+
[ToolTier::NETHERITE, "netherite", "Netherite"],
691+
[ToolTier::STONE, "stone", "Stone"],
692+
[ToolTier::WOOD, "wooden", "Wooden"]
693+
] as [$tier, $idPrefix, $namePrefix]){
694+
self::register($idPrefix . "_axe", fn(IID $id) => new Axe($id, $namePrefix . " Axe", $tier, [EnchantmentTags::AXE]));
695+
self::register($idPrefix . "_hoe", fn(IID $id) => new Hoe($id, $namePrefix . " Hoe", $tier, [EnchantmentTags::HOE]));
696+
self::register($idPrefix . "_pickaxe", fn(IID $id) => new Pickaxe($id, $namePrefix . " Pickaxe", $tier, [EnchantmentTags::PICKAXE]));
697+
self::register($idPrefix . "_shovel", fn(IID $id) => new Shovel($id, $namePrefix . " Shovel", $tier, [EnchantmentTags::SHOVEL]));
698+
self::register($idPrefix . "_sword", fn(IID $id) => new Sword($id, $namePrefix . " Sword", $tier, [EnchantmentTags::SWORD]));
699+
}
710700
}
711701

712702
private static function registerArmorItems() : void{

0 commit comments

Comments
 (0)