mirror of
https://github.com/oldminecraftcommunity/NostalgiaCore.git
synced 2026-11-24 13:39:44 +00:00
better logic
This commit is contained in:
parent
f6ca62ff6c
commit
0049ac9b04
1 changed files with 9 additions and 11 deletions
|
|
@ -649,11 +649,18 @@ class BlockAPI{
|
||||||
* 方块/物品id转换,防止新版本影响旧版本视觉效果
|
* 方块/物品id转换,防止新版本影响旧版本视觉效果
|
||||||
*/
|
*/
|
||||||
public static function convertHighItemIdsToOldItemIds(int $protocolId, int $itemId) : int{
|
public static function convertHighItemIdsToOldItemIds(int $protocolId, int $itemId) : int{
|
||||||
if ($protocolId >= ProtocolInfo::CURRENT_PROTOCOL) {
|
if ($protocolId >= ProtocolInfo12::CURRENT_PROTOCOL_12) {
|
||||||
return $itemId;
|
return $itemId;
|
||||||
}
|
}
|
||||||
|
|
||||||
$idMap = [];
|
$idMap = [ //default for protocol < 12
|
||||||
|
LIT_PUMPKIN => MELON_BLOCK, //block
|
||||||
|
PUMPKIN_SEEDS => MELON_SEEDS, //item
|
||||||
|
PUMPKIN_PIE => BREAD, //item
|
||||||
|
BEETROOT => BREAD, //item
|
||||||
|
BEETROOT_SEEDS => SEEDS, //item
|
||||||
|
];
|
||||||
|
|
||||||
if ($protocolId < ProtocolInfo9::CURRENT_PROTOCOL_9) {
|
if ($protocolId < ProtocolInfo9::CURRENT_PROTOCOL_9) {
|
||||||
$idMap += [
|
$idMap += [
|
||||||
NETHERRACK => OBSIDIAN, //block
|
NETHERRACK => OBSIDIAN, //block
|
||||||
|
|
@ -661,15 +668,6 @@ class BlockAPI{
|
||||||
NETHER_QUARTZ => BRICK, //item
|
NETHER_QUARTZ => BRICK, //item
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
if ($protocolId < ProtocolInfo12::CURRENT_PROTOCOL_12) {
|
|
||||||
$idMap += [
|
|
||||||
LIT_PUMPKIN => MELON_BLOCK, //block
|
|
||||||
PUMPKIN_SEEDS => MELON_SEEDS, //item
|
|
||||||
PUMPKIN_PIE => BREAD, //item
|
|
||||||
BEETROOT => BREAD, //item
|
|
||||||
BEETROOT_SEEDS => SEEDS, //item
|
|
||||||
];
|
|
||||||
}
|
|
||||||
|
|
||||||
return $idMap[$itemId] ?? $itemId;
|
return $idMap[$itemId] ?? $itemId;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue