diff options
author | kingstefan26 <eryk.ruta1@gmail.com> | 2022-10-04 19:34:24 +0200 |
---|---|---|
committer | kingstefan26 <eryk.ruta1@gmail.com> | 2022-10-04 19:34:24 +0200 |
commit | a89ce55ece94804500ce824446dae816e2119402 (patch) | |
tree | fbf2f58d3b2a0a3873a7724edf0a3d8a303751f0 /src | |
parent | 448e5b54187718c4edf44f177b28182fab6d8506 (diff) | |
download | Skyblock-Dungeons-Guide-a89ce55ece94804500ce824446dae816e2119402.tar.gz Skyblock-Dungeons-Guide-a89ce55ece94804500ce824446dae816e2119402.tar.bz2 Skyblock-Dungeons-Guide-a89ce55ece94804500ce824446dae816e2119402.zip |
remove unnecessary yaw interpolation that caused weird jutter
turn the position from ints to floats, so it doesn't jump
Diffstat (limited to 'src')
-rwxr-xr-x | src/main/java/kr/syeyoung/dungeonsguide/dungeon/MapProcessor.java | 18 | ||||
-rw-r--r-- | src/main/java/kr/syeyoung/dungeonsguide/features/impl/dungeon/FeatureDungeonMap.java | 19 |
2 files changed, 23 insertions, 14 deletions
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/MapProcessor.java b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/MapProcessor.java index b6089ebd..8f9ae312 100755 --- a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/MapProcessor.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/MapProcessor.java @@ -22,19 +22,18 @@ import com.google.common.collect.BiMap; import com.google.common.collect.HashBiMap; import com.google.common.collect.Sets; import kr.syeyoung.dungeonsguide.DungeonsGuide; +import kr.syeyoung.dungeonsguide.dungeon.doorfinder.DungeonSpecificDataProvider; +import kr.syeyoung.dungeonsguide.dungeon.doorfinder.DungeonSpecificDataProviderRegistry; import kr.syeyoung.dungeonsguide.dungeon.doorfinder.EDungeonDoorType; import kr.syeyoung.dungeonsguide.dungeon.events.DungeonMapUpdateEvent; import kr.syeyoung.dungeonsguide.dungeon.events.DungeonNodataEvent; import kr.syeyoung.dungeonsguide.dungeon.events.DungeonRoomDiscoverEvent; import kr.syeyoung.dungeonsguide.dungeon.events.SerializableBlockPos; import kr.syeyoung.dungeonsguide.dungeon.roomfinder.DungeonRoom; -import kr.syeyoung.dungeonsguide.dungeon.doorfinder.DungeonSpecificDataProviderRegistry; -import kr.syeyoung.dungeonsguide.dungeon.doorfinder.DungeonSpecificDataProvider; import kr.syeyoung.dungeonsguide.events.DungeonContextInitializationEvent; import kr.syeyoung.dungeonsguide.features.FeatureRegistry; import kr.syeyoung.dungeonsguide.stomp.StompPayload; import kr.syeyoung.dungeonsguide.utils.MapUtils; -import kr.syeyoung.dungeonsguide.wsresource.StaticResource; import kr.syeyoung.dungeonsguide.wsresource.StaticResourceCache; import lombok.Getter; import lombok.Setter; @@ -48,11 +47,10 @@ import net.minecraftforge.common.MinecraftForge; import org.json.JSONObject; import javax.vecmath.Vector2d; -import javax.vecmath.Vector2f; import java.awt.*; -import java.util.*; import java.util.List; -import java.util.concurrent.ExecutionException; +import java.util.Queue; +import java.util.*; public class MapProcessor { @@ -210,6 +208,14 @@ public class MapProcessor { if (context.getDungeonMin() == null) return null; return new Point((worldPoint.getX() - context.getDungeonMin().getX()) / 32, (worldPoint.getZ() - context.getDungeonMin().getZ()) / 32); } + + public Vector2d worldPointToMapPointFLOAT(Vec3 worldPoint) { + if (context.getDungeonMin() == null) return null; + double x = topLeftMapPoint.x + ((worldPoint.xCoord - context.getDungeonMin().getX()) / 32.0f * (unitRoomDimension.width + doorDimension.height)); + double y = topLeftMapPoint.y + ((worldPoint.zCoord - context.getDungeonMin().getZ()) / 32.0f * (unitRoomDimension.height + doorDimension.height)); + return new Vector2d(x, y); + } + public Point worldPointToMapPoint(Vec3 worldPoint) { if (context.getDungeonMin() == null) return null; return new Point(topLeftMapPoint.x + (int)((worldPoint.xCoord - context.getDungeonMin().getX()) / 32.0f * (unitRoomDimension.width + doorDimension.height)), topLeftMapPoint.y + (int)((worldPoint.zCoord - context.getDungeonMin().getZ()) / 32.0f * (unitRoomDimension.height + doorDimension.height))); diff --git a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/dungeon/FeatureDungeonMap.java b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/dungeon/FeatureDungeonMap.java index be28fc34..557232c5 100644 --- a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/dungeon/FeatureDungeonMap.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/dungeon/FeatureDungeonMap.java @@ -163,8 +163,9 @@ public class FeatureDungeonMap extends GuiFeature implements DungeonEndListener, GlStateManager.scale(scale, scale, 0); GlStateManager.scale(postScale, postScale, 0); EntityPlayer p = Minecraft.getMinecraft().thePlayer; - Point pt = mapProcessor.worldPointToMapPoint(p.getPositionEyes(partialTicks)); - double yaw = p.prevRotationYawHead + (p.rotationYaw - p.prevRotationYawHead) * partialTicks; + + Vector2d pt = mapProcessor.worldPointToMapPointFLOAT(p.getPositionEyes(partialTicks)); + double yaw = p.rotationYaw; if (this.<Boolean>getParameter("playerCenter").getValue()) { if (this.<Boolean>getParameter("rotate").getValue()) { GlStateManager.rotate((float) (180.0 - yaw), 0, 0, 1); @@ -283,13 +284,12 @@ public class FeatureDungeonMap extends GuiFeature implements DungeonEndListener, EntityPlayer entityplayer = Minecraft.getMinecraft().theWorld.getPlayerEntityByName(name); - if (entityplayer != Minecraft.getMinecraft().thePlayer) continue; - - Point pt2; + Vector2d pt2; double yaw2; + if (entityplayer != null && (!entityplayer.isInvisible() || entityplayer == Minecraft.getMinecraft().thePlayer)) { - pt2 = mapProcessor.worldPointToMapPoint(entityplayer.getPositionEyes(partialTicks)); + pt2 = mapProcessor.worldPointToMapPointFLOAT(entityplayer.getPositionEyes(partialTicks)); yaw2 = entityplayer.prevRotationYawHead + (entityplayer.rotationYawHead - entityplayer.prevRotationYawHead) * partialTicks; } else { String iconName = mapProcessor.getMapIconToPlayerMap().get(name); @@ -298,7 +298,7 @@ public class FeatureDungeonMap extends GuiFeature implements DungeonEndListener, if (vec == null) { continue; } else { - pt2 = new Point(vec.func_176112_b() / 2 + 64, vec.func_176113_c() / 2 + 64); + pt2 = new Vector2d(vec.func_176112_b() / 2d + 64, vec.func_176113_c() / 2d + 64); yaw2 = vec.func_176111_d() * 360 / 16.0f; } } @@ -320,9 +320,12 @@ public class FeatureDungeonMap extends GuiFeature implements DungeonEndListener, GlStateManager.scale(1 / scale, 1 / scale, 0); GlStateManager.scale(1 / postScale, 1 / postScale, 0); + float s = this.<Float>getParameter("playerheadscale").getValue(); GlStateManager.scale(s, s, 0); - Gui.drawScaledCustomSizeModalRect(-4, -4, 8.0F, (float) l2, 8, i3, 8, 8, 64.0F, 64.0F); + + // cutting out the player head out of the skin texture + Gui.drawScaledCustomSizeModalRect(-4, -4, 8.0F, l2, 8, i3, 8, 8, 64.0F, 64.0F); GL11.glLineWidth(1); RenderUtils.drawUnfilledBox(-4, -4, 4, 4, this.<AColor>getParameter("player_color").getValue()); } |