#What's the most efficient way to prevent an area from being destroyed?

1 messages · Page 1 of 1 (latest)

tough crag
#

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?

hardy bladeBOT
#

<@&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

slender oasis
#

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

tough crag
#

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.

ionic hare
dense wind
ionic hare
dense wind
#

but scoreboards would work. Just that you have to make one for every block that can be mined on your server.

tough crag
#

mining a block without using the correct tool doesn't count in the scoreboards tho

dense wind
#

what scoreboard are you talking about?

tough crag
#

the /scoreboards one

/scoreboard objectives add .mined.stone minecraft.mined:minecraft.stone
dense wind
#

It doesn't count? Since when?

tough crag
#

about since when tho, i have no idea about that

round kindle
#

Okay I tested it, it works for specific components nevermind

tough crag
#

thanks for trying

round kindle
#

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

tough crag
#

no i have other problems as well, I got tnts to work with

round kindle
#

I think that's a thing

round kindle
#

I think that's possible

tough crag
#

will that still damage the players? or do I have to setup a custom /damage?

round kindle
#

I don't think so no

#

oo nevermind, apparently explosion power is not stored in the entity's nbt once ignited

tough crag
#

only creepers have it i think

round kindle
#

but in this case just kill the tnt and drop an item one instead

#

tnt has it but just for the block form

tough crag
#

and fireballs

round kindle
#

but it still shouldnt be a biggie just kill the tnt

#

if it enters the territory

tough crag
#

oh wait no xd

round kindle
#

what

tough crag
#

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

round kindle
#

hold on let me revise your ultimate goa

#

l

#

oh ok i get it

#

alright then

#

uhh

tough crag
#

yeah its a little bit complicated

round kindle
#

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

tough crag
#

what about the lighting of the block?

round kindle
#

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

tough crag
#

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?

round kindle
#

oh that's

#

that's quite huge

#

unless your server is powerful, and even your client, yea that will be a problem

tough crag
#

wait maybe im exaggerating, its prolly only like 400x320 or something, its oval shaped based from the previous screenshot

#

but its still pretty bad

round kindle
#

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

tough crag
#

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

round kindle
#

are there like, buildings in between

#

or objects

tough crag
#

yeah, two bases, one for each team, a bridge perhaps, some random structures in between

round kindle
#

well

tough crag
#

its essentially an arena

round kindle
#

if you could compromise on the block's texture quality, you can have the whole arena be one block display

tough crag
#

wait thats so smart, imma try that rn

round kindle
#

Im not gonna lie I tested it and it's barely noticeable if you are using concrete

#

for easier block display generation

tough crag
#

thanks for the support, ill try my luck with the block displays instead