Skip to content

Commit cd1b15f

Browse files
committed
Update 1.2.29
1 parent 888f76b commit cd1b15f

File tree

6 files changed

+138
-1
lines changed

6 files changed

+138
-1
lines changed
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
package com.fox2code.foxloader.client.mixins;
2+
3+
import net.minecraft.src.game.nbt.NBTTagIntArray;
4+
import org.spongepowered.asm.mixin.Mixin;
5+
import org.spongepowered.asm.mixin.Overwrite;
6+
import org.spongepowered.asm.mixin.Shadow;
7+
8+
import java.io.DataInput;
9+
import java.io.DataOutput;
10+
import java.io.IOException;
11+
12+
@Mixin(NBTTagIntArray.class)
13+
public class MixinNBTTagIntArray {
14+
@Shadow public int[] intArray;
15+
16+
/**
17+
* Fix NBTTagIntArray saving as NBTTagByteArray
18+
*
19+
* @author Fox2Code
20+
* @reason Just a hotfix
21+
*/
22+
@Overwrite
23+
public byte getType() {
24+
return 11;
25+
}
26+
27+
/**
28+
* Fix NBTTagIntArray not saving/loading anything
29+
*
30+
* @author Fox2Code
31+
* @reason Just a hotfix
32+
*/
33+
@Overwrite
34+
void writeTagContents(DataOutput var1) throws IOException {
35+
var1.writeInt(this.intArray.length);
36+
for (int i : this.intArray) {
37+
var1.writeInt(i);
38+
}
39+
}
40+
41+
/**
42+
* Fix NBTTagIntArray not saving/loading anything
43+
*
44+
* @author Fox2Code
45+
* @reason Just a hotfix
46+
*/
47+
@Overwrite
48+
void readTagContents(DataInput var1) throws IOException {
49+
final int var2 = var1.readInt();
50+
this.intArray = new int[var2];
51+
for (int i = 0; i < var2; i++) {
52+
this.intArray[i] = var1.readInt();
53+
}
54+
}
55+
}

client/src/main/resources/foxloader.client.mixins.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
"MixinItem",
2727
"MixinItemStack",
2828
"MixinMinecraft",
29+
"MixinNBTTagIntArray",
2930
"MixinNetClientHandler",
3031
"MixinPacket",
3132
"MixinPacket2Handshake",

common/src/main/java/com/fox2code/foxloader/loader/PreLoader.java

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,30 @@ static void addCoreMod(File coreMod) {
120120
coreMods.add(coreMod);
121121
}
122122

123+
private static void initializePrePatchReadme(File configFolder) {
124+
File readme = new File(configFolder, "README.md");
125+
if (!readme.exists()) {
126+
try (PrintStream printStream = new PrintStream(readme)) {
127+
printStream.println("# FoxLoader patched jar PatchedMinecraft(Client/Server).jar");
128+
printStream.println("This file is the result of core-mods and mods pre-patchers");
129+
printStream.println("As replacing this file may cause issues, FoxLoader doesn't allow it's replacement");
130+
printStream.println();
131+
printStream.println("If you think you absolutely need to change this file, you are wrong.");
132+
printStream.println("You should put your jar-mods/core-mods in \"/coremods\" instead.");
133+
printStream.println();
134+
printStream.println("To do it, just download the vanilla server or client from ReIndev Discord server");
135+
printStream.println("Change it's bytecode, then place it in \"/coremods\"");
136+
printStream.println("Putting a full server jar in \"/coremods\" is officially supported.");
137+
printStream.println();
138+
printStream.println("Need help? Contact me on Discord: @fox2code");
139+
printStream.println("ReIndev Discord: https://discord.gg/38Vfes6NpR");
140+
printStream.flush();
141+
} catch (FileNotFoundException e) {
142+
ModLoader.getModLoaderLogger().log(Level.WARNING, "Failed to create README file!", e);
143+
}
144+
}
145+
}
146+
123147
static void initializePrePatch(boolean client) {
124148
prePatchInitialized = true;
125149
preLoadMetaJarHash.freeze();
@@ -130,6 +154,7 @@ static void initializePrePatch(boolean client) {
130154
ModLoader.foxLoader.logger.severe("Can't create FoxLoader config folder!");
131155
return;
132156
}
157+
PreLoader.initializePrePatchReadme(configFolder);
133158
File jar = new File(configFolder, client ? "PatchedMinecraftClient.jar" : "PatchedMinecraftServer.jar");
134159
File hash = new File(configFolder, client ? "PatchedMinecraftClient.hash" : "PatchedMinecraftServer.hash");
135160
String jarSize = "";

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ org.gradle.parallel=true
33
org.gradle.jvmargs=-Xmx1024m -XX:-UseGCOverheadLimit -Dfile.encoding=UTF-8
44

55
# FoxLoader properties
6-
foxloader.version=1.2.28
6+
foxloader.version=1.2.29
77
foxloader.lastReIndevTransformerChanges=1.2.28
88
# https://www.jitpack.io/#com.fox2code/FoxLoader
99

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
package com.fox2code.foxloader.server.mixins;
2+
3+
import net.minecraft.src.game.nbt.NBTTagIntArray;
4+
import org.spongepowered.asm.mixin.Mixin;
5+
import org.spongepowered.asm.mixin.Overwrite;
6+
import org.spongepowered.asm.mixin.Shadow;
7+
8+
import java.io.DataInput;
9+
import java.io.DataOutput;
10+
import java.io.IOException;
11+
12+
@Mixin(NBTTagIntArray.class)
13+
public class MixinNBTTagIntArray {
14+
@Shadow public int[] intArray;
15+
16+
/**
17+
* Fix NBTTagIntArray saving as NBTTagByteArray
18+
*
19+
* @author Fox2Code
20+
* @reason Just a hotfix
21+
*/
22+
@Overwrite
23+
public byte getType() {
24+
return 11;
25+
}
26+
27+
/**
28+
* Fix NBTTagIntArray not saving/loading anything
29+
*
30+
* @author Fox2Code
31+
* @reason Just a hotfix
32+
*/
33+
@Overwrite
34+
void writeTagContents(DataOutput var1) throws IOException {
35+
var1.writeInt(this.intArray.length);
36+
for (int i : this.intArray) {
37+
var1.writeInt(i);
38+
}
39+
}
40+
41+
/**
42+
* Fix NBTTagIntArray not saving/loading anything
43+
*
44+
* @author Fox2Code
45+
* @reason Just a hotfix
46+
*/
47+
@Overwrite
48+
void readTagContents(DataInput var1) throws IOException {
49+
final int var2 = var1.readInt();
50+
this.intArray = new int[var2];
51+
for (int i = 0; i < var2; i++) {
52+
this.intArray[i] = var1.readInt();
53+
}
54+
}
55+
}

server/src/main/resources/foxloader.server.mixins.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
"MixinItem",
1717
"MixinItemStack",
1818
"MixinMinecraftServer",
19+
"MixinNBTTagIntArray",
1920
"MixinNetLoginHandler",
2021
"MixinNetServerHandler",
2122
"MixinPlayerController",

0 commit comments

Comments
 (0)