Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
ae13dc9
add basic smithing table requirements
HimmelKreis4865 Dec 17, 2023
16de186
Merge branch 'pmmp:stable' into smithing-table
HimmelKreis4865 Dec 17, 2023
fc5e5eb
fixed remaining problems
HimmelKreis4865 Dec 18, 2023
c3ea0ba
phpstan stop crying
HimmelKreis4865 Dec 18, 2023
2a56e41
why are headers missing?
HimmelKreis4865 Dec 18, 2023
4da34c3
updated version with all fixes except for save ids - they must be fixed
HimmelKreis4865 Jan 21, 2024
6dce15d
oops (save ids still not working)
HimmelKreis4865 Jan 21, 2024
b82de65
oops
HimmelKreis4865 Jan 22, 2024
93db5ef
fixes all big remaining issues
HimmelKreis4865 Mar 22, 2024
1ad80e9
Merge remote-tracking branch 'origin/minor-next' into working-smithing
HimmelKreis4865 Mar 22, 2024
5360b77
cs style fixes
HimmelKreis4865 Mar 22, 2024
7433655
resolved some more problems
HimmelKreis4865 Mar 23, 2024
d987a65
made materials & patterns customizable
HimmelKreis4865 Mar 24, 2024
d818686
Merge branch 'minor-next' of https://github.com/pmmp/PocketMine-MP in…
ipad54 Nov 30, 2024
849f9b1
Code overhaul
ipad54 Nov 30, 2024
348a211
Update src/inventory/transaction/SmithingTransaction.php
ipad54 Nov 30, 2024
2294a6f
CS
ipad54 Nov 30, 2024
e19d0d7
Make trim constants private
ipad54 Nov 30, 2024
671a578
Merge branch 'smithing-table' of https://github.com/HimmelKreis4865/P…
ipad54 Nov 30, 2024
30a4edb
Don't use match
ipad54 Dec 1, 2024
d88960e
Use readonly where possible
ipad54 Dec 1, 2024
f479d66
Fix CS
ipad54 Dec 1, 2024
1deacda
Revert "Don't use match"
ipad54 Dec 1, 2024
b8da323
Fix tests
ipad54 Dec 1, 2024
c41cf15
Changes for review
ipad54 Dec 1, 2024
780b373
Declare all offset constants together
ipad54 Dec 1, 2024
a68323a
Merge branch 'minor-next' of https://github.com/pmmp/PocketMine-MP in…
ipad54 Dec 1, 2024
ba55fa3
Merge branch 'minor-next' of https://github.com/pmmp/PocketMine-MP in…
ipad54 Dec 12, 2024
b140a79
Merge branch 'minor-next' into smithing-table
dktapps Feb 10, 2025
5cd4813
Merge branch 'smithing-table' of https://github.com/HimmelKreis4865/P…
ipad54 Feb 11, 2025
275b084
Merge branch 'minor-next' of https://github.com/pmmp/PocketMine-MP in…
ipad54 Feb 11, 2025
f8c99c2
Added resin material
ipad54 Feb 11, 2025
9e76cf7
Fix grammar
ipad54 Feb 11, 2025
a0b4a31
Fix PHPStan
ipad54 Feb 11, 2025
f3dfe55
CS
ipad54 Feb 11, 2025
6b5a891
Merge branch 'minor-next' into smithing-table
dktapps Sep 19, 2025
64cae7c
Merge branch 'minor-next' into smithing-table
dktapps Dec 21, 2025
7fb8f79
Modernise registries
dktapps Dec 22, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
185 changes: 185 additions & 0 deletions generated/item/VanillaArmorTrimMaterials.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,185 @@
<?php

/*
*
* ____ _ _ __ __ _ __ __ ____
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* @author PocketMine Team
* @link http://www.pocketmine.net/
*
*
*/

declare(strict_types=1);

namespace pocketmine\item;

use function array_keys;
use function count;
use function implode;
use function mb_strtoupper;

/**
* This class is generated automatically from source class {@link VanillaArmorTrimMaterialsInputs}. Do not modify it manually.
* It must be regenerated whenever the source class is changed.
* @see build/codegen/registry-interface.php
*/
final class VanillaArmorTrimMaterials{
private static ArmorTrimMaterial $_mAMETHYST;
private static ArmorTrimMaterial $_mCOPPER;
private static ArmorTrimMaterial $_mDIAMOND;
private static ArmorTrimMaterial $_mEMERALD;
private static ArmorTrimMaterial $_mGOLD;
private static ArmorTrimMaterial $_mIRON;
private static ArmorTrimMaterial $_mLAPIS;
private static ArmorTrimMaterial $_mNETHERITE;
private static ArmorTrimMaterial $_mQUARTZ;
private static ArmorTrimMaterial $_mREDSTONE;
private static ArmorTrimMaterial $_mRESIN;

/**
* @var ArmorTrimMaterial[]
* @phpstan-var array<string, ArmorTrimMaterial>
*/
private static array $members;

private static bool $initialized = false;

private function __construct(){
//NOOP
}

/**
* Hack to allow ignoring PHPStan wrong type assignment error in one place instead of hundreds or thousands
* Assumes that the input value already matches the expected type. If not, a TypeError will be thrown on assignment.
*
* @phpstan-param \Closure(never) : ArmorTrimMaterial $closure
*/
private static function unsafeAssign(\Closure $closure, ArmorTrimMaterial $memberValue) : void{
/**
* This type is not correct either (the param is actually a subtype of ArmorTrimMaterial) but it's called
* unsafeAssign for a reason :)
* @phpstan-var \Closure(ArmorTrimMaterial) : ArmorTrimMaterial $closure
*/
$closure($memberValue);
}

/**
* @return \Closure[]
* @phpstan-return array<string, \Closure(never) : ArmorTrimMaterial>
*/
private static function getInitAssigners() : array{
return [
"amethyst" => fn(ArmorTrimMaterial $v) => self::$_mAMETHYST = $v,
"copper" => fn(ArmorTrimMaterial $v) => self::$_mCOPPER = $v,
"diamond" => fn(ArmorTrimMaterial $v) => self::$_mDIAMOND = $v,
"emerald" => fn(ArmorTrimMaterial $v) => self::$_mEMERALD = $v,
"gold" => fn(ArmorTrimMaterial $v) => self::$_mGOLD = $v,
"iron" => fn(ArmorTrimMaterial $v) => self::$_mIRON = $v,
"lapis" => fn(ArmorTrimMaterial $v) => self::$_mLAPIS = $v,
"netherite" => fn(ArmorTrimMaterial $v) => self::$_mNETHERITE = $v,
"quartz" => fn(ArmorTrimMaterial $v) => self::$_mQUARTZ = $v,
"redstone" => fn(ArmorTrimMaterial $v) => self::$_mREDSTONE = $v,
"resin" => fn(ArmorTrimMaterial $v) => self::$_mRESIN = $v,
];
}

private static function init() : void{
//This nasty mess of closures allows us to suppress PHPStan type assignment errors in one place instead of
//on every single assignment. This will only run one time on first init, so it's fine for performance.
if(self::$initialized){
throw new \LogicException("Circular dependency detected - use RegistrySource->registerDelayed() if the circular dependency can't be avoided");
}
self::$initialized = true;
$assigners = self::getInitAssigners();
$assigned = [];
$source = new VanillaArmorTrimMaterialsInputs();
foreach($source->getAllValues() as $name => $value){
$assigner = $assigners[$name] ?? throw new \LogicException("Unexpected source registry member \"$name\" (code probably needs regenerating)");
if(isset($assigned[$name])){
//this should be prevented by RegistrySource, but it doesn't hurt to have some redundancy
throw new \LogicException("Repeated registry source member \"$name\"");
}
self::$members[mb_strtoupper($name)] = $value;
$assigned[$name] = true;
unset($assigners[$name]);
self::unsafeAssign($assigner, $value);
}
if(count($assigners) > 0){
throw new \LogicException("Missing values for registry members (code probably needs regenerating): " . implode(", ", array_keys($assigners)));
}
}

/**
* @return ArmorTrimMaterial[]
* @phpstan-return array<string, ArmorTrimMaterial>
*/
public static function getAll() : array{
if(!isset(self::$members)){ self::init(); }
return self::$members;
}

public static function AMETHYST() : ArmorTrimMaterial{
if(!isset(self::$_mAMETHYST)){ self::init(); }
return self::$_mAMETHYST;
}

public static function COPPER() : ArmorTrimMaterial{
if(!isset(self::$_mCOPPER)){ self::init(); }
return self::$_mCOPPER;
}

public static function DIAMOND() : ArmorTrimMaterial{
if(!isset(self::$_mDIAMOND)){ self::init(); }
return self::$_mDIAMOND;
}

public static function EMERALD() : ArmorTrimMaterial{
if(!isset(self::$_mEMERALD)){ self::init(); }
return self::$_mEMERALD;
}

public static function GOLD() : ArmorTrimMaterial{
if(!isset(self::$_mGOLD)){ self::init(); }
return self::$_mGOLD;
}

public static function IRON() : ArmorTrimMaterial{
if(!isset(self::$_mIRON)){ self::init(); }
return self::$_mIRON;
}

public static function LAPIS() : ArmorTrimMaterial{
if(!isset(self::$_mLAPIS)){ self::init(); }
return self::$_mLAPIS;
}

public static function NETHERITE() : ArmorTrimMaterial{
if(!isset(self::$_mNETHERITE)){ self::init(); }
return self::$_mNETHERITE;
}

public static function QUARTZ() : ArmorTrimMaterial{
if(!isset(self::$_mQUARTZ)){ self::init(); }
return self::$_mQUARTZ;
}

public static function REDSTONE() : ArmorTrimMaterial{
if(!isset(self::$_mREDSTONE)){ self::init(); }
return self::$_mREDSTONE;
}

public static function RESIN() : ArmorTrimMaterial{
if(!isset(self::$_mRESIN)){ self::init(); }
return self::$_mRESIN;
}
}
Loading
Loading