mirror of
https://github.com/YatopiaMC/Yatopia.git
synced 2024-11-29 22:23:50 +01:00
e01705826c
* Updated Upstream and Sidestream(s) (Paper/Purpur/Empirecraft) Upstream/An Sidestream has released updates that appears to apply and compile correctly This update has NOT been tested by YatopiaMC and as with ANY update, please do your own testing. Paper Changes: 2a67a9e51 Fix missing CraftMetaBook#toBuilder override 48aa06106 Add more Wandering Trader API (#5020) 8cec462a5 [CI-SKIP] Remove Astei from the MIT list (#5577) 21fbc3196 [CI-SKIP] Add Other textarea to issue templates (#5562) 453e983e4 fix isProxyOnlineMode coverage, don't lookup UUIDs in offline mode (Fixes #2011) 81cc4f928 Send empty commands if tab completion is disabled (Closes #5519) 9ed3e470d Keep moveToWorld with old method signature 99a66a583 [Auto] Updated Upstream (CraftBukkit) 976c6d425 [CI-SKIP] [Auto] Rebuild Patches 51deec726 Drop unneeded portal patch (#5566) 07a18c457 [Auto] Updated Upstream (CraftBukkit) 6733d7875 [Auto] Updated Upstream (Bukkit) 9958447cb [Auto] Updated Upstream (Bukkit) 840e72091 [CI-SKIP] [Auto] Rebuild Patches a33232d4a Add beacon activation and deactivation events (#5121) Purpur Changes: ebc0765 Updated Upstream (Paper) 5bc5dfd Fix #318 - Stonecutter does not damage when sneaking 8366582 Resolve #286 - Add config and API for item immunity to lightning a86555b Updated Upstream (Paper) 8b2607c Config for only sending advancements to affected players (#312) 7ee3393 Add config for the piston push limit (#311) a30e5ac Add config for void damage dealt 786382b Updated Upstream (Paper) 60d8411 [ci-skip] fix patch name b64f536 Config for changing the blocks that turn into paths (#303) 1d3f710 Updated Upstream (Paper) 3af86ad Oopsie 4b0342a Gamemode extra permissions 17c8573 [CI-SKIP] Don't pass ping to demo command output c3481c0 Initialize the credits command output in config a176fe6 Add credits command Empirecraft Changes: b2879a24 Updated Paper * Updated Upstream and Sidestream(s) (Paper/Tuinity/Airplane/Purpur/Empirecraft) Upstream/An Sidestream has released updates that appears to apply and compile correctly This update has NOT been tested by YatopiaMC and as with ANY update, please do your own testing. Paper Changes: b3cc88799 Add the ability to clear entities from block storage (#5598) f50171f3b Add missing rarity method on ItemStack (#5594) aeb6e7dd2 Updated Upstream (Bukkit/CraftBukkit/Spigot) (#5601) b0a4f353b fix cancelling block falling causing client desync (fixes #5386) (#5419) 8ed45920c Don't annotate type parameters using JetBrains annotations (#5600) d7625d926 Add new methods from PlayerMoveEvent to EntityMoveEvent (#5591) 29785297b Allow for Component suggestion tooltips in AsyncTabCompleteEvent (#5504) 0aea6c2ff Use JsonSerializationContext#serialize instead of recursion for AdventureComponents - fixes #5580 and #5371 8fcef3c1f Return after sending empty commands (#5586) Tuinity Changes: 3350246 Updated Upstream (Paper) f773caf Fix rare ticket level recursion crash 0fa8a0e Starlight Handle concurrent chunk generation and lighting better Airplane Changes: fad74c2 Fix JB annotations for gradle (credit jpenilla) d02f034 Updated Upstream (Tuinity) Purpur Changes: adfe5d3 Updated Upstream (Paper) 7a728f8 Fix #325 - Fix SPIGOT-6278 f5c3dae Updated Upstream (Paper) a80e5b6 Dont create item meta when checking if meta properties exist 90339c5 Add missing netherite from Material#isArmor bedac18 Updated Upstream (Paper, Tuinity, & Airplane) 3b1531a [ci-skip] Add wrapper validation step to actions 73ab4e6 Update the "changing the blocks that turn into paths" defaults to reflect the vanilla defaults. (#322) a24b31b Updated Upstream (Paper) Empirecraft Changes: 87ceb204 Updated Paper a3497a7e Fix some patches 2ed9e7fa Updated Paper d5a47a3d Updated Paper * Updated Upstream and Sidestream(s) (Tuinity) Upstream/An Sidestream has released updates that appears to apply and compile correctly This update has NOT been tested by YatopiaMC and as with ANY update, please do your own testing. Tuinity Changes: 1382473 Null check chunk in block changes for Starlight
110 lines
6.6 KiB
Diff
110 lines
6.6 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: MrIvanPlays <ivan@mrivanplays.com>
|
|
Date: Sun, 9 Aug 2020 22:27:52 +0300
|
|
Subject: [PATCH] Optimize BehaviorController
|
|
|
|
|
|
diff --git a/src/main/java/net/minecraft/world/entity/ai/BehaviorController.java b/src/main/java/net/minecraft/world/entity/ai/BehaviorController.java
|
|
index fc4216cafbd3a81cac319b11ee093bec38827742..e38cdf81e3f3ba1a2ee86c3a202e5643dd9c0fd1 100644
|
|
--- a/src/main/java/net/minecraft/world/entity/ai/BehaviorController.java
|
|
+++ b/src/main/java/net/minecraft/world/entity/ai/BehaviorController.java
|
|
@@ -65,13 +65,16 @@ public class BehaviorController<E extends EntityLiving> {
|
|
|
|
mutableobject.setValue((new MapCodec<BehaviorController<E>>() {
|
|
public <T> Stream<T> keys(DynamicOps<T> dynamicops) {
|
|
- return collection.stream().flatMap((memorymoduletype) -> {
|
|
- return SystemUtils.a(memorymoduletype.getSerializer().map((codec) -> {
|
|
- return IRegistry.MEMORY_MODULE_TYPE.getKey(memorymoduletype);
|
|
- }));
|
|
- }).map((minecraftkey) -> {
|
|
- return dynamicops.createString(minecraftkey.toString());
|
|
- });
|
|
+ // Yatopia start
|
|
+ // about previous impl: WHY ? WHO DID THIS TO YOU?
|
|
+ Collection<T> candidates = new java.util.ArrayList<>();
|
|
+ for (MemoryModuleType<?> moduleType : collection) {
|
|
+ moduleType.getSerializer()
|
|
+ .map(c -> IRegistry.MEMORY_MODULE_TYPE.getKey(moduleType))
|
|
+ .ifPresent(key -> candidates.add(dynamicops.createString(key.toString())));
|
|
+ }
|
|
+ return candidates.stream();
|
|
+ // Yatopia end
|
|
}
|
|
|
|
public <T> DataResult<BehaviorController<E>> decode(DynamicOps<T> dynamicops, MapLike<T> maplike) {
|
|
@@ -83,23 +86,17 @@ public class BehaviorController<E extends EntityLiving> {
|
|
return this.a(memorymoduletype, dynamicops, pair.getSecond());
|
|
});
|
|
|
|
- mutableobject1.setValue(((DataResult) mutableobject1.getValue()).apply2(Builder::add, dataresult1));
|
|
+ mutableobject1.setValue((mutableobject1.getValue()).apply2(Builder::add, dataresult1)); // Yatopia - decompile fix
|
|
});
|
|
- DataResult dataresult = (DataResult) mutableobject1.getValue();
|
|
- Logger logger = BehaviorController.LOGGER;
|
|
+ DataResult<ImmutableList.Builder<BehaviorController.a<?>>> dataresult = mutableobject1.getValue(); // Yatopia - decompile fix
|
|
|
|
- logger.getClass();
|
|
- ImmutableList<BehaviorController.a<?>> immutablelist = (ImmutableList) dataresult.resultOrPartial(logger::error).map(Builder::build).orElseGet(ImmutableList::of);
|
|
- Collection collection2 = collection;
|
|
- Collection collection3 = collection1;
|
|
- MutableObject mutableobject2 = mutableobject;
|
|
+ ImmutableList<BehaviorController.a<?>> immutablelist = dataresult.resultOrPartial(BehaviorController.LOGGER::error).map(Builder::build).orElseGet(ImmutableList::of); // Yatopia - decompile fix
|
|
|
|
- mutableobject.getClass();
|
|
- return DataResult.success(new BehaviorController<>(collection2, collection3, immutablelist, mutableobject2::getValue));
|
|
+ return DataResult.success(new BehaviorController<>(collection, collection1, immutablelist, mutableobject::getValue)); // Yatopia - decompile fix
|
|
}
|
|
|
|
private <T, U> DataResult<BehaviorController.a<U>> a(MemoryModuleType<U> memorymoduletype, DynamicOps<T> dynamicops, T t0) {
|
|
- return ((DataResult) memorymoduletype.getSerializer().map(DataResult::success).orElseGet(() -> {
|
|
+ return (memorymoduletype.getSerializer().map(DataResult::success).orElseGet(() -> { // Yatopia - decompile fix
|
|
return DataResult.error("No codec for memory: " + memorymoduletype);
|
|
})).flatMap((codec) -> {
|
|
return codec.parse(dynamicops, t0);
|
|
@@ -109,9 +106,9 @@ public class BehaviorController<E extends EntityLiving> {
|
|
}
|
|
|
|
public <T> RecordBuilder<T> encode(BehaviorController<E> behaviorcontroller, DynamicOps<T> dynamicops, RecordBuilder<T> recordbuilder) {
|
|
- behaviorcontroller.j().forEach((behaviorcontroller_a) -> {
|
|
+ for (BehaviorController.a<?> behaviorcontroller_a : behaviorcontroller.memoriesList()) { // Yatopia
|
|
behaviorcontroller_a.a(dynamicops, recordbuilder);
|
|
- });
|
|
+ } // Yatopia
|
|
return recordbuilder;
|
|
}
|
|
}).fieldOf("memories").codec());
|
|
@@ -170,6 +167,15 @@ public class BehaviorController<E extends EntityLiving> {
|
|
return ((Codec) this.b.get()).encodeStart(dynamicops, this);
|
|
}
|
|
|
|
+ // Yatopia start
|
|
+ private List<BehaviorController.a<?>> memoriesList() {
|
|
+ List<BehaviorController.a<?>> ret = new java.util.ArrayList<>();
|
|
+ for (Map.Entry<MemoryModuleType<?>, Optional<? extends ExpirableMemory<?>>> entry : memories.entrySet()) {
|
|
+ ret.add(BehaviorController.a.b(entry.getKey(), (Optional) entry.getValue()));
|
|
+ }
|
|
+ return ret;
|
|
+ }
|
|
+ // Yatopia end
|
|
private Stream<BehaviorController.a<?>> j() {
|
|
return this.memories.entrySet().stream().map((entry) -> {
|
|
return BehaviorController.a.b((MemoryModuleType) entry.getKey(), (Optional) entry.getValue());
|
|
@@ -208,7 +214,7 @@ public class BehaviorController<E extends EntityLiving> {
|
|
}
|
|
|
|
public <U> Optional<U> getMemory(MemoryModuleType<U> memorymoduletype) {
|
|
- return ((Optional) this.memories.get(memorymoduletype)).map(ExpirableMemory::c);
|
|
+ return (Optional<U>) this.memories.get(memorymoduletype).map(ExpirableMemory::c); // Yatopia - Decompile fix
|
|
}
|
|
|
|
public <U> boolean b(MemoryModuleType<U> memorymoduletype, U u0) {
|
|
@@ -547,7 +553,7 @@ public class BehaviorController<E extends EntityLiving> {
|
|
private final MemoryModuleType<U> a;
|
|
private final Optional<? extends ExpirableMemory<U>> b;
|
|
|
|
- private static <U> BehaviorController.a<U> b(MemoryModuleType<U> memorymoduletype, Optional<? extends ExpirableMemory<?>> optional) {
|
|
+ private static <U> BehaviorController.a<U> b(MemoryModuleType<U> memorymoduletype, Optional<? extends ExpirableMemory<U>> optional) { // Yatopia - decompile fix
|
|
return new BehaviorController.a<>(memorymoduletype, optional);
|
|
}
|
|
|