aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/io/github/moulberry/notenoughupdates/DungeonBlocks.java
diff options
context:
space:
mode:
authorMoulberry <james.jenour@student.scotch.wa.edu.au>2020-10-19 02:06:15 +1100
committerMoulberry <james.jenour@student.scotch.wa.edu.au>2020-10-19 02:06:15 +1100
commit7ebee833e54e95ffcd9dcfbad5744e299102acd9 (patch)
treeddec55c308357f6ed92cb55408353ec40d702595 /src/main/java/io/github/moulberry/notenoughupdates/DungeonBlocks.java
parenta0402708801b525145d01d0f4da17f0ba9d93455 (diff)
downloadnotenoughupdates-7ebee833e54e95ffcd9dcfbad5744e299102acd9.tar.gz
notenoughupdates-7ebee833e54e95ffcd9dcfbad5744e299102acd9.tar.bz2
notenoughupdates-7ebee833e54e95ffcd9dcfbad5744e299102acd9.zip
1.4.2
Diffstat (limited to 'src/main/java/io/github/moulberry/notenoughupdates/DungeonBlocks.java')
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/DungeonBlocks.java24
1 files changed, 19 insertions, 5 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;