mirror of
https://github.com/YatopiaMC/Yatopia.git
synced 2024-12-01 15:13:24 +01:00
44 lines
2.4 KiB
Diff
44 lines
2.4 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: JellySquid <jellysquid+atwork@protonmail.com>
|
|
Date: Sat, 24 Oct 2020 19:36:50 -0500
|
|
Subject: [PATCH] lithium reduce allocations
|
|
|
|
This patch reduces object allocations in several places.
|
|
|
|
Parts of this patch were created for the Lithium project <https://github.com/CaffeineMC/lithium-fabric> by JellySquid <jellysquid+atwork@protonmail.com> and 2No2Name <https://github.com/2No2Name> under the GNU LGPLv3 license.
|
|
Portions of this patch that were sourced from Lithium were remapped from Yarn mappings by Mykyta Komarnytskyy <nkomarn@hotmail.com>.
|
|
|
|
Co-authored-by: Mykyta Komarnytskyy <nkomarn@hotmail.com>
|
|
|
|
diff --git a/src/main/java/net/minecraft/world/level/block/BlockComposter.java b/src/main/java/net/minecraft/world/level/block/BlockComposter.java
|
|
index e4e519ba773388b8d26a8f794a6eff51e3d8f72e..01e315d145160efcd437063afd7566a4213834ce 100644
|
|
--- a/src/main/java/net/minecraft/world/level/block/BlockComposter.java
|
|
+++ b/src/main/java/net/minecraft/world/level/block/BlockComposter.java
|
|
@@ -337,7 +337,7 @@ public class BlockComposter extends Block implements IInventoryHolder {
|
|
|
|
@Override
|
|
public int[] getSlotsForFace(EnumDirection enumdirection) {
|
|
- return enumdirection == EnumDirection.UP ? new int[]{0} : new int[0];
|
|
+ return enumdirection == EnumDirection.UP ? org.yatopiamc.yatopia.server.util.Constants.ZERO_ARRAY : org.yatopiamc.yatopia.server.util.Constants.EMPTY_ARRAY; // Yatopia - avoid array allocation
|
|
}
|
|
|
|
@Override
|
|
@@ -387,7 +387,7 @@ public class BlockComposter extends Block implements IInventoryHolder {
|
|
|
|
@Override
|
|
public int[] getSlotsForFace(EnumDirection enumdirection) {
|
|
- return enumdirection == EnumDirection.DOWN ? new int[]{0} : new int[0];
|
|
+ return enumdirection == EnumDirection.DOWN ? org.yatopiamc.yatopia.server.util.Constants.ZERO_ARRAY : org.yatopiamc.yatopia.server.util.Constants.EMPTY_ARRAY; // Yatopia - avoid array allocation
|
|
}
|
|
|
|
@Override
|
|
@@ -423,7 +423,7 @@ public class BlockComposter extends Block implements IInventoryHolder {
|
|
|
|
@Override
|
|
public int[] getSlotsForFace(EnumDirection enumdirection) {
|
|
- return new int[0];
|
|
+ return org.yatopiamc.yatopia.server.util.Constants.EMPTY_ARRAY; // Yatopia - avoid array allocation
|
|
}
|
|
|
|
@Override
|