This commit is contained in:
Sunch 2025-04-29 19:21:59 +08:00
parent 26cafcab00
commit 1e85a65764
52 changed files with 2400 additions and 2406 deletions

View file

@ -645,12 +645,12 @@ class BlockAPI{
/**
* 方块/物品id转换,防止新版本影响旧版本视觉效果
*/
public static function convertHighItemIdsToOldItemIds(int $protocolId, int $itemId) : int{
if ($protocolId >= ProtocolInfo12::CURRENT_PROTOCOL_12) {
return $itemId;
}
public static function convertHighItemIdsToOldItemIds(int $protocolId, int $itemId) : int{
if ($protocolId >= ProtocolInfo12::CURRENT_PROTOCOL_12) {
return $itemId;
}
$idMap = [ //default for protocol < 12
$idMap = [ //default for protocol < 12
LIT_PUMPKIN => MELON_BLOCK, //block
PUMPKIN_SEEDS => MELON_SEEDS, //item
PUMPKIN_PIE => BREAD, //item
@ -658,14 +658,14 @@ class BlockAPI{
BEETROOT_SEEDS => SEEDS, //item
];
if ($protocolId < ProtocolInfo9::CURRENT_PROTOCOL_9) {
$idMap += [
NETHERRACK => OBSIDIAN, //block
NETHER_BRICK => BRICK, //item
NETHER_QUARTZ => BRICK, //item
];
}
if ($protocolId < ProtocolInfo9::CURRENT_PROTOCOL_9) {
$idMap += [
NETHERRACK => OBSIDIAN, //block
NETHER_BRICK => BRICK, //item
NETHER_QUARTZ => BRICK, //item
];
}
return $idMap[$itemId] ?? $itemId;
}
return $idMap[$itemId] ?? $itemId;
}
}

View file

@ -327,16 +327,16 @@ class PlayerAPI{
return $o;
}
/**
* @return int
*/
public static function decodeProtocol($ip){
foreach(ServerAPI::request()->clients as $p) {
if($p->ip == $ip){
return $p->PROTOCOL;
}
}
}
/**
* @return int
*/
public static function decodeProtocol($ip){
foreach(ServerAPI::request()->clients as $p) {
if($p->ip == $ip){
return $p->PROTOCOL;
}
}
}
public function add($CID){
if(isset($this->server->clients[$CID])){