mirror of
https://github.com/oldminecraftcommunity/NostalgiaCore.git
synced 2026-11-21 03:59:43 +00:00
Merge 2dbeda3c90 into dbaa8a659f
This commit is contained in:
commit
232dae04a6
5 changed files with 20 additions and 4 deletions
|
|
@ -25,8 +25,8 @@ class AddMobPacket extends RakNetDataPacket{
|
|||
$this->putFloat($this->x);
|
||||
$this->putFloat($this->y);
|
||||
$this->putFloat($this->z);
|
||||
$this->putByte($this->yaw);
|
||||
$this->putByte($this->pitch);
|
||||
$this->putByte(Utils::rotDegreesToChar($this->yaw));
|
||||
$this->putByte(Utils::rotDegreesToChar($this->pitch));
|
||||
$this->put(Utils::writeMetadata($this->metadata));
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -40,8 +40,8 @@ class AddPlayerPacket extends RakNetDataPacket{
|
|||
$this->putFloat($this->x);
|
||||
$this->putFloat($this->y);
|
||||
$this->putFloat($this->z);
|
||||
$this->putByte($this->yaw);
|
||||
$this->putByte($this->pitch);
|
||||
$this->putByte(Utils::rotDegreesToChar($this->yaw));
|
||||
$this->putByte(Utils::rotDegreesToChar($this->pitch));
|
||||
$this->putShort($this->itemID);
|
||||
$this->putShort($this->itemAuxValue); //Example: bow shooting power
|
||||
$this->put(Utils::writeMetadata($this->metadata));
|
||||
|
|
|
|||
|
|
@ -13,6 +13,8 @@ class FuelData{
|
|||
WOODEN_SWORD => 10,
|
||||
WOODEN_SHOVEL => 10,
|
||||
WOODEN_HOE => 10,
|
||||
BOW => 10,
|
||||
BOWL => 10,
|
||||
STICK => 5,
|
||||
FENCE => 15,
|
||||
FENCE_GATE => 15,
|
||||
|
|
@ -20,6 +22,8 @@ class FuelData{
|
|||
SPRUCE_WOOD_STAIRS => 15,
|
||||
BIRCH_WOOD_STAIRS => 15,
|
||||
JUNGLE_WOOD_STAIRS => 15,
|
||||
WOODEN_SLAB => 15,
|
||||
DOUBLE_WOOD_SLAB => 15,
|
||||
TRAPDOOR => 15,
|
||||
WORKBENCH => 15,
|
||||
BOOKSHELF => 15,
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@ class SmeltingData{
|
|||
TRUNK => [COAL, 1], //Charcoal
|
||||
GOLD_ORE => [GOLD_INGOT, 0],
|
||||
IRON_ORE => [IRON_INGOT, 0],
|
||||
DIAMOND_ORE => [DIAMOND, 0],
|
||||
NETHERRACK => [NETHER_BRICK, 0],
|
||||
RAW_PORKCHOP => [COOKED_PORKCHOP, 0],
|
||||
CLAY => [BRICK, 0],
|
||||
|
|
|
|||
|
|
@ -457,6 +457,17 @@ class Utils{
|
|||
return substr(pack("N", $value), 1);
|
||||
}
|
||||
|
||||
public static function rotDegreesToChar(float $deg) : int{
|
||||
$v = ((int)(($deg / 360.0) * 256.0)) & 0xFF;
|
||||
return $v >= 128 ? $v - 256 : $v;
|
||||
}
|
||||
|
||||
public static function rotCharToDegrees(int $char) : float{
|
||||
$char = $char & 0xFF;
|
||||
if($char >= 128) $char -= 256;
|
||||
return $char * 360.0 / 256.0;
|
||||
}
|
||||
|
||||
public static function getRandomBytes($length = 16, $secure = true, $raw = true, $startEntropy = "", &$rounds = 0, &$drop = 0){
|
||||
return $raw ? random_bytes($length) : bin2hex(random_bytes($length)); //nobody would ever notice other parameters
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue