mirror of
https://github.com/MinecraftForge/MinecraftForge.git
synced 2026-11-21 12:42:26 +00:00
Clean up uses of deprecated library functions (#4130)
Avoid catching and rethrowing runtime exceptions Append error messages to exceptions instead of the log
This commit is contained in:
1 parent
ead0e81025
commit
0fde64ac38
44 files changed
+118
-232
No files matched your search
@@ -23,6 +23,7 @@ import java.io.ByteArrayInputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStreamReader;
|
||||
import java.io.Reader;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@@ -37,11 +38,9 @@ import net.minecraftforge.common.model.IModelState;
|
||||
import net.minecraftforge.common.model.TRSRTransformation;
|
||||
|
||||
import net.minecraftforge.fml.common.FMLLog;
|
||||
import org.apache.commons.io.Charsets;
|
||||
import org.apache.commons.io.IOUtils;
|
||||
import org.apache.commons.lang3.tuple.Pair;
|
||||
|
||||
import com.google.common.base.Throwables;
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import com.google.common.collect.Lists;
|
||||
import com.google.common.collect.Maps;
|
||||
@@ -74,8 +73,8 @@ public class BlockStateLoader
|
||||
{
|
||||
try
|
||||
{
|
||||
byte[] data = IOUtils.toByteArray(reader);
|
||||
reader = new InputStreamReader(new ByteArrayInputStream(data), Charsets.UTF_8);
|
||||
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.
|
||||
|
||||
@@ -111,9 +110,8 @@ public class BlockStateLoader
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
Throwables.propagate(e);
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static class Marker
|
||||
@@ -215,7 +213,7 @@ public class BlockStateLoader
|
||||
final IModel model;
|
||||
if (modelLocation == null)
|
||||
{
|
||||
FMLLog.getLogger().error("model not found for variant " + entry.getKey() + "for blockstate " + blockstateLocation);
|
||||
FMLLog.log.error("model not found for variant {} for blockstate {}", entry.getKey(), blockstateLocation);
|
||||
model = ModelLoaderRegistry.getMissingModel(blockstateLocation, new Throwable());
|
||||
}
|
||||
else
|
||||
|
||||
@@ -22,6 +22,7 @@ package net.minecraftforge.client.model.obj;
|
||||
import java.io.BufferedReader;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStreamReader;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
@@ -43,7 +44,6 @@ import javax.vecmath.Vector4f;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.client.renderer.block.model.BakedQuad;
|
||||
import net.minecraft.client.renderer.block.model.IBakedModel;
|
||||
import net.minecraft.client.renderer.block.model.ItemCameraTransforms;
|
||||
import net.minecraft.client.renderer.block.model.ItemCameraTransforms.TransformType;
|
||||
import net.minecraft.client.renderer.block.model.ItemOverrideList;
|
||||
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
||||
@@ -65,7 +65,6 @@ import net.minecraftforge.fml.common.FMLLog;
|
||||
|
||||
import org.apache.commons.lang3.tuple.Pair;
|
||||
|
||||
import com.google.common.base.Charsets;
|
||||
import java.util.function.Function;
|
||||
import com.google.common.base.Objects;
|
||||
import java.util.Optional;
|
||||
@@ -206,7 +205,7 @@ public class OBJModel implements IModel
|
||||
{
|
||||
this.manager = manager;
|
||||
this.objFrom = from.getResourceLocation();
|
||||
this.objStream = new InputStreamReader(from.getInputStream(), Charsets.UTF_8);
|
||||
this.objStream = new InputStreamReader(from.getInputStream(), StandardCharsets.UTF_8);
|
||||
this.objReader = new BufferedReader(objStream);
|
||||
}
|
||||
|
||||
@@ -499,7 +498,7 @@ public class OBJModel implements IModel
|
||||
String domain = from.getResourceDomain();
|
||||
if (!path.contains("/"))
|
||||
path = from.getResourcePath().substring(0, from.getResourcePath().lastIndexOf("/") + 1) + path;
|
||||
mtlStream = new InputStreamReader(manager.getResource(new ResourceLocation(domain, path)).getInputStream(), Charsets.UTF_8);
|
||||
mtlStream = new InputStreamReader(manager.getResource(new ResourceLocation(domain, path)).getInputStream(), StandardCharsets.UTF_8);
|
||||
mtlReader = new BufferedReader(mtlStream);
|
||||
|
||||
String currentLine = "";
|
||||
|
||||
Reference in new issue
Block a user