added keepinventory into extra.properties

This commit is contained in:
GameHerobrine 2024-11-28 22:23:54 +03:00
parent 57f8067434
commit a39791f092
5 changed files with 9 additions and 5 deletions

View file

@ -92,8 +92,10 @@ class PocketMinecraftServer{
"force-20-tps" => false,
"enable-mob-pushing" => Living::$entityPushing,
"keep-chunks-loaded" => self::$KEEP_CHUNKS_LOADED,
"use-experimental-hotbar" => Player::$experimentalHotbar
"use-experimental-hotbar" => Player::$experimentalHotbar,
"keep-items-on-death" => Entity::$keepInventory
]);
Entity::$keepInventory = $this->extraprops->get("keep-items-on-death");
Player::$experimentalHotbar = $this->extraprops->get("use-experimental-hotbar");
Player::$smallChunks = $this->extraprops->get("16x16x16_chunk_sending");
Living::$despawnMobs = $this->extraprops->get("despawn-mobs");

View file

@ -14,6 +14,7 @@ class Entity extends Position
public $fallDistance = 0;
public static $updateOnTick, $allowedAI;
public static $allowFly = true;
public static $keepInventory = false;
public $canBeAttacked;
public $moveTime, $lookTime, $idleTime, $knockbackTime = 0;
public $attackTimeout = 0;
@ -341,6 +342,9 @@ class Entity extends Position
{
if($this->class === ENTITY_PLAYER and $this->player instanceof Player and ($this->player->gamemode & 0x01) === 0){
$inv = [];
if(self::$keepInventory){
return [];
}
for($i = 0; $i < PLAYER_SURVIVAL_SLOTS; ++ $i){
$slot = $this->player->getSlot($i);
$this->player->setSlot($i, BlockAPI::getItem(AIR, 0, 0));

View file

@ -188,10 +188,8 @@ class Arrow extends Entity{
$v4 = MovingObjectPosition::fromEntity($bestEnt);
}
//TODO entity collisions
if($v4 != null){
if($v4->entityHit != null){
//TODO entity hit
$v49 = sqrt($this->speedY*$this->speedY + $this->speedX*$this->speedX + $this->speedZ*$this->speedZ);
$damage = ceil($v49+$v49);

View file

@ -12,7 +12,7 @@ class TrapdoorBlock extends TransparentBlock{
}
$this->hardness = 15;
}
//TODO collision box
public function canAttachTo(Block $target){
$id = $target->getID();
return $id === SLAB || $id === GLOWSTONE || $id === SLAB || $id === WOOD_SLAB || (!$target->isTransparent || $target instanceof StairBlock);

View file

@ -6,7 +6,7 @@ class LiquidBlockDynamic extends LiquidBlock{
}
public static $blockID = 0;
public static $sourcesAround = 0; //TODO rename
public static $sourcesAround = 0;
public static $spread = [0, 0, 0, 0];
public static function getHighest(Level $level, $x, $y, $z, $highest){