From f0293a74282cece3aa8a2a328559889d6e187209 Mon Sep 17 00:00:00 2001 From: Moulberry Date: Sun, 26 Jul 2020 12:12:25 +1000 Subject: 1.11.7 --- .../notenoughupdates/shaders/program/blur.json | 21 +++++++++++++ .../notenoughupdates/shaders/program/blur2.fsh | 34 ++++++++++++++++++++++ .../shaders/program/setrgbtoalpha.fsh | 11 +++++++ .../shaders/program/setrgbtoalpha.json | 17 +++++++++++ .../notenoughupdates/shaders/program/sobel.vsh | 20 +++++++++++++ 5 files changed, 103 insertions(+) create mode 100644 src/main/resources/assets/notenoughupdates/shaders/program/blur.json create mode 100644 src/main/resources/assets/notenoughupdates/shaders/program/blur2.fsh create mode 100644 src/main/resources/assets/notenoughupdates/shaders/program/setrgbtoalpha.fsh create mode 100644 src/main/resources/assets/notenoughupdates/shaders/program/setrgbtoalpha.json create mode 100644 src/main/resources/assets/notenoughupdates/shaders/program/sobel.vsh (limited to 'src/main/resources/assets/notenoughupdates/shaders/program') diff --git a/src/main/resources/assets/notenoughupdates/shaders/program/blur.json b/src/main/resources/assets/notenoughupdates/shaders/program/blur.json new file mode 100644 index 00000000..9da3c2e8 --- /dev/null +++ b/src/main/resources/assets/notenoughupdates/shaders/program/blur.json @@ -0,0 +1,21 @@ +{ + "blend": { + "func": "add", + "srcrgb": "srcalpha", + "dstrgb": "1-srcalpha" + }, + "vertex": "sobel", + "fragment": "blur2", + "attributes": [ "Position" ], + "samplers": [ + { "name": "DiffuseSampler" } + ], + "uniforms": [ + { "name": "ProjMat", "type": "matrix4x4", "count": 16, "values": [ 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0 ] }, + { "name": "InSize", "type": "float", "count": 2, "values": [ 1.0, 1.0 ] }, + { "name": "OutSize", "type": "float", "count": 2, "values": [ 1.0, 1.0 ] }, + { "name": "BlurDir", "type": "float", "count": 2, "values": [ 1.0, 1.0 ] }, + { "name": "Radius", "type": "float", "count": 1, "values": [ 5.0 ] }, + { "name": "AlphaMult", "type": "float", "count": 1, "values": [ 1.0 ] } + ] +} diff --git a/src/main/resources/assets/notenoughupdates/shaders/program/blur2.fsh b/src/main/resources/assets/notenoughupdates/shaders/program/blur2.fsh new file mode 100644 index 00000000..ca64470a --- /dev/null +++ b/src/main/resources/assets/notenoughupdates/shaders/program/blur2.fsh @@ -0,0 +1,34 @@ +#version 120 + +uniform sampler2D DiffuseSampler; + +varying vec2 texCoord; +varying vec2 oneTexel; + +uniform vec2 InSize; + +uniform vec2 BlurDir; +uniform float Radius; +uniform float AlphaMult; + +void main() { + vec4 blurred = vec4(0.0); + float totalStrength = 0.0; + float totalAlpha = 0.0; + float totalSamples = 0.0; + for(float r = -Radius; r <= Radius; r += 1.0) { + vec4 sample = texture2D(DiffuseSampler, texCoord + oneTexel * r * BlurDir); + + // Accumulate average alpha + totalAlpha = totalAlpha + sample.a; + totalSamples = totalSamples + 1.0; + + // Accumulate smoothed blur + //float strength = (2.0 - abs(r / Radius))*sample.a; + float strength = sample.a; + totalStrength = totalStrength + strength; + blurred = blurred + sample; + } + float alpha = totalAlpha/totalSamples*AlphaMult; + gl_FragColor = vec4(blurred.rgb / totalStrength, alpha); +} diff --git a/src/main/resources/assets/notenoughupdates/shaders/program/setrgbtoalpha.fsh b/src/main/resources/assets/notenoughupdates/shaders/program/setrgbtoalpha.fsh new file mode 100644 index 00000000..324602fd --- /dev/null +++ b/src/main/resources/assets/notenoughupdates/shaders/program/setrgbtoalpha.fsh @@ -0,0 +1,11 @@ +#version 120 + +uniform sampler2D DiffuseSampler; + +varying vec2 texCoord; + +void main(){ + vec4 diffuseColor = texture2D(DiffuseSampler, texCoord); + + gl_FragColor = vec4(diffuseColor.a); +} diff --git a/src/main/resources/assets/notenoughupdates/shaders/program/setrgbtoalpha.json b/src/main/resources/assets/notenoughupdates/shaders/program/setrgbtoalpha.json new file mode 100644 index 00000000..653764fb --- /dev/null +++ b/src/main/resources/assets/notenoughupdates/shaders/program/setrgbtoalpha.json @@ -0,0 +1,17 @@ +{ + "blend": { + "func": "add", + "srcrgb": "srcalpha", + "dstrgb": "1-srcalpha" + }, + "vertex": "blit", + "fragment": "setrgbtoalpha", + "attributes": [ "Position" ], + "samplers": [ + { "name": "DiffuseSampler" } + ], + "uniforms": [ + { "name": "ProjMat", "type": "matrix4x4", "count": 16, "values": [ 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0 ] }, + { "name": "OutSize", "type": "float", "count": 2, "values": [ 1.0, 1.0 ] } + ] +} diff --git a/src/main/resources/assets/notenoughupdates/shaders/program/sobel.vsh b/src/main/resources/assets/notenoughupdates/shaders/program/sobel.vsh new file mode 100644 index 00000000..21b17369 --- /dev/null +++ b/src/main/resources/assets/notenoughupdates/shaders/program/sobel.vsh @@ -0,0 +1,20 @@ +#version 120 + +attribute vec4 Position; + +uniform mat4 ProjMat; +uniform vec2 InSize; +uniform vec2 OutSize; + +varying vec2 texCoord; +varying vec2 oneTexel; + +void main(){ + vec4 outPos = ProjMat * vec4(Position.xy, 0.0, 1.0); + gl_Position = vec4(outPos.xy, 0.2, 1.0); + + oneTexel = 1.0 / InSize; + + texCoord = Position.xy / OutSize; + texCoord.y = 1.0 - texCoord.y; +} -- cgit From 431d4a5eca207aa6f86a90e3c4e1912885f115eb Mon Sep 17 00:00:00 2001 From: Moulberry Date: Sat, 31 Oct 2020 21:49:14 +1100 Subject: 1.4.9 --- .../moulberry/notenoughupdates/DumymMod.java | 53 + .../moulberry/notenoughupdates/DungeonBlocks.java | 2 +- .../moulberry/notenoughupdates/DungeonMap.java | 1522 +- .../moulberry/notenoughupdates/GuiButtonItem.java | 93 + .../notenoughupdates/GuiDungeonMapEditor.java | 754 + .../notenoughupdates/NotEnoughUpdates.java | 39 +- .../notenoughupdates/auction/APIManager.java | 6 +- .../notenoughupdates/gamemodes/SBGamemodes.java | 4 +- .../notenoughupdates/options/Options.java | 100 +- .../profileviewer/PlayerStats.java | 9 +- .../profileviewer/ProfileViewer.java | 6 +- .../moulberry/notenoughupdates/util/Constants.java | 2 +- .../notenoughupdates/util/SpecialColour.java | 14 + .../moulberry/notenoughupdates/util/Utils.java | 85 + .../dungeon_map/borders/large/1.json | 3 + .../dungeon_map/borders/large/10.json | 3 + .../dungeon_map/borders/large/10.png | Bin 0 -> 7050 bytes .../dungeon_map/borders/large/11.json | 3 + .../dungeon_map/borders/large/11.png | Bin 0 -> 16913 bytes .../dungeon_map/borders/large/2.json | 3 + .../dungeon_map/borders/large/2.png | Bin 0 -> 1006 bytes .../dungeon_map/borders/large/3.json | 3 + .../dungeon_map/borders/large/3.png | Bin 0 -> 6971 bytes .../dungeon_map/borders/large/4.json | 3 + .../dungeon_map/borders/large/4.png | Bin 0 -> 10886 bytes .../dungeon_map/borders/large/5.json | 3 + .../dungeon_map/borders/large/5.png | Bin 0 -> 13433 bytes .../dungeon_map/borders/large/6.json | 3 + .../dungeon_map/borders/large/6.png | Bin 0 -> 10655 bytes .../dungeon_map/borders/large/7.json | 3 + .../dungeon_map/borders/large/7.png | Bin 0 -> 4217 bytes .../dungeon_map/borders/large/8.json | 3 + .../dungeon_map/borders/large/8.png | Bin 0 -> 6904 bytes .../borders/map_border_dragon_stone.png | Bin 0 -> 4952 bytes .../dungeon_map/borders/medium/1.json | 3 + .../dungeon_map/borders/medium/10.json | 3 + .../dungeon_map/borders/medium/10.png | Bin 0 -> 6703 bytes .../dungeon_map/borders/medium/11.json | 3 + .../dungeon_map/borders/medium/11.png | Bin 0 -> 15370 bytes .../dungeon_map/borders/medium/2.json | 3 + .../dungeon_map/borders/medium/2.png | Bin 0 -> 717 bytes .../dungeon_map/borders/medium/3.json | 3 + .../dungeon_map/borders/medium/3.png | Bin 0 -> 6522 bytes .../dungeon_map/borders/medium/4.json | 3 + .../dungeon_map/borders/medium/4.png | Bin 0 -> 7093 bytes .../dungeon_map/borders/medium/5.json | 3 + .../dungeon_map/borders/medium/5.png | Bin 0 -> 7618 bytes .../dungeon_map/borders/medium/6.json | 3 + .../dungeon_map/borders/medium/6.png | Bin 0 -> 7874 bytes .../dungeon_map/borders/medium/7.json | 3 + .../dungeon_map/borders/medium/7.png | Bin 0 -> 4400 bytes .../dungeon_map/borders/medium/8.json | 3 + .../dungeon_map/borders/medium/8.png | Bin 0 -> 6277 bytes .../dungeon_map/borders/small/1.json | 3 + .../dungeon_map/borders/small/10.json | 3 + .../dungeon_map/borders/small/10.png | Bin 0 -> 7045 bytes .../dungeon_map/borders/small/11.json | 3 + .../dungeon_map/borders/small/11.png | Bin 0 -> 12576 bytes .../dungeon_map/borders/small/2.json | 3 + .../dungeon_map/borders/small/2.png | Bin 0 -> 1949 bytes .../dungeon_map/borders/small/3.json | 3 + .../dungeon_map/borders/small/3.png | Bin 0 -> 6697 bytes .../dungeon_map/borders/small/4.json | 3 + .../dungeon_map/borders/small/4.png | Bin 0 -> 5947 bytes .../dungeon_map/borders/small/5.json | 3 + .../dungeon_map/borders/small/5.png | Bin 0 -> 8456 bytes .../dungeon_map/borders/small/6.json | 3 + .../dungeon_map/borders/small/6.png | Bin 0 -> 6474 bytes .../dungeon_map/borders/small/7.json | 3 + .../dungeon_map/borders/small/7.png | Bin 0 -> 4502 bytes .../dungeon_map/borders/small/8.json | 3 + .../dungeon_map/borders/small/8.png | Bin 0 -> 6789 bytes .../dungeon_map/borders/small/9.json | 3 + .../dungeon_map/borders/small/9.png | Bin 0 -> 5897 bytes .../dungeon_map/borders/steampunk.png | Bin 0 -> 10039 bytes .../dungeon_map/corners_default/brown_corner.png | Bin 0 -> 971 bytes .../corridors_default/brown_corridor.png | Bin 0 -> 1023 bytes .../corridors_default/gray_corridor.png | Bin 0 -> 1055 bytes .../corridors_default/green_corridor.png | Bin 0 -> 1107 bytes .../corridors_default/orange_corridor.png | Bin 0 -> 1083 bytes .../corridors_default/pink_corridor.png | Bin 0 -> 1032 bytes .../corridors_default/purple_corridor.png | Bin 0 -> 1044 bytes .../dungeon_map/corridors_default/red_corridor.png | Bin 0 -> 1055 bytes .../corridors_default/yellow_corridor.png | Bin 0 -> 1033 bytes .../dungeon_map/dividers_default/brown_divider.png | Bin 0 -> 964 bytes .../dungeon_map/editor/background.png | Bin 0 -> 2414 bytes .../dungeon_map/rooms_default/orange_room.png | Bin 0 -> 979 bytes .../assets/notenoughupdates/maps/F1Full.json | 16386 +++++++++++++++++++ .../shaders/program/dungeonmap.fsh | 32 + .../shaders/program/dungeonmap.json | 19 + .../shaders/program/dungeonmap.vsh | 16 + 91 files changed, 18795 insertions(+), 440 deletions(-) create mode 100644 src/main/java/io/github/moulberry/notenoughupdates/DumymMod.java create mode 100644 src/main/java/io/github/moulberry/notenoughupdates/GuiButtonItem.java create mode 100644 src/main/java/io/github/moulberry/notenoughupdates/GuiDungeonMapEditor.java create mode 100644 src/main/resources/assets/notenoughupdates/dungeon_map/borders/large/1.json create mode 100644 src/main/resources/assets/notenoughupdates/dungeon_map/borders/large/10.json create mode 100644 src/main/resources/assets/notenoughupdates/dungeon_map/borders/large/10.png create mode 100644 src/main/resources/assets/notenoughupdates/dungeon_map/borders/large/11.json create mode 100644 src/main/resources/assets/notenoughupdates/dungeon_map/borders/large/11.png create mode 100644 src/main/resources/assets/notenoughupdates/dungeon_map/borders/large/2.json create mode 100644 src/main/resources/assets/notenoughupdates/dungeon_map/borders/large/2.png create mode 100644 src/main/resources/assets/notenoughupdates/dungeon_map/borders/large/3.json create mode 100644 src/main/resources/assets/notenoughupdates/dungeon_map/borders/large/3.png create mode 100644 src/main/resources/assets/notenoughupdates/dungeon_map/borders/large/4.json create mode 100644 src/main/resources/assets/notenoughupdates/dungeon_map/borders/large/4.png create mode 100644 src/main/resources/assets/notenoughupdates/dungeon_map/borders/large/5.json create mode 100644 src/main/resources/assets/notenoughupdates/dungeon_map/borders/large/5.png create mode 100644 src/main/resources/assets/notenoughupdates/dungeon_map/borders/large/6.json create mode 100644 src/main/resources/assets/notenoughupdates/dungeon_map/borders/large/6.png create mode 100644 src/main/resources/assets/notenoughupdates/dungeon_map/borders/large/7.json create mode 100644 src/main/resources/assets/notenoughupdates/dungeon_map/borders/large/7.png create mode 100644 src/main/resources/assets/notenoughupdates/dungeon_map/borders/large/8.json create mode 100644 src/main/resources/assets/notenoughupdates/dungeon_map/borders/large/8.png create mode 100644 src/main/resources/assets/notenoughupdates/dungeon_map/borders/map_border_dragon_stone.png create mode 100644 src/main/resources/assets/notenoughupdates/dungeon_map/borders/medium/1.json create mode 100644 src/main/resources/assets/notenoughupdates/dungeon_map/borders/medium/10.json create mode 100644 src/main/resources/assets/notenoughupdates/dungeon_map/borders/medium/10.png create mode 100644 src/main/resources/assets/notenoughupdates/dungeon_map/borders/medium/11.json create mode 100644 src/main/resources/assets/notenoughupdates/dungeon_map/borders/medium/11.png create mode 100644 src/main/resources/assets/notenoughupdates/dungeon_map/borders/medium/2.json create mode 100644 src/main/resources/assets/notenoughupdates/dungeon_map/borders/medium/2.png create mode 100644 src/main/resources/assets/notenoughupdates/dungeon_map/borders/medium/3.json create mode 100644 src/main/resources/assets/notenoughupdates/dungeon_map/borders/medium/3.png create mode 100644 src/main/resources/assets/notenoughupdates/dungeon_map/borders/medium/4.json create mode 100644 src/main/resources/assets/notenoughupdates/dungeon_map/borders/medium/4.png create mode 100644 src/main/resources/assets/notenoughupdates/dungeon_map/borders/medium/5.json create mode 100644 src/main/resources/assets/notenoughupdates/dungeon_map/borders/medium/5.png create mode 100644 src/main/resources/assets/notenoughupdates/dungeon_map/borders/medium/6.json create mode 100644 src/main/resources/assets/notenoughupdates/dungeon_map/borders/medium/6.png create mode 100644 src/main/resources/assets/notenoughupdates/dungeon_map/borders/medium/7.json create mode 100644 src/main/resources/assets/notenoughupdates/dungeon_map/borders/medium/7.png create mode 100644 src/main/resources/assets/notenoughupdates/dungeon_map/borders/medium/8.json create mode 100644 src/main/resources/assets/notenoughupdates/dungeon_map/borders/medium/8.png create mode 100644 src/main/resources/assets/notenoughupdates/dungeon_map/borders/small/1.json create mode 100644 src/main/resources/assets/notenoughupdates/dungeon_map/borders/small/10.json create mode 100644 src/main/resources/assets/notenoughupdates/dungeon_map/borders/small/10.png create mode 100644 src/main/resources/assets/notenoughupdates/dungeon_map/borders/small/11.json create mode 100644 src/main/resources/assets/notenoughupdates/dungeon_map/borders/small/11.png create mode 100644 src/main/resources/assets/notenoughupdates/dungeon_map/borders/small/2.json create mode 100644 src/main/resources/assets/notenoughupdates/dungeon_map/borders/small/2.png create mode 100644 src/main/resources/assets/notenoughupdates/dungeon_map/borders/small/3.json create mode 100644 src/main/resources/assets/notenoughupdates/dungeon_map/borders/small/3.png create mode 100644 src/main/resources/assets/notenoughupdates/dungeon_map/borders/small/4.json create mode 100644 src/main/resources/assets/notenoughupdates/dungeon_map/borders/small/4.png create mode 100644 src/main/resources/assets/notenoughupdates/dungeon_map/borders/small/5.json create mode 100644 src/main/resources/assets/notenoughupdates/dungeon_map/borders/small/5.png create mode 100644 src/main/resources/assets/notenoughupdates/dungeon_map/borders/small/6.json create mode 100644 src/main/resources/assets/notenoughupdates/dungeon_map/borders/small/6.png create mode 100644 src/main/resources/assets/notenoughupdates/dungeon_map/borders/small/7.json create mode 100644 src/main/resources/assets/notenoughupdates/dungeon_map/borders/small/7.png create mode 100644 src/main/resources/assets/notenoughupdates/dungeon_map/borders/small/8.json create mode 100644 src/main/resources/assets/notenoughupdates/dungeon_map/borders/small/8.png create mode 100644 src/main/resources/assets/notenoughupdates/dungeon_map/borders/small/9.json create mode 100644 src/main/resources/assets/notenoughupdates/dungeon_map/borders/small/9.png create mode 100644 src/main/resources/assets/notenoughupdates/dungeon_map/borders/steampunk.png create mode 100644 src/main/resources/assets/notenoughupdates/dungeon_map/corners_default/brown_corner.png create mode 100644 src/main/resources/assets/notenoughupdates/dungeon_map/corridors_default/brown_corridor.png create mode 100644 src/main/resources/assets/notenoughupdates/dungeon_map/corridors_default/gray_corridor.png create mode 100644 src/main/resources/assets/notenoughupdates/dungeon_map/corridors_default/green_corridor.png create mode 100644 src/main/resources/assets/notenoughupdates/dungeon_map/corridors_default/orange_corridor.png create mode 100644 src/main/resources/assets/notenoughupdates/dungeon_map/corridors_default/pink_corridor.png create mode 100644 src/main/resources/assets/notenoughupdates/dungeon_map/corridors_default/purple_corridor.png create mode 100644 src/main/resources/assets/notenoughupdates/dungeon_map/corridors_default/red_corridor.png create mode 100644 src/main/resources/assets/notenoughupdates/dungeon_map/corridors_default/yellow_corridor.png create mode 100644 src/main/resources/assets/notenoughupdates/dungeon_map/dividers_default/brown_divider.png create mode 100644 src/main/resources/assets/notenoughupdates/dungeon_map/editor/background.png create mode 100644 src/main/resources/assets/notenoughupdates/dungeon_map/rooms_default/orange_room.png create mode 100644 src/main/resources/assets/notenoughupdates/maps/F1Full.json create mode 100644 src/main/resources/assets/notenoughupdates/shaders/program/dungeonmap.fsh create mode 100644 src/main/resources/assets/notenoughupdates/shaders/program/dungeonmap.json create mode 100644 src/main/resources/assets/notenoughupdates/shaders/program/dungeonmap.vsh (limited to 'src/main/resources/assets/notenoughupdates/shaders/program') diff --git a/src/main/java/io/github/moulberry/notenoughupdates/DumymMod.java b/src/main/java/io/github/moulberry/notenoughupdates/DumymMod.java new file mode 100644 index 00000000..07205519 --- /dev/null +++ b/src/main/java/io/github/moulberry/notenoughupdates/DumymMod.java @@ -0,0 +1,53 @@ +package io.github.moulberry.notenoughupdates; + +import java.util.Arrays; + +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.inventory.GuiChest; +import net.minecraft.init.Blocks; +import net.minecraft.item.ItemStack; +import net.minecraftforge.client.event.GuiScreenEvent; +import net.minecraftforge.common.MinecraftForge; +import net.minecraftforge.fml.common.Mod; +import net.minecraftforge.fml.common.Mod.EventHandler; +import net.minecraftforge.fml.common.ModMetadata; +import net.minecraftforge.fml.common.event.FMLPreInitializationEvent; +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; + +public class DumymMod { + + @SubscribeEvent + public void onInitGui(GuiScreenEvent.InitGuiEvent.Post event) { + int width = event.gui.width / 2; + int height = event.gui.height / 2 - 106; + + if (event.gui instanceof GuiChest) + { + event.buttonList.add(new GuiButtonItem(1001, width + 88, height + 47, new ItemStack(Blocks.crafting_table))); + event.buttonList.add(new GuiButtonItem(1000, width + 88, height + 66, new ItemStack(Blocks.ender_chest))); + } + } + + private long lastButtonClick = -1; + + @SubscribeEvent + public void onPostActionPerformedGui(GuiScreenEvent.ActionPerformedEvent.Post event) { + long now = System.currentTimeMillis(); + + if (event.gui instanceof GuiChest) + { + if (now - this.lastButtonClick > 100L) + { + if (event.button.id == 1000) + { + Minecraft.getMinecraft().thePlayer.sendChatMessage("/enderchest"); + } + else if (event.button.id == 1001) + { + Minecraft.getMinecraft().thePlayer.sendChatMessage("/craft"); + } + this.lastButtonClick = now; + } + } + } +} \ No newline at end of file diff --git a/src/main/java/io/github/moulberry/notenoughupdates/DungeonBlocks.java b/src/main/java/io/github/moulberry/notenoughupdates/DungeonBlocks.java index f0b92c6a..cdf7b59b 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/DungeonBlocks.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/DungeonBlocks.java @@ -39,7 +39,7 @@ public class DungeonBlocks implements IResourceManagerReloadListener { } public static boolean isInDungeons() { - return !NotEnoughUpdates.INSTANCE.manager.config.disableDungeonBlocks.value && + return false && !NotEnoughUpdates.INSTANCE.manager.config.disableDungeonBlocks.value && (NotEnoughUpdates.INSTANCE.manager.config.dungeonBlocksEverywhere.value || (SBInfo.getInstance().getLocation() != null && SBInfo.getInstance().getLocation().equals("dungeon"))); } diff --git a/src/main/java/io/github/moulberry/notenoughupdates/DungeonMap.java b/src/main/java/io/github/moulberry/notenoughupdates/DungeonMap.java index c9be3dab..daff1a24 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/DungeonMap.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/DungeonMap.java @@ -1,32 +1,50 @@ package io.github.moulberry.notenoughupdates; +import com.google.common.math.BigIntegerMath; +import com.google.gson.JsonObject; +import io.github.moulberry.notenoughupdates.questing.SBInfo; +import io.github.moulberry.notenoughupdates.util.SpecialColour; import io.github.moulberry.notenoughupdates.util.Utils; import net.minecraft.block.material.MapColor; import net.minecraft.block.state.IBlockState; import net.minecraft.client.Minecraft; +import net.minecraft.client.entity.AbstractClientPlayer; import net.minecraft.client.gui.Gui; import net.minecraft.client.gui.MapItemRenderer; -import net.minecraft.client.renderer.GlStateManager; -import net.minecraft.client.renderer.Tessellator; -import net.minecraft.client.renderer.WorldRenderer; +import net.minecraft.client.gui.ScaledResolution; +import net.minecraft.client.renderer.*; +import net.minecraft.client.renderer.entity.RenderItem; import net.minecraft.client.renderer.texture.DynamicTexture; +import net.minecraft.client.renderer.texture.TextureUtil; import net.minecraft.client.renderer.vertex.DefaultVertexFormats; +import net.minecraft.client.resources.DefaultPlayerSkin; +import net.minecraft.client.shader.Framebuffer; +import net.minecraft.client.shader.Shader; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Blocks; +import net.minecraft.init.Items; import net.minecraft.item.ItemMap; import net.minecraft.item.ItemStack; import net.minecraft.scoreboard.ScorePlayerTeam; -import net.minecraft.util.BlockPos; -import net.minecraft.util.ResourceLocation; -import net.minecraft.util.Vec4b; +import net.minecraft.util.*; import net.minecraft.world.storage.MapData; import net.minecraftforge.client.event.RenderGameOverlayEvent; +import net.minecraftforge.fml.common.eventhandler.EventPriority; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; +import org.lwjgl.BufferUtils; import org.lwjgl.input.Keyboard; import org.lwjgl.opengl.GL11; +import org.lwjgl.opengl.GL14; +import org.lwjgl.opengl.GL30; +import org.lwjgl.opengl.GL45; import java.awt.*; import java.awt.image.BufferedImage; +import java.io.BufferedReader; +import java.io.InputStreamReader; +import java.nio.ByteBuffer; +import java.nio.IntBuffer; +import java.nio.charset.StandardCharsets; import java.util.*; import java.util.List; @@ -43,9 +61,22 @@ public class DungeonMap { private static final ResourceLocation ROOM_PINK = new ResourceLocation("notenoughupdates:dungeon_map/rooms_default/pink_room.png"); private static final ResourceLocation ROOM_PURPLE = new ResourceLocation("notenoughupdates:dungeon_map/rooms_default/purple_room.png"); private static final ResourceLocation ROOM_YELLOW = new ResourceLocation("notenoughupdates:dungeon_map/rooms_default/yellow_room.png"); + private static final ResourceLocation ROOM_ORANGE = new ResourceLocation("notenoughupdates:dungeon_map/rooms_default/orange_room.png"); - private static final int RENDER_ROOM_SIZE = 16; - private static final int RENDER_CONN_SIZE = 4; + private static final ResourceLocation CORRIDOR_RED = new ResourceLocation("notenoughupdates:dungeon_map/corridors_default/red_corridor.png"); + private static final ResourceLocation CORRIDOR_BROWN = new ResourceLocation("notenoughupdates:dungeon_map/corridors_default/brown_corridor.png"); + private static final ResourceLocation CORRIDOR_GRAY = new ResourceLocation("notenoughupdates:dungeon_map/corridors_default/gray_corridor.png"); + private static final ResourceLocation CORRIDOR_GREEN = new ResourceLocation("notenoughupdates:dungeon_map/corridors_default/green_corridor.png"); + private static final ResourceLocation CORRIDOR_PINK = new ResourceLocation("notenoughupdates:dungeon_map/corridors_default/pink_corridor.png"); + private static final ResourceLocation CORRIDOR_PURPLE = new ResourceLocation("notenoughupdates:dungeon_map/corridors_default/purple_corridor.png"); + private static final ResourceLocation CORRIDOR_YELLOW = new ResourceLocation("notenoughupdates:dungeon_map/corridors_default/yellow_corridor.png"); + private static final ResourceLocation CORRIDOR_ORANGE = new ResourceLocation("notenoughupdates:dungeon_map/corridors_default/orange_corridor.png"); + + private static final ResourceLocation DIVIDER_BROWN = new ResourceLocation("notenoughupdates:dungeon_map/dividers_default/brown_divider.png"); + + private static final ResourceLocation CORNER_BROWN = new ResourceLocation("notenoughupdates:dungeon_map/corners_default/brown_corner.png"); + + private static final ResourceLocation BORDER_STEAMPUNK = new ResourceLocation("notenoughupdates:dungeon_map/borders/steampunk.png"); private final HashMap roomMap = new HashMap<>(); private Color[][] colourMap = new Color[128][128]; @@ -53,15 +84,17 @@ public class DungeonMap { private int startRoomY = -1; private int connectorSize = 5; private int roomSize = 0; - - private int roomSizeBlocks = 7; - private final List decorations = new ArrayList<>(); - private final List lastDecorations = new ArrayList<>(); + //private final List decorations = new ArrayList<>(); + //private final List lastDecorations = new ArrayList<>(); private long lastDecorationsMillis = -1; private long lastLastDecorationsMillis = -1; - private Map playerMapPositions = new HashMap<>(); + private Map playerEntityMapPositions = new HashMap<>(); + private Map playerMarkerMapPositions = new HashMap<>(); + private Map playerMarkerMapPositionsLast = new HashMap<>(); + + private Map playerSkinMap = new HashMap<>(); private class RoomOffset { int x; @@ -144,6 +177,50 @@ public class DungeonMap { RoomConnection right = new RoomConnection(RoomConnectionType.NONE, new Color(0, true)); RoomConnection down = new RoomConnection(RoomConnectionType.NONE, new Color(0, true)); + public void renderNoRotate(int roomSize, int connectorSize, int rotation) { + if(tickColour != 0) { + Color tick = new Color(tickColour, true); + ResourceLocation indicatorTex = null; + if(tick.getRed() == 255 && tick.getGreen() == 255 && tick.getBlue() == 255) { + indicatorTex = WHITE_CHECK; + } else if(tick.getRed() == 0 && tick.getGreen() == 124 && tick.getBlue() == 0) { + indicatorTex = GREEN_CHECK; + } else if(tick.getRed() == 13 && tick.getGreen() == 13 && tick.getBlue() == 13) { + indicatorTex = QUESTION; + } + if(indicatorTex != null) { + Minecraft.getMinecraft().getTextureManager().bindTexture(indicatorTex); + float x = 0; + float y = 0; + + if(NotEnoughUpdates.INSTANCE.manager.config.dmCenterCheck.value) { + if(fillCorner) { + x += -(roomSize+connectorSize)/2f*Math.cos(Math.toRadians(rotation-45))*1.414f; + y += (roomSize+connectorSize)/2f*Math.sin(Math.toRadians(rotation-45))*1.414; + } + if(down.type == RoomConnectionType.ROOM_DIVIDER && right.type != RoomConnectionType.ROOM_DIVIDER) { + x += -(roomSize+connectorSize)/2f*Math.sin(Math.toRadians(rotation)); + y += -(roomSize+connectorSize)/2f*Math.cos(Math.toRadians(rotation)); + } else if(down.type != RoomConnectionType.ROOM_DIVIDER && right.type == RoomConnectionType.ROOM_DIVIDER) { + x += -(roomSize+connectorSize)/2f*Math.cos(Math.toRadians(rotation)); + y += (roomSize+connectorSize)/2f*Math.sin(Math.toRadians(rotation)); + } + } + GlStateManager.translate(x, y, 0); + if(!NotEnoughUpdates.INSTANCE.manager.config.dmOrientCheck.value) { + GlStateManager.rotate(-rotation+180, 0, 0, 1); + } + + Utils.drawTexturedRect(-5, -5, 10, 10, GL11.GL_NEAREST); + + if(!NotEnoughUpdates.INSTANCE.manager.config.dmOrientCheck.value) { + GlStateManager.rotate(rotation-180, 0, 0, 1); + } + GlStateManager.translate(-x, -y, 0); + } + } + } + public void render(int roomSize, int connectorSize) { ResourceLocation roomTex = null; if(colour.getRed() == 114 && colour.getGreen() == 67 && colour.getBlue() == 27) { @@ -160,82 +237,170 @@ public class DungeonMap { roomTex = ROOM_RED; } else if(colour.getRed() == 229 && colour.getGreen() == 229 && colour.getBlue() == 51) { roomTex = ROOM_YELLOW; + } else if(colour.getRed() == 216 && colour.getGreen() == 127 && colour.getBlue() == 51) { + roomTex = ROOM_ORANGE; } if(roomTex != null) { Minecraft.getMinecraft().getTextureManager().bindTexture(roomTex); GlStateManager.color(1, 1, 1, 1); Utils.drawTexturedRect(0, 0, roomSize, roomSize, GL11.GL_LINEAR); - } - - //Gui.drawRect(0, 0, roomSize, roomSize, colour.getRGB()); - if(tickColour != 0) { - Gui.drawRect(roomSize/2-4, roomSize/2-4, roomSize/2+4, roomSize/2+4, tickColour); + } else { + Gui.drawRect(0, 0, roomSize, roomSize, colour.getRGB()); } if(fillCorner) { - Gui.drawRect(-connectorSize, -connectorSize, 0, 0, colour.getRGB()); + GlStateManager.color(1, 1, 1, 1); + Minecraft.getMinecraft().getTextureManager().bindTexture(CORNER_BROWN); + Utils.drawTexturedRect(roomSize, roomSize, connectorSize, connectorSize, GL11.GL_NEAREST); } - for(int k=0; k<4; k++) { - RoomConnection connection = up; + for(int k=0; k<2; k++) { + RoomConnection connection = down; if(k == 1) connection = right; - if(k == 2) connection = down; - if(k == 3) connection = left; if(connection.type == RoomConnectionType.NONE || connection.type == RoomConnectionType.WALL) continue; + + ResourceLocation corridorTex = null; + if(connection.colour.getRed() == 114 && connection.colour.getGreen() == 67 && connection.colour.getBlue() == 27) { + corridorTex = connection.type == RoomConnectionType.CORRIDOR ? CORRIDOR_BROWN : DIVIDER_BROWN; + } else if(connection.colour.getRed() == 65 && connection.colour.getGreen() == 65 && connection.colour.getBlue() == 65) { + corridorTex = CORRIDOR_GRAY; + } else if(connection.colour.getRed() == 0 && connection.colour.getGreen() == 124 && connection.colour.getBlue() == 0) { + corridorTex = CORRIDOR_GREEN; + } else if(connection.colour.getRed() == 242 && connection.colour.getGreen() == 127 && connection.colour.getBlue() == 165) { + corridorTex = CORRIDOR_PINK; + } else if(connection.colour.getRed() == 178 && connection.colour.getGreen() == 76 && connection.colour.getBlue() == 216) { + corridorTex = CORRIDOR_PURPLE; + } else if(connection.colour.getRed() == 255 && connection.colour.getGreen() == 0 && connection.colour.getBlue() == 0) { + corridorTex = CORRIDOR_RED; + } else if(connection.colour.getRed() == 229 && connection.colour.getGreen() == 229 && connection.colour.getBlue() == 51) { + corridorTex = CORRIDOR_YELLOW; + } else if(connection.colour.getRed() == 216 && connection.colour.getGreen() == 127 && connection.colour.getBlue() == 51) { + corridorTex = CORRIDOR_ORANGE; + } - int xOffset = 0; - int yOffset = 0; - int width = 0; - int height = 0; + if(corridorTex == null) { + int xOffset = 0; + int yOffset = 0; + int width = 0; + int height = 0; - if(connection == up) { - yOffset = -connectorSize; - width = roomSize; - height = connectorSize; + if(connection == right) { + xOffset = roomSize; + width = connectorSize; + height = roomSize; - if(connection.type == RoomConnectionType.CORRIDOR) { - width = 8; - xOffset += 4; - } - } else if(connection == right) { - xOffset = roomSize; - width = connectorSize; - height = roomSize; - - if(connection.type == RoomConnectionType.CORRIDOR) { - height = 8; - yOffset += 4; - } - } else if(connection == down) { - yOffset = roomSize; - width = roomSize; - height = connectorSize; - - if(connection.type == RoomConnectionType.CORRIDOR) { - width = 8; - xOffset += 4; + if(connection.type == RoomConnectionType.CORRIDOR) { + height = 8; + yOffset += 4; + } + } else if(connection == down) { + yOffset = roomSize; + width = roomSize; + height = connectorSize; + + if(connection.type == RoomConnectionType.CORRIDOR) { + width = 8; + xOffset += 4; + } } - } else if(connection == left) { - xOffset = -connectorSize; - width = connectorSize; - height = roomSize; - - if(connection.type == RoomConnectionType.CORRIDOR) { - height = 8; - yOffset += 4; + + Gui.drawRect(xOffset, yOffset, xOffset+width, yOffset+height, connection.colour.getRGB()); + } else { + GlStateManager.color(1, 1, 1, 1); + Minecraft.getMinecraft().getTextureManager().bindTexture(corridorTex); + GlStateManager.pushMatrix(); + if(connection==right) { + GlStateManager.translate(roomSize/2f, roomSize/2f, 0); + GlStateManager.rotate(-90, 0, 0, 1); + GlStateManager.translate(-roomSize/2f, -roomSize/2f, 0); } + Utils.drawTexturedRect(0, roomSize, roomSize, connectorSize, GL11.GL_NEAREST); + GlStateManager.popMatrix(); } - - Gui.drawRect(xOffset, yOffset, xOffset+width, yOffset+height, connection.colour.getRGB()); } } } private static final ResourceLocation mapIcons = new ResourceLocation("textures/map/map_icons.png"); - public void render() { + public static Framebuffer mapFramebuffer1 = null; + public static Framebuffer mapFramebuffer2 = null; + public static Matrix4f projectionMatrix = null; + public static Shader mapShader = null; + + private static Framebuffer checkFramebufferSizes(Framebuffer framebuffer, int width, int height) { + if(framebuffer == null || framebuffer.framebufferWidth != width || framebuffer.framebufferHeight != height) { + if(framebuffer == null) { + framebuffer = new Framebuffer(width, height, true); + } else { + framebuffer.createBindFramebuffer(width, height); + } + framebuffer.setFramebufferFilter(GL11.GL_NEAREST); + } + return framebuffer; + } + + private static void upload(Shader shader, int width, int height, int scale, float radiusSq) { + if(shader == null) return; + shader.getShaderManager().getShaderUniformOrDefault("ProjMat").set(projectionMatrix); + shader.getShaderManager().getShaderUniformOrDefault("InSize").set(width*scale, height*scale); + shader.getShaderManager().getShaderUniformOrDefault("OutSize").set(width, height); + shader.getShaderManager().getShaderUniformOrDefault("ScreenSize").set((float)width, (float)height); + shader.getShaderManager().getShaderUniformOrDefault("radiusSq").set(radiusSq); + } + + public int getRenderRoomSize() { + int roomSizeOption = NotEnoughUpdates.INSTANCE.manager.config.dmRoomSize.value.intValue(); + return roomSizeOption == 0 ? 12 : roomSizeOption == 2 ? 20 : 16; + } + + public int getRenderConnSize() { + int roomSizeOption = NotEnoughUpdates.INSTANCE.manager.config.dmRoomSize.value.intValue(); + return roomSizeOption == 0 ? 3 : roomSizeOption == 2 ? 5 : 4; + } + + private HashMap borderRadiusCache = new HashMap<>(); + public float getBorderRadius() { + int borderSizeOption = NotEnoughUpdates.INSTANCE.manager.config.dmBorderSize.value.intValue(); + String sizeId = borderSizeOption == 0 ? "small" : borderSizeOption == 2 ? "large" : "medium"; + + int style = NotEnoughUpdates.INSTANCE.manager.config.dmBorderStyle.value.intValue(); + if(borderRadiusCache.containsKey(style)) { + return borderRadiusCache.get(style); + } + + try { + BufferedReader reader = new BufferedReader(new InputStreamReader(Minecraft.getMinecraft().getResourceManager().getResource( + new ResourceLocation("notenoughupdates:dungeon_map/borders/"+sizeId+"/"+style+".json")).getInputStream(), StandardCharsets.UTF_8)); + JsonObject json = NotEnoughUpdates.INSTANCE.manager.gson.fromJson(reader, JsonObject.class); + float radiusSq = json.get("radiusSq").getAsFloat(); + + borderRadiusCache.put(style, radiusSq); + return radiusSq; + } catch(Exception ignored) { } + + borderRadiusCache.put(style, 1f); + return 1f; + } + + public void render(int centerX, int centerY) { + ScaledResolution scaledResolution = Utils.pushGuiScale(2); + + boolean useFb = NotEnoughUpdates.INSTANCE.manager.config.dmCompat.value <= 1; + boolean useShd = NotEnoughUpdates.INSTANCE.manager.config.dmCompat.value <= 0; + + if((useFb && !OpenGlHelper.isFramebufferEnabled()) || (useShd && !OpenGlHelper.areShadersSupported())) { + Utils.drawStringCentered(EnumChatFormatting.RED+"NEU Dungeon Map requires framebuffers & shaders", + Minecraft.getMinecraft().fontRendererObj, centerX, centerY-10, true, 0); + Utils.drawStringCentered(EnumChatFormatting.RED+"Turn off Optifine Fast Render", + Minecraft.getMinecraft().fontRendererObj, centerX, centerY, true, 0); + Utils.drawStringCentered(EnumChatFormatting.RED+"If that doesn't work, join NEU discord for support", + Minecraft.getMinecraft().fontRendererObj, centerX, centerY+10, true, 0); + return; + } + int minRoomX = 999; int minRoomY = 999; int maxRoomX = -999; @@ -247,131 +412,385 @@ public class DungeonMap { maxRoomY = Math.max(offset.y, maxRoomY); } - /*Set uniques = new HashSet<>(); - for(Color[] cs : colourMap) { - for(Color c : cs) { - uniques.add(c); + int borderSizeOption = NotEnoughUpdates.INSTANCE.manager.config.dmBorderSize.value.intValue(); + + int renderRoomSize = getRenderRoomSize(); + int renderConnSize = getRenderConnSize(); + + MapPosition playerPos = null; + if(playerEntityMapPositions.containsKey(Minecraft.getMinecraft().thePlayer.getName())) { + playerPos = playerEntityMapPositions.get(Minecraft.getMinecraft().thePlayer.getName()); + } else if(playerMarkerMapPositions.containsKey(Minecraft.getMinecraft().thePlayer.getName())) { + playerPos = playerMarkerMapPositions.get(Minecraft.getMinecraft().thePlayer.getName()); + } + + int rotation = 180; + if(playerPos != null && NotEnoughUpdates.INSTANCE.manager.config.dmRotatePlayer.value) { + rotation = (int)playerPos.rotation; + } + + int mapSizeX = borderSizeOption == 0 ? 90 : borderSizeOption == 2 ? 160 : 120; + int mapSizeY = borderSizeOption == 0 ? 90 : borderSizeOption == 2 ? 160 : 120; + int roomsSizeX = (maxRoomX-minRoomX)*(renderRoomSize+renderConnSize)+renderRoomSize; + int roomsSizeY = (maxRoomY-minRoomY)*(renderRoomSize+renderConnSize)+renderRoomSize; + int mapCenterX = mapSizeX/2; + int mapCenterY = mapSizeY/2; + int scaleFactor = 8; + + projectionMatrix = Utils.createProjectionMatrix(mapSizeX*scaleFactor, mapSizeY*scaleFactor); + mapFramebuffer1 = checkFramebufferSizes(mapFramebuffer1, mapSizeX*scaleFactor, mapSizeY*scaleFactor); + mapFramebuffer2 = checkFramebufferSizes(mapFramebuffer2, mapSizeX*scaleFactor, mapSizeY*scaleFactor); + mapFramebuffer1.framebufferColor[1] = 0; + mapFramebuffer1.framebufferColor[2] = 0; + + try { + if(mapShader == null) { + mapShader = new Shader(new NEUResourceManager(Minecraft.getMinecraft().getResourceManager()), + "dungeonmap", mapFramebuffer1, mapFramebuffer2); } + } catch(Exception e) { + e.printStackTrace(); + return; } - System.out.println("Unique colours:"); - for(Color c : uniques) { - System.out.println(c + "" + c.getAlpha()); - }*/ - int centerX = 80; - int centerY = 80; - int rotation = (int)Minecraft.getMinecraft().thePlayer.rotationYawHead; + int backgroundColour = SpecialColour.specialToChromaRGB(NotEnoughUpdates.INSTANCE.manager.config.dmBackgroundColour.value); - GlStateManager.pushMatrix(); - GlStateManager.translate(centerX, centerY, 0); - GlStateManager.rotate(-rotation+180, 0, 0, 1); - GlStateManager.translate(-(maxRoomX-minRoomX+1)*(RENDER_ROOM_SIZE+RENDER_CONN_SIZE)/2f, - -(maxRoomY-minRoomY+1)*(RENDER_ROOM_SIZE+RENDER_CONN_SIZE)/2f, 0); + mapFramebuffer1.framebufferColor[0] = ((backgroundColour >> 16) & 0xFF)/255f; + mapFramebuffer1.framebufferColor[1] = ((backgroundColour >> 8) & 0xFF)/255f; + mapFramebuffer1.framebufferColor[2] = (backgroundColour & 0xFF)/255f; + mapFramebuffer2.framebufferColor[0] = ((backgroundColour >> 16) & 0xFF)/255f; + mapFramebuffer2.framebufferColor[1] = ((backgroundColour >> 8) & 0xFF)/255f; + mapFramebuffer2.framebufferColor[2] = (backgroundColour & 0xFF)/255f; - Gui.drawRect(-10, -10, (maxRoomX-minRoomX)*(RENDER_ROOM_SIZE+RENDER_CONN_SIZE)+RENDER_ROOM_SIZE+10, - (maxRoomY-minRoomY)*(RENDER_ROOM_SIZE+RENDER_CONN_SIZE)+RENDER_ROOM_SIZE+10, - new Color(200, 200, 200).getRGB()); + try { + if(useFb) { + mapFramebuffer1.framebufferClear(); + mapFramebuffer2.framebufferClear(); + } - for(Map.Entry entry : roomMap.entrySet()) { - RoomOffset roomOffset = entry.getKey(); - Room room = entry.getValue(); - - int x = (roomOffset.x-minRoomX)*(RENDER_ROOM_SIZE+RENDER_CONN_SIZE); - int y = (roomOffset.y-minRoomY)*(RENDER_ROOM_SIZE+RENDER_CONN_SIZE); - - GlStateManager.pushMatrix(); - GlStateManager.translate(x, y, 0); - room.render(RENDER_ROOM_SIZE, RENDER_CONN_SIZE); - GlStateManager.translate(-x, -y, 0); - GlStateManager.popMatrix(); - } - - Tessellator tessellator = Tessellator.getInstance(); - WorldRenderer worldrenderer = tessellator.getWorldRenderer(); - GlStateManager.color(1, 1, 1, 1); - Minecraft.getMinecraft().getTextureManager().bindTexture(mapIcons); - int k = 0; - for(int i=0; i 180 && angleLast < 180) angleLast += 360; - if(angleLast > 180 && angle < 180) angle += 360; - - float interpFactor = Math.round((System.currentTimeMillis() - lastDecorationsMillis)*100f)/100f/(lastDecorationsMillis - lastLastDecorationsMillis); - interpFactor = Math.max(0, Math.min(1, interpFactor)); - - x = xLast+(x - xLast)*interpFactor; - y = yLast+(y - yLast)*interpFactor; - angle = angleLast+(angle - angleLast)*interpFactor; - angle %= 360; - } + GlStateManager.pushMatrix(); { + if(useFb) { + GlStateManager.matrixMode(5889); + GlStateManager.loadIdentity(); + GlStateManager.ortho(0.0D, mapSizeX*scaleFactor, mapSizeY*scaleFactor, 0.0D, 1000.0D, 3000.0D); + GlStateManager.matrixMode(5888); + GlStateManager.loadIdentity(); + GlStateManager.translate(0.0F, 0.0F, -2000.0F); + + GlStateManager.scale(scaleFactor, scaleFactor, 1); + mapFramebuffer1.bindFramebuffer(true); + + GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); + GlStateManager.disableBlend(); + } else { + GL11.glEnable(GL11.GL_SCISSOR_TEST); + GL11.glScissor((centerX-mapSizeX/2)*2, Minecraft.getMinecraft().displayHeight-(centerY+mapSizeY/2)*2, mapSizeX*2, mapSizeY*2); + + GlStateManager.translate(centerX-mapSizeX/2, centerY-mapSizeY/2, 100); } - } - if(decoration.id == 3 || decoration.id == 1) { - float closestDistSq = RENDER_ROOM_SIZE*RENDER_ROOM_SIZE; - EntityPlayer closestPlayer = null; - for(Map.Entry entry : playerMapPositions.entrySet()) { - if(Minecraft.getMinecraft().thePlayer.getName().equalsIgnoreCase(entry.getKey().getName()) != (decoration.id == 1)) { - continue; + if(NotEnoughUpdates.INSTANCE.manager.config.dmBackgroundBlur.value > 0.1) { + GlStateManager.translate(-centerX+mapSizeX/2, -centerY+mapSizeY/2, 0); + renderBlurredBackground(scaledResolution.getScaledWidth(), scaledResolution.getScaledHeight(), + centerX-mapSizeX/2, centerY-mapSizeY/2, mapSizeX, mapSizeY); + GlStateManager.translate(centerX-mapSizeX/2, centerY-mapSizeY/2, 0); + } + + GlStateManager.translate(mapCenterX, mapCenterY, 10); + + if(!useFb || NotEnoughUpdates.INSTANCE.manager.config.dmBackgroundBlur.value > 0.1) { + GlStateManager.enableBlend(); + GL14.glBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ONE_MINUS_SRC_ALPHA); + } + Utils.drawRectNoBlend(-mapCenterX, -mapCenterY, mapCenterX, mapCenterY, backgroundColour); + + GlStateManager.rotate(-rotation+180, 0, 0, 1); + + if(NotEnoughUpdates.INSTANCE.manager.config.dmCenterPlayer.value && playerPos != null) { + float x = playerPos.getRenderX(); + float y = playerPos.getRenderY(); + x -= minRoomX*(renderRoomSize+renderConnSize); + y -= minRoomY*(renderRoomSize+renderConnSize); + + GlStateManager.translate(-x, -y, 0); + } else { + GlStateManager.translate(-roomsSizeX/2, -roomsSizeY/2, 0); + } + + for(Map.Entry entry : roomMap.entrySet()) { + RoomOffset roomOffset = entry.getKey(); + Room room = entry.getValue(); + + int x = (roomOffset.x-minRoomX)*(renderRoomSize+renderConnSize); + int y = (roomOffset.y-minRoomY)*(renderRoomSize+renderConnSize); + + GlStateManager.pushMatrix(); + GlStateManager.translate(x, y, 0); + + room.render(renderRoomSize, renderConnSize); + + GlStateManager.translate(-x, -y, 0); + GlStateManager.popMatrix(); + } + + GlStateManager.translate(-mapCenterX+roomsSizeX/2f, -mapCenterY+roomsSizeY/2f, 0); + + GlStateManager.translate(mapCenterX, mapCenterY, 0); + GlStateManager.rotate(rotation-180, 0, 0, 1); + GlStateManager.translate(-mapCenterX, -mapCenterY, 0); + + GlStateManager.translate(mapCenterX, mapCenterY, 0); + + for(Map.Entry entry : roomMap.entrySet()) { + RoomOffset roomOffset = entry.getKey(); + Room room = entry.getValue(); + + float x = (roomOffset.x-minRoomX)*(renderRoomSize+renderConnSize)-roomsSizeX/2f+renderRoomSize/2f; + float y = (roomOffset.y-minRoomY)*(renderRoomSize+renderConnSize)-roomsSizeY/2f+renderRoomSize/2f; + float x2 = (float)(-x*Math.cos(Math.toRadians(-rotation)) + y*Math.sin(Math.toRadians(-rotation))); + float y2 = (float)(-x*Math.sin(Math.toRadians(-rotation)) - y*Math.cos(Math.toRadians(-rotation))); + + GlStateManager.pushMatrix(); + GlStateManager.translate(x2, y2, 0); + + GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); + room.renderNoRotate(renderRoomSize, renderConnSize, rotation); + + GlStateManager.translate(-x2, -y2, 0); + GlStateManager.popMatrix(); + } + + + GlStateManager.translate(-mapCenterX, -mapCenterY, 0); + + GlStateManager.translate(mapCenterX, mapCenterY, 0); + GlStateManager.rotate(-rotation+180, 0, 0, 1); + GlStateManager.translate(-mapCenterX, -mapCenterY, 0); + + GlStateManager.translate(mapCenterX-roomsSizeX/2f, mapCenterY-roomsSizeY/2f, 0); + + Tessellator tessellator = Tessellator.getInstance(); + WorldRenderer worldrenderer = tessellator.getWorldRenderer(); + int k = 0; + + for(Map.Entry entry : playerMarkerMapPositions.entrySet()) { + String name = entry.getKey(); + MapPosition pos = entry.getValue(); + float x = pos.getRenderX(); + float y = pos.getRenderY(); + float angle = pos.rotation; + + boolean doInterp = NotEnoughUpdates.INSTANCE.manager.config.dmPlayerInterp.value; + if(playerEntityMapPositions.containsKey(name)) { + MapPosition entityPos = playerEntityMapPositions.get(name); + angle = entityPos.rotation; + + float deltaX = entityPos.getRenderX() - pos.getRenderX(); + float deltaY = entityPos.getRenderY() - pos.getRenderY(); + + /*if(deltaX > (renderRoomSize + renderConnSize)/2) { + deltaX -= (renderRoomSize + renderConnSize); + } else if(deltaX < -(renderRoomSize + renderConnSize)/2) { + deltaX += (renderRoomSize + renderConnSize); + } + if(deltaY > (renderRoomSize + renderConnSize)/2) { + deltaY -= (renderRoomSize + renderConnSize); + } else if(deltaY < -(renderRoomSize + renderConnSize)/2) { + deltaY += (renderRoomSize + renderConnSize); + }*/ + + x += deltaX; + y += deltaY; + + doInterp = false; } - float playerX = entry.getValue().getRenderX(); - float playerY = entry.getValue().getRenderY(); + float minU = 3/4f; + float minV = 0; + + if(name.equals(Minecraft.getMinecraft().thePlayer.getName())) { + minU = 1/4f; + } - float distSq = (playerX-x)*(playerX-x) + (playerY-y)*(playerY-y); + float maxU = minU + 1/4f; + float maxV = minV + 1/4f; - if(distSq < closestDistSq) { - closestDistSq = distSq; - closestPlayer = entry.getKey(); + if(doInterp && playerMarkerMapPositionsLast.containsKey(name)) { + MapPosition last = playerMarkerMapPositionsLast.get(name); + float xLast = last.getRenderX(); + float yLast = last.getRenderY(); + + float distSq = (x-xLast) * (x-xLast) + (y-yLast) * (y-yLast); + if (distSq < renderRoomSize*renderRoomSize/4f) { + float angleLast = last.rotation; + if (angle > 180 && angleLast < 180) angleLast += 360; + if (angleLast > 180 && angle < 180) angle += 360; + + float interpFactor = Math.round((System.currentTimeMillis() - lastDecorationsMillis) * 100f) / 100f / (lastDecorationsMillis - lastLastDecorationsMillis); + interpFactor = Math.max(0, Math.min(1, interpFactor)); + + x = xLast + (x - xLast) * interpFactor; + y = yLast + (y - yLast) * interpFactor; + angle = angleLast + (angle - angleLast) * interpFactor; + angle %= 360; + } } + + int pixelWidth = 8; + int pixelHeight = 8; + GlStateManager.color(1, 1, 1, 1); + if(NotEnoughUpdates.INSTANCE.manager.config.dmPlayerHeads.value >= 1 && + playerSkinMap.containsKey(entry.getKey())) { + Minecraft.getMinecraft().getTextureManager().bindTexture(playerSkinMap.get(entry.getKey())); + + if(NotEnoughUpdates.INSTANCE.manager.config.dmPlayerHeads.value >= 3) { + minU = 9/64f; + minV = 9/64f; + maxU = 15/64f; + maxV = 15/64f; + } else { + minU = 8/64f; + minV = 8/64f; + maxU = 16/64f; + maxV = 16/64f; + } + + if(NotEnoughUpdates.INSTANCE.manager.config.dmPlayerHeads.value >= 2) { + pixelWidth = 6; + pixelHeight = 6; + } + } else { + Minecraft.getMinecraft().getTextureManager().bindTexture(mapIcons); + } + + x -= minRoomX*(renderRoomSize+renderConnSize); + y -= minRoomY*(renderRoomSize+renderConnSize); + + GlStateManager.pushMatrix(); + + GlStateManager.disableDepth(); + GlStateManager.enableBlend(); + GL14.glBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ONE_MINUS_SRC_ALPHA); + + GlStateManager.translate(x, y, -0.02F); + GlStateManager.rotate(angle, 0.0F, 0.0F, 1.0F); + GlStateManager.translate(-0.5F, 0.5F, 0.0F); + worldrenderer.begin(7, DefaultVertexFormats.POSITION_TEX); + worldrenderer.pos(-pixelWidth/2f, pixelHeight/2f, 30+((float)k * -0.005F)).tex(minU, minV).endVertex(); + worldrenderer.pos(pixelWidth/2f, pixelHeight/2f, 30+((float)k * -0.005F)).tex(maxU, minV).endVertex(); + worldrenderer.pos(pixelWidth/2f, -pixelHeight/2f, 30+((float)k * -0.005F)).tex(maxU, maxV).endVertex(); + worldrenderer.pos(-pixelWidth/2f, -pixelHeight/2f, 30+((float)k * -0.005F)).tex(minU, maxV).endVertex(); + tessellator.draw(); + + GlStateManager.popMatrix(); + k--; } - if(closestPlayer != null) { - x = playerMapPositions.get(closestPlayer).getRenderX(); - y = playerMapPositions.get(closestPlayer).getRenderY(); - angle = closestPlayer.rotationYawHead; + if(useFb) { + GlStateManager.enableBlend(); + GL14.glBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ONE_MINUS_SRC_ALPHA); + } else { + GL11.glDisable(GL11.GL_SCISSOR_TEST); + } + } GlStateManager.popMatrix(); + + if(useFb) { + Framebuffer renderFromBuffer = mapFramebuffer1; + if(useShd) { + GlStateManager.pushMatrix(); { + try { + upload(mapShader, mapSizeX, mapSizeY, scaleFactor, getBorderRadius()); + mapShader.setProjectionMatrix(projectionMatrix); + mapShader.loadShader(0); + renderFromBuffer = mapFramebuffer2; + } catch(Exception e) { + } + } GlStateManager.popMatrix(); + } + + Minecraft.getMinecraft().getFramebuffer().bindFramebuffer(true); + + Utils.pushGuiScale(2); + + GlStateManager.translate(centerX, centerY, 100); + + renderFromBuffer.bindFramebufferTexture(); + Utils.drawTexturedRect(-mapSizeX/2, -mapSizeY/2, mapSizeX, mapSizeY, + 0, 1, 1, 0, GL11.GL_NEAREST); + GlStateManager.bindTexture(0); + + GlStateManager.translate(-centerX, -centerY, -100); + + Utils.pushGuiScale(-1); + } + + GlStateManager.translate(centerX, centerY, 100); + + if(NotEnoughUpdates.INSTANCE.manager.config.dmChromaBorder.value) { + int colour = SpecialColour.specialToChromaRGB(NotEnoughUpdates.INSTANCE.manager.config.dmBorderColour.value); + + Gui.drawRect(-mapCenterX-2, -mapCenterY-2, -mapCenterX, -mapCenterY, + colour); //topleft + Gui.drawRect(-mapCenterX-2, mapCenterY+2, -mapCenterX, mapCenterY, + SpecialColour.rotateHue(colour, -180)); //bottomleft + Gui.drawRect(mapCenterX, -mapCenterY-2, mapCenterX+2, mapCenterY, + SpecialColour.rotateHue(colour, -180)); //topright + Gui.drawRect(mapCenterX, mapCenterY, mapCenterX+2, mapCenterY+2, + colour); //bottomright + + for(int i=0; i<20; i++) { + int start1 = SpecialColour.rotateHue(colour, -9*i); + int start2 = SpecialColour.rotateHue(colour, -9*i-9); + int end1 = SpecialColour.rotateHue(colour, -180-9*i); + int end2 = SpecialColour.rotateHue(colour, -180-9*i-9); + + Utils.drawGradientRect(-mapCenterX-2, -mapCenterY+(int)(mapSizeY*(i/20f)), -mapCenterX, + -mapCenterY+(int)(mapSizeY*((i+1)/20f)), start1, start2); //left + Utils.drawGradientRect(mapCenterX, -mapCenterY+(int)(mapSizeX*(i/20f)), mapCenterX+2, + -mapCenterY+(int)(mapSizeX*((i+1)/20f)), + end1, end2); //right + Utils.drawGradientRectHorz(-mapCenterX+(int)(mapSizeX*(i/20f)), -mapCenterY-2, + -mapCenterX+(int)(mapSizeX*((i+1)/20f)), -mapCenterY, start1, start2); //top + Utils.drawGradientRectHorz(-mapCenterX+(int)(mapSizeX*(i/20f)), + mapCenterY, -mapCenterX+(int)(mapSizeX*((i+1)/20f)), mapCenterY+2, + end1, end2); //bottom } + + } else { + Gui.drawRect(-mapCenterX-2, -mapCenterY, -mapCenterX, mapCenterY, + SpecialColour.specialToChromaRGB(NotEnoughUpdates.INSTANCE.manager.config.dmBorderColour.value)); //left + Gui.drawRect(mapCenterX, -mapCenterY, mapCenterX+2, mapCenterY, + SpecialColour.specialToChromaRGB(NotEnoughUpdates.INSTANCE.manager.config.dmBorderColour.value)); //right + Gui.drawRect(-mapCenterX-2, -mapCenterY-2, mapCenterX+2, -mapCenterY, + SpecialColour.specialToChromaRGB(NotEnoughUpdates.INSTANCE.manager.config.dmBorderColour.value)); //top + Gui.drawRect(-mapCenterX-2, mapCenterY, mapCenterX+2, mapCenterY+2, + SpecialColour.specialToChromaRGB(NotEnoughUpdates.INSTANCE.manager.config.dmBorderColour.value)); //bottom + } + + String sizeId = borderSizeOption == 0 ? "small" : borderSizeOption == 2 ? "large" : "medium"; + + ResourceLocation rl = new ResourceLocation("notenoughupdates:dungeon_map/borders/"+sizeId+"/"+ + NotEnoughUpdates.INSTANCE.manager.config.dmBorderStyle.value.intValue()+".png"); + if(Minecraft.getMinecraft().getTextureManager().getTexture(rl) != TextureUtil.missingTexture) { + Minecraft.getMinecraft().getTextureManager().bindTexture(rl); + GlStateManager.color(1, 1, 1, 1); + + int size = borderSizeOption == 0 ? 165 : borderSizeOption == 2 ? 300 : 220; + Utils.drawTexturedRect(-size/2, -size/2, size, size, GL11.GL_NEAREST); } - x -= minRoomX*(RENDER_ROOM_SIZE+RENDER_CONN_SIZE); - y -= minRoomY*(RENDER_ROOM_SIZE+RENDER_CONN_SIZE); - - GlStateManager.pushMatrix(); - GlStateManager.translate(x, y, -0.02F); - GlStateManager.rotate(angle, 0.0F, 0.0F, 1.0F); - GlStateManager.scale(4.0F, 4.0F, 3.0F); - GlStateManager.translate(-0.125F, 0.125F, 0.0F); - worldrenderer.begin(7, DefaultVertexFormats.POSITION_TEX); - worldrenderer.pos(-1.0D, 1.0D, 10+((float)k * -0.001F)).tex(minU, minV).endVertex(); - worldrenderer.pos(1.0D, 1.0D, 10+((float)k * -0.001F)).tex(minU+1/4f, minV).endVertex(); - worldrenderer.pos(1.0D, -1.0D, 10+((float)k * -0.001F)).tex(minU+1/4f, minV+1/4f).endVertex(); - worldrenderer.pos(-1.0D, -1.0D, 10+((float)k * -0.001F)).tex(minU, minV+1/4f).endVertex(); - tessellator.draw(); - GlStateManager.popMatrix(); - k--; - } - - GlStateManager.rotate(rotation-180, 0, 0, 1); - GlStateManager.translate(-centerX, -centerY, 0); - GlStateManager.popMatrix(); + GlStateManager.translate(-centerX, -centerY, -100); + } catch(Exception e) { + e.printStackTrace(); + Minecraft.getMinecraft().entityRenderer.setupOverlayRendering(); + Minecraft.getMinecraft().getFramebuffer().bindFramebuffer(true); + } + + Utils.pushGuiScale(-1); + + GlStateManager.enableBlend(); + GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0); + GlStateManager.enableDepth(); } @@ -409,6 +828,7 @@ public class DungeonMap { } for(int k=0; k<4; k++) { + Color colour = null; int totalFilled = 0; for(int i=0; i 0 && y > 0 && x < colourMap.length && y < colourMap[x].length) { - if(colourMap[x][y].equals(room.colour)) { - totalFilled++; + Color pixel = colourMap[x][y]; + if(pixel.getAlpha() > 40) { + if(colour == null) { + colour = pixel; + totalFilled = 1; + } else { + if(colour.equals(pixel)) { + totalFilled++; + } else { + totalFilled--; + if(totalFilled <= 0) { + colour = pixel; + totalFilled = 1; + } + } + } } } } @@ -446,24 +880,24 @@ public class DungeonMap { type = RoomConnectionType.CORRIDOR; } if(k == 0) { - room.up = new RoomConnection(type, room.colour); + room.up = new RoomConnection(type, colour); } else if(k == 1) { - room.right = new RoomConnection(type, room.colour); + room.right = new RoomConnection(type, colour); } else if(k == 2) { - room.down = new RoomConnection(type, room.colour); + room.down = new RoomConnection(type, colour); } else { - room.left = new RoomConnection(type, room.colour); + room.left = new RoomConnection(type, colour); } } + int x = startRoomX + roomOffset.x*(roomSize+connectorSize) + roomSize + connectorSize/2; + int y = startRoomY + roomOffset.y*(roomSize+connectorSize) + roomSize + connectorSize/2; + room.fillCorner = false; - if(room.left.type == RoomConnectionType.ROOM_DIVIDER && room.up.type == RoomConnectionType.ROOM_DIVIDER) { - RoomOffset upleft = new RoomOffset(roomOffset.x-1, roomOffset.y-1); - if(roomMap.containsKey(upleft)) { - Room upleftRoom = roomMap.get(upleft); - if(upleftRoom.right.type == RoomConnectionType.ROOM_DIVIDER && upleftRoom.down.type == RoomConnectionType.ROOM_DIVIDER) { - room.fillCorner = true; - } + if(x > 0 && y > 0 && x < colourMap.length && y < colourMap[x].length) { + Color pixel = colourMap[x][y]; + if(pixel.equals(room.colour)) { + room.fillCorner = true; } } } @@ -478,7 +912,7 @@ public class DungeonMap { int x = startRoomX + neighbor.x*(roomSize+connectorSize); int y = startRoomY + neighbor.y*(roomSize+connectorSize); - if(x > 0 && y > 0 && x+roomSize < colourMap.length && y+roomSize < colourMap[x].length) { + if(x >= 0 && y >= 0 && x+roomSize < colourMap.length && y+roomSize < colourMap[x].length) { if(colourMap[x][y].getAlpha() > 100) { roomMap.put(neighbor, new Room()); loadNeighbors(neighbor); @@ -499,33 +933,6 @@ public class DungeonMap { } } - class MapDecoration { - MapPosition position; - int id; - float angle; - - public MapDecoration(MapPosition position, int id, float angle) { - this.position = position; - this.id = id; - this.angle = angle; - } - - @Override - public boolean equals(Object o) { - if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; - MapDecoration that = (MapDecoration) o; - return id == that.id && - Float.compare(that.angle, angle) == 0 && - Objects.equals(position, that.position); - } - - @Override - public int hashCode() { - return Objects.hash(position, id, angle); - } - } - private class MapPosition { public float roomOffsetX; public float connOffsetX; @@ -533,6 +940,8 @@ public class DungeonMap { public float roomOffsetY; public float connOffsetY; + public float rotation; + public MapPosition(float roomOffsetX, float connOffsetX, float roomOffsetY, float connOffsetY) { this.roomOffsetX = roomOffsetX; this.connOffsetX = connOffsetX; @@ -541,11 +950,11 @@ public class DungeonMap { } public float getRenderX() { - return roomOffsetX*RENDER_ROOM_SIZE + connOffsetX*RENDER_CONN_SIZE; + return roomOffsetX*getRenderRoomSize() + connOffsetX*getRenderConnSize(); } public float getRenderY() { - return roomOffsetY*RENDER_ROOM_SIZE + connOffsetY*RENDER_CONN_SIZE; + return roomOffsetY*getRenderRoomSize() + connOffsetY*getRenderConnSize(); } @Override @@ -556,28 +965,374 @@ public class DungeonMap { return Float.compare(that.roomOffsetX, roomOffsetX) == 0 && Float.compare(that.connOffsetX, connOffsetX) == 0 && Float.compare(that.roomOffsetY, roomOffsetY) == 0 && - Float.compare(that.connOffsetY, connOffsetY) == 0; + Float.compare(that.connOffsetY, connOffsetY) == 0 && + Float.compare(that.rotation, rotation) == 0; } @Override public int hashCode() { - return Objects.hash(roomOffsetX, connOffsetX, roomOffsetY, connOffsetY); + return Objects.hash(roomOffsetX, connOffsetX, roomOffsetY, connOffsetY, rotation); + } + } + + private long lastClearCache = 0; + public void renderMap(int centerX, int centerY, Color[][] colourMap, Map mapDecorations, + int roomSizeBlocks, Set actualPlayers, boolean usePlayerPositions) { + if(!NotEnoughUpdates.INSTANCE.manager.config.dmEnable.value) return; + if(colourMap == null) return; + if(colourMap.length != 128) return; + if(colourMap[0].length != 128) return; + this.colourMap = colourMap; + + if(System.currentTimeMillis() - lastClearCache > 1000) { + roomMap.clear(); + startRoomX = -1; + startRoomY = -1; + connectorSize = -1; + roomSize = -1; + borderRadiusCache.clear(); + + lastClearCache = System.currentTimeMillis(); + } + + if(startRoomX < 0 || startRoomY < 0 || roomSize <= 0) { + for(int x=0; x 80) { + if(startRoomX < 0 && startRoomY < 0 && c.getRed() == 0 && c.getGreen() == 124 && c.getBlue() == 0) { + roomSize = 0; + out: + for(int xd=0; xd<=20; xd++) { + for(int yd=0; yd<=20; yd++) { + if(x+xd >= colourMap.length || y+yd >= colourMap[x+xd].length) continue; + Color c2 = colourMap[x+xd][y+yd]; + + if(c2.getGreen() != 124 || c2.getAlpha() <= 80) { + if(xd < 10 && yd < 10) { + break out; + } + } else { + roomSize = Math.max(roomSize, Math.min(xd+1, yd+1)); + } + if(xd == 20 && yd == 20) { + if(roomSize == 0) roomSize = 20; + startRoomX = x; + startRoomY = y; + } + } + } + } + } + } + } + } + + if(connectorSize <= 0) { + for(int i=0; i 0 && y > 0 && x < colourMap.length && y < colourMap[x].length) { + if(colourMap[x][y].getAlpha() > 80) { + if(j == 1) { + break; + } + connectorSize = Math.min(connectorSize, j-1); + } + } + } + } + } + + if(connectorSize <= 0) { + connectorSize = 4; + } + } + + for(EntityPlayer player : Minecraft.getMinecraft().theWorld.playerEntities) { + if(player instanceof AbstractClientPlayer && actualPlayers.contains(player.getName())) { + AbstractClientPlayer aplayer = (AbstractClientPlayer) player; + ResourceLocation skin = aplayer.getLocationSkin(); + if(skin != DefaultPlayerSkin.getDefaultSkin(aplayer.getUniqueID())) { + playerSkinMap.put(player.getName(), skin); + } + } + } + + playerEntityMapPositions.clear(); + if(usePlayerPositions) { + for(EntityPlayer player : Minecraft.getMinecraft().theWorld.playerEntities) { + if(actualPlayers.contains(player.getName())) { + float roomX = (float)player.posX / (roomSizeBlocks+1); + float roomY = (float)player.posZ / (roomSizeBlocks+1); + + float playerRoomOffsetX = (float) Math.floor(roomX); + float playerConnOffsetX = (float) Math.floor(roomX); + float playerRoomOffsetY = (float) Math.floor(roomY); + float playerConnOffsetY = (float) Math.floor(roomY); + + float roomXInBlocks = (float)player.posX % (roomSizeBlocks+1); + if(roomXInBlocks < 2) { //0,1 + playerConnOffsetX -= 2/5f-roomXInBlocks/5f; + } else if(roomXInBlocks > roomSizeBlocks-2) { //31,30,29 + playerRoomOffsetX++; + playerConnOffsetX += (roomXInBlocks - (roomSizeBlocks-2))/5f; + } else { + playerRoomOffsetX += (roomXInBlocks-2) / (roomSizeBlocks-4); + } + + float roomYInBlocks = (float)player.posZ % (roomSizeBlocks+1); + if(roomYInBlocks < 2) { //0,1 + playerConnOffsetY -= 2/5f-roomYInBlocks/5f; + } else if(roomYInBlocks > roomSizeBlocks-2) { //31,30,29 + playerRoomOffsetY++; + playerConnOffsetY += (roomYInBlocks - (roomSizeBlocks-2))/5f; + } else { + playerRoomOffsetY += (roomYInBlocks-2) / (roomSizeBlocks-4); + } + + playerRoomOffsetX -= startRoomX/(roomSize+connectorSize); + playerRoomOffsetY -= startRoomY/(roomSize+connectorSize); + playerConnOffsetX -= startRoomX/(roomSize+connectorSize); + playerConnOffsetY -= startRoomY/(roomSize+connectorSize); + + MapPosition pos = new MapPosition(playerRoomOffsetX, playerConnOffsetX, playerRoomOffsetY, playerConnOffsetY); + pos.rotation = player.rotationYawHead % 360; + if(pos.rotation < 0) pos.rotation += 360; + playerEntityMapPositions.put(player.getName(), pos); + } + } + } + + loadNeighbors(new RoomOffset(0, 0)); + updateRoomColours(); + for(RoomOffset offset : roomMap.keySet()) { + updateRoomConnections(offset); + } + + if(mapDecorations != null && mapDecorations.size() > 0) { + List positions = new ArrayList<>(); + for (Vec4b vec4b : mapDecorations.values()) { + float x = (float) vec4b.func_176112_b() / 2.0F + 64.0F; + float y = (float) vec4b.func_176113_c() / 2.0F + 64.0F; + + x = Math.max(0, Math.min(160, x)); + y = Math.max(0, Math.min(160, y)); + + float deltaX = x - startRoomX; + float deltaY = y - startRoomY; + + float roomsOffsetX = (int) Math.floor(deltaX / (roomSize + connectorSize)); + float connOffsetX = (int) Math.floor(deltaX / (roomSize + connectorSize)); + float xRemainder = deltaX % (roomSize + connectorSize); + if (Math.abs(xRemainder) > roomSize) { + roomsOffsetX += Math.copySign(1, xRemainder); + connOffsetX += Math.copySign(1, xRemainder) * (Math.abs(xRemainder) - roomSize) / connectorSize; + } else { + roomsOffsetX += xRemainder / roomSize; + } + if (deltaX < 0 && xRemainder != 0) { + roomsOffsetX++; + connOffsetX++; + } + float roomsOffsetY = (int) Math.floor(deltaY / (roomSize + connectorSize)); + float connOffsetY = (int) Math.floor(deltaY / (roomSize + connectorSize)); + float yRemainder = deltaY % (roomSize + connectorSize); + if (Math.abs(yRemainder) > roomSize) { + roomsOffsetY += Math.copySign(1, yRemainder); + connOffsetY += Math.copySign(1, yRemainder) * (Math.abs(yRemainder) - roomSize) / connectorSize; + } else { + roomsOffsetY += yRemainder / roomSize; + } + if (deltaY < 0 && yRemainder != 0) { + roomsOffsetY++; + connOffsetY++; + } + + float angle = (float) (vec4b.func_176111_d() * 360) / 16.0F; + + MapPosition pos = new MapPosition(roomsOffsetX, connOffsetX, roomsOffsetY, connOffsetY); + pos.rotation = angle % 360; + if(pos.rotation < 0) pos.rotation += 360; + positions.add(pos); + } + + //System.out.println(playerMarkerMapPositions.size() + ":" + positions.size()); + boolean different = playerMarkerMapPositions.size() != positions.size(); + + if (!different) { + for (MapPosition pos : playerMarkerMapPositions.values()) { + if (!positions.contains(pos)) { + different = true; + break; + } + } + } + + if(different && positions.size() > 0) { + lastLastDecorationsMillis = lastDecorationsMillis; + lastDecorationsMillis = System.currentTimeMillis(); + + playerMarkerMapPositionsLast.clear(); + for (Map.Entry entry : playerMarkerMapPositions.entrySet()) { + playerMarkerMapPositionsLast.put(entry.getKey(), entry.getValue()); + } + playerMarkerMapPositions.clear(); + + Set foundPlayers = new HashSet<>(); + for (Map.Entry entry : playerEntityMapPositions.entrySet()) { + playerMarkerMapPositions.put(entry.getKey(), entry.getValue()); + playerMarkerMapPositionsLast.put(entry.getKey(), entry.getValue()); + foundPlayers.add(entry.getKey()); + } + + HashMap> distanceMap = new HashMap<>(); + for (Map.Entry entry : playerMarkerMapPositionsLast.entrySet()) { + HashMap deltaDists = new HashMap<>(); + for (int i = 0; i < positions.size(); i++) { + float dx = entry.getValue().getRenderX() - positions.get(i).getRenderX(); + float dy = entry.getValue().getRenderY() - positions.get(i).getRenderY(); + deltaDists.put(i, dx * dx + dy * dy); + } + distanceMap.put(entry.getKey(), deltaDists); + } + + List playerList = new ArrayList<>(playerMarkerMapPositionsLast.keySet()); + List> playerPermutations = permutations(playerList); + + //if(playerPermutations.size() > 0 || playerMarkerMapPositionsLast.size() > 0) + // System.out.println("Perm Size: " + playerPermutations.size() + " from " + playerMarkerMapPositionsLast.size()); + + List finalUsedIndexes = new ArrayList<>(); + if (playerPermutations.size() > 0) { + HashMap smallestPermutation = null; + float smallestTotalDistance = 0; + + for (List permutation : playerPermutations) { + HashMap usedIndexes = new HashMap<>(); + + float totalDistance = 0; + for (String player : permutation) { + int smallestIndex = -1; + float smallestDist = 0; + for (Map.Entry entry : distanceMap.get(player).entrySet()) { + if (!usedIndexes.containsValue(entry.getKey())) { + if (smallestIndex == -1 || entry.getValue() < smallestDist) { + smallestIndex = entry.getKey(); + smallestDist = entry.getValue(); + } + } + } + if (smallestIndex != -1) { + usedIndexes.put(player, smallestIndex); + totalDistance += smallestDist; + } + } + + if (smallestPermutation == null || totalDistance < smallestTotalDistance) { + smallestPermutation = usedIndexes; + smallestTotalDistance = totalDistance; + } + } + + //System.out.println("--- PERM START ---"); + for (Map.Entry entry : smallestPermutation.entrySet()) { + //System.out.println(entry.getKey() + ":" + entry.getValue() + " : Total dist: " + smallestTotalDistance); + finalUsedIndexes.add(entry.getValue()); + playerMarkerMapPositions.put(entry.getKey(), positions.get(entry.getValue())); + } + } + + List nonUsedIndexes = new ArrayList<>(); + for(int i=0; i entry : playerEntityMapPositions.entrySet()) { + playerMarkerMapPositions.put(entry.getKey(), entry.getValue()); + } + } + + if(!roomMap.isEmpty() && startRoomX >= 0 && startRoomY >= 0) { + render(centerX, centerY); + } + + this.colourMap = colourMap; + } + + @SubscribeEvent(priority=EventPriority.HIGH) + public void onRenderOverlayPre(RenderGameOverlayEvent.Pre event) { + if(event.type == RenderGameOverlayEvent.ElementType.ALL) { + if(NotEnoughUpdates.INSTANCE.manager.config.dmBackgroundBlur.value > 0.1) { + blurBackground(); + } + GlStateManager.enableBlend(); + GlStateManager.enableTexture2D(); } } @SubscribeEvent public void onRenderOverlay(RenderGameOverlayEvent event) { if(event.type == RenderGameOverlayEvent.ElementType.ALL) { + if(SBInfo.getInstance().getLocation() == null || !SBInfo.getInstance().getLocation().equals("dungeon")) { + return; + } + ItemStack stack = Minecraft.getMinecraft().thePlayer.inventory.mainInventory[8]; - if(NotEnoughUpdates.INSTANCE.colourMap != null || (stack != null && stack.getItem() instanceof ItemMap)) { - if(NotEnoughUpdates.INSTANCE.colourMap != null) { - colourMap = NotEnoughUpdates.INSTANCE.colourMap; + boolean holdingBow = stack != null && stack.getItem() == Items.arrow; + if(holdingBow || (stack != null && stack.getItem() instanceof ItemMap)) { + Map decorations = null; + + Color[][] colourMap = new Color[128][128]; + if(holdingBow) { + for(int x=0; x<128; x++) { + for(int y=0; y<128; y++) { + if(this.colourMap != null && this.colourMap[x][y] != null) { + colourMap[x][y] = this.colourMap[x][y]; + } else { + colourMap[x][y] = new Color(0, true); + } + } + } } else { ItemMap map = (ItemMap) stack.getItem(); MapData mapData = map.getMapData(stack, Minecraft.getMinecraft().theWorld); if(mapData == null) return; + decorations = mapData.mapDecorations; + for (int i = 0; i < 16384; ++i) { int x = i % 128; int y = i / 128; @@ -593,80 +1348,10 @@ public class DungeonMap { colourMap[x][y] = c; } - - //mapData. } - roomMap.clear(); - startRoomX = -1; - startRoomY = -1; - connectorSize = 5; - roomSize = 0; - - for(int x=0; x 80) { - if(startRoomX < 0 && startRoomY < 0 && c.getRed() == 0 && c.getGreen() == 124 && c.getBlue() == 0) { - roomSize = 0; - out: - for(int xd=0; xd<=20; xd++) { - for(int yd=0; yd<=20; yd++) { - if(x+xd >= colourMap.length || y+yd >= colourMap[x+xd].length) continue; - Color c2 = colourMap[x+xd][y+yd]; - - if(c2.getGreen() != 124 || c2.getAlpha() <= 80) { - if(xd < 10 && yd < 10) { - break out; - } - } else { - roomSize = Math.max(roomSize, Math.min(xd+1, yd+1)); - } - if(xd == 20 && yd == 20) { - if(roomSize == 0) roomSize = 20; - startRoomX = x; - startRoomY = y; - } - } - } - } - } - } - } - - for(int i=0; i 0 && y > 0 && x < colourMap.length && y < colourMap[x].length) { - if(colourMap[x][y].getAlpha() > 80) { - if(j == 1) { - break; - } - connectorSize = Math.min(connectorSize, j-1); - } - } - } - } - } - - List dists = new ArrayList<>(); + int roomSizeBlocks = 31; + /*List dists = new ArrayList<>(); int currentBlockCount = 0; for(int i=0; i<300; i++) { IBlockState state = Minecraft.getMinecraft().theWorld.getBlockState(new BlockPos(0, 99, i)); @@ -677,7 +1362,6 @@ public class DungeonMap { currentBlockCount++; } } - //roomSizeBlocks = 7; currentBlockCount = 0; for(int i=0; i<300; i++) { IBlockState state = Minecraft.getMinecraft().theWorld.getBlockState(new BlockPos(i, 99, 0)); @@ -700,163 +1384,151 @@ public class DungeonMap { } } } - if(mostCommonDist != -1) roomSizeBlocks = Math.max(31, mostCommonDist); - if(Keyboard.isKeyDown(Keyboard.KEY_N)) System.out.println(roomSizeBlocks + ":" + dists.size()); + if(mostCommonDist > 31) roomSizeBlocks = mostCommonDist;*/ Set actualPlayers = new HashSet<>(); for(ScorePlayerTeam team : Minecraft.getMinecraft().thePlayer.getWorldScoreboard().getTeams()) { if(team.getTeamName().startsWith("a")) { - for(String player : team.getMembershipCollection()) { - actualPlayers.add(player.toLowerCase()); - } + actualPlayers.addAll(team.getMembershipCollection()); } } - playerMapPositions.clear(); - for(EntityPlayer player : Minecraft.getMinecraft().theWorld.playerEntities) { - if(actualPlayers.isEmpty() || actualPlayers.contains(player.getName().toLowerCase())) { - float roomX = (float)player.posX / (roomSizeBlocks+1); - float roomY = (float)player.posZ / (roomSizeBlocks+1); - - float playerRoomOffsetX = (float) Math.floor(roomX); - float playerConnOffsetX = (float) Math.floor(roomX); - float playerRoomOffsetY = (float) Math.floor(roomY); - float playerConnOffsetY = (float) Math.floor(roomY); - - float roomXInBlocks = (float)player.posX % (roomSizeBlocks+1); - if(roomXInBlocks < 2) { //0,1 - playerConnOffsetX -= roomXInBlocks/5f; - } else if(roomXInBlocks > roomSizeBlocks-3) { //31,30,29 - playerRoomOffsetX++; - playerConnOffsetX += (roomXInBlocks - (roomSizeBlocks-3))/5f; - } else { - playerRoomOffsetX += (roomXInBlocks-2) / (roomSizeBlocks-5); - } - - float roomYInBlocks = (float)player.posZ % (roomSizeBlocks+1); - if(roomYInBlocks < 2) { //0,1 - playerConnOffsetY -= roomYInBlocks/5f; - } else if(roomYInBlocks > roomSizeBlocks-3) { //31,30,29 - playerRoomOffsetY++; - playerConnOffsetY += (roomYInBlocks - (roomSizeBlocks-3))/5f; - } else { - playerRoomOffsetY += (roomYInBlocks-2) / (roomSizeBlocks-5); - } + renderMap((int)(NotEnoughUpdates.INSTANCE.manager.config.dmCenterX.value/100*Minecraft.getMinecraft().displayWidth/2), + (int)(NotEnoughUpdates.INSTANCE.manager.config.dmCenterY.value/100*Minecraft.getMinecraft().displayHeight/2), + colourMap, decorations, roomSizeBlocks, actualPlayers, true); + } + } + } - playerRoomOffsetX -= startRoomX/(roomSize+connectorSize); - playerRoomOffsetY -= startRoomY/(roomSize+connectorSize); - playerConnOffsetX -= startRoomX/(roomSize+connectorSize); - playerConnOffsetY -= startRoomY/(roomSize+connectorSize); + public List> permutations(List values) { + List> permutations = new ArrayList<>(); - playerMapPositions.put(player, new MapPosition(playerRoomOffsetX, playerConnOffsetX, playerRoomOffsetY, playerConnOffsetY)); - } - } + if(values.size() == 1) { + permutations.add(values); + return permutations; + } - loadNeighbors(new RoomOffset(0, 0)); - updateRoomColours(); - for(RoomOffset offset : roomMap.keySet()) { - updateRoomConnections(offset); + for(String first : values) { + List newList = new ArrayList<>(); + for(String val : values) { + if(!val.equals(first)) { + newList.add(val); } + } - if(NotEnoughUpdates.INSTANCE.colourMap == null) { - ItemMap map = (ItemMap) stack.getItem(); - MapData mapData = map.getMapData(stack, Minecraft.getMinecraft().theWorld); - - if(mapData.mapDecorations.size() > 0) { - boolean different = mapData.mapDecorations.size() != decorations.size(); - - List decorationsNew = new ArrayList<>(); - - for (Vec4b vec4b : mapData.mapDecorations.values()) { - byte b0 = vec4b.func_176110_a(); - - float x = (float)vec4b.func_176112_b() / 2.0F + 64.0F; - float y = (float)vec4b.func_176113_c() / 2.0F + 64.0F; - - float deltaX = x - startRoomX; - float deltaY = y - startRoomY; - - float roomsOffsetX = (int)Math.floor(deltaX / (roomSize+connectorSize)); - float connOffsetX = (int)Math.floor(deltaX / (roomSize+connectorSize)); - float xRemainder = deltaX % (roomSize+connectorSize); - if(Math.abs(xRemainder) > roomSize) { - roomsOffsetX++; - connOffsetX += (xRemainder-roomSize)/connectorSize; - } else { - roomsOffsetX += xRemainder/roomSize; - } - if(deltaX < 0) { - roomsOffsetX++; - connOffsetX++; - } - float roomsOffsetY = (int)Math.floor(deltaY / (roomSize+connectorSize)); - float connOffsetY = (int)Math.floor(deltaY / (roomSize+connectorSize)); - float yRemainder = deltaY % (roomSize+connectorSize); - if(Math.abs(yRemainder) > roomSize) { - roomsOffsetY++; - connOffsetY += Math.abs(yRemainder-roomSize)/connectorSize; - } else { - roomsOffsetY += yRemainder/roomSize; - } - if(deltaY < 0) { - roomsOffsetY++; - connOffsetY++; - } - - float angle = (float)(vec4b.func_176111_d() * 360) / 16.0F; - - MapDecoration decoration = new MapDecoration(new MapPosition(roomsOffsetX, connOffsetX, roomsOffsetY, connOffsetY), (int)b0, angle); - if(!different && !decorations.contains(decoration)) { - different = true; - } - decorationsNew.add(decoration); - } + for(List list2 : permutations(newList)) { + List perm = new ArrayList<>(); + perm.add(first); + perm.addAll(list2); + permutations.add(perm); + } + } - if(different) { - lastDecorations.clear(); + return permutations; + } - for(int i=0; iwidth; 0->height] to OpenGL coordinate + * space [-1 -> 1; 1 -> -1] (Note: flipped y-axis). + * + * This is so that we can render to and from the framebuffer in a way that is familiar to us, instead of needing to + * apply scales and translations manually. + */ + private Matrix4f createProjectionMatrix(int width, int height) { + Matrix4f projMatrix = new Matrix4f(); + projMatrix.setIdentity(); + projMatrix.m00 = 2.0F / (float)width; + projMatrix.m11 = 2.0F / (float)(-height); + projMatrix.m22 = -0.0020001999F; + projMatrix.m33 = 1.0F; + projMatrix.m03 = -1.0F; + projMatrix.m13 = 1.0F; + projMatrix.m23 = -1.0001999F; + return projMatrix; + } - float lowestDistSq = 999; - MapDecoration closest = null; + private double lastBgBlurFactor = -1; + private void blurBackground() { + if(!OpenGlHelper.isFramebufferEnabled()) return; - for(int j=0; jx+blurWidth, y->y+blurHeight] + */ + public void renderBlurredBackground(int width, int height, int x, int y, int blurWidth, int blurHeight) { + if(!OpenGlHelper.isFramebufferEnabled()) return; - lastLastDecorationsMillis = lastDecorationsMillis; - lastDecorationsMillis = System.currentTimeMillis(); - } - } + if(blurOutputVert == null) return; - } + float uMin = x/(float)width; + float uMax = (x+blurWidth)/(float)width; + float vMin = (height-y)/(float)height; + float vMax = (height-y-blurHeight)/(float)height; - if(!roomMap.isEmpty()) { - render(); - } - } - } + blurOutputVert.bindFramebufferTexture(); + GlStateManager.color(1f, 1f, 1f, 1f); + Utils.drawTexturedRectNoBlend(x, y, blurWidth, blurHeight, uMin, uMax, vMin, vMax, GL11.GL_LINEAR); + blurOutputVert.unbindFramebufferTexture(); } } diff --git a/src/main/java/io/github/moulberry/notenoughupdates/GuiButtonItem.java b/src/main/java/io/github/moulberry/notenoughupdates/GuiButtonItem.java new file mode 100644 index 00000000..a08b27bc --- /dev/null +++ b/src/main/java/io/github/moulberry/notenoughupdates/GuiButtonItem.java @@ -0,0 +1,93 @@ +package io.github.moulberry.notenoughupdates; + +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.Gui; +import net.minecraft.client.gui.GuiButton; +import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.client.renderer.RenderHelper; +import net.minecraft.init.Items; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagList; +import net.minecraft.nbt.NBTTagString; +import net.minecraft.util.EnumChatFormatting; +import net.minecraft.util.ResourceLocation; + +public class GuiButtonItem extends GuiButton +{ + private static final ResourceLocation TEXTURE = new ResourceLocation("dummy:textures/gui/blank.png"); + private ItemStack itemStack; + private String customName; + + public GuiButtonItem(int buttonID, int xPos, int yPos, ItemStack itemStack) + { + this(buttonID, xPos, yPos, xPos, itemStack, itemStack.getDisplayName()); + } + + public GuiButtonItem(int buttonID, int xPos, int yPos, int potionX, ItemStack itemStack) + { + this(buttonID, xPos, yPos, potionX, itemStack, itemStack.getDisplayName()); + } + + public GuiButtonItem(int buttonID, int xPos, int yPos, ItemStack itemStack, String customName) + { + this(buttonID, xPos, yPos, xPos, itemStack, customName); + } + + public GuiButtonItem(int buttonID, int xPos, int yPos, int potionX, ItemStack itemStack, String customName) + { + super(buttonID, xPos, yPos, 18, 18, ""); + this.itemStack = itemStack; + this.customName = customName; + } + + @Override + public void drawButton(Minecraft mc, int mouseX, int mouseY) + { + boolean flag = mouseX >= this.xPosition && mouseY >= this.yPosition && mouseX < this.xPosition + this.width && mouseY < this.yPosition + this.height; + + if (this.visible) + { + if (this.itemStack.getItem() == Items.nether_star) + { + ItemStack skyBlockMenu = this.itemStack.copy(); + NBTTagList list = new NBTTagList(); + skyBlockMenu.setStackDisplayName("SkyBlock Menu"); + list.appendTag(new NBTTagString(EnumChatFormatting.GRAY + "View all of your SkyBlock")); + skyBlockMenu.getTagCompound().getCompoundTag("display").setTag("Lore", list); + this.itemStack = skyBlockMenu; + } + + mc.getTextureManager().bindTexture(TEXTURE); + GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); + Gui.drawModalRectWithCustomSizedTexture(this.xPosition, this.yPosition, flag ? 18 : 0, 0, this.width, this.height, 36, 18); + + GlStateManager.enableDepth(); + GlStateManager.enableRescaleNormal(); + GlStateManager.enableBlend(); + GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0); + RenderHelper.enableGUIStandardItemLighting(); + GlStateManager.enableLighting(); + mc.getRenderItem().renderItemAndEffectIntoGUI(this.itemStack, this.xPosition + 1, this.yPosition + 1); + } + } + + public String getName() + { + return this.customName; + } + + public ItemStack getItemStack() + { + return this.itemStack; + } + + public void setName(String name) + { + this.customName = name; + } + + public void setItemStack(ItemStack itemStack) + { + this.itemStack = itemStack; + } +} \ No newline at end of file diff --git a/src/main/java/io/github/moulberry/notenoughupdates/GuiDungeonMapEditor.java b/src/main/java/io/github/moulberry/notenoughupdates/GuiDungeonMapEditor.java new file mode 100644 index 00000000..5bc4b6ee --- /dev/null +++ b/src/main/java/io/github/moulberry/notenoughupdates/GuiDungeonMapEditor.java @@ -0,0 +1,754 @@ +package io.github.moulberry.notenoughupdates; + +import io.github.moulberry.notenoughupdates.infopanes.SettingsInfoPane; +import io.github.moulberry.notenoughupdates.itemeditor.GuiElementTextField; +import io.github.moulberry.notenoughupdates.options.Options; +import io.github.moulberry.notenoughupdates.profileviewer.GuiProfileViewer; +import io.github.moulberry.notenoughupdates.util.SpecialColour; +import io.github.moulberry.notenoughupdates.util.Utils; +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.Gui; +import net.minecraft.client.gui.GuiScreen; +import net.minecraft.client.gui.ScaledResolution; +import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.client.renderer.OpenGlHelper; +import net.minecraft.client.renderer.texture.DynamicTexture; +import net.minecraft.client.shader.Framebuffer; +import net.minecraft.client.shader.Shader; +import net.minecraft.util.EnumChatFormatting; +import net.minecraft.util.Matrix4f; +import net.minecraft.util.ResourceLocation; +import net.minecraft.util.Vec4b; +import org.lwjgl.input.Keyboard; +import org.lwjgl.input.Mouse; +import org.lwjgl.opengl.GL11; + +import java.awt.*; +import java.awt.image.BufferedImage; +import java.io.IOException; +import java.util.*; +import java.util.List; + +import static io.github.moulberry.notenoughupdates.GuiTextures.*; +import static io.github.moulberry.notenoughupdates.GuiTextures.colour_selector_dot; + +public class GuiDungeonMapEditor extends GuiScreen { + + public static final ResourceLocation BACKGROUND = new ResourceLocation("notenoughupdates:dungeon_map/editor/background.png"); + public static final ResourceLocation BUTTON = new ResourceLocation("notenoughupdates:button.png"); + private static final DungeonMap demoMap = new DungeonMap(); + + private int sizeX; + private int sizeY; + private int guiLeft; + private int guiTop; + + private List