Yatopia/patches/server/0069-Origami-Remove-some-streams-and-object-allocations.patch
2021-05-20 12:51:47 -04:00

40 lines
1.7 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Phoenix616 <mail@moep.tv>
Date: Thu, 30 Jan 2020 21:50:40 +0100
Subject: [PATCH] (Origami) Remove some streams and object allocations
Partially based on a patch in Spottedleaf's Paper fork
diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java
index b210921a8176d41224b230809cdcbb4a78750460..029e07a7b860d775fa41c37fe14a84e26173c191 100644
--- a/src/main/java/net/minecraft/server/level/ChunkMap.java
+++ b/src/main/java/net/minecraft/server/level/ChunkMap.java
@@ -16,9 +16,10 @@ public abstract class ChunkMap extends LightEngineGraph {
@Override
protected void a(long i, int j, boolean flag) {
- ChunkCoordIntPair chunkcoordintpair = new ChunkCoordIntPair(i);
- int k = chunkcoordintpair.x;
- int l = chunkcoordintpair.z;
+ // Origami start - remove allocation of ChunkCoordIntPair
+ int k = ChunkCoordIntPair.getX(i);
+ int l = ChunkCoordIntPair.getZ(i);
+ // Origami end
for (int i1 = -1; i1 <= 1; ++i1) {
for (int j1 = -1; j1 <= 1; ++j1) {
@@ -35,9 +36,10 @@ public abstract class ChunkMap extends LightEngineGraph {
@Override
protected int a(long i, long j, int k) {
int l = k;
- ChunkCoordIntPair chunkcoordintpair = new ChunkCoordIntPair(i);
- int i1 = chunkcoordintpair.x;
- int j1 = chunkcoordintpair.z;
+ // Origami start - remove allocation of ChunkCoordIntPair
+ int i1 = ChunkCoordIntPair.getX(i);
+ int j1 = ChunkCoordIntPair.getZ(i);
+ // Origami end
for (int k1 = -1; k1 <= 1; ++k1) {
for (int l1 = -1; l1 <= 1; ++l1) {