fix some compile issues

This commit is contained in:
Jake Potrebic 2023-06-07 14:46:56 -07:00
parent 27f97c0f4e
commit eb4be91142
5 changed files with 13 additions and 18 deletions

View file

@ -104,7 +104,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
import java.io.IOException; import java.io.IOException;
@@ -0,0 +0,0 @@ public abstract class Level implements LevelAccessor, AutoCloseable { @@ -0,0 +0,0 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
// Paper start - Prevent tile entity and entity crashes // 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); MinecraftServer.LOGGER.error(msg, throwable);
+ getCraftServer().getPluginManager().callEvent(new ServerExceptionEvent(new ServerInternalException(msg, throwable))); + getCraftServer().getPluginManager().callEvent(new ServerExceptionEvent(new ServerInternalException(msg, throwable)));
entity.discard(); entity.discard();

View file

@ -20,18 +20,22 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ // Paper start - Get flow speed. Throttle if its water and flowing adjacent to lava + // Paper start - Get flow speed. Throttle if its water and flowing adjacent to lava
+ public int getFlowSpeed(Level world, BlockPos blockposition) { + 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 ( + if (
+ world.getMaterialIfLoaded(blockposition.north(1)) == net.minecraft.world.level.material.Material.LAVA || + isLava(world, blockposition.north(1)) ||
+ world.getMaterialIfLoaded(blockposition.south(1)) == net.minecraft.world.level.material.Material.LAVA || + isLava(world, blockposition.south(1)) ||
+ world.getMaterialIfLoaded(blockposition.west(1)) == net.minecraft.world.level.material.Material.LAVA || + isLava(world, blockposition.west(1)) ||
+ world.getMaterialIfLoaded(blockposition.east(1)) == net.minecraft.world.level.material.Material.LAVA + isLava(world, blockposition.east(1))
+ ) { + ) {
+ return world.paperConfig().environment.waterOverLavaFlowSpeed; + return world.paperConfig().environment.waterOverLavaFlowSpeed;
+ } + }
+ } + }
+ return this.fluid.getTickDelay(world); + 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 + // Paper end
+ +
@Override @Override

View file

@ -6738,21 +6738,12 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
import net.minecraft.world.level.block.entity.BlockEntity; import net.minecraft.world.level.block.entity.BlockEntity;
import net.minecraft.world.level.block.entity.BlockEntityType; import net.minecraft.world.level.block.entity.BlockEntityType;
import net.minecraft.world.level.block.state.BlockState; 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;
@@ -0,0 +0,0 @@ public interface BlockGetter extends LevelHeightAccessor { @@ -0,0 +0,0 @@ public interface BlockGetter extends LevelHeightAccessor {
} }
BlockState getBlockState(BlockPos pos); BlockState getBlockState(BlockPos pos);
+ // Paper start - if loaded util + // Paper start - if loaded util
+ @Nullable BlockState getBlockStateIfLoaded(BlockPos blockposition); + @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) { + default @Nullable Block getBlockIfLoaded(BlockPos blockposition) {
+ BlockState type = this.getBlockStateIfLoaded(blockposition); + BlockState type = this.getBlockStateIfLoaded(blockposition);
@ -7071,7 +7062,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
// CraftBukkit end // CraftBukkit end
+ // Paper start + // Paper start
+ public @Nullable ChunkHolder playerChunk; + public @Nullable net.minecraft.server.level.ChunkHolder playerChunk;
+ +
+ static final int NEIGHBOUR_CACHE_RADIUS = 3; + static final int NEIGHBOUR_CACHE_RADIUS = 3;
+ public static int getNeighbourCacheRadius() { + public static int getNeighbourCacheRadius() {

View file

@ -27,7 +27,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ // Paper start - Prevent armor stands from doing entity lookups + // Paper start - Prevent armor stands from doing entity lookups
+ @Override + @Override
+ public boolean noCollision(@Nullable Entity entity, AABB box) { + 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); + return LevelAccessor.super.noCollision(entity, box);
+ } + }
+ // Paper end + // Paper end

View file

@ -18,7 +18,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
- entity.fillCrashReportCategory(crashreportsystemdetails); - entity.fillCrashReportCategory(crashreportsystemdetails);
- throw new ReportedException(crashreport); - throw new ReportedException(crashreport);
+ // Paper start - Prevent tile entity and entity crashes + // 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); + MinecraftServer.LOGGER.error(msg, throwable);
+ entity.discard(); + entity.discard();
+ // Paper end + // Paper end