Open DaMatrix opened 6 years ago
It could probably be done by writing a mod that hooks Level::onPlayerDeath(Player&, EntityDamageSource const&)
and calls LevelData::setSpawn(BlockPos const&)
with a random spawn position. This will change the world spawn point every time a player dies.
I'm new to modding so what I just said may not be true.
Actually to make a spawn protection mod it would be better to just not allow players to modify blocks near the spawnpoint. This could maybe be done with minecraft::api::PlayerInteractionInterface::handlePlayerPlacingBlockEvent()
and minecraft::api::PlayerInteractionInterface::handlePlayerBreakingBlockEvent()
, but how I would need to modify that function to keep a player from placing a block I don't know.
I tried writing a mod for this, but I ran into an issue when trying to get the player abilities.
EntityUniqueID entityuniqueid = player.getUniqueID();
Level level = player.getLevel();
Abilities abilities = level.getPlayerAbilities(entityuniqueid);
But everything I tried just resulted in crashes so I guess I give up for now.
@nic96 Most likely you are guessing the wrong, the return type of function. Player::getLevel()
most likely return an pointer.
Discussing modding is off-topic, please use a different place for this.
See this link
A way to have players not always respawn at the exact same place would be useful, as it makes it possible for people to spawn trap players and make it impossible to get out.
I'm not sure if this is within the scope of the project, as it's (currently) not in vanilla MCPE. However, it's a very useful feature for multiplayer servers.