Skip to content

Commit

Permalink
Revert "MixinCompressedStreamTools : add experimental Thread"
Browse files Browse the repository at this point in the history
This reverts commit a4140e0.
  • Loading branch information
quentin452 committed Jan 22, 2024
1 parent 83186ed commit 0717f27
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 57 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@

import java.io.*;
import java.lang.reflect.Method;
import java.nio.file.Files;

import fr.iamacat.optimizationsandtweaks.utils.optimizationsandtweaks.vanilla.NBTReadThread;
import net.minecraft.crash.CrashReport;
import net.minecraft.crash.CrashReportCategory;
import net.minecraft.nbt.*;
Expand All @@ -24,16 +22,18 @@ public abstract class MixinCompressedStreamTools {
* Load the gzipped compound from the inputstream.
*/
@Overwrite
public static NBTTagCompound readCompressed(InputStream p_74796_0_) {
NBTReadThread thread = new NBTReadThread(p_74796_0_);
thread.start();
public static NBTTagCompound readCompressed(InputStream p_74796_0_) throws IOException {
DataInputStream datainputstream = new DataInputStream(
new BufferedInputStream(new GZIPInputStream2(p_74796_0_)));
NBTTagCompound nbttagcompound;

try {
thread.join();
} catch (InterruptedException e) {
e.printStackTrace();
nbttagcompound = func_152456_a(datainputstream, NBTSizeTracker.field_152451_a);
} finally {
datainputstream.close();
}

return thread.getResult();
return nbttagcompound;
}

/**
Expand Down Expand Up @@ -131,7 +131,8 @@ public static NBTTagCompound func_152456_a(DataInput dataInput, NBTSizeTracker n
}

@Shadow
private static NBTBase func_152455_a(DataInput p_152455_0_, int p_152455_1_, NBTSizeTracker p_152455_2_) {
private static NBTBase func_152455_a(DataInput p_152455_0_, int p_152455_1_, NBTSizeTracker p_152455_2_)
throws IOException {
try {
Method func_150284_a = NBTBase.class.getDeclaredMethod("func_150284_a", byte.class);
Method func_152446_a = NBTBase.class
Expand Down Expand Up @@ -176,7 +177,7 @@ public static void write(NBTTagCompound nbtTagCompound, DataOutput dataOutput) t
}

@Shadow
private static void func_150663_a(NBTBase p_150663_0_, DataOutput p_150663_1_) {
private static void func_150663_a(NBTBase p_150663_0_, DataOutput p_150663_1_) throws IOException {
try {
Method writeMethod = NBTBase.class.getDeclaredMethod("write", DataOutput.class);

Expand Down Expand Up @@ -221,7 +222,7 @@ public static NBTTagCompound func_152458_a(File p_152458_0_, NBTSizeTracker p_15
if (!p_152458_0_.exists()) {
return null;
} else {
DataInputStream datainputstream = new DataInputStream(Files.newInputStream(p_152458_0_.toPath()));
DataInputStream datainputstream = new DataInputStream(new FileInputStream(p_152458_0_));
NBTTagCompound nbttagcompound;

try {
Expand Down

This file was deleted.

0 comments on commit 0717f27

Please sign in to comment.