remove dead code

This commit is contained in:
ShockedPlot7560 2025-03-22 21:22:08 +01:00
parent b4cb09fe5e
commit 11135c2fd8
No known key found for this signature in database
GPG Key ID: D7539B420F1FA86E
6 changed files with 12 additions and 36 deletions

View File

@ -28,10 +28,8 @@ use pocketmine\item\Item;
/**
* This class is here to hold the result of an anvil crafting process.
*/
class AnvilCraftResult{
final class AnvilCraftResult{
/**
* @param int $xpCost
* @param Item $output
* @param Item|null $sacrificeResult If the given item is considered as null (count <= 0), the value will be set to null.
*/
public function __construct(

View File

@ -34,7 +34,6 @@ use function count;
use function implode;
use function ksort;
use function spl_object_id;
use function var_dump;
use const SORT_STRING;
class CraftingManager{

View File

@ -25,12 +25,10 @@ namespace pocketmine\crafting;
use pocketmine\item\Durable;
use pocketmine\item\Item;
use pocketmine\item\Tool;
use function ceil;
use function floor;
use function max;
use function min;
use function var_dump;
/**
* Represent a recipe that repair an item with a material in an anvil.
@ -39,7 +37,8 @@ class MaterialRepairRecipe implements AnvilRecipe{
public function __construct(
private RecipeIngredient $input,
private RecipeIngredient $material
){ }
){
}
public function getInput() : RecipeIngredient{
return $this->input;
@ -55,10 +54,8 @@ class MaterialRepairRecipe implements AnvilRecipe{
if($damage !== 0){
$quarter = min($damage, (int) floor($input->getMaxDurability() / 4));
$numberRepair = min($material->getCount(), (int) ceil($damage / $quarter));
if($numberRepair > 0){
// TODO: remove the material
$damage -= $quarter * $numberRepair;
}
$damage -= $quarter * $numberRepair;
return new AnvilCraftResult(
$numberRepair,
(clone $input)->setDamage(max(0, $damage)),

View File

@ -34,7 +34,6 @@ use pocketmine\nbt\tag\IntTag;
use pocketmine\player\Player;
use pocketmine\utils\Binary;
use pocketmine\utils\Utils;
use function in_array;
use function mt_rand;
class Armor extends Durable{
@ -173,8 +172,4 @@ class Armor extends Durable{
$tag->setInt(self::TAG_CUSTOM_COLOR, Binary::signInt($this->customColor->toARGB())) :
$tag->removeTag(self::TAG_CUSTOM_COLOR);
}
public function isValidRepairMaterial(Item $material) : bool{
return in_array($material->getTypeId(), $this->armorInfo->getMaterial()->getRepairMaterials(), true);
}
}

View File

@ -27,13 +27,9 @@ use pocketmine\world\sound\Sound;
class ArmorMaterial{
/**
* @param int[] $repairMaterials
*/
public function __construct(
private readonly int $enchantability,
private readonly ?Sound $equipSound = null,
private readonly array $repairMaterials = []
private readonly ?Sound $equipSound = null
){
}
@ -53,13 +49,4 @@ class ArmorMaterial{
public function getEquipSound() : ?Sound{
return $this->equipSound;
}
/**
* Returns the items that can be used to repair the armor
*
* @return int[]
*/
public function getRepairMaterials() : array{
return $this->repairMaterials;
}
}

View File

@ -69,12 +69,12 @@ final class VanillaArmorMaterials{
}
protected static function setup() : void{
self::register("leather", new ArmorMaterial(15, new ArmorEquipLeatherSound(), [ItemTypeIds::LEATHER]));
self::register("leather", new ArmorMaterial(15, new ArmorEquipLeatherSound()));
self::register("chainmail", new ArmorMaterial(12, new ArmorEquipChainSound()));
self::register("iron", new ArmorMaterial(9, new ArmorEquipIronSound(), [ItemTypeIds::IRON_INGOT]));
self::register("turtle", new ArmorMaterial(9, new ArmorEquipGenericSound(), [ItemTypeIds::SCUTE]));
self::register("gold", new ArmorMaterial(25, new ArmorEquipGoldSound(), [ItemTypeIds::GOLD_INGOT]));
self::register("diamond", new ArmorMaterial(10, new ArmorEquipDiamondSound(), [ItemTypeIds::DIAMOND]));
self::register("netherite", new ArmorMaterial(15, new ArmorEquipNetheriteSound(), [ItemTypeIds::NETHERITE_INGOT]));
self::register("iron", new ArmorMaterial(9, new ArmorEquipIronSound()));
self::register("turtle", new ArmorMaterial(9, new ArmorEquipGenericSound()));
self::register("gold", new ArmorMaterial(25, new ArmorEquipGoldSound()));
self::register("diamond", new ArmorMaterial(10, new ArmorEquipDiamondSound()));
self::register("netherite", new ArmorMaterial(15, new ArmorEquipNetheriteSound()));
}
}