mirror of
https://github.com/oldminecraftcommunity/NostalgiaCore.git
synced 2026-11-20 11:39:43 +00:00
Init Commit
This commit is contained in:
parent
845ff19ba1
commit
5d0d586ce5
6 changed files with 237 additions and 222 deletions
|
|
@ -673,6 +673,30 @@ class BlockAPI{
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static function convertHighItemIdsToOldItemIds(int $protocolId, int $itemId) : int{
|
||||
if ($protocolId >= ProtocolInfo12::CURRENT_PROTOCOL_12) {
|
||||
return $itemId;
|
||||
}
|
||||
|
||||
$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) {
|
||||
$idMap += [
|
||||
NETHERRACK => OBSIDIAN, //block
|
||||
NETHER_BRICK => BRICK, //item
|
||||
NETHER_QUARTZ => BRICK, //item
|
||||
];
|
||||
}
|
||||
|
||||
return $idMap[$itemId] ?? $itemId;
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated random updates are handled differently now.
|
||||
|
|
|
|||
|
|
@ -522,6 +522,18 @@ class PlayerAPI{
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
public static function decodeProtocol($ip, $port){
|
||||
foreach(ServerAPI::request()->clients as $p) {
|
||||
ConsoleAPI::info($p->ip);
|
||||
if($p->ip == $ip && $p->port == $port){
|
||||
return $p->PROTOCOL;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function remove($CID){
|
||||
if(isset($this->server->clients[$CID])){
|
||||
$player = $this->server->clients[$CID];
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue