fix some compile issues

This commit is contained in:
Jake Potrebic 2023-06-07 14:46:56 -07:00
parent 3c8e176265
commit e09a44e169
No known key found for this signature in database
GPG Key ID: ECE0B3C133C016C5
6 changed files with 27 additions and 32 deletions

View File

@ -6727,10 +6727,10 @@ index 3aa6636aec62b031e2449db7b1b844d2ee5e9a8d..70e663baefe90c06eca2033f07e7e85c
}
// CraftBukkit end
diff --git a/src/main/java/net/minecraft/world/level/BlockGetter.java b/src/main/java/net/minecraft/world/level/BlockGetter.java
index 1c71d2c1b16bdba1e14a8230787e4cb4ad530163..42e05380a875c52cd6e1cb337958b431a751698b 100644
index 1c71d2c1b16bdba1e14a8230787e4cb4ad530163..d6d8bbc98fc71997cb52521d59ebb59d727d3c22 100644
--- a/src/main/java/net/minecraft/world/level/BlockGetter.java
+++ b/src/main/java/net/minecraft/world/level/BlockGetter.java
@@ -9,10 +9,12 @@ import javax.annotation.Nullable;
@@ -9,6 +9,7 @@ import javax.annotation.Nullable;
import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction;
import net.minecraft.util.Mth;
@ -6738,21 +6738,12 @@ index 1c71d2c1b16bdba1e14a8230787e4cb4ad530163..42e05380a875c52cd6e1cb337958b431
import net.minecraft.world.level.block.entity.BlockEntity;
import net.minecraft.world.level.block.entity.BlockEntityType;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.material.FluidState;
+import net.minecraft.world.level.material.Material;
import net.minecraft.world.phys.AABB;
import net.minecraft.world.phys.BlockHitResult;
import net.minecraft.world.phys.Vec3;
@@ -30,6 +32,19 @@ public interface BlockGetter extends LevelHeightAccessor {
@@ -30,6 +31,15 @@ public interface BlockGetter extends LevelHeightAccessor {
}
BlockState getBlockState(BlockPos pos);
+ // Paper start - if loaded util
+ @Nullable BlockState getBlockStateIfLoaded(BlockPos blockposition);
+ default @Nullable Material getMaterialIfLoaded(BlockPos blockposition) {
+ BlockState type = this.getBlockStateIfLoaded(blockposition);
+ return type == null ? null : type.getMaterial();
+ }
+
+ default @Nullable Block getBlockIfLoaded(BlockPos blockposition) {
+ BlockState type = this.getBlockStateIfLoaded(blockposition);
@ -7063,7 +7054,7 @@ index 532a0cae6db0d830e720a72e9021aa7a8ed0f106..e5e562f75e7d4b6a750f192842940c5e
this.levelHeightAccessor = heightLimitView;
this.sections = new LevelChunkSection[heightLimitView.getSectionsCount()];
diff --git a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
index 36c3a06a94177ec21cfc5c513d16f7168fe2fe2c..5aa89166e854136f366eb36ff02a37ae9ba77ab1 100644
index 36c3a06a94177ec21cfc5c513d16f7168fe2fe2c..e4deb276f956c5f292ab8bf7836eeeffd6ed59d5 100644
--- a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
+++ b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
@@ -114,6 +114,109 @@ public class LevelChunk extends ChunkAccess {
@ -7071,7 +7062,7 @@ index 36c3a06a94177ec21cfc5c513d16f7168fe2fe2c..5aa89166e854136f366eb36ff02a37ae
// CraftBukkit end
+ // Paper start
+ public @Nullable ChunkHolder playerChunk;
+ public @Nullable net.minecraft.server.level.ChunkHolder playerChunk;
+
+ static final int NEIGHBOUR_CACHE_RADIUS = 3;
+ public static int getNeighbourCacheRadius() {

View File

@ -5,7 +5,7 @@ Subject: [PATCH] Prevent tile entity and entity crashes
diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
index f21ba175538436e59c45d5350ef7b2605ed96775..05e8f34044241ce9b6c1afa4f90a92492d3a64b1 100644
index f21ba175538436e59c45d5350ef7b2605ed96775..627f80e726f306edc765be5e6ac59ca73aade10b 100644
--- a/src/main/java/net/minecraft/world/level/Level.java
+++ b/src/main/java/net/minecraft/world/level/Level.java
@@ -723,11 +723,11 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
@ -18,7 +18,7 @@ index f21ba175538436e59c45d5350ef7b2605ed96775..05e8f34044241ce9b6c1afa4f90a9249
- entity.fillCrashReportCategory(crashreportsystemdetails);
- throw new ReportedException(crashreport);
+ // Paper start - Prevent tile entity and entity crashes
+ final String msg = String.format("Entity threw exception at %s:%s,%s,%s", entity.level.getWorld().getName(), entity.getX(), entity.getY(), entity.getZ());
+ final String msg = String.format("Entity threw exception at %s:%s,%s,%s", entity.level().getWorld().getName(), entity.getX(), entity.getY(), entity.getZ());
+ MinecraftServer.LOGGER.error(msg, throwable);
+ entity.discard();
+ // Paper end
@ -44,7 +44,7 @@ index b300d12e9e00519028b53aca9c3fb01f589eaa91..63acd109a79ed752a05df3d4f1b99309
}
}
diff --git a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
index 9bd0e817cf717fe6257ceb4ace6bf6f5eed9eb82..0ebee823180e91281fbde206a16d525277f0fb3d 100644
index 09999a3f523ce6d652799215d3418284a69042c1..8e1ca484356a7eddcdb37ef7ec01dea9864eec70 100644
--- a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
+++ b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
@@ -1057,11 +1057,11 @@ public class LevelChunk extends ChunkAccess {

View File

@ -88,7 +88,7 @@ index c6fb4c33d7ea52b88d8fc0d90748cbab7387c565..fed09b886f4fa0006d160e5f2abb00df
}
diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
index 89e065a643eb16ccc308bcf42ea9f5d02c181a1f..49ef7d349e0e4b1d45611ff0a225ba94c3db2600 100644
index 42e81640354c2679570823347b28ee1155e7a00e..a7fb12648c2e655e191d8c805753ae0c05421d17 100644
--- a/src/main/java/net/minecraft/world/level/Level.java
+++ b/src/main/java/net/minecraft/world/level/Level.java
@@ -1,5 +1,10 @@
@ -104,7 +104,7 @@ index 89e065a643eb16ccc308bcf42ea9f5d02c181a1f..49ef7d349e0e4b1d45611ff0a225ba94
import java.io.IOException;
@@ -725,6 +730,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
// Paper start - Prevent tile entity and entity crashes
final String msg = String.format("Entity threw exception at %s:%s,%s,%s", entity.level.getWorld().getName(), entity.getX(), entity.getY(), entity.getZ());
final String msg = String.format("Entity threw exception at %s:%s,%s,%s", entity.level().getWorld().getName(), entity.getX(), entity.getY(), entity.getZ());
MinecraftServer.LOGGER.error(msg, throwable);
+ getCraftServer().getPluginManager().callEvent(new ServerExceptionEvent(new ServerInternalException(msg, throwable)));
entity.discard();
@ -131,7 +131,7 @@ index f1675e35be0ab7670c875c6b0d1e982a3ae09d1e..b2bb9bbd3af414c50ec3f8e3e171a679
}
diff --git a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
index 0ebee823180e91281fbde206a16d525277f0fb3d..7edb17360bc0611c6a1412b868ed128c9dbcfb4f 100644
index 8e1ca484356a7eddcdb37ef7ec01dea9864eec70..2006760ff24ec9ce5f71c107ddf942e550d03589 100644
--- a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
+++ b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
@@ -1,6 +1,7 @@

View File

@ -17,7 +17,7 @@ index 68ac3ffae5d800bde3c5b5163a52768a43bb5963..a59381646031a1a99c98c8c6ad9de7ef
for (int i = 0; i < list.size(); ++i) {
diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
index eb2f9464b15f4e6e25c419761c055b6ee4c03279..823121fdfe99db01e3e995a50dbc8e241bcebe9c 100644
index a34be79fa1767c581fbfbff5deb747729bd9e5da..42e16101ad20d8e94f17f1db0f682c5cbbce35b4 100644
--- a/src/main/java/net/minecraft/world/level/Level.java
+++ b/src/main/java/net/minecraft/world/level/Level.java
@@ -760,6 +760,13 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
@ -27,7 +27,7 @@ index eb2f9464b15f4e6e25c419761c055b6ee4c03279..823121fdfe99db01e3e995a50dbc8e24
+ // Paper start - Prevent armor stands from doing entity lookups
+ @Override
+ public boolean noCollision(@Nullable Entity entity, AABB box) {
+ if (entity instanceof net.minecraft.world.entity.decoration.ArmorStand && !entity.level.paperConfig().entities.armorStands.doCollisionEntityLookups) return false;
+ if (entity instanceof net.minecraft.world.entity.decoration.ArmorStand && !entity.level().paperConfig().entities.armorStands.doCollisionEntityLookups) return false;
+ return LevelAccessor.super.noCollision(entity, box);
+ }
+ // Paper end

View File

@ -5,10 +5,10 @@ Subject: [PATCH] Configurable speed for water flowing over lava
diff --git a/src/main/java/net/minecraft/world/level/block/LiquidBlock.java b/src/main/java/net/minecraft/world/level/block/LiquidBlock.java
index fd7a7772eef7e2e4418539a11cefa98046b087e1..1530c664d0f6f55acf5292bd8fbb4f97bf7fadd3 100644
index fd7a7772eef7e2e4418539a11cefa98046b087e1..bbabe4ad8afcc3a2069f6e9d4a9adcb643266894 100644
--- a/src/main/java/net/minecraft/world/level/block/LiquidBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/LiquidBlock.java
@@ -106,11 +106,27 @@ public class LiquidBlock extends Block implements BucketPickup {
@@ -106,11 +106,31 @@ public class LiquidBlock extends Block implements BucketPickup {
@Override
public void onPlace(BlockState state, Level world, BlockPos pos, BlockState oldState, boolean notify) {
if (this.shouldSpreadLiquid(world, pos, state)) {
@ -20,24 +20,28 @@ index fd7a7772eef7e2e4418539a11cefa98046b087e1..1530c664d0f6f55acf5292bd8fbb4f97
+ // Paper start - Get flow speed. Throttle if its water and flowing adjacent to lava
+ public int getFlowSpeed(Level world, BlockPos blockposition) {
+ if (this.material == net.minecraft.world.level.material.Material.WATER) {
+ if (net.minecraft.core.registries.BuiltInRegistries.FLUID.wrapAsHolder(this.fluid).is(FluidTags.WATER)) {
+ if (
+ world.getMaterialIfLoaded(blockposition.north(1)) == net.minecraft.world.level.material.Material.LAVA ||
+ world.getMaterialIfLoaded(blockposition.south(1)) == net.minecraft.world.level.material.Material.LAVA ||
+ world.getMaterialIfLoaded(blockposition.west(1)) == net.minecraft.world.level.material.Material.LAVA ||
+ world.getMaterialIfLoaded(blockposition.east(1)) == net.minecraft.world.level.material.Material.LAVA
+ isLava(world, blockposition.north(1)) ||
+ isLava(world, blockposition.south(1)) ||
+ isLava(world, blockposition.west(1)) ||
+ isLava(world, blockposition.east(1))
+ ) {
+ return world.paperConfig().environment.waterOverLavaFlowSpeed;
+ }
+ }
+ return this.fluid.getTickDelay(world);
+ }
+ private static boolean isLava(Level world, BlockPos blockPos) {
+ final FluidState fluidState = world.getFluidIfLoaded(blockPos);
+ return fluidState != null && fluidState.is(FluidTags.LAVA);
+ }
+ // Paper end
+
@Override
public BlockState updateShape(BlockState state, Direction direction, BlockState neighborState, LevelAccessor world, BlockPos pos, BlockPos neighborPos) {
if (state.getFluidState().isSource() || neighborState.getFluidState().isSource()) {
@@ -123,7 +139,7 @@ public class LiquidBlock extends Block implements BucketPickup {
@@ -123,7 +143,7 @@ public class LiquidBlock extends Block implements BucketPickup {
@Override
public void neighborChanged(BlockState state, Level world, BlockPos pos, Block sourceBlock, BlockPos sourcePos, boolean notify) {
if (this.shouldSpreadLiquid(world, pos, state)) {

View File

@ -7,10 +7,10 @@ ray tracing into an unloaded chunk should be treated as a miss
this saves a ton of lag for when AI tries to raytrace near unloaded chunks.
diff --git a/src/main/java/net/minecraft/world/level/BlockGetter.java b/src/main/java/net/minecraft/world/level/BlockGetter.java
index 42e05380a875c52cd6e1cb337958b431a751698b..5ed0dbed49db210e54cf2ece3e8605feb956bc69 100644
index d6d8bbc98fc71997cb52521d59ebb59d727d3c22..89aadd30c1973cf45c5c05fd12462e04b0b05c97 100644
--- a/src/main/java/net/minecraft/world/level/BlockGetter.java
+++ b/src/main/java/net/minecraft/world/level/BlockGetter.java
@@ -75,7 +75,15 @@ public interface BlockGetter extends LevelHeightAccessor {
@@ -70,7 +70,15 @@ public interface BlockGetter extends LevelHeightAccessor {
// CraftBukkit start - moved block handling into separate method for use by Block#rayTrace
default BlockHitResult clip(ClipContext raytrace1, BlockPos blockposition) {