Skip to content

Commit 77f363d

Browse files
authored
Port to 1.11.2 (#289)
I fixed most of the variables that had changed but some stuff had to be commented out and or removed due to the variable not existing. Hopefully will work.
2 parents b1d1b83 + 1451013 commit 77f363d

31 files changed

Lines changed: 104 additions & 138 deletions

src/main/java/com/minecrafttas/mctcommon/KeybindManager.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,10 +69,10 @@ public void registerKeybind(GameSettings options, KeybindID keybindID, Keybind k
6969
this.keybindings.put(keybindID, keybind);
7070
KeyBinding keyBinding = keybind.vanillaKeyBinding;
7171

72-
Map<String, Integer> categoryOrder = AccessorKeyBinding.getCategoryOrder();
72+
//Map<String, Integer> categoryOrder = AccessorKeyBinding.getCategoryOrder();
7373

74-
if (!categoryOrder.containsKey(keybind.category))
75-
categoryOrder.put(keybind.category, categoryOrder.size() + 1);
74+
// if (!categoryOrder.containsKey(keybind.category))
75+
// categoryOrder.put(keybind.category, categoryOrder.size() + 1);
7676

7777
// add keybinding
7878
options.keyBindings = ArrayUtils.add(options.keyBindings, keyBinding);

src/main/java/com/minecrafttas/mctcommon/mixin/AccessorKeyBinding.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@
1010

1111
@Mixin(KeyBinding.class)
1212
public interface AccessorKeyBinding {
13-
14-
@Accessor("CATEGORY_ORDER")
15-
public static Map<String, Integer> getCategoryOrder() {
16-
throw new NotImplementedException("WEE WOO");
17-
}
13+
//
14+
// @Accessor("CATEGORY_ORDER")
15+
// public static Map<String, Integer> getCategoryOrder() {
16+
// throw new NotImplementedException("WEE WOO");
17+
// }
1818
}

src/main/java/com/minecrafttas/mctcommon/mixin/MixinNetHandlerPlayClient.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,11 @@
2020
@Mixin(NetHandlerPlayClient.class)
2121
public class MixinNetHandlerPlayClient {
2222
@Shadow
23-
private Minecraft client;
23+
private Minecraft gameController;
2424

2525
@Inject(method = "handleJoinGame", at = @At(value = "RETURN"))
2626
public void clientJoinServerEvent(CallbackInfo ci) throws ConnectException {
27-
EventListenerRegistry.fireEvent(EventPlayerJoinedClientSide.class, client.player);
27+
EventListenerRegistry.fireEvent(EventPlayerJoinedClientSide.class, gameController.player);
2828
}
2929

3030
@Inject(method = "handlePlayerListItem", at = @At(value = "HEAD"))

src/main/java/com/minecrafttas/tasmod/TASmodClient.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,9 +66,9 @@ public class TASmodClient implements ClientModInitializer, EventClientInit, Even
6666

6767
public static TickSyncClient ticksyncClient;
6868

69-
public final static Path tasfiledirectory = Minecraft.getMinecraft().gameDir.toPath().resolve("saves").resolve("tasfiles");
69+
public final static Path tasfiledirectory = Minecraft.getMinecraft().mcDataDir.toPath().resolve("saves").resolve("tasfiles");
7070

71-
public final static Path savestatedirectory = Minecraft.getMinecraft().gameDir.toPath().resolve("saves").resolve("savestates");
71+
public final static Path savestatedirectory = Minecraft.getMinecraft().mcDataDir.toPath().resolve("saves").resolve("savestates");
7272

7373
public static InfoHud hud;
7474

@@ -354,7 +354,7 @@ private void registerConfigValues() {
354354
}
355355

356356
private void loadConfig(Minecraft mc) {
357-
Path configDir = mc.gameDir.toPath().resolve("config");
357+
Path configDir = mc.mcDataDir.toPath().resolve("config");
358358
if (!Files.exists(configDir)) {
359359
try {
360360
Files.createDirectory(configDir);

src/main/java/com/minecrafttas/tasmod/commands/CommandFileCommand.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@
3737
import net.minecraft.entity.player.EntityPlayer;
3838
import net.minecraft.server.MinecraftServer;
3939
import net.minecraft.util.math.BlockPos;
40-
import net.minecraft.util.text.ChatType;
4140
import net.minecraft.util.text.TextComponentString;
4241
import net.minecraft.util.text.TextFormatting;
4342

@@ -186,7 +185,7 @@ public void onClientPacket(PacketID id, ByteBuffer buf, String username) throws
186185
boolean success = TASmodAPIRegistry.PLAYBACK_FILE_COMMAND.setEnabled(filecommand, enable);
187186

188187
String msg = success ? String.format("%s%s file command: %s", TextFormatting.GREEN, enable ? "Enabled" : "Disabled", filecommand) : String.format("%sFailed to %s file command: %s", TextFormatting.RED, enable ? "enable" : "disable", filecommand);
189-
Minecraft.getMinecraft().ingameGUI.addChatMessage(ChatType.CHAT, new TextComponentString(msg));
188+
Minecraft.getMinecraft().ingameGUI.getChatGUI().printChatMessage(new TextComponentString(msg));
190189
break;
191190
default:
192191
break;

src/main/java/com/minecrafttas/tasmod/commands/CommandRestartAndPlay.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ public List<String> getTabCompletions(MinecraftServer server, ICommandSender sen
5757

5858
public List<String> getFilenames() {
5959
List<String> tab = new ArrayList<String>();
60-
File folder = new File(Minecraft.getMinecraft().gameDir, "saves" + File.separator + "tasfiles");
60+
File folder = new File(Minecraft.getMinecraft().mcDataDir, "saves" + File.separator + "tasfiles");
6161
File[] listOfFiles = folder.listFiles(new FileFilter() {
6262
@Override
6363
public boolean accept(File pathname) {

src/main/java/com/minecrafttas/tasmod/commands/client/ClientCommandRegistry.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
import net.minecraft.client.Minecraft;
99
import net.minecraft.client.entity.EntityPlayerSP;
1010
import net.minecraft.command.CommandBase;
11-
import net.minecraft.util.text.ChatType;
1211
import net.minecraft.util.text.TextComponentString;
1312

1413
public class ClientCommandRegistry extends AbstractRegistry<ClientCommandBase> {
@@ -38,7 +37,7 @@ public boolean runClientCommands(String chatMessage) {
3837
try {
3938
command.execute(null, player, args);
4039
} catch (Exception e) {
41-
mc.ingameGUI.addChatMessage(ChatType.CHAT, new TextComponentString(e.getMessage()));
40+
mc.ingameGUI.getChatGUI().printChatMessage(new TextComponentString(e.getMessage()));
4241
}
4342
return true;
4443
}

src/main/java/com/minecrafttas/tasmod/commands/client/CommandFolder.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
import net.minecraft.command.ICommandSender;
1818
import net.minecraft.server.MinecraftServer;
1919
import net.minecraft.util.math.BlockPos;
20-
import net.minecraft.util.text.ChatType;
2120
import net.minecraft.util.text.Style;
2221
import net.minecraft.util.text.TextComponentString;
2322
import net.minecraft.util.text.TextFormatting;
@@ -79,7 +78,7 @@ private void openSavestates() {
7978
}
8079

8180
if (!Files.exists(file)) {
82-
Minecraft.getMinecraft().ingameGUI.addChatMessage(ChatType.CHAT, new TextComponentString("Can't open savestates, as the directory doesn't exist").setStyle(new Style().setColor(TextFormatting.RED)));
81+
Minecraft.getMinecraft().ingameGUI.getChatGUI().printChatMessage(new TextComponentString("Can't open savestates, as the directory doesn't exist").setStyle(new Style().setColor(TextFormatting.RED)));
8382
return;
8483
}
8584

src/main/java/com/minecrafttas/tasmod/gui/InfoHud.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ private void saveConfig() {
198198
return;
199199
}
200200
try {
201-
File tasmodDir = new File(Minecraft.getMinecraft().gameDir, "tasmod");
201+
File tasmodDir = new File(Minecraft.getMinecraft().mcDataDir, "tasmod");
202202
tasmodDir.mkdir();
203203
File configFile = new File(tasmodDir, "infogui2.cfg");
204204
if (!configFile.exists())
@@ -227,7 +227,7 @@ public boolean checkInit() {
227227
try {
228228
configuration = new Properties();
229229
if (!resetLayout) {
230-
File tasmodDir = new File(Minecraft.getMinecraft().gameDir, "tasmod");
230+
File tasmodDir = new File(Minecraft.getMinecraft().mcDataDir, "tasmod");
231231
tasmodDir.mkdir();
232232
File configFile = new File(tasmodDir, "infogui2.cfg");
233233
if (!configFile.exists())

src/main/java/com/minecrafttas/tasmod/mixin/MixinMinecraft.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,15 +38,15 @@ public void injectRunGameLoop(CallbackInfo ci) {
3838
private EntityRenderer entityRenderer;
3939
@Shadow
4040
private boolean isGamePaused;
41-
@Shadow
42-
private float renderPartialTicksPaused;
41+
//@Shadow
42+
//private float renderPartialTicksPaused;
4343
@Shadow
4444
private Timer timer;
4545

4646
@Redirect(method = "runGameLoop", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/Minecraft;runTick()V"))
4747
public void redirectRunTick(Minecraft mc) {
4848
if (TASmodClient.tickratechanger.ticksPerSecond != 0) {
49-
((SubtickDuck) this.entityRenderer).runUpdate(this.isGamePaused ? this.renderPartialTicksPaused : this.timer.renderPartialTicks);
49+
((SubtickDuck) this.entityRenderer).runUpdate(this.timer.renderPartialTicks);
5050
}
5151
this.runTick();
5252
TASmodClient.tickSchedulerClient.runAllTasks();

0 commit comments

Comments
 (0)