Skip to content

Commit

Permalink
Cleanup patch hunks
Browse files Browse the repository at this point in the history
  • Loading branch information
HaHaWTH committed Dec 7, 2024
1 parent cd40cda commit faf8507
Showing 1 changed file with 1 addition and 107 deletions.
Original file line number Diff line number Diff line change
@@ -1,116 +1,10 @@
--- before/net/minecraft/advancements/AdvancementManager.java
+++ after/net/minecraft/advancements/AdvancementManager.java
@@ -9,6 +9,7 @@
import com.google.gson.JsonObject;
import com.google.gson.JsonParseException;
import java.io.BufferedReader;
+import java.io.Closeable;
import java.io.File;
import java.io.IOException;
import java.io.Reader;
@@ -41,23 +42,14 @@
public class AdvancementManager
{
private static final Logger field_192782_a = LogManager.getLogger();
- public static final Gson field_192783_b = new GsonBuilder()
- .registerTypeHierarchyAdapter(
- Advancement.Builder.class,
- new JsonDeserializer<Advancement.Builder>()
+ public static final Gson field_192783_b = (new GsonBuilder()).registerTypeHierarchyAdapter(Advancement.Builder.class, new JsonDeserializer<Advancement.Builder>()
{
public Advancement.Builder deserialize(JsonElement p_deserialize_1_, Type p_deserialize_2_, JsonDeserializationContext p_deserialize_3_) throws JsonParseException
{
JsonObject jsonobject = JsonUtils.func_151210_l(p_deserialize_1_, "advancement");
return Advancement.Builder.func_192059_a(jsonobject, p_deserialize_3_);
}
- }
- )
- .registerTypeAdapter(AdvancementRewards.class, new AdvancementRewards.Deserializer())
- .registerTypeHierarchyAdapter(ITextComponent.class, new ITextComponent.Serializer())
- .registerTypeHierarchyAdapter(Style.class, new Style.Serializer())
- .registerTypeAdapterFactory(new EnumTypeAdapterFactory())
- .create();
+ }).registerTypeAdapter(AdvancementRewards.class, new AdvancementRewards.Deserializer()).registerTypeHierarchyAdapter(ITextComponent.class, new ITextComponent.Serializer()).registerTypeHierarchyAdapter(Style.class, new Style.Serializer()).registerTypeAdapterFactory(new EnumTypeAdapterFactory()).create();
private static final AdvancementList field_192784_c = new AdvancementList();
private final File field_192785_d;
private boolean field_193768_e;
@@ -74,6 +66,7 @@
@@ -74,6 +74,7 @@
field_192784_c.func_192087_a();
Map<ResourceLocation, Advancement.Builder> map = this.func_192781_c();
this.func_192777_a(map);
+ this.field_193768_e |= net.minecraftforge.common.ForgeHooks.loadAdvancements(map);
field_192784_c.func_192083_a(map);

for (Advancement advancement : field_192784_c.func_192088_b())
@@ -94,11 +87,11 @@
{
if (this.field_192785_d == null)
{
- return Maps.newHashMap();
+ return Maps.<ResourceLocation, Advancement.Builder>newHashMap();
}
else
{
- Map<ResourceLocation, Advancement.Builder> map = Maps.newHashMap();
+ Map<ResourceLocation, Advancement.Builder> map = Maps.<ResourceLocation, Advancement.Builder>newHashMap();
this.field_192785_d.mkdirs();

for (File file1 : FileUtils.listFiles(this.field_192785_d, new String[] {"json"}, true))
@@ -112,9 +105,7 @@

try
{
- Advancement.Builder advancement$builder = JsonUtils.func_188178_a(
- field_192783_b, FileUtils.readFileToString(file1, StandardCharsets.UTF_8), Advancement.Builder.class
- );
+ Advancement.Builder advancement$builder = (Advancement.Builder)JsonUtils.func_188178_a(field_192783_b, FileUtils.readFileToString(file1, StandardCharsets.UTF_8), Advancement.Builder.class);

if (advancement$builder == null)
{
@@ -149,12 +140,7 @@
{
URL url = AdvancementManager.class.getResource("/assets/.mcassetsroot");

- if (url == null)
- {
- field_192782_a.error("Couldn't find .mcassetsroot");
- this.field_193768_e = true;
- }
- else
+ if (url != null)
{
URI uri = url.toURI();
Path path;
@@ -195,7 +181,7 @@
try
{
bufferedreader = Files.newBufferedReader(path1);
- Advancement.Builder advancement$builder = JsonUtils.func_193839_a(field_192783_b, bufferedreader, Advancement.Builder.class);
+ Advancement.Builder advancement$builder = (Advancement.Builder)JsonUtils.func_193839_a(field_192783_b, bufferedreader, Advancement.Builder.class);
p_192777_1_.put(resourcelocation, advancement$builder);
}
catch (JsonParseException jsonparseexception)
@@ -215,16 +201,22 @@
}
}
}
+
+ return;
}
+
+ field_192782_a.error("Couldn't find .mcassetsroot");
+ this.field_193768_e = true;
}
catch (IOException | URISyntaxException urisyntaxexception)
{
field_192782_a.error("Couldn't get a list of all built-in advancement files", (Throwable)urisyntaxexception);
this.field_193768_e = true;
+ return;
}
finally
{
- IOUtils.closeQuietly(filesystem);
+ IOUtils.closeQuietly((Closeable)filesystem);
}
}

0 comments on commit faf8507

Please sign in to comment.