From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Spottedleaf Date: Fri, 31 Mar 2023 20:40:28 -0700 Subject: [PATCH] MC-Dev fixes diff --git a/src/main/java/net/minecraft/world/entity/ai/Brain.java b/src/main/java/net/minecraft/world/entity/ai/Brain.java index dea20f16ac97402f754c8e47d03e9ef38de73190..21e5d1451f90194aa415cf0a183d1a731854f605 100644 --- a/src/main/java/net/minecraft/world/entity/ai/Brain.java +++ b/src/main/java/net/minecraft/world/entity/ai/Brain.java @@ -72,15 +72,15 @@ public class Brain { } public DataResult> decode(DynamicOps dynamicOps, MapLike mapLike) { - MutableObject>>> mutableObject = new MutableObject<>(DataResult.success(ImmutableList.builder())); + MutableObject>>> mutableObject2 = new MutableObject<>(DataResult.success(ImmutableList.builder())); // Folia - decompile fix mapLike.entries().forEach((pair) -> { DataResult> dataResult = BuiltInRegistries.MEMORY_MODULE_TYPE.byNameCodec().parse(dynamicOps, pair.getFirst()); DataResult> dataResult2 = dataResult.flatMap((memoryType) -> { return this.captureRead(memoryType, dynamicOps, (T)pair.getSecond()); }); - mutableObject.setValue(mutableObject.getValue().apply2(ImmutableList.Builder::add, dataResult2)); + mutableObject2.setValue(mutableObject2.getValue().apply2(ImmutableList.Builder::add, dataResult2)); // Folia - decompile fix }); - ImmutableList> immutableList = mutableObject.getValue().resultOrPartial(Brain.LOGGER::error).map(ImmutableList.Builder::build).orElseGet(ImmutableList::of); + ImmutableList> immutableList = mutableObject2.getValue().resultOrPartial(Brain.LOGGER::error).map(ImmutableList.Builder::build).orElseGet(ImmutableList::of); // Folia - decompile fix return DataResult.success(new Brain<>(memoryModules, sensors, immutableList, mutableObject::getValue)); } @@ -181,14 +181,14 @@ public class Brain { if (optional == null) { throw new IllegalStateException("Unregistered memory fetched: " + type); } else { - return optional.map(ExpirableValue::getValue); + return (Optional)optional.map(ExpirableValue::getValue); // Folia - decompile fix } } @Nullable public Optional getMemoryInternal(MemoryModuleType type) { Optional> optional = this.memories.get(type); - return optional == null ? null : optional.map(ExpirableValue::getValue); + return optional == null ? null : (Optional)optional.map(ExpirableValue::getValue); // Folia - decompile fix } public long getTimeUntilExpiry(MemoryModuleType type) { @@ -483,7 +483,7 @@ public class Brain { private final Optional> value; static Brain.MemoryValue createUnchecked(MemoryModuleType type, Optional> data) { - return new Brain.MemoryValue<>(type, data); + return new Brain.MemoryValue<>(type, (Optional>)data); // Folia - decompile fix } MemoryValue(MemoryModuleType type, Optional> data) {