diff options
author | Moulberry <james.jenour@student.scotch.wa.edu.au> | 2020-10-19 02:06:15 +1100 |
---|---|---|
committer | Moulberry <james.jenour@student.scotch.wa.edu.au> | 2020-10-19 02:06:15 +1100 |
commit | 7ebee833e54e95ffcd9dcfbad5744e299102acd9 (patch) | |
tree | ddec55c308357f6ed92cb55408353ec40d702595 /src/main | |
parent | a0402708801b525145d01d0f4da17f0ba9d93455 (diff) | |
download | NotEnoughUpdates-7ebee833e54e95ffcd9dcfbad5744e299102acd9.tar.gz NotEnoughUpdates-7ebee833e54e95ffcd9dcfbad5744e299102acd9.tar.bz2 NotEnoughUpdates-7ebee833e54e95ffcd9dcfbad5744e299102acd9.zip |
1.4.2
Diffstat (limited to 'src/main')
10 files changed, 330 insertions, 113 deletions
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/DungeonBlocks.java b/src/main/java/io/github/moulberry/notenoughupdates/DungeonBlocks.java index 29f5edc7..a97032c4 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/DungeonBlocks.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/DungeonBlocks.java @@ -39,13 +39,13 @@ public class DungeonBlocks implements IResourceManagerReloadListener { } public static boolean isInDungeons() { - return NotEnoughUpdates.INSTANCE.manager.config.dungeonBlocksEverywhere.value || - (SBInfo.getInstance().getLocation() != null && SBInfo.getInstance().getLocation().equals("dungeon")); + return !NotEnoughUpdates.INSTANCE.manager.config.disableDungeonBlocks.value && + (NotEnoughUpdates.INSTANCE.manager.config.dungeonBlocksEverywhere.value || + (SBInfo.getInstance().getLocation() != null && SBInfo.getInstance().getLocation().equals("dungeon"))); } public static void reset() { textureId = -1; - intbuffer = null; for(int tex : modified.values()) { GlStateManager.deleteTexture(tex); } @@ -53,6 +53,14 @@ public class DungeonBlocks implements IResourceManagerReloadListener { } public static int getModifiedTexture(ResourceLocation location, int colour) { + if(!isInDungeons()) { + return -1; + } + + if(((colour >> 24) & 0xFF) < 50) { + return -1; + } + String id = location.getResourceDomain()+":"+location.getResourcePath(); if(modified.containsKey(id)) { return modified.get(id); @@ -125,6 +133,10 @@ public class DungeonBlocks implements IResourceManagerReloadListener { } public static void tick() { + if(!isInDungeons()) { + return; + } + if(textureId == -1) { int locationBlocksId = Minecraft.getMinecraft().getTextureManager().getTexture(TextureMap.locationBlocksTexture).getGlTextureId(); @@ -173,16 +185,18 @@ public class DungeonBlocks implements IResourceManagerReloadListener { GL11.glGetTexImage(GL11.GL_TEXTURE_2D, level, GL12.GL_BGRA, GL12.GL_UNSIGNED_INT_8_8_8_8_REV, intbuffer); for(Map.Entry<TextureAtlasSprite, Integer> entry : spriteMap.entrySet()) { + if(((entry.getValue() >> 24) & 0xFF) < 50) continue; + TextureAtlasSprite tas = entry.getKey(); for(int x=(int)(w2*tas.getMinU()); x<w2*tas.getMaxU(); x++) { for(int y=(int)(h2*tas.getMinV()); y<h2*tas.getMaxV(); y++) { int index = x+y*w2; int newCol = entry.getValue(); - float newAlpha = ((newCol >> 24) & 0xFF)/255f; + /*float newAlpha = ((newCol >> 24) & 0xFF)/255f; float newRed = ((newCol >> 16) & 0xFF)/255f; float newGreen = ((newCol >> 8) & 0xFF)/255f; - float newBlue = (newCol & 0xFF)/255f; + float newBlue = (newCol & 0xFF)/255f;*/ /*int oldCol = intbuffer.get(index); int oldAlpha = (oldCol >> 24) & 0xFF; diff --git a/src/main/java/io/github/moulberry/notenoughupdates/DungeonMap.java b/src/main/java/io/github/moulberry/notenoughupdates/DungeonMap.java index aac7726a..b32e3452 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/DungeonMap.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/DungeonMap.java @@ -4,11 +4,16 @@ import io.github.moulberry.notenoughupdates.util.Utils; import net.minecraft.block.material.MapColor; import net.minecraft.client.Minecraft; 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.renderer.texture.DynamicTexture; +import net.minecraft.client.renderer.vertex.DefaultVertexFormats; import net.minecraft.item.ItemMap; import net.minecraft.item.ItemStack; import net.minecraft.util.ResourceLocation; +import net.minecraft.util.Vec4b; import net.minecraft.world.storage.MapData; import net.minecraftforge.client.event.RenderGameOverlayEvent; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; @@ -16,10 +21,7 @@ import org.lwjgl.opengl.GL11; import java.awt.*; import java.awt.image.BufferedImage; -import java.util.HashMap; -import java.util.Map; -import java.util.Objects; -import java.util.Set; +import java.util.*; public class DungeonMap { @@ -106,6 +108,8 @@ public class DungeonMap { private class Room { Color colour = new Color(0, 0, 0, 0); + int tickColour = 0; + boolean fillCorner = false; RoomConnection left = new RoomConnection(RoomConnectionType.NONE, new Color(0, true)); RoomConnection up = new RoomConnection(RoomConnectionType.NONE, new Color(0, true)); @@ -114,6 +118,67 @@ public class DungeonMap { public void render(int roomSize, int connectorSize) { 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); + } + + if(fillCorner) { + Gui.drawRect(-connectorSize, -connectorSize, 0, 0, colour.getRGB()); + } + + for(int k=0; k<4; k++) { + RoomConnection connection = up; + 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; + + int xOffset = 0; + int yOffset = 0; + int width = 0; + int height = 0; + + if(connection == up) { + yOffset = -connectorSize; + width = roomSize; + height = connectorSize; + + 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; + } + } 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()); + } } } @@ -124,65 +189,70 @@ public class DungeonMap { } } - public void render(RoomOffset roomOffset, int[] renderTo, int startOffsetX, int startOffsetY) { - /*for(Map.Entry<RoomOffset, Room> entry : roomMap.entrySet()) { + private static final ResourceLocation mapIcons = new ResourceLocation("textures/map/map_icons.png"); + + public void render() { + int minRoomX = 999; + int minRoomY = 999; + int maxRoomX = -999; + int maxRoomY = -999; + for(RoomOffset offset : roomMap.keySet()) { + minRoomX = Math.min(offset.x, minRoomX); + minRoomY = Math.min(offset.y, minRoomY); + maxRoomX = Math.max(offset.x, maxRoomX); + maxRoomY = Math.max(offset.y, maxRoomY); + } - }*/ - if(roomMap.containsKey(roomOffset)) { - Room room = roomMap.get(roomOffset); + int roomSize = 16; + int connSize = 4; - for(int xo=0; xo<16; xo++) { - for(int yo=0; yo<16; yo++) { - int x = (roomOffset.x-startOffsetX)*20+xo; - int y = (roomOffset.y-startOffsetY)*20+yo; + Gui.drawRect(8, 8, 8+(maxRoomX-minRoomX+1)*(roomSize+connSize), 8+(maxRoomY-minRoomY+1)*(roomSize+connSize), + new Color(200, 200, 200).getRGB()); - render(renderTo, x, y, room.colour.getRGB()); - } - } + for(Map.Entry<RoomOffset, Room> entry : roomMap.entrySet()) { + RoomOffset roomOffset = entry.getKey(); + Room room = entry.getValue(); - for(int k=0; k<4; k++) { - RoomConnection connection; - if(k == 0) { - connection = room.up; - } else if(k == 1) { - connection = room.right; - } else if(k == 2) { - connection = room.down; - } else { - connection = room.left; - } - if(connection.type == RoomConnectionType.NONE || connection.type == RoomConnectionType.WALL) continue; - for(int o1=1; o1<=4; o1++) { - int min = 0; - int max = 16; - if(connection.type == RoomConnectionType.CORRIDOR) { - min = 6; - max = 10; - } - for (int o2 = min; o2 < max; o2++) { - int x; - int y; + int x = (roomOffset.x-minRoomX)*(roomSize+connSize); + int y = (roomOffset.y-minRoomY)*(roomSize+connSize); - if(k == 0) { - x = (roomOffset.x-startOffsetX)*20+o2; - y = (roomOffset.y-startOffsetY)*20-o1; - } else if(k == 1) { - x = (roomOffset.x-startOffsetX)*20+15+o1; - y = (roomOffset.y-startOffsetY)*20+o2; - } else if(k == 2) { - x = (roomOffset.x-startOffsetX)*20+o2; - y = (roomOffset.y-startOffsetY)*20+15+o1; - } else { - x = (roomOffset.x-startOffsetX)*20-o1; - y = (roomOffset.y-startOffsetY)*20+o2; - } - - render(renderTo, x, y, connection.colour.getRGB()); - } - } - } + GlStateManager.pushMatrix(); + GlStateManager.translate(x+10, y+10, 0); + room.render(roomSize, connSize); + GlStateManager.translate(-(x+10), -(y+10), 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(MapDecoration decoration : decorations) { + float x = (decoration.roomsOffsetX+decoration.roomInPercentX)*roomSize + + (decoration.connOffsetX+decoration.connInPercentX)*connectorSize; + float y = (decoration.roomsOffsetY+decoration.roomInPercentY)*roomSize + + (decoration.connOffsetY+decoration.connInPercentY)*connectorSize; + + x -= minRoomX*(roomSize+connSize); + y -= minRoomY*(roomSize+connSize); + + //System.out.println(decoration.angle); + + GlStateManager.pushMatrix(); + GlStateManager.translate(x+10, y+10, -0.02F); + GlStateManager.rotate(decoration.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(decoration.minU, decoration.minV).endVertex(); + worldrenderer.pos(1.0D, 1.0D, 10+((float)k * -0.001F)).tex(decoration.minU+1/4f, decoration.minV).endVertex(); + worldrenderer.pos(1.0D, -1.0D, 10+((float)k * -0.001F)).tex(decoration.minU+1/4f, decoration.minV+1/4f).endVertex(); + worldrenderer.pos(-1.0D, -1.0D, 10+((float)k * -0.001F)).tex(decoration.minU, decoration.minV+1/4f).endVertex(); + tessellator.draw(); + GlStateManager.popMatrix(); + k--; + } } private HashMap<RoomOffset, Room> roomMap = new HashMap<>(); @@ -196,8 +266,38 @@ public class DungeonMap { if(roomMap.containsKey(roomOffset)) { Room room = roomMap.get(roomOffset); + int otherPixelFilled = 0; + int otherPixelColour = 0; + for(int xOff=0; xOff<roomSize; xOff++) { + for(int yOff=0; yOff<roomSize; yOff++) { + int x = startRoomX + roomOffset.x*(roomSize+connectorSize) + xOff; + int y = startRoomY + roomOffset.y*(roomSize+connectorSize) + yOff; + + if(x < colourMap.length && y < colourMap[x].length) { + Color c = colourMap[x][y]; + if(!c.equals(room.colour)) { + if(otherPixelColour == c.getRGB()) { + otherPixelFilled++; + } else { + otherPixelFilled--; + if(otherPixelFilled <= 0) { + otherPixelFilled = 1; + otherPixelColour = c.getRGB(); + } + } + } + } + } + } + + room.tickColour = 0; + if((float)otherPixelFilled/roomSize/connectorSize > 0.05) { + room.tickColour = otherPixelColour; + } + for(int k=0; k<4; k++) { int totalFilled = 0; + for(int i=0; i<roomSize; i++) { for(int j=1; j<=connectorSize; j++) { int x = startRoomX + roomOffset.x*(roomSize+connectorSize); @@ -242,6 +342,16 @@ public class DungeonMap { room.left = new RoomConnection(type, room.colour); } } + + 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; + } + } + } } } @@ -273,6 +383,38 @@ public class DungeonMap { } } + private Set<MapDecoration> decorations = new HashSet<>(); + class MapDecoration { + float roomInPercentX; + float connInPercentX; + float roomsOffsetX; + float connOffsetX; + float roomInPercentY; + float connInPercentY; + float roomsOffsetY; + float connOffsetY; + + float minU; + float minV; + + float angle; + + public MapDecoration(float roomInPercentX, float connInPercentX, float roomsOffsetX, float connOffsetX, + float roomInPercentY, float connInPercentY, float roomsOffsetY, float connOffsetY, float minU, float minV, float angle) { + this.roomInPercentX = roomInPercentX; + this.connInPercentX = connInPercentX; + this.roomsOffsetX = roomsOffsetX; + this.connOffsetX = connOffsetX; + this.roomInPercentY = roomInPercentY; + this.connInPercentY = connInPercentY; + this.roomsOffsetY = roomsOffsetY; + this.connOffsetY = connOffsetY; + this.minU = minU; + this.minV = minV; + this.angle = angle; + } + } + @SubscribeEvent public void onRenderOverlay(RenderGameOverlayEvent event) { //System.out.println("render overlayw"); @@ -306,6 +448,8 @@ public class DungeonMap { colourMap[x][y] = c; } + + //mapData. } for(int x=0; x<colourMap.length; x++) { @@ -377,6 +521,57 @@ public class DungeonMap { updateRoomConnections(offset); } + if(NotEnoughUpdates.INSTANCE.colourMap == null) { + ItemMap map = (ItemMap) stack.getItem(); + MapData mapData = map.getMapData(stack, Minecraft.getMinecraft().theWorld); + + if(mapData.mapDecorations.size() > 0) { + decorations.clear(); + } + 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 minU = (float)(b0 % 4 + 0) / 4.0F; + float minV = (float)(b0 / 4 + 0) / 4.0F; + + float deltaX = x - startRoomX; + float deltaY = y - startRoomY; + + float roomInPercentX = 0; + float connInPercentX = 0; + float roomsOffsetX = (int)Math.floor(deltaX / (roomSize+connectorSize)); + float connOffsetX = (int)Math.floor(deltaX / (roomSize+connectorSize)); + float xRemainder = deltaX % (roomSize+connectorSize); + if(xRemainder > roomSize) { + roomsOffsetX++; + connInPercentX = (xRemainder-roomSize)/connectorSize; + } else { + roomInPercentX = xRemainder/roomSize; + } + float roomInPercentY = 0; + float connInPercentY = 0; + float roomsOffsetY = (int)Math.floor(deltaY / (roomSize+connectorSize)); + float connOffsetY = (int)Math.floor(deltaY / (roomSize+connectorSize)); + float yRemainder = deltaY % (roomSize+connectorSize); + if(yRemainder > roomSize) { + roomsOffsetY++; + connInPercentY = (yRemainder-roomSize)/connectorSize; + } else { + roomInPercentY = yRemainder/roomSize; + } + + float angle = (float)(vec4b.func_176111_d() * 360) / 16.0F; + + //System.out.println((float)(vec4b.func_176111_d() * 360) / 16.0F); + decorations.add(new MapDecoration(roomInPercentX, connInPercentX, roomsOffsetX, connOffsetX, roomInPercentY, connInPercentY, + roomsOffsetY, connOffsetY, minU, minV, angle)); + } + + } + + //System.out.println("room x: " + startRoomX + "room y: " + startRoomY + " size: " + roomSize + " connector: " + connectorSize); //rendering @@ -397,9 +592,11 @@ public class DungeonMap { } for(RoomOffset offset : roomMap.keySet()) { - render(offset, mapTextureData, minRoomX, minRoomY); + //render(offset, mapTextureData, minRoomX, minRoomY); } + render(); + //process dynamicTexture.updateDynamicTexture(); diff --git a/src/main/java/io/github/moulberry/notenoughupdates/NEUEventListener.java b/src/main/java/io/github/moulberry/notenoughupdates/NEUEventListener.java index a2ce0055..ed5be01a 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/NEUEventListener.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/NEUEventListener.java @@ -135,7 +135,7 @@ public class NEUEventListener { longUpdate = true; lastLongUpdate = currentTime; } - if(currentTime - lastVeryLongUpdate > 10000) { + if(longUpdate && currentTime - lastVeryLongUpdate > 10000) { veryLongUpdate = true; lastVeryLongUpdate = currentTime; } diff --git a/src/main/java/io/github/moulberry/notenoughupdates/NotEnoughUpdates.java b/src/main/java/io/github/moulberry/notenoughupdates/NotEnoughUpdates.java index 575562a0..77855b3e 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/NotEnoughUpdates.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/NotEnoughUpdates.java @@ -685,7 +685,7 @@ public class NotEnoughUpdates { public Color[][] colourMap = null; SimpleCommand neumapCommand = new SimpleCommand("neumap", new SimpleCommand.ProcessCommandRunnable() { public void processCommand(ICommandSender sender, String[] args) { - if(args.length == 1 && args[0] == "reset") { + if(args.length == 1 && args[0].equals("reset")) { colourMap = null; return; } @@ -788,7 +788,7 @@ public class NotEnoughUpdates { MinecraftForge.EVENT_BUS.register(new SBGamemodes()); MinecraftForge.EVENT_BUS.register(SBInfo.getInstance()); MinecraftForge.EVENT_BUS.register(CustomItemEffects.INSTANCE); - MinecraftForge.EVENT_BUS.register(new DungeonMap()); + //MinecraftForge.EVENT_BUS.register(new DungeonMap()); //MinecraftForge.EVENT_BUS.register(new BetterPortals()); IResourceManager resourceManager = Minecraft.getMinecraft().getResourceManager(); diff --git a/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinRender.java b/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinRender.java new file mode 100644 index 00000000..dcdb4bf4 --- /dev/null +++ b/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinRender.java @@ -0,0 +1,34 @@ +package io.github.moulberry.notenoughupdates.mixins; + +import io.github.moulberry.notenoughupdates.DungeonBlocks; +import io.github.moulberry.notenoughupdates.NotEnoughUpdates; +import io.github.moulberry.notenoughupdates.util.SpecialColour; +import net.minecraft.client.Minecraft; +import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.client.renderer.entity.Render; +import net.minecraft.entity.Entity; +import net.minecraft.entity.passive.EntityBat; +import net.minecraft.util.ResourceLocation; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; + +@Mixin(Render.class) +public class MixinRender { + + @Inject(method="bindEntityTexture", at=@At("HEAD"), cancellable = true) + public void bindEntityTexture(Entity entity, CallbackInfoReturnable cir) { + if(entity instanceof EntityBat && DungeonBlocks.isInDungeons()) { + int tex = DungeonBlocks.getModifiedTexture(new ResourceLocation("textures/entity/bat.png"), + SpecialColour.specialToSimpleRGB(NotEnoughUpdates.INSTANCE.manager.config.dungBatColour.value)); + + if(tex >= 0) { + GlStateManager.bindTexture(tex); + cir.setReturnValue(true); + } + } + } + +} diff --git a/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinRenderBat.java b/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinRenderBat.java deleted file mode 100644 index 93182439..00000000 --- a/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinRenderBat.java +++ /dev/null @@ -1,40 +0,0 @@ -package io.github.moulberry.notenoughupdates.mixins; - -import io.github.moulberry.notenoughupdates.DungeonBlocks; -import io.github.moulberry.notenoughupdates.NotEnoughUpdates; -import io.github.moulberry.notenoughupdates.util.SpecialColour; -import net.minecraft.client.Minecraft; -import net.minecraft.client.renderer.GlStateManager; -import net.minecraft.client.renderer.entity.RenderBat; -import net.minecraft.client.renderer.texture.AbstractTexture; -import net.minecraft.client.renderer.texture.SimpleTexture; -import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer; -import net.minecraft.client.resources.IResourceManager; -import net.minecraft.entity.passive.EntityBat; -import net.minecraft.util.ResourceLocation; -import org.lwjgl.opengl.GL11; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.injection.At; -import org.spongepowered.asm.mixin.injection.Inject; -import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; -import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; - -import java.io.IOException; - -@Mixin({RenderBat.class}) -public abstract class MixinRenderBat { - - @Inject(method="getEntityTexture", at=@At("HEAD"), cancellable = true) - public void getEntityTexture(EntityBat entity, CallbackInfoReturnable<ResourceLocation> cir) { - if(DungeonBlocks.isInDungeons()) { - ResourceLocation rl = new ResourceLocation("notenoughupdates:dynamic/dungeon_bat"); - Minecraft.getMinecraft().getTextureManager().loadTexture(rl, new AbstractTexture() { - public void loadTexture(IResourceManager resourceManager) { - glTextureId = DungeonBlocks.getModifiedTexture(new ResourceLocation("textures/entity/bat.png"), - SpecialColour.specialToSimpleRGB(NotEnoughUpdates.INSTANCE.manager.config.dungBatColour.value)); - } - }); - cir.setReturnValue(rl); - } - } -} diff --git a/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinTileEntitySpecialRenderer.java b/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinTileEntitySpecialRenderer.java index 16e4bfbe..b8a77051 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinTileEntitySpecialRenderer.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinTileEntitySpecialRenderer.java @@ -22,12 +22,15 @@ public abstract class MixinTileEntitySpecialRenderer { @Inject(method="bindTexture", at=@At("HEAD"), cancellable = true) public void bindTexture(ResourceLocation location, CallbackInfo info) { if(DungeonBlocks.isInDungeons() && location.getResourcePath().equals("textures/entity/chest/normal.png")) { - info.cancel(); + int tex = DungeonBlocks.getModifiedTexture(location, + SpecialColour.specialToSimpleRGB(NotEnoughUpdates.INSTANCE.manager.config.dungChestColour.value)); - GlStateManager.bindTexture(DungeonBlocks.getModifiedTexture(location, - SpecialColour.specialToSimpleRGB(NotEnoughUpdates.INSTANCE.manager.config.dungChestColour.value))); - GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MIN_FILTER, GL11.GL_NEAREST_MIPMAP_LINEAR); - GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MAG_FILTER, GL11.GL_NEAREST); + if(tex >= 0) { + info.cancel(); + GlStateManager.bindTexture(tex); + GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MIN_FILTER, GL11.GL_NEAREST_MIPMAP_LINEAR); + GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MAG_FILTER, GL11.GL_NEAREST); + } } } } diff --git a/src/main/java/io/github/moulberry/notenoughupdates/options/Options.java b/src/main/java/io/github/moulberry/notenoughupdates/options/Options.java index c8a596b1..55f81f53 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/options/Options.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/options/Options.java @@ -166,6 +166,11 @@ public class Options { "Show Dungeon Block Overlay Everywhere", false, "If true, will show the overlay for cracked bricks, etc. even when not in dungeons."); + public Option<Boolean> disableDungeonBlocks = new Option( + false, + "Disables the dungeon blocks feature", + false, + "If true, the dungeon block overlay will be disabled."); public Option<Double> paneWidthMult = new Option( 1.0, "Pane Width", @@ -435,6 +440,7 @@ public class Options { tryAddOption(invBazaarPrice, options); tryAddOption(invAuctionPrice, options); tryAddOption(dungeonBlocksEverywhere, options); + tryAddOption(disableDungeonBlocks, options); //Sliders tryAddOption(smoothAoteMillis, options); tryAddOption(bgBlurFactor, options); diff --git a/src/main/java/io/github/moulberry/notenoughupdates/questing/SBInfo.java b/src/main/java/io/github/moulberry/notenoughupdates/questing/SBInfo.java index b647fb1c..2d594ccf 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/questing/SBInfo.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/questing/SBInfo.java @@ -53,10 +53,13 @@ public class SBInfo { if(event.message.getUnformattedText().startsWith("{")) { try { JsonObject obj = NotEnoughUpdates.INSTANCE.manager.gson.fromJson(event.message.getUnformattedText(), JsonObject.class); - if(obj.has("server") && obj.has("gametype") && obj.has("mode") && obj.has("map")) { - locraw = obj; + if(obj.has("server")) { event.setCanceled(true); + if(obj.has("gametype") && obj.has("mode") && obj.has("map")) { + locraw = obj; + } } + } catch(Exception e) { e.printStackTrace(); } diff --git a/src/main/resources/mixins.notenoughupdates.json b/src/main/resources/mixins.notenoughupdates.json index cedde696..65957a53 100644 --- a/src/main/resources/mixins.notenoughupdates.json +++ b/src/main/resources/mixins.notenoughupdates.json @@ -16,6 +16,6 @@ "MixinRenderList", "MixinEntityPlayer", "MixinTileEntitySpecialRenderer", - "MixinRenderBat" + "MixinRender" ] }
\ No newline at end of file |