Skip to content

Commit 1a5321b

Browse files
committed
Update ReIndev to 2.9_01
1 parent 16e95ad commit 1a5321b

File tree

6 files changed

+14
-204
lines changed

6 files changed

+14
-204
lines changed

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,7 @@ static ZipEntry partialCopy(ZipEntry zipEntry) {
246246
}
247247

248248
String slimHash = project['reindev.slimSHA256Sum'] as String
249-
if (slimURL == "null") {
249+
if (slimURL == "null" || (clientFile.exists() && serverFile.exists() && !slimFile.exists())) {
250250
if (slimFile.exists()) {
251251
byte[] fileData = Files.readAllBytes(slimFile.toPath())
252252
byte[] fileHash = MessageDigest.getInstance("SHA-256").digest(fileData)

gradle.properties

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,12 @@ foxloader.version=2.0-alpha18
99
# https://www.jitpack.io/#com.fox2code/FoxLoader
1010

1111
# ReIndev properties
12-
reindev.slimUrl=https://cdn.fox2code.com/files/reindev-slim-2.9.jar
13-
reindev.slimJar=reindev-slim-2.9.jar
14-
reindev.patchedJar=reindev-foxloader-2.9.jar
15-
reindev.clientJar=reindev-client-2.9.jar
16-
reindev.serverJar=reindev-server-2.9.jar
17-
reindev.slimSHA256Sum=2fd437b85e4fb7e8f7d4bdf70cf2f5d5691386bd27b477074686c8f2e08b238f
12+
reindev.slimUrl=https://cdn.fox2code.com/files/reindev-slim-2.9_01.jar
13+
reindev.slimJar=reindev-slim-2.9_01.jar
14+
reindev.patchedJar=reindev-foxloader-2.9_01.jar
15+
reindev.clientJar=reindev-client-2.9_01.jar
16+
reindev.serverJar=reindev-server-2.9_01.jar
17+
reindev.slimSHA256Sum=a179dd06b090a5296563b8a300de9bd6a63c2b6c226053ecd1baa37b3add3e9f
1818
reindev.version=2.9
1919
reindev.version.allowFrom=2.9
2020

loader/src/main/java/com/fox2code/foxloader/client/CreativeTab.java

Lines changed: 0 additions & 111 deletions
This file was deleted.

loader/src/main/java/com/fox2code/foxloader/registry/GameRegistry.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323
*/
2424
package com.fox2code.foxloader.registry;
2525

26-
import com.fox2code.foxloader.client.CreativeTab;
2726
import com.fox2code.foxloader.energy.FoxPowerCableTileEntity;
2827
import com.fox2code.foxloader.launcher.FoxLauncher;
2928
import com.fox2code.foxloader.loader.ModContainer;
@@ -37,6 +36,7 @@
3736
import com.fox2code.foxloader.registry.missing.MissingBlock;
3837
import com.fox2code.foxloader.registry.missing.MissingItem;
3938
import com.fox2code.foxloader.registry.missing.MissingItemBlock;
39+
import net.minecraft.client.gui.creative.CreativeTab;
4040
import net.minecraft.common.block.Block;
4141
import net.minecraft.common.block.Blocks;
4242
import net.minecraft.common.block.tileentity.TileEntity;
@@ -312,7 +312,7 @@ public static void freeze() {
312312
Item item = Items.ITEMS_LIST[i];
313313
CreativeTab creativeTab;
314314
if (item != null && (creativeTab = item.getRegisterFLTab()) != null) {
315-
creativeTab.addToCreativeTab(item);
315+
creativeTab.add(item);
316316
}
317317
}
318318
for (int i = 0; i < Blocks.BLOCKS_LIST.length; i++) {

patching/src/main/java/com/fox2code/foxloader/patching/game/HotfixesPatch.java

Lines changed: 2 additions & 82 deletions
Original file line numberDiff line numberDiff line change
@@ -23,101 +23,21 @@
2323
*/
2424
package com.fox2code.foxloader.patching.game;
2525

26-
import com.fox2code.foxloader.patching.TransformerUtils;
27-
import org.objectweb.asm.Opcodes;
28-
import org.objectweb.asm.Type;
2926
import org.objectweb.asm.tree.*;
3027

3128
/**
3229
* Theses are just hotfixes for the game, dedicated to fixing ReIndev bugs and crashes.
3330
*/
3431
final class HotfixesPatch extends GamePatch {
35-
private static final String Packet = "net/minecraft/common/networking/Packet";
36-
private static final String Packet249Chunk = "net/minecraft/common/networking/Packet249Chunk";
37-
private static final String Minecraft = "net/minecraft/client/Minecraft";
38-
private static final String GameSettings = "net/minecraft/client/util/GameSettings";
39-
static final boolean USE_HOTFIXES = true;
32+
static final boolean USE_HOTFIXES = false;
4033

4134
HotfixesPatch() {
42-
super(new String[]{Packet, Minecraft, GameSettings});
35+
super(new String[]{});
4336
}
4437

4538
@Override
4639
public ClassNode transform(ClassNode classNode) {
47-
switch (classNode.name) {
48-
case Packet:
49-
patchPacket(classNode);
50-
break;
51-
case Minecraft:
52-
patchMinecraft(classNode);
53-
break;
54-
case GameSettings:
55-
patchGameSettings(classNode);
56-
break;
57-
}
5840
return classNode;
5941
}
6042

61-
private static void patchPacket(ClassNode classNode) {
62-
// Hotfix Packet249Chunk being parsed by the server if sent by the client.
63-
MethodNode clInit = TransformerUtils.getMethod(classNode, "<clinit>");
64-
for (AbstractInsnNode abstractInsnNode : clInit.instructions) {
65-
if (abstractInsnNode.getOpcode() == LDC) {
66-
LdcInsnNode ldcInsnNode = (LdcInsnNode) abstractInsnNode;
67-
if (ldcInsnNode.cst instanceof Type &&
68-
Packet249Chunk.equals(((Type) ldcInsnNode.cst).getInternalName())) {
69-
AbstractInsnNode previous = ldcInsnNode.getPrevious();
70-
AbstractInsnNode previous2 = previous.getPrevious();
71-
if (previous.getOpcode() == ICONST_1 && previous2.getOpcode() == ICONST_1) {
72-
clInit.instructions.set(previous, new InsnNode(ICONST_0));
73-
clInit.instructions.set(previous2, new InsnNode(ICONST_0));
74-
}
75-
break;
76-
}
77-
}
78-
}
79-
}
80-
81-
private static void patchMinecraft(ClassNode classNode) {
82-
// Hotfix switching to fullscreen sometimes causing the game to crash.
83-
MethodNode toggleFullscreenImpl = TransformerUtils.findMethod(classNode, "toggleFullscreenImpl");
84-
FieldNode gameSettingsField = TransformerUtils.findFieldDesc(classNode, "L" + GameSettings + ";");
85-
if (toggleFullscreenImpl == null || gameSettingsField == null) return;
86-
for (AbstractInsnNode abstractInsnNode : toggleFullscreenImpl.instructions) {
87-
MethodInsnNode methodInsnNode;
88-
if (abstractInsnNode.getOpcode() == Opcodes.INVOKEVIRTUAL &&
89-
GameSettings.equals((methodInsnNode = (MethodInsnNode) abstractInsnNode).owner) &&
90-
"setOptionValue".equals(methodInsnNode.name) && methodInsnNode.desc.endsWith(")V")) {
91-
AbstractInsnNode start = TransformerUtils.previousNonCodeInsn(methodInsnNode);
92-
TransformerUtils.removeInstructionsInRange(
93-
toggleFullscreenImpl.instructions, start, methodInsnNode.getNext());
94-
InsnList insnList = new InsnList();
95-
insnList.add(new VarInsnNode(ALOAD, 0));
96-
insnList.add(new FieldInsnNode(GETFIELD, Minecraft,
97-
gameSettingsField.name, gameSettingsField.desc));
98-
insnList.add(new VarInsnNode(ILOAD, 1));
99-
insnList.add(new MethodInsnNode(INVOKEVIRTUAL, GameSettings,
100-
"setFullscreenState", "(Z)V"));
101-
toggleFullscreenImpl.instructions.insert(start, insnList);
102-
}
103-
}
104-
}
105-
106-
private static void patchGameSettings(ClassNode classNode) {
107-
// Hotfix switching to fullscreen sometimes causing the game to crash.
108-
if (TransformerUtils.findMethod(classNode, "setFullscreenState", "(Z)V") != null) {
109-
return;
110-
}
111-
FieldNode fullscreenField = TransformerUtils.getField(classNode, "fullScreen");
112-
MethodNode setFullscreenState = new MethodNode(ACC_PUBLIC,
113-
"setFullscreenState", "(Z)V", null, null);
114-
setFullscreenState.instructions.add(new VarInsnNode(ALOAD, 0));
115-
setFullscreenState.instructions.add(new VarInsnNode(ILOAD, 1));
116-
setFullscreenState.instructions.add(new FieldInsnNode(PUTFIELD,
117-
GameSettings, fullscreenField.name, fullscreenField.desc));
118-
setFullscreenState.instructions.add(new InsnNode(RETURN));
119-
TransformerUtils.setThisParameterName(classNode, setFullscreenState);
120-
TransformerUtils.setParameterName(setFullscreenState, 1, "fullscreen");
121-
classNode.methods.add(setFullscreenState);
122-
}
12343
}

patching/src/main/java/com/fox2code/foxloader/patching/game/RegistryPatch.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,8 @@ final class RegistryPatch extends GamePatch {
9393
private static final String GameRegistry = "com/fox2code/foxloader/registry/GameRegistry";
9494
private static final String GameRegistry$Internal = "com/fox2code/foxloader/registry/GameRegistry$Internal";
9595
private static final String ModContainer = "com/fox2code/foxloader/loader/ModContainer";
96-
private static final String CreativeTab = "com/fox2code/foxloader/client/CreativeTab";
96+
private static final String CreativeTab = "net/minecraft/client/gui/creative/CreativeTab";
97+
private static final String CreativeTabs = "net/minecraft/client/gui/creative/CreativeTabs";
9798

9899
RegistryPatch() {
99100
super(ALL_CLASSES);
@@ -276,7 +277,7 @@ private static void injectGetRegisterFLTab(ClassNode classNode, String creativeT
276277
MethodNode getRegisterFLTab = new MethodNode(ASM_API,
277278
ACC_PUBLIC, "getRegisterFLTab", "()L" + CreativeTab + ";", null, null);
278279
getRegisterFLTab.instructions.add(new FieldInsnNode(
279-
GETSTATIC, CreativeTab, creativeTab, "L" + CreativeTab + ";"));
280+
GETSTATIC, CreativeTabs, creativeTab, "L" + CreativeTab + ";"));
280281
getRegisterFLTab.instructions.add(new InsnNode(ARETURN));
281282
classNode.methods.add(getRegisterFLTab);
282283
}

0 commit comments

Comments
 (0)