The Meaning of Life, the Universe, and Everything.
Join Date:
4/23/2018
Posts:
53
Member Details
Hello everyone, I'm attempting to create shrinking zone system (like pubg and other BRs). I'm working on way to control it throught commands and in order to save it all I've made capability just for that. It all works fine.
When creating the map you have to specify the map center and map size. When you run command to start the game, center of world border is calculated based on these values. But I need to have dynamic size of the world border to prevent it blocking some parts of the map. I have tried few things, but nothing was precise. So I am asking the Minecraft community if somebody is more experienced with all this maths stuff to help me with this. I want to be able to have always 2 sides of the map inside the border (I know I can't have all on square map with offset world border - so the other 2 sides of the border will be longer than the map size, but that doesn't matter).
The Meaning of Life, the Universe, and Everything.
Join Date:
4/23/2018
Posts:
53
Member Details
No, I meant it this way:
- I have BlockPos as a map center + size parameter
- Based on these parameters Minecraft calculates random border center
If the border center would be in the map center for example [x = 0, z = 0] and map size from center to side of the map would be 100, I would have the border size cover all 4 corners of the map since it's in the center. But since the border center won't be in the map center, it would cut 2 corners of the map (with border size 100), so I smh need to calculate the distance of the border center to map center and add it to the border size.
The Meaning of Life, the Universe, and Everything.
Join Date:
4/23/2018
Posts:
53
Member Details
Okay, I have managed to solve this. Having 2 corners of the zone lined with 2 corners of the map didn't make sense at all (I think), so now I always have one side of the zone lined with one side of the map. For anyone interested into the code, you can check the GitHub Link (code related to this is inside the startGame() function
Hello everyone, I'm attempting to create shrinking zone system (like pubg and other BRs). I'm working on way to control it throught commands and in order to save it all I've made capability just for that. It all works fine.
When creating the map you have to specify the map center and map size. When you run command to start the game, center of world border is calculated based on these values. But I need to have dynamic size of the world border to prevent it blocking some parts of the map. I have tried few things, but nothing was precise. So I am asking the Minecraft community if somebody is more experienced with all this maths stuff to help me with this. I want to be able to have always 2 sides of the map inside the border (I know I can't have all on square map with offset world border - so the other 2 sides of the border will be longer than the map size, but that doesn't matter).
So what I have tried:
The code
Get my mod here: Official site
No, I meant it this way:
- I have BlockPos as a map center + size parameter
- Based on these parameters Minecraft calculates random border center
If the border center would be in the map center for example [x = 0, z = 0] and map size from center to side of the map would be 100, I would have the border size cover all 4 corners of the map since it's in the center. But since the border center won't be in the map center, it would cut 2 corners of the map (with border size 100), so I smh need to calculate the distance of the border center to map center and add it to the border size.
Get my mod here: Official site
Okay, I have managed to solve this. Having 2 corners of the zone lined with 2 corners of the map didn't make sense at all (I think), so now I always have one side of the zone lined with one side of the map. For anyone interested into the code, you can check the GitHub Link (code related to this is inside the startGame() function
Get my mod here: Official site