Clean up Reader/Writer handling to use a specified charset (#4872)

This commit is contained in:
Ben Staddon authored and mezz committed 2018-04-14 17:00:38 -07:00
1 parent d0566ebadc
commit 97a2143fc2
7 files changed
+29 -23

No files matched your search

@@ -76,7 +76,7 @@ public class BlockStateLoader
byte[] data = IOUtils.toByteArray(reader, StandardCharsets.UTF_8);
reader = new InputStreamReader(new ByteArrayInputStream(data), StandardCharsets.UTF_8);
Marker marker = GSON.fromJson(new String(data), Marker.class); // Read "forge_marker" to determine what to load.
Marker marker = GSON.fromJson(new String(data, StandardCharsets.UTF_8), Marker.class); // Read "forge_marker" to determine what to load.
switch (marker.forge_marker)
{
@@ -22,11 +22,13 @@ package net.minecraftforge.client.model.animation;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStreamReader;
import java.nio.charset.StandardCharsets;
import java.util.Collections;
import java.util.EnumSet;
import java.util.Iterator;
import java.util.Map;
import java.util.NoSuchElementException;
import java.util.Optional;
import java.util.TreeMap;
import javax.annotation.Nullable;
@@ -35,9 +37,6 @@ import javax.vecmath.Matrix4f;
import javax.vecmath.Quat4f;
import javax.vecmath.Vector3f;
import org.apache.commons.io.IOUtils;
import org.apache.logging.log4j.Level;
import net.minecraft.client.renderer.block.model.BlockPart;
import net.minecraft.client.resources.IResource;
import net.minecraft.client.resources.IResourceManager;
@@ -56,7 +55,6 @@ import net.minecraftforge.common.model.animation.JointClips;
import net.minecraftforge.common.util.JsonUtils;
import net.minecraftforge.fml.common.FMLLog;
import java.util.Optional;
import com.google.common.collect.ImmutableCollection;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
@@ -557,7 +555,7 @@ public class ModelBlockAnimation
{
try (IResource resource = manager.getResource(armatureLocation))
{
ModelBlockAnimation mba = mbaGson.fromJson(new InputStreamReader(resource.getInputStream(), "UTF-8"), ModelBlockAnimation.class);
ModelBlockAnimation mba = mbaGson.fromJson(new InputStreamReader(resource.getInputStream(), StandardCharsets.UTF_8), ModelBlockAnimation.class);
//String json = mbaGson.toJson(mba);
return mba;
}