- 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:
Dylan K. Taylor 2018-10-17 15:08:08 +01:00
parent f81849e550
commit e7494fff96

View File

@ -343,6 +343,9 @@ 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");
} }
/** @var Item $item */
$item = null;
if($meta !== -1){
try{ try{
$sublist = self::$list[self::getListOffset($id)]; $sublist = self::$list[self::getListOffset($id)];
@ -354,20 +357,21 @@ class ItemFactory{
/** @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 }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 /* 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. */ * crafting ingredients with any-damage. */
$item = new ItemBlock($id, $meta); $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){ }catch(\RuntimeException $e){
throw new \InvalidArgumentException("Item ID $id is invalid or out of bounds"); 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);
$item->setCompoundTag($tags); $item->setCompoundTag($tags);