Skip to content

Instantly share code, notes, and snippets.

@Mijyuoon
Created October 15, 2018 07:47
Show Gist options
  • Save Mijyuoon/726d98ddfc07bf9a5fe65bf3ebe2ed8c to your computer and use it in GitHub Desktop.
Save Mijyuoon/726d98ddfc07bf9a5fe65bf3ebe2ed8c to your computer and use it in GitHub Desktop.
Shitty MC minimap code
public void updateDisplayVars(Shape shape, Position position, boolean force) {
if (this.dv != null && !force && this.mc.field_71440_d == this.dv.displayHeight && this.mc.field_71443_c == this.dv.displayWidth && this.dv.shape == shape && this.dv.position == position && this.dv.fontScale == (double)this.miniMapProperties.fontScale.get().intValue()) {
return;
}
this.initGridRenderer();
if (force) {
shape = (Shape)this.miniMapProperties.shape.get();
position = (Position)this.miniMapProperties.position.get();
}
this.miniMapProperties.shape.set(shape);
this.miniMapProperties.position.set(position);
this.miniMapProperties.save();
DisplayVars oldDv = this.dv;
this.dv = new DisplayVars(this.mc, this.miniMapProperties);
if (oldDv == null || oldDv.shape != this.dv.shape) {
String timerName = String.format("MiniMap%s.%s", this.miniMapProperties.getId(), shape.name());
this.drawTimer = StatTimer.get(timerName, 100);
this.drawTimer.reset();
this.refreshStateTimer = StatTimer.get(timerName + "+refreshState", 5);
this.refreshStateTimer.reset();
}
double xpad = 0.0;
double ypad = 0.0;
Rectangle2D.Double viewPort = new Rectangle2D.Double((double)this.dv.textureX + xpad, (double)this.dv.textureY + ypad, (double)this.dv.minimapWidth - 2.0 * xpad, (double)this.dv.minimapHeight - 2.0 * ypad);
gridRenderer.setViewPort(viewPort);
MiniMap.updateUIState(true);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment