Yatopia/patches/server/0064-lithium-shape.patch

359 lines
14 KiB
Diff
Raw Permalink Normal View History

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: JellySquid <jellysquid+atwork@protonmail.com>
Date: Wed, 27 Jan 2021 21:05:05 +0100
Subject: [PATCH] lithium shape
Co-authored-by: Hugo Planque <hookwood01@gmail.com>
diff --git a/src/main/java/me/jellysquid/mods/lithium/common/block/LithiumEntityShapeContext.java b/src/main/java/me/jellysquid/mods/lithium/common/block/LithiumEntityShapeContext.java
new file mode 100644
index 0000000000000000000000000000000000000000..85d55d144a38a16d0f148a29cd11985d7febe880
--- /dev/null
+++ b/src/main/java/me/jellysquid/mods/lithium/common/block/LithiumEntityShapeContext.java
@@ -0,0 +1,55 @@
+package me.jellysquid.mods.lithium.common.block;
+
+import net.minecraft.core.BlockPosition;
+import net.minecraft.world.entity.Entity;
+import net.minecraft.world.entity.EntityLiving;
+import net.minecraft.core.EnumDirection;
+import net.minecraft.world.level.material.Fluid;
+import net.minecraft.world.level.material.FluidTypeFlowing;
+import net.minecraft.world.item.Item;
+import net.minecraft.world.item.Items;
+import net.minecraft.world.phys.shapes.VoxelShape;
+import net.minecraft.world.phys.shapes.VoxelShapeCollision;
+
+/**
+ * A replacement for EntityShapeContext that does not calculate the heldItem on construction. As most instances never
+ * use this field, a lazy evaluation is faster on average. The initialization of the heldItem field takes about 1% of
+ * the server thread CPU time in a fresh world with lots of animals (singleplayer 1.16.5, renderdistance 24).
+ *
+ * @author 2No2Name
+ */
+public class LithiumEntityShapeContext implements VoxelShapeCollision {
+ private final Entity entity;
+ private final boolean descending;
+ private final double minY;
+ private Item heldItem;
+
+ public LithiumEntityShapeContext(Entity entity) {
+ this.entity = entity;
+ this.descending = entity.isDescending();
+ this.minY = entity.locY();
+ }
+
+ @Override
+ public boolean a(Item item) {
+ if (this.heldItem == null) {
+ this.heldItem = entity instanceof EntityLiving ? ((EntityLiving)entity).getItemInMainHand().getItem() : Items.AIR;
+ }
+ return this.heldItem == item;
+ }
+
+ @Override
+ public boolean a(Fluid aboveState, FluidTypeFlowing fluid) {
+ return this.entity instanceof EntityLiving && ((EntityLiving) this.entity).a(fluid) && !aboveState.getType().a(fluid);
+ }
+
+ @Override
+ public boolean b() {
+ return this.descending;
+ }
+
+ @Override
+ public boolean a(VoxelShape shape, BlockPosition pos, boolean defaultValue) {
+ return this.minY > (double)pos.getY() + shape.getMax(EnumDirection.EnumAxis.Y) - 9.999999747378752E-6D;
+ }
+}
\ No newline at end of file
diff --git a/src/main/java/me/jellysquid/mods/lithium/common/shapes/pairs/LithiumDoublePairList.java b/src/main/java/me/jellysquid/mods/lithium/common/shapes/pairs/LithiumDoublePairList.java
new file mode 100644
index 0000000000000000000000000000000000000000..bfa06e714050260779fc8727b4b2cabb6f811398
--- /dev/null
+++ b/src/main/java/me/jellysquid/mods/lithium/common/shapes/pairs/LithiumDoublePairList.java
@@ -0,0 +1,117 @@
+package me.jellysquid.mods.lithium.common.shapes.pairs;
+
+import it.unimi.dsi.fastutil.doubles.DoubleArrayList;
+import it.unimi.dsi.fastutil.doubles.DoubleList;
+import net.minecraft.world.phys.shapes.VoxelShapeMerger;
+
+/**
+ * Optimized variant of {@link net.minecraft.util.shape.SimplePairList}. This implementation works directly against
+ * flat arrays and tries to organize code in a manner that hits the JIT's happy path. In my testing, this is about
+ * ~50% faster than the vanilla implementation.
+ */
+public final class LithiumDoublePairList implements VoxelShapeMerger {
+ private final double[] merged;
+ private final int[] indicesFirst;
+ private final int[] indicesSecond;
+
+ private final DoubleArrayList pairs;
+
+ public LithiumDoublePairList(DoubleList aPoints, DoubleList bPoints, boolean flag1, boolean flag2) {
+ int size = aPoints.size() + bPoints.size();
+
+ this.merged = new double[size];
+ this.indicesFirst = new int[size];
+ this.indicesSecond = new int[size];
+
+ this.pairs = DoubleArrayList.wrap(this.merged);
+
+ this.merge(getArray(aPoints), getArray(bPoints), aPoints.size(), bPoints.size(), flag1, flag2);
+ }
+
+ private void merge(double[] aPoints, double[] bPoints, int aSize, int bSize, boolean flag1, boolean flag2) {
+ int aIdx = 0;
+ int bIdx = 0;
+
+ double prev = 0.0D;
+
+ int a1 = 0, a2 = 0;
+
+ while (true) {
+ boolean aWithinBounds = aIdx < aSize;
+ boolean bWithinBounds = bIdx < bSize;
+
+ if (!aWithinBounds && !bWithinBounds) {
+ break;
+ }
+
+ boolean flip = aWithinBounds && (!bWithinBounds || aPoints[aIdx] < bPoints[bIdx] + 1.0E-7D);
+
+ double value;
+
+ if (flip) {
+ value = aPoints[aIdx++];
+ } else {
+ value = bPoints[bIdx++];
+ }
+
+ if ((aIdx == 0 || !aWithinBounds) && !flip && !flag2) {
+ continue;
+ }
+
+ if ((bIdx == 0 || !bWithinBounds) && flip && !flag1) {
+ continue;
+ }
+
+ if (a2 == 0 || prev < value - 1.0E-7D) {
+ this.indicesFirst[a1] = aIdx - 1;
+ this.indicesSecond[a1] = bIdx - 1;
+ this.merged[a2] = value;
+
+ a1++;
+ a2++;
+ prev = value;
+ } else if (a2 > 0) {
+ this.indicesFirst[a1 - 1] = aIdx - 1;
+ this.indicesSecond[a1 - 1] = bIdx - 1;
+ }
+ }
+
+ if (a2 == 0) {
+ this.merged[a2++] = Math.min(aPoints[aSize - 1], bPoints[bSize - 1]);
+ }
+
+ this.pairs.size(a2);
+ }
+
+ @Override
+ public boolean a(VoxelShapeMerger.a predicate) {
+ int l = this.pairs.size() - 1;
+
+ for (int i = 0; i < l; i++) {
+ if (!predicate.merge(this.indicesFirst[i], this.indicesSecond[i], i)) {
+ return false;
+ }
+ }
+
+ return true;
+ }
+
+ @Override
+ public DoubleList a() {
+ return this.pairs;
+ }
+
+ private static double[] getArray(DoubleList list) {
+ if (list instanceof DoubleArrayList) {
+ return ((DoubleArrayList) list).elements();
+ }
+
+ double[] points = new double[list.size()];
+
+ for (int i = 0; i < points.length; i++) {
+ points[i] = list.getDouble(i);
+ }
+
+ return points;
+ }
+}
diff --git a/src/main/java/me/jellysquid/mods/lithium/common/util/collections/Object2BooleanCacheTable.java b/src/main/java/me/jellysquid/mods/lithium/common/util/collections/Object2BooleanCacheTable.java
new file mode 100644
index 0000000000000000000000000000000000000000..e210e0fa39b74805429832c3d232fadb33975414
--- /dev/null
+++ b/src/main/java/me/jellysquid/mods/lithium/common/util/collections/Object2BooleanCacheTable.java
@@ -0,0 +1,61 @@
+package me.jellysquid.mods.lithium.common.util.collections;
+
+import it.unimi.dsi.fastutil.HashCommon;
+import net.minecraft.util.MathHelper;
+
+import java.util.function.Predicate;
+
+/**
+ * A lossy hashtable implementation that stores a mapping between an object and a boolean.
+ * <p>
+ * Any hash collisions will result in an overwrite: this is safe because the correct value can always be recomputed,
+ * given that the given operator is deterministic.
+ * <p>
+ * This implementation is safe to use from multiple threads
+ */
+public final class Object2BooleanCacheTable<T> {
+ private final int capacity;
+ private final int mask;
+
+ private final Node<T>[] nodes;
+
+ private final Predicate<T> operator;
+
+ @SuppressWarnings("unchecked")
+ public Object2BooleanCacheTable(int capacity, Predicate<T> operator) {
+ this.capacity = MathHelper.smallestEncompassingPowerOfTwo(capacity);
+ this.mask = this.capacity - 1;
+
+ this.nodes = (Node<T>[]) new Node[this.capacity];
+
+ this.operator = operator;
+ }
+
+ private static <T> int hash(T key) {
+ return HashCommon.mix(key.hashCode());
+ }
+
+ public boolean get(T key) {
+ int idx = hash(key) & this.mask;
+
+ Node<T> node = this.nodes[idx];
+ if (node != null && key.equals(node.key)) {
+ return node.value;
+ }
+
+ boolean test = this.operator.test(key);
+ this.nodes[idx] = new Node<>(key, test);
+
+ return test;
+ }
+
+ static class Node<T> {
+ final T key;
+ final boolean value;
+
+ Node(T key, boolean value) {
+ this.key = key;
+ this.value = value;
+ }
+ }
+}
diff --git a/src/main/java/net/minecraft/util/MathHelper.java b/src/main/java/net/minecraft/util/MathHelper.java
index b95115aca72ba0cf6451096ddbd8b50a8f3bb5c6..0afb8c643cb3e5938e12183c6132797d6ed645bb 100644
--- a/src/main/java/net/minecraft/util/MathHelper.java
+++ b/src/main/java/net/minecraft/util/MathHelper.java
@@ -198,6 +198,7 @@ public class MathHelper {
return c(f, f + f3, f2);
}
+ public static int smallestEncompassingPowerOfTwo(int i){ return c(i); } // Yatopia - OBFHELPER
public static int c(int i) {
int j = i - 1;
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
Upstream (#502) * Updated Upstream and Sidestream(s) (Paper/Purpur/Origami) 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: 2299159bb Add option to fix items merging through blocks (#5334) d8c20ddc7 Fix PlayerBucketEmptyEvent result itemstack (#5698) ceb3762fb Add PufferFishStateChangeEvent (#5606) cd4defec0 [CI-SKIP] Update version checker to use V2 downloads API (#5728) b9f2a673d Limit item frame cursors on maps (#5730) 81a537c1f Add PlayerKickEvent causes (#5648) b7976b956 Add More Lidded Block API (#5707) Purpur Changes: b88aef3a Fix Paper#4748 - Shulkerbox allow oversized stacks 9fec1bae Updated Upstream (Paper) 2aacc766 Update Toothpick to 1.1.0-SNAPSHOT a08d7470 Configurable anvil cumulative cost (#352) Origami Changes: 3b8adab Fix importing of classes not working if their directory doesn't exist * Updated Upstream and Sidestream(s) (Paper/Tuinity/Purpur/Empirecraft/Origami) 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: 525d0e3d3 fix beacon activate/deactivate events (#5646) e403d6aaf [Auto] Updated Upstream (CraftBukkit) 6bcd8b57c Updated Upstream (CraftBukkit) (#5742) 501cc9448 Reset villager inventory on cancelled pickup event (#5738) 3f72a549b Exit with non-zero exit code when killed by watchdog (#5732) a8d7ad099 Updated Upstream (Bukkit/CraftBukkit) (#5735) Tuinity Changes: e9c8348 Revert entity ticking chunk map for tracker Purpur Changes: 687936be Updated Upstream (Paper) 4c2d7e56 Fix advancement triggers on entity death 49a0fb90 Fix oversized shulker box dupe e92d259e Fix raid captains not giving voluntary exile advancement a97fdc48 Config to broadcast the death message to the affected player (#363) 9bf8e165 Add burn in daylight API for LivingEntity (#331) 96460068 Fix dupe bug caused by SPIGOT-6452 2618c24f Revert "allow disabling offline mode message on an ONLINE MODE proxy" aa79fa5c allow disabling offline mode message on an ONLINE MODE proxy 830141ca Bee can work when raining or at night (#365) ae6ca468 Updated Upstream (Paper) d99cc6e8 [ci-skip] Add better issue templates (#360) Empirecraft Changes: 12009c31 Updated Paper 5305540d Updated Paper 1043bd94 Revert "Call EntityPickupItemEvent for villagers" CB commit 820b9bdf Updated Paper Origami Changes: 64fba4f Fix importing of classes not working if their directory doesn't exist 3b8adab Fix importing of classes not working if their directory doesn't exist * rebuild Patches
2021-05-30 01:17:00 +02:00
index 2ed54208faf35ea5b4ea8540e95886b56d4d11fe..4b64a8f7ca507a54871c3b4929e663a60897870d 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
Upstream (#490) * Updated Upstream and Sidestream(s) (Paper/Tuinity/Airplane/Purpur/Origami) 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: 151457628 Fix Counter#decrement recursive call (#5665) 21ac7dc98 [Auto] Updated Upstream (CraftBukkit) 18ad2c9dd Add environment variable (PAPER_DISABLE_SERVER_GUI) to disable server gui 6ecbe5776 Rename leftover resource->datapack (#5662) ec90a7859 I give up on trying to teach people to avoid the incorrect ways. dc7b7a160 Fix missing username console death message (#5654) (#5658) c639a52a6 Add basic Datapack API (#5653) (#5653) 99c1d9da6 Updated Upstream (CraftBukkit) (#5652) 2d50c17e2 [CI-SKIP] Add PR rebasing steps (#5634) 2c5f8085e Remove boat interaction event (Fixes #5539) 96ee1fb8f fix WorldSaveEvent not firing with /save-all (#5650) e90e7829e remove unneeded patch (#5641) d875bacc2 Activate warning by default when people are doing silly things (#5642) cb896d471 Updated Upstream (Bukkit/CraftBukkit/Spigot) (#5643) ecbf5a38e Revert "Updated Upstream (Bukkit/CraftBukkit/Spigot) (#5636)" 20fc4ab70 Updated Upstream (Bukkit/CraftBukkit/Spigot) (#5636) 20d8812ea Fix CraftPotionBrewer cache (#5632) cd6ae8816 Add a "Should Burn in Sunlight" API for Phantoms and Skeletons (#5608) 25edfe58b Remove unneeded component conversion for kick msg (#5626) cec386f66 Call PortalCreateEvent when players enter the end (#5618) 453c7f05c Add ItemStack#displayName to get the formatted display name of an ItemStack (#5628) 4efe8b498 Update Java version warning (#5621) e0a021ccc Add ItemStack#getTranslationKey() (#5616) 53d71b717 Add setPotionUseTimeLeft to Witch (#5597) 239935d18 Add Inventory#close (#5610) 29bf6cd41 Updated Upstream (CraftBukkit) ad45f316c Add raw address to AsyncPlayerPreLoginEvent (#5614) 28865335a [Auto] Updated Upstream (CraftBukkit) 750049fa2 Fix incorrect colors in some log messages (#5609) c5fa3f0d4 Add Adventure message to PlayerAdvancementDoneEvent (#5030) 69c09cdb0 Updated Upstream (CraftBukkit) (#5607) Tuinity Changes: 1222573 Fix incorrect status dataconverter for pre 1.13 chunks Airplane Changes: 3dce697 Fix gradle stuff 209bce3 Patches Purpur Changes: 72708f4 Option to disable dragon egg teleporting 5f87a45 Updated Upstream (Paper) 7bfc70d swap heavy logic to end bb9d72d Fix #338 - Phantoms always burning bug 8fa99b3 Configurable critical damage multiplier (#339) dc4a1cb Updated Upstream (Paper & Tuinity) c166841 Configurable powered rail boost modifier (closes #329) (#333) ab9b8ca Updated Upstream (Paper & Airplane) 44e72f7 Let parrots breed using any tempting item 09d98d3 this part is important, too :3 2015fe5 Breedable parrots 552d783 Iron golem poppy calms anger 1fa06a1 Optimize collisions (#328) 1112240 Extend Halloween Optimization (#321) 03f1aec Config for health to impact Creeper explosion radius (#304) 8f7bce4 Add config for hidden from entity selector patch 21906a2 Hide hidden players from entity selector 445496d [ci-skip] fix this too, now.. jfc 3ba8c81 Ya'll didn't see nothing.. 2d4611b Updated Upstream (Paper) beed258 Better offline mode warning (#330) c1efe3c It's meant to be double :facepalm: 3f9958b Implement the Mob Blindness mod 6e98c88 Add missing repo to settings.gradle.kts da5185b Update Gradle to 7.0.1 fbd28d8 Updated Upstream (Paper & Tuinity) cb42dec Updated Upstream (Paper) e883991 Fix compatibility with MyPet Origami Changes: 4c0616d Update Paper * Updated Upstream and Sidestream(s) (Paper) 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: 45e19ffb0 [Auto] Updated Upstream (CraftBukkit) * Updated Upstream and Sidestream(s) (Paper/Purpur) 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: 7989028a5 More Enchantment API (#5588) c0cb5c129 Adds methods for checking item repairability (#5651) 22399b07f Actually use extended/ambient in BeaconEffectEvent (#5647) 979135878 Add cause and cancel message to PlayerGameModeChangeEvent (#5638) 51e1e58d2 Fix Adventure support in UnknownCommandEvent (#5664) Purpur Changes: ca9be56 Do not allow duplicate unsafe enchants * Updated Upstream and Sidestream(s) (Paper/Purpur/Paper) 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: 7989028a5 More Enchantment API (#5588) c0cb5c129 Adds methods for checking item repairability (#5651) 22399b07f Actually use extended/ambient in BeaconEffectEvent (#5647) 979135878 Add cause and cancel message to PlayerGameModeChangeEvent (#5638) 51e1e58d2 Fix Adventure support in UnknownCommandEvent (#5664) Purpur Changes: ca9be56 Do not allow duplicate unsafe enchants Paper Changes: 322886c86 Avoid NPE due to PlayerBedFailEnterEvent d3c9a195c removed duplicate ProjectileHitEvent for fireball (#5671) * Updated Upstream and Sidestream(s) (Paper/Airplane/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: 2c6b1f048 Revert "Remove itneract event from boat" (Fixes #5677) aae1c54a9 Add command line option to load extra plugin jars not in the plugins folder Airplane Changes: 4a22184 Updated Upstream (Tuinity) Empirecraft Changes: d0aaf527 Updated Paper * Updated Upstream and Sidestream(s) (Airplane/Purpur) 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. Airplane Changes: 046ae54 Improve hopper performance via bitset Purpur Changes: c333d3d Add config for the unverified username message (#348) 703b5da Fix invulnerable-while-accepting-resource-pack not being used * Updated Upstream and Sidestream(s) (Paper/Purpur) 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: 6c183f1ae [Auto] Updated Upstream (CraftBukkit) Purpur Changes: e0991e0 allow using legacy section symbol in unverified username message 6bd246b Updated Upstream (Paper) * Updated Upstream and Sidestream(s) (Airplane) 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. Airplane Changes: 5fab6a2 Improvements to fluid & profiler patches * 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: 41e6073ce [Auto] Updated Upstream (CraftBukkit) 6f93dc95d Add cause to Weather/ThunderChangeEvents (#4832) 507cf19b3 [CI-SKIP] [Auto] Rebuild Patches afe0785bf Added PlayerPurchaseEvent for standalone Merchant GUIs (#5583) 615df3d8a Fix entity motion tag from mob spawners (#5718) 2d34898b5 Add methods for getting default item attributes (#5593) d9766433e Add EntityInsideBlockEvent (#5596) 47d48790d Change return type of ItemStack#editMeta to allow checking for successful vs non-successful edits 7aabe7d56 [CI-SKIP] fix minecart vs minecraft typos (#5713) f775e87b4 [CI-SKIP] ci: update setup-java action (#5710) c58b3b277 ci: replace Java 11 with Java 16 in GH Actions build flow (#5709) 4b72327a6 ItemStack#editMeta 68984b664 Add Unix domain socket support (#5611) 68c67e680 Add Mob#lookAt API (#5633) 4bacecd16 [Auto] Updated Upstream (Bukkit/CraftBukkit) 1f28e6eeb Fix default ChatRenderer when no plugins are installed (#5702) ecb0d32ca Enhance (Async)ChatEvent with per-viewer rendering API (#5684) f3e541ca1 Actually list all missing hard depends (#5701) 11f83fe8e [CI-SKIP] [Auto] Rebuild Patches a36e5d65f MC-148809: Fix incorrect structure block data length 3dcbdc73b Fix force upgrade patch (#5699) dab6ec6cd List all missing hard depends not just first (#5673) aed5031e3 Fix/Optimize world and light datafixes (#5693) 719040d92 [Auto] Updated Upstream (CraftBukkit) Tuinity Changes: f0e91a4 Updated Upstream (Paper) f88659c Fix and optimise world force upgrading Airplane Changes: 636dbff [ci skip] Cleanup mcdev import files c579320 [ci skip] Remove icons 7ada9a4 [skip ci] Need to specify 1.16.5 in the README of course 813df1a Update README daf3f0b Optimize air case for raytracing 1c252a5 Update Tuinity URL 50babee Updated Upstream (Tuinity) 85e0c63 Revert "Allow plugins to stupidly replace server internals" db3fe2c Remove auto import 6b32e01 Allow plugins to stupidly replace server internals f849f00 Flare Update ac10e43 Flare Update 7f3b091 Move check 040fa19 Better checking for useless move packets Purpur Changes: adb0cafe Updated Upstream (Paper) f9ccf6dd Updated Upstream (Paper & Airplane) 1343a050 Updated Upstream (Paper, Tuinity, & Airplane) af2dd61a Updated Upstream (Paper, Tuinity, & Airplane) 1808888a Expand gamemode extra perms some more Empirecraft Changes: 9e2881e6 Don't dismount on teleports... 7ed16bf3 Updated Paper c3d0a1b2 Re-add missing line in Vehicle teleporting patch * drop Improved-oversized-chunk-data-packet-handling.patch
2021-05-27 04:01:31 +02:00
@@ -2676,6 +2676,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, ne
return this.isSneaking();
}
+ public boolean isDescending() { return by(); } // Yatopia - OBFHELPER
public boolean by() {
return this.isSneaking();
}
diff --git a/src/main/java/net/minecraft/world/level/block/Block.java b/src/main/java/net/minecraft/world/level/block/Block.java
Upstream (#490) * Updated Upstream and Sidestream(s) (Paper/Tuinity/Airplane/Purpur/Origami) 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: 151457628 Fix Counter#decrement recursive call (#5665) 21ac7dc98 [Auto] Updated Upstream (CraftBukkit) 18ad2c9dd Add environment variable (PAPER_DISABLE_SERVER_GUI) to disable server gui 6ecbe5776 Rename leftover resource->datapack (#5662) ec90a7859 I give up on trying to teach people to avoid the incorrect ways. dc7b7a160 Fix missing username console death message (#5654) (#5658) c639a52a6 Add basic Datapack API (#5653) (#5653) 99c1d9da6 Updated Upstream (CraftBukkit) (#5652) 2d50c17e2 [CI-SKIP] Add PR rebasing steps (#5634) 2c5f8085e Remove boat interaction event (Fixes #5539) 96ee1fb8f fix WorldSaveEvent not firing with /save-all (#5650) e90e7829e remove unneeded patch (#5641) d875bacc2 Activate warning by default when people are doing silly things (#5642) cb896d471 Updated Upstream (Bukkit/CraftBukkit/Spigot) (#5643) ecbf5a38e Revert "Updated Upstream (Bukkit/CraftBukkit/Spigot) (#5636)" 20fc4ab70 Updated Upstream (Bukkit/CraftBukkit/Spigot) (#5636) 20d8812ea Fix CraftPotionBrewer cache (#5632) cd6ae8816 Add a "Should Burn in Sunlight" API for Phantoms and Skeletons (#5608) 25edfe58b Remove unneeded component conversion for kick msg (#5626) cec386f66 Call PortalCreateEvent when players enter the end (#5618) 453c7f05c Add ItemStack#displayName to get the formatted display name of an ItemStack (#5628) 4efe8b498 Update Java version warning (#5621) e0a021ccc Add ItemStack#getTranslationKey() (#5616) 53d71b717 Add setPotionUseTimeLeft to Witch (#5597) 239935d18 Add Inventory#close (#5610) 29bf6cd41 Updated Upstream (CraftBukkit) ad45f316c Add raw address to AsyncPlayerPreLoginEvent (#5614) 28865335a [Auto] Updated Upstream (CraftBukkit) 750049fa2 Fix incorrect colors in some log messages (#5609) c5fa3f0d4 Add Adventure message to PlayerAdvancementDoneEvent (#5030) 69c09cdb0 Updated Upstream (CraftBukkit) (#5607) Tuinity Changes: 1222573 Fix incorrect status dataconverter for pre 1.13 chunks Airplane Changes: 3dce697 Fix gradle stuff 209bce3 Patches Purpur Changes: 72708f4 Option to disable dragon egg teleporting 5f87a45 Updated Upstream (Paper) 7bfc70d swap heavy logic to end bb9d72d Fix #338 - Phantoms always burning bug 8fa99b3 Configurable critical damage multiplier (#339) dc4a1cb Updated Upstream (Paper & Tuinity) c166841 Configurable powered rail boost modifier (closes #329) (#333) ab9b8ca Updated Upstream (Paper & Airplane) 44e72f7 Let parrots breed using any tempting item 09d98d3 this part is important, too :3 2015fe5 Breedable parrots 552d783 Iron golem poppy calms anger 1fa06a1 Optimize collisions (#328) 1112240 Extend Halloween Optimization (#321) 03f1aec Config for health to impact Creeper explosion radius (#304) 8f7bce4 Add config for hidden from entity selector patch 21906a2 Hide hidden players from entity selector 445496d [ci-skip] fix this too, now.. jfc 3ba8c81 Ya'll didn't see nothing.. 2d4611b Updated Upstream (Paper) beed258 Better offline mode warning (#330) c1efe3c It's meant to be double :facepalm: 3f9958b Implement the Mob Blindness mod 6e98c88 Add missing repo to settings.gradle.kts da5185b Update Gradle to 7.0.1 fbd28d8 Updated Upstream (Paper & Tuinity) cb42dec Updated Upstream (Paper) e883991 Fix compatibility with MyPet Origami Changes: 4c0616d Update Paper * Updated Upstream and Sidestream(s) (Paper) 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: 45e19ffb0 [Auto] Updated Upstream (CraftBukkit) * Updated Upstream and Sidestream(s) (Paper/Purpur) 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: 7989028a5 More Enchantment API (#5588) c0cb5c129 Adds methods for checking item repairability (#5651) 22399b07f Actually use extended/ambient in BeaconEffectEvent (#5647) 979135878 Add cause and cancel message to PlayerGameModeChangeEvent (#5638) 51e1e58d2 Fix Adventure support in UnknownCommandEvent (#5664) Purpur Changes: ca9be56 Do not allow duplicate unsafe enchants * Updated Upstream and Sidestream(s) (Paper/Purpur/Paper) 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: 7989028a5 More Enchantment API (#5588) c0cb5c129 Adds methods for checking item repairability (#5651) 22399b07f Actually use extended/ambient in BeaconEffectEvent (#5647) 979135878 Add cause and cancel message to PlayerGameModeChangeEvent (#5638) 51e1e58d2 Fix Adventure support in UnknownCommandEvent (#5664) Purpur Changes: ca9be56 Do not allow duplicate unsafe enchants Paper Changes: 322886c86 Avoid NPE due to PlayerBedFailEnterEvent d3c9a195c removed duplicate ProjectileHitEvent for fireball (#5671) * Updated Upstream and Sidestream(s) (Paper/Airplane/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: 2c6b1f048 Revert "Remove itneract event from boat" (Fixes #5677) aae1c54a9 Add command line option to load extra plugin jars not in the plugins folder Airplane Changes: 4a22184 Updated Upstream (Tuinity) Empirecraft Changes: d0aaf527 Updated Paper * Updated Upstream and Sidestream(s) (Airplane/Purpur) 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. Airplane Changes: 046ae54 Improve hopper performance via bitset Purpur Changes: c333d3d Add config for the unverified username message (#348) 703b5da Fix invulnerable-while-accepting-resource-pack not being used * Updated Upstream and Sidestream(s) (Paper/Purpur) 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: 6c183f1ae [Auto] Updated Upstream (CraftBukkit) Purpur Changes: e0991e0 allow using legacy section symbol in unverified username message 6bd246b Updated Upstream (Paper) * Updated Upstream and Sidestream(s) (Airplane) 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. Airplane Changes: 5fab6a2 Improvements to fluid & profiler patches * 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: 41e6073ce [Auto] Updated Upstream (CraftBukkit) 6f93dc95d Add cause to Weather/ThunderChangeEvents (#4832) 507cf19b3 [CI-SKIP] [Auto] Rebuild Patches afe0785bf Added PlayerPurchaseEvent for standalone Merchant GUIs (#5583) 615df3d8a Fix entity motion tag from mob spawners (#5718) 2d34898b5 Add methods for getting default item attributes (#5593) d9766433e Add EntityInsideBlockEvent (#5596) 47d48790d Change return type of ItemStack#editMeta to allow checking for successful vs non-successful edits 7aabe7d56 [CI-SKIP] fix minecart vs minecraft typos (#5713) f775e87b4 [CI-SKIP] ci: update setup-java action (#5710) c58b3b277 ci: replace Java 11 with Java 16 in GH Actions build flow (#5709) 4b72327a6 ItemStack#editMeta 68984b664 Add Unix domain socket support (#5611) 68c67e680 Add Mob#lookAt API (#5633) 4bacecd16 [Auto] Updated Upstream (Bukkit/CraftBukkit) 1f28e6eeb Fix default ChatRenderer when no plugins are installed (#5702) ecb0d32ca Enhance (Async)ChatEvent with per-viewer rendering API (#5684) f3e541ca1 Actually list all missing hard depends (#5701) 11f83fe8e [CI-SKIP] [Auto] Rebuild Patches a36e5d65f MC-148809: Fix incorrect structure block data length 3dcbdc73b Fix force upgrade patch (#5699) dab6ec6cd List all missing hard depends not just first (#5673) aed5031e3 Fix/Optimize world and light datafixes (#5693) 719040d92 [Auto] Updated Upstream (CraftBukkit) Tuinity Changes: f0e91a4 Updated Upstream (Paper) f88659c Fix and optimise world force upgrading Airplane Changes: 636dbff [ci skip] Cleanup mcdev import files c579320 [ci skip] Remove icons 7ada9a4 [skip ci] Need to specify 1.16.5 in the README of course 813df1a Update README daf3f0b Optimize air case for raytracing 1c252a5 Update Tuinity URL 50babee Updated Upstream (Tuinity) 85e0c63 Revert "Allow plugins to stupidly replace server internals" db3fe2c Remove auto import 6b32e01 Allow plugins to stupidly replace server internals f849f00 Flare Update ac10e43 Flare Update 7f3b091 Move check 040fa19 Better checking for useless move packets Purpur Changes: adb0cafe Updated Upstream (Paper) f9ccf6dd Updated Upstream (Paper & Airplane) 1343a050 Updated Upstream (Paper, Tuinity, & Airplane) af2dd61a Updated Upstream (Paper, Tuinity, & Airplane) 1808888a Expand gamemode extra perms some more Empirecraft Changes: 9e2881e6 Don't dismount on teleports... 7ed16bf3 Updated Paper c3d0a1b2 Re-add missing line in Vehicle teleporting patch * drop Improved-oversized-chunk-data-packet-handling.patch
2021-05-27 04:01:31 +02:00
index a835285d230ea0dffa1b28c2a7a006041f2e6b2a..ccb35c1ddbf83a7e644f88ed17b8881ff305685a 100644
--- a/src/main/java/net/minecraft/world/level/block/Block.java
+++ b/src/main/java/net/minecraft/world/level/block/Block.java
@@ -54,6 +54,7 @@ import net.minecraft.world.phys.shapes.VoxelShape;
import net.minecraft.world.phys.shapes.VoxelShapes;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
+import me.jellysquid.mods.lithium.common.util.collections.Object2BooleanCacheTable;
public class Block extends BlockBase implements IMaterial {
@@ -216,8 +217,14 @@ public class Block extends BlockBase implements IMaterial {
return a(voxelshape1);
}
+ // Yatopia start - Port lithium
+ private static final Object2BooleanCacheTable<VoxelShape> FULL_CUBE_CACHE = new Object2BooleanCacheTable<>(
+ 512,
+ shape -> !VoxelShapes.applyOperation(VoxelShapes.fullCube(), shape, OperatorBoolean.NOT_SAME)
+ );
+
public static boolean a(VoxelShape voxelshape) {
- return (Boolean) Block.a.getUnchecked(voxelshape);
+ return FULL_CUBE_CACHE.get(voxelshape); // Yatopia end
}
public boolean b(IBlockData iblockdata, IBlockAccess iblockaccess, BlockPosition blockposition) {
diff --git a/src/main/java/net/minecraft/world/phys/shapes/VoxelShape.java b/src/main/java/net/minecraft/world/phys/shapes/VoxelShape.java
index fbc5fab9946b6f9233f3014f0e69f2576b2138d7..012892063405616c8ae35b6e06020008dfd147df 100644
--- a/src/main/java/net/minecraft/world/phys/shapes/VoxelShape.java
+++ b/src/main/java/net/minecraft/world/phys/shapes/VoxelShape.java
@@ -71,6 +71,7 @@ public abstract class VoxelShape {
return i >= this.a.c(enumdirection_enumaxis) ? Double.POSITIVE_INFINITY : this.a(enumdirection_enumaxis, i);
}
+ public double getMax(EnumDirection.EnumAxis enumdirection_enumaxis) { return c(enumdirection_enumaxis); } // Yatopia - OBFHELPER
public double c(EnumDirection.EnumAxis enumdirection_enumaxis) {
int i = this.a.b(enumdirection_enumaxis);
diff --git a/src/main/java/net/minecraft/world/phys/shapes/VoxelShapeMerger.java b/src/main/java/net/minecraft/world/phys/shapes/VoxelShapeMerger.java
index d2a46ce0c5c980d34dc2f4b716a174a81a68f1d0..0c594866cb291abb2e90b149d52445a628331879 100644
--- a/src/main/java/net/minecraft/world/phys/shapes/VoxelShapeMerger.java
+++ b/src/main/java/net/minecraft/world/phys/shapes/VoxelShapeMerger.java
@@ -2,7 +2,7 @@ package net.minecraft.world.phys.shapes;
import it.unimi.dsi.fastutil.doubles.DoubleList;
-interface VoxelShapeMerger {
+public interface VoxelShapeMerger { // Yatopia - make Public
DoubleList a();
diff --git a/src/main/java/net/minecraft/world/phys/shapes/VoxelShapes.java b/src/main/java/net/minecraft/world/phys/shapes/VoxelShapes.java
index 049aa5f51e7517744b25f8c2c4b5e7a7de24a73e..173197e9dc6acb31aa41ce645224fd9a2733f27c 100644
--- a/src/main/java/net/minecraft/world/phys/shapes/VoxelShapes.java
+++ b/src/main/java/net/minecraft/world/phys/shapes/VoxelShapes.java
@@ -5,6 +5,8 @@ import com.google.common.math.DoubleMath;
import com.google.common.math.IntMath;
import it.unimi.dsi.fastutil.doubles.DoubleArrayList;
import it.unimi.dsi.fastutil.doubles.DoubleList;
+import me.jellysquid.mods.lithium.common.shapes.pairs.LithiumDoublePairList; // Yatopia
+
import java.util.Arrays;
import java.util.Iterator;
import java.util.Objects;
@@ -476,7 +478,7 @@ public final class VoxelShapes {
// doublelist is usually a DoubleArrayList with Infinite head/tails that falls to the final else clause
// This is actually the most common path, so jump to it straight away
if (doublelist.getDouble(0) == Double.NEGATIVE_INFINITY && doublelist.getDouble(doublelist.size() - 1) == Double.POSITIVE_INFINITY) {
- return new VoxelShapeMergerList(doublelist, doublelist1, flag, flag1);
+ return new LithiumDoublePairList(doublelist, doublelist1, flag, flag1); // Yatopia - Port lithium
}
// Split out rest to hopefully inline the above
return lessCommonMerge(i, doublelist, doublelist1, flag, flag1);