Yatopia/patches/server/0016-lithium-MixinLandPathNodeMaker.patch

93 lines
4.1 KiB
Diff
Raw Normal View History

2020-07-17 18:05:50 +02:00
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
[WIP] Better Patch System (#18) * Update build.yml * Remove 3rd party patches * Add Upsteam Submodules * Fix patches * ? * Fix patches * Add Fast Init script * Lots of stuff also it's broke * more broken * fixes * mor stuff * gfhfgh hg * fix patch * fix up script * update submodule * add papercut * update tuinity * update gitmodules * fix var name * fix more var stuff * some how it's not deleting shit anymore * should now use the branch it just made why are we doing this again? * now it does thing thing * return previous so YAPFA can use it * ok now it really does the thing * for REAL it does the thing * don't do the thing because it causes too many problems * fix api * work * use better patching for YAPFA patches * fix better patching * more fixes * new patches stuff * remove old 3rd parry patches add removed akarin patches * make new branch for making patches * hopefully build patches correctly * fix gitignore and add config patches * remove papercut files * fix some weirdness * fix bug * time to do some fixin' :eyes: * New Patch System Rebased Patches * fix full build * exit 1 * fix * Remove patch * Hopefully fix compile errors * fixes * this might work * don't use rej for our patches * tmp disable cache * some times case sensitivity is dumb * my sanity is at an all time low :) * dfg * readd cahce * fix? * Update Upstream * fix perms * fix * fix api * Redo API * rm folders * fix villager brain patch * emc explosion pref * fixed aikar's shit * betterfix * fix lagggg * Origami * Origami Fixes * Update readme * test async path finding * WIP Async Path Finding * WIP fix async path finding * same as bellow * same * update to newer funcs * fix newer funcs * fix author * Updates, Fixes, and new patches * fixes * possibly async flying path finding * minor asnyc pathfinding fix * test remove non asnyc path finder * WIP make all path finding async * Rename everything * Exec flag * Rebuild hashes * remove dupe patch * fix? * Fix packages, redirect config * old nav class is now async and back * add getchatcolor.getbyid and handle patches with a . in them better Co-authored-by: tr7zw <tr7zw@live.de> Co-authored-by: Unknown <unknown@example.com> Co-authored-by: Ovydux <68059159+Ovydux@users.noreply.github.com>
2020-08-03 18:48:42 +02:00
From: JellySquid <jellysquid+atwork@protonmail.com>
2020-06-27 19:00:18 +02:00
Date: Mon, 11 May 2020 22:56:27 +0200
Subject: [PATCH] lithium MixinLandPathNodeMaker
Original code by JellySquid, licensed under GNU Lesser General Public License v3.0
2020-08-06 23:02:30 +02:00
you can find the original code on https://github.com/jellysquid3/lithium-fabric/tree/1.16.x/fabric (Yarn mappings)
2020-06-27 19:00:18 +02:00
diff --git a/src/main/java/net/minecraft/server/PathfinderNormal.java b/src/main/java/net/minecraft/server/PathfinderNormal.java
index 9caf6598f8a267ce057e863a32ee29fa5fdb0641..56da391b4d415630b881cccbaa50507eb2c23cc0 100644
2020-06-27 19:00:18 +02:00
--- a/src/main/java/net/minecraft/server/PathfinderNormal.java
+++ b/src/main/java/net/minecraft/server/PathfinderNormal.java
@@ -7,9 +7,15 @@ import it.unimi.dsi.fastutil.objects.Object2BooleanOpenHashMap;
import java.util.EnumSet;
import java.util.Iterator;
import javax.annotation.Nullable;
+import it.unimi.dsi.fastutil.objects.Reference2ReferenceMap; // Yatopia
+import it.unimi.dsi.fastutil.objects.Reference2ReferenceOpenHashMap; // Yatopia
2020-06-27 19:00:18 +02:00
public class PathfinderNormal extends PathfinderAbstract {
+ // Yatopia start - this is not thread safe!
+ private static final Reference2ReferenceMap<IBlockData, PathType> commonTypes = new Reference2ReferenceOpenHashMap<>();
+ // Yatopia end
[WIP] Better Patch System (#18) * Update build.yml * Remove 3rd party patches * Add Upsteam Submodules * Fix patches * ? * Fix patches * Add Fast Init script * Lots of stuff also it's broke * more broken * fixes * mor stuff * gfhfgh hg * fix patch * fix up script * update submodule * add papercut * update tuinity * update gitmodules * fix var name * fix more var stuff * some how it's not deleting shit anymore * should now use the branch it just made why are we doing this again? * now it does thing thing * return previous so YAPFA can use it * ok now it really does the thing * for REAL it does the thing * don't do the thing because it causes too many problems * fix api * work * use better patching for YAPFA patches * fix better patching * more fixes * new patches stuff * remove old 3rd parry patches add removed akarin patches * make new branch for making patches * hopefully build patches correctly * fix gitignore and add config patches * remove papercut files * fix some weirdness * fix bug * time to do some fixin' :eyes: * New Patch System Rebased Patches * fix full build * exit 1 * fix * Remove patch * Hopefully fix compile errors * fixes * this might work * don't use rej for our patches * tmp disable cache * some times case sensitivity is dumb * my sanity is at an all time low :) * dfg * readd cahce * fix? * Update Upstream * fix perms * fix * fix api * Redo API * rm folders * fix villager brain patch * emc explosion pref * fixed aikar's shit * betterfix * fix lagggg * Origami * Origami Fixes * Update readme * test async path finding * WIP Async Path Finding * WIP fix async path finding * same as bellow * same * update to newer funcs * fix newer funcs * fix author * Updates, Fixes, and new patches * fixes * possibly async flying path finding * minor asnyc pathfinding fix * test remove non asnyc path finder * WIP make all path finding async * Rename everything * Exec flag * Rebuild hashes * remove dupe patch * fix? * Fix packages, redirect config * old nav class is now async and back * add getchatcolor.getbyid and handle patches with a . in them better Co-authored-by: tr7zw <tr7zw@live.de> Co-authored-by: Unknown <unknown@example.com> Co-authored-by: Ovydux <68059159+Ovydux@users.noreply.github.com>
2020-08-03 18:48:42 +02:00
+
2020-06-27 19:00:18 +02:00
protected float j;
private final Long2ObjectMap<PathType> k = new Long2ObjectOpenHashMap();
private final Object2BooleanMap<AxisAlignedBB> l = new Object2BooleanOpenHashMap();
@@ -490,9 +496,22 @@ public class PathfinderNormal extends PathfinderAbstract {
2020-06-27 19:00:18 +02:00
protected static PathType b(IBlockAccess iblockaccess, BlockPosition blockposition) {
IBlockData iblockdata = iblockaccess.getTypeIfLoaded(blockposition); // Paper
if (iblockdata == null) return PathType.BLOCKED; // Paper
- Block block = iblockdata.getBlock();
- Material material = iblockdata.getMaterial();
+ // Yatopia start - replaced logic
+ //Block block = iblockdata.getBlock();
+ //Material material = iblockdata.getMaterial();
+ if (iblockdata.isAir()) return PathType.OPEN;
2020-06-27 19:00:18 +02:00
+ PathType type = commonTypes.get(iblockdata);
+ if (type == null) {
+ commonTypes.put(iblockdata, type = getPathType(iblockdata));
2020-06-27 19:00:18 +02:00
+ }
2020-06-27 19:00:18 +02:00
+ if (type == PathType.OPEN) {
+ if (!iblockdata.a(iblockaccess, blockposition, PathMode.LAND)) {
+ return PathType.BLOCKED;
+ }
+ }
+
+ /*
if (iblockdata.isAir()) {
return PathType.OPEN;
} else if (!iblockdata.a((Tag) TagsBlock.TRAPDOORS) && !iblockdata.a(Blocks.LILY_PAD)) {
@@ -512,7 +531,38 @@ public class PathfinderNormal extends PathfinderAbstract {
} else {
return PathType.TRAPDOOR;
}
+ */
2020-06-27 19:00:18 +02:00
+ return type;
+ // Yatopia end
2020-06-27 19:00:18 +02:00
+ }
+
+ // Yatopia start
+ private static PathType getPathType(IBlockData iblockdata) {
+ Block block = iblockdata.getBlock();
2020-06-27 19:00:18 +02:00
+ if (!block.a(TagsBlock.TRAPDOORS) && block != Blocks.LILY_PAD) {
+ if (block == Blocks.FIRE) {
+ return PathType.DAMAGE_FIRE;
+ } else if (block == Blocks.CACTUS) {
+ return PathType.DAMAGE_CACTUS;
+ } else if (iblockdata.a(Blocks.SWEET_BERRY_BUSH)) {
+ return PathType.DAMAGE_OTHER;
+ } else if (iblockdata.a(Blocks.HONEY_BLOCK)) {
+ return PathType.STICKY_HONEY;
+ } else if (iblockdata.a(Blocks.COCOA)) {
+ return PathType.COCOA;
+ } else {
+ Fluid fluid = iblockdata.getFluid(); // Tuinity - remove another get type call
+
+ if (fluid.a(TagsFluid.WATER)) return PathType.WATER;
+ if (fluid.a(TagsFluid.LAVA)) return PathType.LAVA;
2020-06-27 19:00:18 +02:00
+
+ return PathType.OPEN;
+ }
+ } else {
+ return PathType.TRAPDOOR;
+ }
}
+ // Yatopia end
private static boolean a(IBlockData iblockdata) {
return iblockdata.a((Tag) TagsBlock.FIRE) || iblockdata.a(Blocks.LAVA) || iblockdata.a(Blocks.MAGMA_BLOCK) || BlockCampfire.g(iblockdata);