Skip to content

Instantly share code, notes, and snippets.

@DV8FromTheWorld
Created July 22, 2014 19:50
Show Gist options
  • Select an option

  • Save DV8FromTheWorld/b2e45fa1d6844f90ba3a to your computer and use it in GitHub Desktop.

Select an option

Save DV8FromTheWorld/b2e45fa1d6844f90ba3a to your computer and use it in GitHub Desktop.
public void onTickInGame(float f, ats mc)
{
try
{
this.renderPartialTicks = f;
this.currentTimeMillis = System.currentTimeMillis();
GL11.glPushAttrib(1048575);
GL11.glPushClientAttrib(-1);
GL11.glPushMatrix();
try
{
if (mc == null) {
return;
}
if (this.errorString != null)
{
this.scaledResolution = new awc(mc.u, mc.d, mc.e);
mc.l.a(this.errorString, this.scaledResolution.a() - mc.l.a(this.errorString) - 2, 2, -65536); return;
}
if (this.theMinecraft == null)
{
((bjj)ats.w().K()).a(this);
this.theMinecraft = mc;
this.ingameGUI = this.theMinecraft.r;
try
{
int temp = 0;
for (Field fields : aur.class.getDeclaredFields()) {
if ((fields.getType() == List.class) && (temp++ == 1))
{
fields.setAccessible(true);
this.chatLineList = ((List)fields.get(this.ingameGUI.b()));
break;
}
}
}
catch (Exception e) {}
this.chatLineList = (this.chatLineList == null ? new ArrayList() : this.chatLineList);
try
{
for (Field field : bgi.class.getDeclaredFields()) {
if (field.getType() == Map.class)
{
WaypointEntityRender wer = new WaypointEntityRender(mc);
wer.a(bgi.a);
field.setAccessible(true);
((Map)field.get(bgi.a)).put(WaypointEntity.class, wer);
break;
}
}
}
catch (Exception e)
{
e.printStackTrace();
}
}
this.thePlayer = this.theMinecraft.h;
this.playerPosX = (this.thePlayer.r + (this.thePlayer.u - this.thePlayer.r) * f);
this.playerPosY = (this.thePlayer.s + (this.thePlayer.v - this.thePlayer.s) * f);
this.playerPosZ = (this.thePlayer.t + (this.thePlayer.w - this.thePlayer.t) * f);
this.playerRotationYaw = (this.thePlayer.C + (this.thePlayer.A - this.thePlayer.C) * f);
this.playerRotationPitch = (this.thePlayer.D + (this.thePlayer.B - this.thePlayer.D) * f);
if (this.theWorld != this.theMinecraft.f)
{
this.updateCount = 0;
this.isUpdateImage = false;
this.texture.unregister();
this.theWorld = this.theMinecraft.f;
this.theWorld.c(new WaypointEntity(this.theMinecraft));
this.multiplayer = (this.theMinecraft.C() == null);
Arrays.fill(this.texture.data, (byte)0);
if (this.theWorld != null)
{
this.worldHeight = (this.theWorld.R() - 1);
ChunkData.init();
boolean changeWorld;
if (this.multiplayer)
{
this.seed = 0L;
String levelName = null;
SocketAddress addr = getRemoteSocketAddress(this.thePlayer);
if (addr == null) {
throw new MinimapException("SMP ADDRESS ACQUISITION FAILURE");
}
boolean changeWorld = this.currentServer != addr;
if (changeWorld)
{
String addrStr = addr.toString().replaceAll("[\r\n]", "");
Matcher matcher = Pattern.compile("(.*)/(.*):([0-9]+)").matcher(addrStr);
if (matcher.matches())
{
levelName = matcher.group(1);
if (levelName.isEmpty()) {
levelName = matcher.group(2);
}
if (!matcher.group(3).equals("25565")) {
levelName = levelName + "[" + matcher.group(3) + "]";
}
}
else
{
String str = addr.toString().replaceAll("[a-z]", "a").replaceAll("[A-Z]", "A").replaceAll("[0-9]", "*");
throw new MinimapException("SMP ADDRESS FORMAT EXCEPTION: " + str);
}
for (char c : v.b) {
levelName = levelName.replace(c, '_');
}
this.currentLevelName = levelName;
this.currentServer = addr;
}
}
else
{
String levelName = this.theMinecraft.C().M();
if (levelName == null) {
throw new MinimapException("WORLD_NAME ACQUISITION FAILURE");
}
for (char c : v.b) {
levelName = levelName.replace(c, '_');
}
changeWorld = (!levelName.equals(this.currentLevelName)) || (this.currentServer != null);
if (changeWorld)
{
this.currentLevelName = levelName;
changeWorld = true;
}
this.currentServer = null;
}
if (changeWorld)
{
this.chatTime = System.currentTimeMillis();
this.chatWelcomed = (!this.multiplayer);
this.allowCavemap = (!this.multiplayer);
this.allowEntitiesRadar = (!this.multiplayer);
this.allowEntityPlayer = (!this.multiplayer);
this.allowEntityAnimal = (!this.multiplayer);
this.allowEntityMob = (!this.multiplayer);
this.allowEntitySlime = (!this.multiplayer);
this.allowEntitySquid = (!this.multiplayer);
this.allowEntityLiving = (!this.multiplayer);
loadWaypoints();
}
}
this.stripCounter.reset();
this.currentDimension = -2147483647;
}
if (this.currentDimension != this.thePlayer.ar)
{
this.currentDimension = this.thePlayer.ar;
this.waypointDimension = this.currentDimension;
this.wayPts = ((List)this.wayPtsMap.get(Integer.valueOf(this.waypointDimension)));
if (this.wayPts == null)
{
this.wayPts = new ArrayList();
this.wayPtsMap.put(Integer.valueOf(this.waypointDimension), this.wayPts);
}
}
if ((!this.chatWelcomed) && (System.currentTimeMillis() < this.chatTime + 10000L))
{
for (ato cl : this.chatLineList)
{
if ((cl == null) || (this.chatLineLast == cl)) {
break;
}
Matcher matcher = Pattern.compile("§0§0((?:§[1-9a-d])+)§e§f").matcher(cl.a());
while (matcher.find())
{
this.chatWelcomed = true;
for (char ch : matcher.group(1).toCharArray()) {
switch (ch)
{
case '1':
this.allowCavemap = true;
break;
case '2':
this.allowEntityPlayer = true;
break;
case '3':
this.allowEntityAnimal = true;
break;
case '4':
this.allowEntityMob = true;
break;
case '5':
this.allowEntitySlime = true;
break;
case '6':
this.allowEntitySquid = true;
break;
case '7':
this.allowEntityLiving = true;
}
}
}
}
this.chatLineLast = (this.chatLineList.isEmpty() ? null : (ato)this.chatLineList.get(0));
if (this.chatWelcomed)
{
this.allowEntitiesRadar = ((this.allowEntityPlayer) || (this.allowEntityAnimal) || (this.allowEntityMob) || (this.allowEntitySlime) || (this.allowEntitySquid) || (this.allowEntityLiving));
if (this.allowCavemap) {
chatInfo("§E[Rei's Minimap] enabled: cavemapping.");
}
if (this.allowEntitiesRadar)
{
StringBuilder sb = new StringBuilder("§E[Rei's Minimap] enabled: entities radar (");
if (this.allowEntityPlayer) {
sb.append("Player, ");
}
if (this.allowEntityAnimal) {
sb.append("Animal, ");
}
if (this.allowEntityMob) {
sb.append("Mob, ");
}
if (this.allowEntitySlime) {
sb.append("Slime, ");
}
if (this.allowEntitySquid) {
sb.append("Squid, ");
}
if (this.allowEntityLiving) {
sb.append("Living, ");
}
sb.setLength(sb.length() - 2);
sb.append(")");
chatInfo(sb.toString());
}
}
}
else
{
this.chatWelcomed = true;
}
this.visibleEntitiesRadar = ((this.allowEntitiesRadar) && (this.configEntitiesRadar));
this.visibleEntityPlayer = ((this.allowEntityPlayer) && (this.configEntityPlayer));
this.visibleEntityAnimal = ((this.allowEntityAnimal) && (this.configEntityAnimal));
this.visibleEntityMob = ((this.allowEntityMob) && (this.configEntityMob));
this.visibleEntitySlime = ((this.allowEntitySlime) && (this.configEntitySlime));
this.visibleEntitySquid = ((this.allowEntitySquid) && (this.configEntitySquid));
this.visibleEntityLiving = ((this.allowEntityLiving) && (this.configEntityLiving));
nm ticksEntity = this.thePlayer.o == null ? this.thePlayer : this.thePlayer.o;
if (ticksEntity.ac != this.ticksExisted)
{
if (this.updateTexture)
{
this.updateTexture = false;
ChunkData.updateTexture();
}
this.updateCount += 1;
this.ticksExisted = this.thePlayer.ac;
for (int z = -8; z <= 8; z++) {
for (int x = -8; x <= 8; x++)
{
ChunkData cd = ChunkData.createChunkData(this.thePlayer.aj + x, this.thePlayer.al + z);
if (cd != null) {
cd.updateChunk(this.preloadedChunks);
}
}
}
for (List<oe> list : this.visibleEntities) {
list.clear();
}
this.weatherEffects.clear();
if (this.visibleEntitiesRadar)
{
for (nm entity : this.theWorld.e)
{
int type = getVisibleEntityType(entity);
if (type != -1) {
this.visibleEntities[type].add((oe)entity);
}
}
this.weatherEffects.addAll(this.theWorld.i);
}
}
int displayWidth = this.theMinecraft.d;
int displayHeight = this.theMinecraft.e;
this.scaledResolution = new awc(this.theMinecraft.u, displayWidth, displayHeight);
GL11.glScaled(1.0D / this.scaledResolution.e(), 1.0D / this.scaledResolution.e(), 1.0D);
this.scWidth = mc.d;
this.scHeight = mc.e;
KeyInput.update();
if (mc.n == null)
{
if (!this.fullmap)
{
if (KeyInput.TOGGLE_ZOOM.isKeyPush())
{
if (this.theMinecraft.u.Q.e) {
this.flagZoom = ((this.flagZoom == 0 ? ZOOM_LIST.length : this.flagZoom) - 1);
} else {
this.flagZoom = ((this.flagZoom + 1) % ZOOM_LIST.length);
}
}
else if ((KeyInput.ZOOM_IN.isKeyPush()) && (this.flagZoom < ZOOM_LIST.length - 1)) {
this.flagZoom += 1;
} else if ((KeyInput.ZOOM_OUT.isKeyPush()) && (this.flagZoom > 0)) {
this.flagZoom -= 1;
}
this.targetZoom = ZOOM_LIST[this.flagZoom];
}
else
{
if (KeyInput.TOGGLE_ZOOM.isKeyPush())
{
if (this.theMinecraft.u.Q.e) {
this.largeZoom = ((this.largeZoom == 0 ? ZOOM_LIST.length : this.largeZoom) - 1);
} else {
this.largeZoom = ((this.largeZoom + 1) % ZOOM_LIST.length);
}
}
else if ((KeyInput.ZOOM_IN.isKeyPush()) && (this.largeZoom < ZOOM_LIST.length - 1)) {
this.largeZoom += 1;
} else if ((KeyInput.ZOOM_OUT.isKeyPush()) && (this.largeZoom > 0)) {
this.largeZoom -= 1;
}
this.targetZoom = ZOOM_LIST[this.largeZoom];
}
if (KeyInput.TOGGLE_ENABLE.isKeyPush())
{
this.enable = (!this.enable);
this.stripCounter.reset();
this.forceUpdate = true;
}
if (KeyInput.TOGGLE_RENDER_TYPE.isKeyPush())
{
if (this.theMinecraft.u.Q.e)
{
this.renderType -= 1;
if (this.renderType < 0) {
this.renderType = (EnumOption.RENDER_TYPE.getValueNum() - 1);
}
if ((!this.allowCavemap) && (EnumOption.RENDER_TYPE.getValue(this.renderType) == EnumOptionValue.CAVE)) {
this.renderType -= 1;
}
}
else
{
this.renderType += 1;
if ((!this.allowCavemap) && (EnumOption.RENDER_TYPE.getValue(this.renderType) == EnumOptionValue.CAVE)) {
this.renderType += 1;
}
if (this.renderType >= EnumOption.RENDER_TYPE.getValueNum()) {
this.renderType = 0;
}
}
this.stripCounter.reset();
this.forceUpdate = true;
}
if (KeyInput.TOGGLE_WAYPOINTS_DIMENSION.isKeyPush()) {
if (this.theMinecraft.u.Q.e) {
prevDimension();
} else {
nextDimension();
}
}
if (KeyInput.TOGGLE_WAYPOINTS_VISIBLE.isKeyPush()) {
this.visibleWaypoints = (!this.visibleWaypoints);
}
if (KeyInput.TOGGLE_WAYPOINTS_MARKER.isKeyPush()) {
this.marker = (!this.marker);
}
if (KeyInput.TOGGLE_LARGE_MAP.isKeyPush())
{
this.fullmap = (!this.fullmap);
this.currentZoom = (this.targetZoom = ZOOM_LIST[this.flagZoom]);
this.forceUpdate = true;
this.stripCounter.reset();
if (this.threading)
{
this.lock.lock();
try
{
this.stripCounter.reset();
mapCalc(false);
}
finally
{
this.lock.unlock();
}
}
}
if ((KeyInput.TOGGLE_LARGE_MAP_LABEL.isKeyPush()) && (this.fullmap)) {
this.largeMapLabel = (!this.largeMapLabel);
}
if ((this.allowEntitiesRadar) && (KeyInput.TOGGLE_ENTITIES_RADAR.isKeyPush())) {
this.configEntitiesRadar = (!this.configEntitiesRadar);
}
if (KeyInput.SET_WAYPOINT.isKeyPushUp())
{
this.waypointDimension = this.currentDimension;
this.wayPts = ((List)this.wayPtsMap.get(Integer.valueOf(this.waypointDimension)));
if (this.wayPts == null)
{
this.wayPts = new ArrayList();
this.wayPtsMap.put(Integer.valueOf(this.waypointDimension), this.wayPts);
}
mc.a(new GuiWaypointEditorScreen(mc, null));
}
if (KeyInput.WAYPOINT_LIST.isKeyPushUp()) {
mc.a(new GuiWaypointScreen(null));
}
if (KeyInput.MENU_KEY.isKeyPush()) {
mc.a(new GuiOptionScreen());
}
}
else if (this.fullmap)
{
this.currentZoom = (this.targetZoom = ZOOM_LIST[this.flagZoom]);
this.fullmap = false;
this.forceUpdate = true;
this.stripCounter.reset();
}
if ((!this.allowCavemap) && (EnumOption.RENDER_TYPE.getValue(this.renderType) == EnumOptionValue.CAVE)) {
this.renderType = 0;
}
if ((this.deathPoint) && ((this.theMinecraft.n instanceof auz)) && (!(this.guiScreen instanceof auz)))
{
this.waypointDimension = this.currentDimension;
this.wayPts = ((List)this.wayPtsMap.get(Integer.valueOf(this.currentDimension)));
if (this.wayPts == null)
{
this.wayPts = new ArrayList();
this.wayPtsMap.put(Integer.valueOf(this.currentDimension), this.wayPts);
}
String name = "Death Point";
int x = lr.c(this.playerPosX);
int y = lr.c(this.playerPosY);
int z = lr.c(this.playerPosZ);
Random rng = new Random();
float r = rng.nextFloat();
float g = rng.nextFloat();
float b = rng.nextFloat();
boolean contains = false;
for (Waypoint wp : this.wayPts) {
if ((wp.type == 1) && (wp.x == x) && (wp.y == y) && (wp.z == z) && (wp.enable))
{
contains = true;
break;
}
}
if (!contains)
{
this.wayPts.add(new Waypoint(name, x, y, z, true, r, g, b, 1));
saveWaypoints();
}
}
this.guiScreen = this.theMinecraft.n;
if ((!this.enable) || (!checkGuiScreen(mc.n)) || (BlockDataPack.defaultBlockColor == null)) {
return;
}
if (this.threading)
{
if ((this.workerThread == null) || (!this.workerThread.isAlive()))
{
this.workerThread = new Thread(this);
this.workerThread.setPriority(3 + this.threadPriority);
this.workerThread.setDaemon(true);
this.workerThread.start();
}
}
else {
mapCalc(true);
}
if (this.lock.tryLock()) {
try
{
if (this.isUpdateImage)
{
this.isUpdateImage = false;
this.texture.setMinFilter(this.filtering);
this.texture.setMagFilter(this.filtering);
this.texture.setClampTexture(true);
this.texture.register();
}
this.condition.signal();
}
finally
{
this.lock.unlock();
}
}
this.currentTime = System.nanoTime();
double elapseTime = (this.currentTime - this.previousTime) * 1.E-009D;
this.zoomVisible = ((float)(this.zoomVisible - elapseTime));
if (this.currentZoom != this.targetZoom)
{
double d = Math.max(0.0D, Math.min(1.0D, elapseTime * 4.0D));
this.currentZoom += (this.targetZoom - this.currentZoom) * d;
if (Math.abs(this.currentZoom - this.targetZoom) < 0.0005D) {
this.currentZoom = this.targetZoom;
}
this.zoomVisible = 3.0F;
}
this.previousTime = this.currentTime;
if (this.texture.getId() != 0)
{
int scale = this.fontScale == 0 ? this.scaledResolution.e() + 1 >> 1 : this.fontScale;
int x;
int y;
switch (this.mapPosition)
{
case 0:
x = 37;
y = 37;
break;
case 1:
x = 37;
y = this.scHeight - 37;
y -= scale * (((this.showMenuKey | this.showCoordinate) ? 2 : 0) + (this.showMenuKey ? 9 : 0) + (this.showCoordinate ? 18 : 0)) / this.scaledResolution.e();
break;
case 2:
default:
x = this.scWidth - 37;
y = 37;
break;
case 3:
x = this.scWidth - 37;
y = this.scHeight - 37;
y -= scale * (((this.showMenuKey | this.showCoordinate) ? 2 : 0) + (this.showMenuKey ? 9 : 0) + (this.showCoordinate ? 18 : 0)) / this.scaledResolution.e();
}
if (this.fullmap) {
renderFullMap();
} else if (this.roundmap) {
renderRoundMap();
} else {
renderSquareMap();
}
}
}
catch (RuntimeException e)
{
e.printStackTrace();
this.errorString = ("[Rei's Minimap] ERROR: " + e.getMessage());
error("mainloop runtime exception", e);
}
finally
{
GL11.glPopMatrix();
GL11.glPopClientAttrib();
GL11.glPopAttrib();
}
if (this.count != 0) {
this.theMinecraft.l.a(String.format("%12d", new Object[] { Long.valueOf(this.ntime / this.count) }), 2, 12, -1);
}
Thread.yield();
}
finally {}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment