Good day! I'm currently working on a minigame where I want players to place blocks while at the same time prevent them from breaking the map blocks. Right now, my current method is to clone the area and constantly check whether those two areas match and only re-clone the area if they're a mismatch. Issue is it heavily lags my game, a lot of red spikes in the TPS section in the debug screen which I expected. I'm asking if there's a better way to do this and make it less laggy?
#What's the most efficient way to prevent an area from being destroyed?
1 messages · Page 1 of 1 (latest)
<@&1201956957406109788>
Someone will come and help soon!
💬 While you wait, take this time to provide more context and details.
🙇 If nobody has answered you by <t:1750599766:t>, feel free to use the Summon Helpers button to ping our helper team.
✅ Once your question has been resolved (or you no longer need it), please click Resolve Question or run /resolve
Is there a possibility to put the players in adventure mode?
You can still allow players to place blocks by giving the items a can_place_on component. You can also give them a pickaxe which allows them to break certain blocks
That's one way of fixing it yes, players would then need tools to break the wool blocks. But then players couldn't break those blocks using only their hands.
Couldn't check for item drops or scoreboard checks either cause what if the player mines a stone block using their hands, it doesn't detect it.
I also have this idea of maybe doing a constant raycast for every player on what blocks they're looking at. If they're looking at stone or grass, change their gamemode to adventure and if they're looking at wool or concrete blocks, then change it to survival. Problem is, it would introduce lag for players playing on a server that's far away from their region. I have a feeling those gamemode switches would be noticeable for laggy players.
you could allow wool blocks to be used to break wool blocks
the gamemode switch would not be the problem, but all the raycasts.
ive seen this done and its relatively stable and efficient
read the whole text, they talked about that.
but scoreboards would work. Just that you have to make one for every block that can be mined on your server.
mining a block without using the correct tool doesn't count in the scoreboards tho
what scoreboard are you talking about?
the /scoreboards one
/scoreboard objectives add .mined.stone minecraft.mined:minecraft.stone
It doesn't count? Since when?
I believe (unsure if this was fixed) there is a bug you could utilize, I will test it first and let you know if it still works
Okay I tested it, it works for specific components nevermind
thanks for trying
By the way
By your question, are you ONLY referring to player destruction? like a player mining a block
Because I'd reckon you could just like, put their mining speed attribute to 0
no i have other problems as well, I got tnts to work with
I think that's a thing
tnt's power can be turned 0 instantly if it's in the area that's not a big problem
I think that's possible
will that still damage the players? or do I have to setup a custom /damage?
I don't think so no
oo nevermind, apparently explosion power is not stored in the entity's nbt once ignited
only creepers have it i think
but in this case just kill the tnt and drop an item one instead
tnt has it but just for the block form
and fireballs
oh wait no xd
what
theres a tnt purchasable from a shop somewhere that players can place to combat other players. This tnt would then damage players, breaks blocks that were placed by other players, but would not break the blocks that are from the map itself
yeah its a little bit complicated
why not make the floor of barrier blocks, and place a concrete block display on it
that wouldn't lag your game
not as much as constantly cloning would at least
what about the lighting of the block?
there is an option for block displays to be lit, but even if they aren't, those are barrier blocks, you could place light blocks under
and just keep the game in survival
how bad is it if i replace the top layers in my 1000x500 map with barrier blocks and have each one have a block display?
oh that's
that's quite huge
unless your server is powerful, and even your client, yea that will be a problem
wait maybe im exaggerating, its prolly only like 400x320 or something, its oval shaped based from the previous screenshot
but its still pretty bad
well not bad bad, display entities generally are more of a problem for the client more than the server
but yea it is recommended to avoid large amounts if possible
why is your arena this huge though, are there parts where you could compromise the barrier blocks
well im just gonna tell it straight away
im trying to make a capture the flag map for a server that can be played with like 6v6 max, the screenshot above there was meant to be like a floor guide, surrounding the edges with mountains to cover the void
but yeah, really the main issue was to figure out how to prevent players from breaking the world while also at the same time allow them to build on it
yeah, two bases, one for each team, a bridge perhaps, some random structures in between
well
its essentially an arena
if you could compromise on the block's texture quality, you can have the whole arena be one block display
wait thats so smart, imma try that rn
Im not gonna lie I tested it and it's barely noticeable if you are using concrete
by the way @tough crag you could use this if you want https://eszesbalint.github.io/bdstudio/editor
for easier block display generation
thanks for the support, ill try my luck with the block displays instead