aboutsummaryrefslogtreecommitdiff
path: root/src/main/java
diff options
context:
space:
mode:
authorMoulberry <james.jenour@student.scotch.wa.edu.au>2020-10-31 21:49:14 +1100
committerMoulberry <james.jenour@student.scotch.wa.edu.au>2020-10-31 21:49:14 +1100
commit431d4a5eca207aa6f86a90e3c4e1912885f115eb (patch)
tree8d3bd19ad3d40da034aaca8e2766dadb627bfaf1 /src/main/java
parent2397734d98c30a05db58bc6ef67607078889a386 (diff)
downloadNotEnoughUpdates-431d4a5eca207aa6f86a90e3c4e1912885f115eb.tar.gz
NotEnoughUpdates-431d4a5eca207aa6f86a90e3c4e1912885f115eb.tar.bz2
NotEnoughUpdates-431d4a5eca207aa6f86a90e3c4e1912885f115eb.zip
1.4.9
Diffstat (limited to 'src/main/java')
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/DumymMod.java53
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/DungeonBlocks.java2
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/DungeonMap.java1522
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/GuiButtonItem.java93
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/GuiDungeonMapEditor.java754
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/NotEnoughUpdates.java39
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/auction/APIManager.java6
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/gamemodes/SBGamemodes.java4
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/options/Options.java100
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/profileviewer/PlayerStats.java9
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/profileviewer/ProfileViewer.java6
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/util/Constants.java2
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/util/SpecialColour.java14
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/util/Utils.java85
14 files changed, 2249 insertions, 440 deletions
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<RoomOffset, Room> 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<MapDecoration> decorations = new ArrayList<>();
- private final List<MapDecoration> lastDecorations = new ArrayList<>();
+ //private final List<MapDecoration> decorations = new ArrayList<>();
+ //private final List<MapDecoration> lastDecorations = new ArrayList<>();
private long lastDecorationsMillis = -1;
private long lastLastDecorationsMillis = -1;
- private Map<EntityPlayer, MapPosition> playerMapPositions = new HashMap<>();
+ private Map<String, MapPosition> playerEntityMapPositions = new HashMap<>();
+ private Map<String, MapPosition> playerMarkerMapPositions = new HashMap<>();
+ private Map<String, MapPosition> playerMarkerMapPositionsLast = new HashMap<>();
+
+ private Map<String, ResourceLocation> 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<Integer, Float> 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<Color> 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<RoomOffset, Room> 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<decorations.size(); i++) {
- MapDecoration decoration = decorations.get(i);
- float minU = (float)(decoration.id % 4) / 4.0F;
- float minV = (float)(decoration.id / 4) / 4.0F;
-
- float x = decoration.position.getRenderX();
- float y = decoration.position.getRenderY();
- float angle = decoration.angle;
-
- if(decoration.id == 1) {
- angle = Minecraft.getMinecraft().thePlayer.rotationYawHead;
- } else {
- if(false && i < lastDecorations.size()) {
- MapDecoration last = lastDecorations.get(i);
- float xLast = last.position.getRenderX();
- float yLast = last.position.getRenderY();
-
- float distSq = (x-xLast)*(x-xLast)+(y-yLast)*(y-yLast);
- if(distSq < RENDER_ROOM_SIZE*RENDER_ROOM_SIZE) {
- float angleLast = last.angle;
- 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;
- }
+ 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<EntityPlayer, MapPosition> entry : playerMapPositions.entrySet()) {
- if(Minecraft.getMinecraft().thePlayer.getName().equalsIgnoreCase(entry.getKey().getName()) != (decoration.id == 1)) {
- continue;
+ if(NotEnoughUpdates.INSTANCE.manager.config.dmBackgroundBlur.value