mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-05-13 01:09:44 +00:00
- the fix didn't fix
this is a mess it would be nice not to have to start the server to find these kinds of bugs >.<
This commit is contained in:
parent
f81849e550
commit
e7494fff96
@ -343,30 +343,34 @@ class ItemFactory{
|
|||||||
throw new \TypeError("`tags` argument must be a string or CompoundTag instance, " . (is_object($tags) ? "instance of " . get_class($tags) : gettype($tags)) . " given");
|
throw new \TypeError("`tags` argument must be a string or CompoundTag instance, " . (is_object($tags) ? "instance of " . get_class($tags) : gettype($tags)) . " given");
|
||||||
}
|
}
|
||||||
|
|
||||||
try{
|
/** @var Item $item */
|
||||||
$sublist = self::$list[self::getListOffset($id)];
|
$item = null;
|
||||||
|
if($meta !== -1){
|
||||||
|
try{
|
||||||
|
$sublist = self::$list[self::getListOffset($id)];
|
||||||
|
|
||||||
/** @var Item|null $listed */
|
/** @var Item|null $listed */
|
||||||
if($sublist !== null){
|
if($sublist !== null){
|
||||||
if(isset($sublist[$meta])){
|
if(isset($sublist[$meta])){
|
||||||
$item = clone $sublist[$meta];
|
$item = clone $sublist[$meta];
|
||||||
}elseif(isset($sublist[0]) and $sublist[0] instanceof Durable){
|
}elseif(isset($sublist[0]) and $sublist[0] instanceof Durable){
|
||||||
/** @var Durable $item */
|
/** @var Durable $item */
|
||||||
$item = clone $sublist[0];
|
$item = clone $sublist[0];
|
||||||
$item->setDamage($meta);
|
$item->setDamage($meta);
|
||||||
}else{
|
}
|
||||||
throw new \InvalidArgumentException("Unknown variant $meta of item ID $id");
|
}elseif($id < 256){ //intentionally includes negatives, for extended block IDs
|
||||||
|
/* Blocks must have a damage value 0-15, but items can have damage value -1 to indicate that they are
|
||||||
|
* crafting ingredients with any-damage. */
|
||||||
|
$item = new ItemBlock($id, $meta);
|
||||||
}
|
}
|
||||||
}elseif($id < 256){ //intentionally includes negatives, for extended block IDs
|
}catch(\RuntimeException $e){
|
||||||
/* Blocks must have a damage value 0-15, but items can have damage value -1 to indicate that they are
|
throw new \InvalidArgumentException("Item ID $id is invalid or out of bounds");
|
||||||
* crafting ingredients with any-damage. */
|
|
||||||
$item = new ItemBlock($id, $meta);
|
|
||||||
}else{
|
|
||||||
//negative damage values will fallthru to here, to avoid crazy shit with crafting wildcard hacks
|
|
||||||
$item = new Item($id, $meta);
|
|
||||||
}
|
}
|
||||||
}catch(\RuntimeException $e){
|
}
|
||||||
throw new \InvalidArgumentException("Item ID $id is invalid or out of bounds");
|
|
||||||
|
if($item === null){
|
||||||
|
//negative damage values will fallthru to here, to avoid crazy shit with crafting wildcard hacks
|
||||||
|
$item = new Item($id, $meta);
|
||||||
}
|
}
|
||||||
|
|
||||||
$item->setCount($count);
|
$item->setCount($count);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user