diff options
author | Dalwyn <100111505+DalwynWasTaken@users.noreply.github.com> | 2023-02-18 16:57:50 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-02-19 00:57:50 +0900 |
commit | 0c787aa9e54331eb42bfb82804926df173c6f04f (patch) | |
tree | 0486d089c261239b7cb76e083b6f4cbe3f5cb86f /mod | |
parent | d5e88bc3fa96493e9bffecac50e73a1da86de0aa (diff) | |
download | Skyblock-Dungeons-Guide-0c787aa9e54331eb42bfb82804926df173c6f04f.tar.gz Skyblock-Dungeons-Guide-0c787aa9e54331eb42bfb82804926df173c6f04f.tar.bz2 Skyblock-Dungeons-Guide-0c787aa9e54331eb42bfb82804926df173c6f04f.zip |
MapPlayerProcessor to use renderDistance (#322)
* MapPlayerProcessor to use renderDistance
If this is wrong, please do remove it. Also you will probably change this in a few weeks with map recode but thought I may as well add it.
If I did something wrong please tell me
* - Fix squared distance issue
Signed-off-by: syeyoung <cyoung06@naver.com>
---------
Signed-off-by: syeyoung <cyoung06@naver.com>
Co-authored-by: syeyoung <cyoung06@naver.com>
Diffstat (limited to 'mod')
-rwxr-xr-x | mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/map/MapPlayerProcessor.java | 13 |
1 files changed, 4 insertions, 9 deletions
diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/map/MapPlayerProcessor.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/map/MapPlayerProcessor.java index c52d3693..be387624 100755 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/map/MapPlayerProcessor.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/map/MapPlayerProcessor.java @@ -45,11 +45,6 @@ public class MapPlayerProcessor { @Getter private final BiMap<String, String> mapIconToPlayerMap = HashBiMap.create(); Logger logger = LogManager.getLogger("DG-MapPlayerProcessor"); - /** - * If the player on the map is closer than value this it won't save it - * this should be done with render-distance but whateva - */ - int closenessDistance = 50; private int waitDelay = 0; public MapPlayerProcessor(DungeonContext context) { @@ -67,7 +62,7 @@ public class MapPlayerProcessor { waitDelay++; return; } - ItemStack stack = Minecraft.getMinecraft().thePlayer.inventory.getStackInSlot(8); + ItemStack stack = mc.thePlayer.inventory.getStackInSlot(8); if (stack == null || !(stack.getItem() instanceof ItemMap)) { return; @@ -128,7 +123,7 @@ public class MapPlayerProcessor { int y2 = bbb.func_176113_c() / 2 + 64; int dx = x2 - x; int dy = y2 - y; - if (dx * dx + dy * dy < closenessDistance) { + if (dx * dx + dy * dy < mc.gameSettings.renderDistanceChunks * mc.gameSettings.renderDistanceChunks * 256 ) { shouldSave = false; break; } @@ -164,13 +159,13 @@ public class MapPlayerProcessor { } private boolean isPlayerNear(String player, BlockPos mapPos) { - EntityPlayer entityPlayer = Minecraft.getMinecraft().theWorld.getPlayerEntityByName(player); + EntityPlayer entityPlayer = mc.theWorld.getPlayerEntityByName(player); if (entityPlayer != null && !entityPlayer.isInvisible()) { BlockPos pos = entityPlayer.getPosition(); int dx = mapPos.getX() - pos.getX(); int dz = mapPos.getZ() - pos.getZ(); - return dx * dx + dz * dz < closenessDistance; + return dx * dx + dz * dz < mc.gameSettings.renderDistanceChunks * mc.gameSettings.renderDistanceChunks * 256; } |