Skip to content

Commit

Permalink
Texture support
Browse files Browse the repository at this point in the history
Bug fixes:
Catch RuntimeException in BlockColourGen when requesting the render
colour for blocks added by mods.
Fix underground mode exception in End dimension (thanks tterrag1098)
  • Loading branch information
daveyliam committed Dec 17, 2013
1 parent 917ae0a commit 58bd7dd
Show file tree
Hide file tree
Showing 14 changed files with 225 additions and 127 deletions.
4 changes: 1 addition & 3 deletions BlockColourGen.java
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,7 @@ private static int adjustBlockColourFromType(BlockColours bc, int blockAndMeta,
if (renderColour != 0xffffff) {
blockColour = Render.multiplyColours(blockColour, 0xff000000 | renderColour);
}
} catch (ArrayIndexOutOfBoundsException e) {
// do nothing
} catch (NullPointerException e) {
} catch (RuntimeException e) {
// do nothing
}
break;
Expand Down
3 changes: 3 additions & 0 deletions Mw.java
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ public class Mw {
public String saveDirOverride = "";
public boolean regionFileOutputEnabledSP = true;
public boolean regionFileOutputEnabledMP = true;
public int backgroundTextureMode = 0;
//public boolean lightingEnabled = false;

// flags and counters
Expand Down Expand Up @@ -221,6 +222,7 @@ public void loadConfig() {
this.undergroundMode = this.config.getOrSetBoolean(catOptions, "undergroundMode", this.undergroundMode);
this.regionFileOutputEnabledSP = this.config.getOrSetBoolean(catOptions, "regionFileOutputEnabledSP", this.regionFileOutputEnabledSP);
this.regionFileOutputEnabledMP = this.config.getOrSetBoolean(catOptions, "regionFileOutputEnabledMP", this.regionFileOutputEnabledMP);
this.backgroundTextureMode = this.config.getOrSetInt(catOptions, "backgroundTextureMode", this.backgroundTextureMode, 0, 1);
//this.lightingEnabled = this.config.getOrSetBoolean(catOptions, "lightingEnabled", this.lightingEnabled);

this.maxZoom = this.config.getOrSetInt(catOptions, "zoomOutLevels", this.maxZoom, 1, 256);
Expand Down Expand Up @@ -251,6 +253,7 @@ public void saveConfig() {
this.config.setInt(catOptions, "maxDeathMarkers", this.maxDeathMarkers);
this.config.setInt(catOptions, "chunksPerTick", this.chunksPerTick);
this.config.setBoolean(catOptions, "undergroundMode", this.undergroundMode);
this.config.setInt(catOptions, "backgroundTextureMode", this.backgroundTextureMode);
//this.config.setBoolean(catOptions, "lightingEnabled", this.lightingEnabled);

// save config
Expand Down
11 changes: 0 additions & 11 deletions Texture.java
Original file line number Diff line number Diff line change
Expand Up @@ -88,17 +88,6 @@ public synchronized void setRGB(int x, int y, int w, int h, int[] pixels, int of
}
}

public synchronized void setRGBOpaque(int x, int y, int w, int h, int[] pixels, int offset, int scanSize) {
int bufOffset = (y * this.w) + x;
for (int i = 0; i < h; i++) {
this.pixelBuf.position(bufOffset + (i * this.w));
int rowOffset = offset + (i * scanSize);
for (int j = 0; j < w; j++) {
this.pixelBuf.put(pixels[rowOffset + j] | 0xff000000);
}
}
}

public synchronized void setRGB(int x, int y, int colour) {
this.pixelBuf.put((y * this.w) + x, colour);
}
Expand Down
23 changes: 18 additions & 5 deletions gui/MwGuiOptionSlot.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,13 @@ public class MwGuiOptionSlot extends GuiSlot {
"small",
"large"
};
private static final String[] backgroundModeStringArray = {
"none",
"static",
"panning"
};

private GuiButton[] buttons = new GuiButton[11];
private GuiButton[] buttons = new GuiButton[12];

static final ResourceLocation WIDGET_TEXTURE_LOC = new ResourceLocation("textures/gui/widgets.png");

Expand All @@ -50,13 +55,13 @@ public void updateButtonLabel(int i) {
this.buttons[i].displayString = "Texture scaling: " + (this.mw.linearTextureScalingEnabled ? "linear" : "nearest");
break;
case 4:
this.buttons[i].displayString = "Trail Markers: " + (this.mw.playerTrail.enabled);
this.buttons[i].displayString = "Trail markers: " + (this.mw.playerTrail.enabled);
break;
case 5:
this.buttons[i].displayString = "Map Colours: " + (this.mw.useSavedBlockColours ? "Frozen" : "Auto");
this.buttons[i].displayString = "Map colours: " + (this.mw.useSavedBlockColours ? "frozen" : "auto");
break;
case 6:
this.buttons[i].displayString = "Max Draw Distance: " + Math.round(Math.sqrt(this.mw.maxChunkSaveDistSq));
this.buttons[i].displayString = "Max draw distance: " + Math.round(Math.sqrt(this.mw.maxChunkSaveDistSq));
break;
case 7:
this.buttons[i].displayString = "Mini map size: " + this.mw.miniMap.smallMapMode.heightPercent;
Expand All @@ -68,7 +73,10 @@ public void updateButtonLabel(int i) {
this.buttons[i].displayString = "Map pixel snapping: " + (this.mw.mapPixelSnapEnabled ? "enabled" : "disabled");
break;
case 10:
this.buttons[i].displayString = "Max Death Markers: " + this.mw.maxDeathMarkers;
this.buttons[i].displayString = "Max death markers: " + this.mw.maxDeathMarkers;
break;
case 11:
this.buttons[i].displayString = "Background mode: " + backgroundModeStringArray[this.mw.backgroundTextureMode];
break;
//case 11:
// this.buttons[i].displayString = "Map Lighting: " + (this.mw.lightingEnabled ? "enabled" : "disabled");
Expand Down Expand Up @@ -122,6 +130,7 @@ protected void elementClicked(int i, boolean doubleClicked) {
// linear scaling
this.mw.linearTextureScalingEnabled = !this.mw.linearTextureScalingEnabled;
this.mw.mapTexture.setLinearScaling(this.mw.linearTextureScalingEnabled);
this.mw.undergroundMapTexture.setLinearScaling(this.mw.linearTextureScalingEnabled);
break;
case 4:
// player trail
Expand Down Expand Up @@ -183,6 +192,10 @@ protected void elementClicked(int i, boolean doubleClicked) {
this.mw.maxDeathMarkers = 0;
}
break;
case 11:
// background texture mode
this.mw.backgroundTextureMode = (this.mw.backgroundTextureMode + 1) % 3;
break;
//case 11:
// // lighting
// this.mw.lightingEnabled = !this.mw.lightingEnabled;
Expand Down
Loading

0 comments on commit 58bd7dd

Please sign in to comment.