Skip to content

Commit

Permalink
[Port] Update to a1.1.2_01 (v2.4.3)
Browse files Browse the repository at this point in the history
  • Loading branch information
CDAGaming committed Jun 26, 2024
1 parent 880618b commit 5d704bf
Show file tree
Hide file tree
Showing 14 changed files with 64 additions and 191 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -204,14 +204,14 @@ private void clientTick() {
if (!Constants.IS_GAME_CLOSING) {
instance = getMinecraftInstance();
if (initialized) {
session = instance.field_6320_i;
session = instance.session;
player = instance.thePlayer;

username = session.inventory;
username = session.username;

CommandUtils.reloadData(false);
} else if (instance != null) {
session = instance.field_6320_i;
session = instance.session;
if (session != null) {
init();
}
Expand All @@ -226,7 +226,7 @@ private static void ThrowException(Throwable e) {
public static void ThrowException(String message, Throwable e) {
Minecraft game = getMinecraftInstance();
if (game != null) {
game.handleEntityTeleport(new UnexpectedThrowable(message, e));
game.displayUnexpectedThrowable(new UnexpectedThrowable(message, e));
} else {
throw new RuntimeException(e);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -388,7 +388,7 @@ public static void syncPlaceholders() {

CraftPresence.CLIENT.syncArgument("_general.instance", () -> CraftPresence.instance);
CraftPresence.CLIENT.syncArgument("_general.player", () -> CraftPresence.player);
CraftPresence.CLIENT.syncArgument("_general.world", () -> CraftPresence.player != null ? CraftPresence.player.worldObj : null);
CraftPresence.CLIENT.syncArgument("_general.world", () -> CraftPresence.player != null ? CraftPresence.instance.theWorld : null);
CraftPresence.CLIENT.syncArgument("_config.instance", () -> CraftPresence.CONFIG);

// Sync Custom Variables
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -240,9 +240,9 @@ public Set<Map.Entry<String, KeyBindData>> getKeyEntries() {
*/
void onTick() {
if (!areKeysRegistered()) {
if (CraftPresence.instance.gameSettings != null) {
if (CraftPresence.instance.options != null) {
for (KeyBindData entry : KEY_MAPPINGS.values()) {
CraftPresence.instance.gameSettings.keyBindings = StringUtils.addToArray(CraftPresence.instance.gameSettings.keyBindings, entry.binding());
CraftPresence.instance.options.keyBindings = StringUtils.addToArray(CraftPresence.instance.options.keyBindings, entry.binding());
}
keysRegistered = true;
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ public static Object parseTag(final NBTBase tag) {
return null;
}

switch (tag.setScheduledTime()) {
switch (tag.getType()) {
case 1:
return ((NBTTagByte) tag).byteValue;
case 2:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ public static String getWeather(final World worldObj) {
* @return the current weather data
*/
public static String getWeather(final Entity entity) {
return getWeather(entity != null ? entity.worldObj : null);
return getWeather((World) null);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ public static boolean isEmpty(final Object data) {
if (itemStack.stackSize <= 0) {
return true;
} else {
return itemStack.itemDamage < -32768 || itemStack.itemDamage > 65535;
return itemStack.itemDmg < -32768 || itemStack.itemDmg > 65535;
}
} else {
return true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ public void clearAttributes() {

@Override
public void preTick() {
isFocused = CraftPresence.instance.currentScreen != null && (CraftPresence.instance.field_6289_L || CraftPresence.player != null);
isFocused = CraftPresence.instance.currentScreen != null && (CraftPresence.instance.inGameHasFocus || CraftPresence.player != null);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -262,22 +262,22 @@ public boolean mousePressed(@Nonnull Minecraft arg, int mouseX, int mouseY) {

@Override
public int getControlWidth() {
return xCoord;
return width;
}

@Override
public void setControlWidth(final int width) {
this.xCoord = width;
this.width = width;
}

@Override
public int getControlHeight() {
return yCoord;
return height;
}

@Override
public void setControlHeight(final int height) {
this.yCoord = height;
this.height = height;
}

@Override
Expand Down Expand Up @@ -434,7 +434,7 @@ public void setControlEnabled(final boolean isEnabled) {
* @return Whether the control is currently visible
*/
public boolean isControlVisible() {
return this.enabled2;
return this.visible;
}

/**
Expand All @@ -443,7 +443,7 @@ public boolean isControlVisible() {
* @param isVisible The new visibility state for this control
*/
public void setControlVisible(final boolean isVisible) {
this.enabled2 = isVisible;
this.visible = isVisible;
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -610,7 +610,7 @@ public void postRender() {
}

@Override
public void func_567_a(int tint) {
public void drawWorldBackground(int tint) {
renderCriticalData();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ public void drawScreen(int i, int j, float f) {
GL11.glDisable(2896);
GL11.glDisable(2912);
Tessellator var15 = Tessellator.instance;
GL11.glBindTexture(3553, this.mc.renderEngine.getTexture("/gui/background.png"));
GL11.glBindTexture(3553, this.mc.renderEngine.getTexture("/dirt.png"));
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
float var16 = 32.0F;
var15.startDrawingQuads();
Expand Down Expand Up @@ -214,18 +214,18 @@ public void drawScreen(int i, int j, float f) {
GL11.glShadeModel(7425);
GL11.glDisable(3553);
var15.startDrawingQuads();
var15.setColorRGBA_I(0, 0);
setColorRGBA_I(var15, 0, 0);
var15.addVertexWithUV((double)this.left, (double)(this.top + var17), 0.0, 0.0, 1.0);
var15.addVertexWithUV((double)this.right, (double)(this.top + var17), 0.0, 1.0, 1.0);
var15.setColorRGBA_I(0, 255);
setColorRGBA_I(var15, 0, 255);
var15.addVertexWithUV((double)this.right, (double)this.top, 0.0, 1.0, 0.0);
var15.addVertexWithUV((double)this.left, (double)this.top, 0.0, 0.0, 0.0);
var15.draw();
var15.startDrawingQuads();
var15.setColorRGBA_I(0, 255);
setColorRGBA_I(var15, 0, 255);
var15.addVertexWithUV((double)this.left, (double)this.bottom, 0.0, 0.0, 1.0);
var15.addVertexWithUV((double)this.right, (double)this.bottom, 0.0, 1.0, 1.0);
var15.setColorRGBA_I(0, 0);
setColorRGBA_I(var15, 0, 0);
var15.addVertexWithUV((double)this.right, (double)(this.bottom - var17), 0.0, 1.0, 0.0);
var15.addVertexWithUV((double)this.left, (double)(this.bottom - var17), 0.0, 0.0, 0.0);
var15.draw();
Expand All @@ -246,21 +246,21 @@ public void drawScreen(int i, int j, float f) {
}

var15.startDrawingQuads();
var15.setColorRGBA_I(0, 255);
setColorRGBA_I(var15, 0, 255);
var15.addVertexWithUV((double)var5, (double)this.bottom, 0.0, 0.0, 1.0);
var15.addVertexWithUV((double)var6, (double)this.bottom, 0.0, 1.0, 1.0);
var15.addVertexWithUV((double)var6, (double)this.top, 0.0, 1.0, 0.0);
var15.addVertexWithUV((double)var5, (double)this.top, 0.0, 0.0, 0.0);
var15.draw();
var15.startDrawingQuads();
var15.setColorRGBA_I(8421504, 255);
setColorRGBA_I(var15, 8421504, 255);
var15.addVertexWithUV((double)var5, (double)(var12 + var11), 0.0, 0.0, 1.0);
var15.addVertexWithUV((double)var6, (double)(var12 + var11), 0.0, 1.0, 1.0);
var15.addVertexWithUV((double)var6, (double)var12, 0.0, 1.0, 0.0);
var15.addVertexWithUV((double)var5, (double)var12, 0.0, 0.0, 0.0);
var15.draw();
var15.startDrawingQuads();
var15.setColorRGBA_I(12632256, 255);
setColorRGBA_I(var15, 12632256, 255);
var15.addVertexWithUV((double)var5, (double)(var12 + var11 - 1), 0.0, 0.0, 1.0);
var15.addVertexWithUV((double)(var6 - 1), (double)(var12 + var11 - 1), 0.0, 1.0, 1.0);
var15.addVertexWithUV((double)(var6 - 1), (double)var12, 0.0, 1.0, 0.0);
Expand All @@ -276,16 +276,23 @@ public void drawScreen(int i, int j, float f) {

private void overlayBackground(int i, int j, int k, int l) {
Tessellator var5 = Tessellator.instance;
GL11.glBindTexture(3553, this.mc.renderEngine.getTexture("/gui/background.png"));
GL11.glBindTexture(3553, this.mc.renderEngine.getTexture("/dirt.png"));
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
float var6 = 32.0F;
var5.startDrawingQuads();
var5.setColorRGBA_I(4210752, l);
setColorRGBA_I(var5, 4210752, l);
var5.addVertexWithUV(0.0, (double)j, 0.0, 0.0, (double)((float)j / var6));
var5.addVertexWithUV((double)this.width, (double)j, 0.0, (double)((float)this.width / var6), (double)((float)j / var6));
var5.setColorRGBA_I(4210752, k);
setColorRGBA_I(var5, 4210752, k);
var5.addVertexWithUV((double)this.width, (double)i, 0.0, (double)((float)this.width / var6), (double)((float)i / var6));
var5.addVertexWithUV(0.0, (double)i, 0.0, 0.0, (double)((float)i / var6));
var5.draw();
}

private void setColorRGBA_I(Tessellator instance, int i, int j) {
int var3 = i >> 16 & 255;
int var4 = i >> 8 & 255;
int var5 = i & 255;
instance.setColorRGBA(var3, var4, var5, j);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -220,15 +220,15 @@ public void updateData() {
ServerData newServerData;
try {
if (CraftPresence.instance.theWorld instanceof WorldClient) {
newConnection = (NetClientHandler) StringUtils.getField(WorldClient.class, ((WorldClient)CraftPresence.instance.theWorld), "sendQueue", "field_1052_A", "B");
newConnection = (NetClientHandler) StringUtils.getField(WorldClient.class, ((WorldClient)CraftPresence.instance.theWorld), "sendQueue", "field_1052_A", "A");
}
} catch (Exception ex) {
newConnection = null;
}

try {
String retrievedIP = (String) StringUtils.getField(Minecraft.class, CraftPresence.instance, "serverName", "field_9234_V", "V");
int retrievedPort = (Integer) StringUtils.getField(Minecraft.class, CraftPresence.instance, "serverPort", "field_9233_W", "W");
String retrievedIP = (String) StringUtils.getField(Minecraft.class, CraftPresence.instance, "serverName", "field_9234_V", "S");
int retrievedPort = (Integer) StringUtils.getField(Minecraft.class, CraftPresence.instance, "serverPort", "field_9233_W", "T");
newServerData = (!StringUtils.isNullOrEmpty(retrievedIP) && retrievedPort != 0) ? new ServerData(retrievedIP, retrievedPort) : null;
} catch (Exception ex) {
newServerData = null;
Expand Down Expand Up @@ -468,8 +468,8 @@ public void verifyAndJoin(final String secret) {
private void joinServer(final ServerData serverData) {
try {
if (CraftPresence.player != null) {
CraftPresence.player.worldObj.sendQuittingDisconnectingPacket();
CraftPresence.instance.func_6261_a(null);
CraftPresence.instance.theWorld.sendQuittingDisconnectingPacket();
CraftPresence.instance.changeWorld1(null);
}
CraftPresence.instance.displayGuiScreen(new GuiConnecting(CraftPresence.instance, serverData.serverIP, serverData.serverPort));
} catch (Throwable ex) {
Expand All @@ -492,7 +492,7 @@ public void initPresence() {
syncArgument("world.difficulty", () -> {
final String newDifficulty = false ?
ModUtils.RAW_TRANSLATOR.translate("selectWorld.gameMode.hardcore") :
Integer.toString(CraftPresence.player.worldObj.difficultySetting);
Integer.toString(CraftPresence.instance.theWorld.difficultySetting);
return StringUtils.getOrDefault(newDifficulty);
});
syncArgument("world.weather.name", () -> {
Expand All @@ -507,22 +507,22 @@ public void initPresence() {

// World Time Arguments
syncArgument("world.time.day", () ->
TimeUtils.fromWorldTime(CraftPresence.player.worldObj.worldTime).getFirst()
TimeUtils.fromWorldTime(CraftPresence.instance.theWorld.worldTime).getFirst()
);
syncArgument("world.time.format_24", () ->
TimeUtils.toString(
TimeUtils.fromWorldTime(CraftPresence.player.worldObj.worldTime).getSecond(),
TimeUtils.fromWorldTime(CraftPresence.instance.theWorld.worldTime).getSecond(),
"HH:mm"
)
, true);
syncArgument("world.time.format_12", () ->
TimeUtils.toString(
TimeUtils.fromWorldTime(CraftPresence.player.worldObj.worldTime).getSecond(),
TimeUtils.fromWorldTime(CraftPresence.instance.theWorld.worldTime).getSecond(),
"HH:mm a"
)
, true);
syncArgument("data.world.time.instance", () ->
TimeUtils.fromWorldTime(CraftPresence.player.worldObj.worldTime)
TimeUtils.fromWorldTime(CraftPresence.instance.theWorld.worldTime)
);

// Default Arguments
Expand Down
Loading

0 comments on commit 5d704bf

Please sign in to comment.