2020-08-20 17:04:08 +02:00
|
|
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
|
|
From: JellySquid <jellysquid+atwork@protonmail.com>
|
|
|
|
Date: Thu, 20 Aug 2020 17:25:11 +0300
|
|
|
|
Subject: [PATCH] lithium MixinChunkSection
|
|
|
|
|
|
|
|
Original code by JellySquid, licensed under LGPLv3
|
|
|
|
you can find the original code on https://github.com/jellysquid3/lithium-fabric/ (Yarn mappings)
|
|
|
|
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/BlockBase.java b/src/main/java/net/minecraft/server/BlockBase.java
|
2020-09-11 08:03:00 +02:00
|
|
|
index 5541531223456d9890dee154fec058314d56f256..c1f992b2ebac9819085bec74bc40ca3b5384c741 100644
|
2020-08-20 17:04:08 +02:00
|
|
|
--- a/src/main/java/net/minecraft/server/BlockBase.java
|
|
|
|
+++ b/src/main/java/net/minecraft/server/BlockBase.java
|
2020-08-31 20:35:20 +02:00
|
|
|
@@ -345,6 +345,8 @@ public abstract class BlockBase {
|
2020-08-30 06:40:10 +02:00
|
|
|
}
|
|
|
|
// Tuinity end
|
|
|
|
|
2020-08-31 20:35:20 +02:00
|
|
|
+ public final boolean shapeExceedsCubeUncached() { return this.a == null || this.a.c; } // Yatopia - uncached shapeExceedsCube due to collisions stuff
|
|
|
|
+
|
2020-08-30 06:40:10 +02:00
|
|
|
// Tuinity start
|
2020-08-31 20:35:20 +02:00
|
|
|
protected boolean isTicking;
|
|
|
|
protected Fluid fluid;
|
2020-08-20 17:04:08 +02:00
|
|
|
diff --git a/src/main/java/net/minecraft/server/ChunkSection.java b/src/main/java/net/minecraft/server/ChunkSection.java
|
2020-08-31 20:35:20 +02:00
|
|
|
index cebd808e273dbdb88feb16920dd7a2f60390b34f..d210ac3d5775491e9beb885dde608f5e8fda8eb2 100644
|
2020-08-20 17:04:08 +02:00
|
|
|
--- a/src/main/java/net/minecraft/server/ChunkSection.java
|
|
|
|
+++ b/src/main/java/net/minecraft/server/ChunkSection.java
|
|
|
|
@@ -4,7 +4,7 @@ import java.util.function.Predicate;
|
|
|
|
import com.destroystokyo.paper.antixray.ChunkPacketInfo; // Paper - Anti-Xray - Add chunk packet info
|
|
|
|
import javax.annotation.Nullable;
|
|
|
|
|
|
|
|
-public class ChunkSection {
|
|
|
|
+public class ChunkSection implements me.jellysquid.mods.lithium.common.entity.movement.ChunkAwareBlockCollisionSweeper.OversizedBlocksCounter { // Yatopia
|
|
|
|
|
|
|
|
public static final DataPalette<IBlockData> GLOBAL_PALETTE = new DataPaletteGlobal<>(Block.REGISTRY_ID, Blocks.AIR.getBlockData());
|
|
|
|
final int yPos; // Paper - private -> package-private
|
|
|
|
@@ -12,6 +12,7 @@ public class ChunkSection {
|
|
|
|
short tickingBlockCount; // Paper - private -> package-private
|
|
|
|
private short e;
|
|
|
|
final DataPaletteBlock<IBlockData> blockIds; // Paper - package-private
|
2020-08-31 20:35:20 +02:00
|
|
|
+ private short oversizedBlockCount = 0; // Yatopia
|
2020-08-20 17:04:08 +02:00
|
|
|
|
|
|
|
final com.destroystokyo.paper.util.maplist.IBlockDataList tickingList = new com.destroystokyo.paper.util.maplist.IBlockDataList(); // Paper
|
|
|
|
|
2020-08-31 20:35:20 +02:00
|
|
|
@@ -67,6 +68,7 @@ public class ChunkSection {
|
2020-08-30 06:40:10 +02:00
|
|
|
|
|
|
|
if (!iblockdata1.isAir()) {
|
|
|
|
--this.nonEmptyBlockCount;
|
2020-08-31 20:35:20 +02:00
|
|
|
+ if (iblockdata1.shapeExceedsCubeUncached()) this.oversizedBlockCount--; // Yatopia
|
2020-08-30 06:40:10 +02:00
|
|
|
if (iblockdata1.isTicking()) {
|
|
|
|
--this.tickingBlockCount;
|
|
|
|
// Paper start
|
2020-08-31 20:35:20 +02:00
|
|
|
@@ -81,6 +83,7 @@ public class ChunkSection {
|
2020-08-30 06:40:10 +02:00
|
|
|
|
|
|
|
if (!iblockdata.isAir()) {
|
|
|
|
++this.nonEmptyBlockCount;
|
2020-08-31 20:35:20 +02:00
|
|
|
+ if (iblockdata.shapeExceedsCubeUncached()) this.oversizedBlockCount++; // Yatopia
|
2020-08-30 06:40:10 +02:00
|
|
|
if (iblockdata.isTicking()) {
|
|
|
|
++this.tickingBlockCount;
|
|
|
|
// Paper start
|
2020-08-31 20:35:20 +02:00
|
|
|
@@ -126,10 +129,12 @@ public class ChunkSection {
|
2020-08-20 17:04:08 +02:00
|
|
|
// Paper start
|
|
|
|
this.tickingList.clear();
|
|
|
|
// Paper end
|
|
|
|
+ this.oversizedBlockCount = 0; // Yatopia
|
|
|
|
this.nonEmptyBlockCount = 0;
|
|
|
|
this.tickingBlockCount = 0;
|
|
|
|
this.e = 0;
|
|
|
|
this.blockIds.forEachLocation((iblockdata, location) -> { // Paper
|
2020-08-31 20:35:20 +02:00
|
|
|
+ if (iblockdata.shapeExceedsCubeUncached()) this.oversizedBlockCount += location; // Yatopia
|
2020-08-20 17:04:08 +02:00
|
|
|
Fluid fluid = iblockdata.getFluid();
|
|
|
|
|
|
|
|
if (!iblockdata.isAir()) {
|
2020-08-31 20:35:20 +02:00
|
|
|
@@ -173,4 +178,11 @@ public class ChunkSection {
|
2020-08-20 17:04:08 +02:00
|
|
|
public boolean a(Predicate<IBlockData> predicate) {
|
|
|
|
return this.blockIds.contains(predicate);
|
|
|
|
}
|
|
|
|
+
|
|
|
|
+ // Yatopia start
|
|
|
|
+ @Override
|
|
|
|
+ public boolean hasOversizedBlocks() {
|
|
|
|
+ return this.oversizedBlockCount > 0;
|
|
|
|
+ }
|
|
|
|
+ // Yatopia end
|
|
|
|
}
|