mirror of
https://github.com/PaperMC/Paper.git
synced 2025-08-10 17:52:02 -07:00
Move patches around
This commit is contained in:
@@ -0,0 +1,82 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Aikar <aikar@aikar.co>
|
||||
Date: Sun, 17 Apr 2016 17:27:09 -0400
|
||||
Subject: [PATCH] Prevent Fire from loading chunks & wrongly spread
|
||||
|
||||
This causes the nether to spam unload/reload chunks, plus overall
|
||||
bad behavior.
|
||||
|
||||
This also stops fire from spreading to illegal locations.
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/FireBlock.java b/src/main/java/net/minecraft/world/level/block/FireBlock.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/FireBlock.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/FireBlock.java
|
||||
@@ -0,0 +0,0 @@ public class FireBlock extends BaseFireBlock {
|
||||
BooleanProperty blockstateboolean = (BooleanProperty) FireBlock.PROPERTY_BY_DIRECTION.get(enumdirection);
|
||||
|
||||
if (blockstateboolean != null) {
|
||||
- iblockdata1 = (BlockState) iblockdata1.setValue(blockstateboolean, this.canBurn(world.getBlockState(pos.relative(enumdirection))));
|
||||
+ iblockdata1 = (BlockState) iblockdata1.setValue(blockstateboolean, this.canBurn(world.getTypeIfLoaded(pos.relative(enumdirection)))); // Paper - prevent chunk loads
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +0,0 @@ public class FireBlock extends BaseFireBlock {
|
||||
}
|
||||
|
||||
blockposition_mutableblockposition.setWithOffset((Vec3i) pos, l, j1, i1);
|
||||
+ if (blockposition_mutableblockposition.isInvalidYLocation() || !world.hasChunkAt(blockposition_mutableblockposition)) continue; // Paper
|
||||
int l1 = this.getFireOdds((LevelReader) world, (BlockPos) blockposition_mutableblockposition);
|
||||
|
||||
if (l1 > 0) {
|
||||
@@ -0,0 +0,0 @@ public class FireBlock extends BaseFireBlock {
|
||||
}
|
||||
|
||||
private void trySpread(Level world, BlockPos blockposition, int i, Random random, int j, BlockPos sourceposition) { // CraftBukkit add sourceposition
|
||||
- int k = this.getBurnOdd(world.getBlockState(blockposition));
|
||||
+ // Paper start
|
||||
+ final BlockState iblockdata = world.getTypeIfLoaded(blockposition);
|
||||
+ if (iblockdata == null) {
|
||||
+ return;
|
||||
+ }
|
||||
+ int k = this.getBurnOdd(iblockdata);
|
||||
+ // Paper end
|
||||
|
||||
if (random.nextInt(i) < k) {
|
||||
- BlockState iblockdata = world.getBlockState(blockposition);
|
||||
+ //IBlockData iblockdata = world.getType(blockposition); // Paper
|
||||
|
||||
// CraftBukkit start
|
||||
org.bukkit.block.Block theBlock = world.getWorld().getBlockAt(blockposition.getX(), blockposition.getY(), blockposition.getZ());
|
||||
@@ -0,0 +0,0 @@ public class FireBlock extends BaseFireBlock {
|
||||
for (int j = 0; j < i; ++j) {
|
||||
Direction enumdirection = aenumdirection[j];
|
||||
|
||||
- if (this.canBurn(world.getBlockState(pos.relative(enumdirection)))) {
|
||||
+ if (this.canBurn(world.getTypeIfLoaded(pos.relative(enumdirection)))) { // Paper - prevent chunk loads
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +0,0 @@ public class FireBlock extends BaseFireBlock {
|
||||
|
||||
for (int k = 0; k < j; ++k) {
|
||||
Direction enumdirection = aenumdirection[k];
|
||||
- BlockState iblockdata = iworldreader.getBlockState(pos.relative(enumdirection));
|
||||
+ // Paper start
|
||||
+ BlockState iblockdata = iworldreader.getTypeIfLoaded(pos.relative(enumdirection));
|
||||
+ if (iblockdata == null) {
|
||||
+ continue;
|
||||
+ }
|
||||
+ // Paper end
|
||||
|
||||
i = Math.max(this.getFlameOdds(iblockdata), i);
|
||||
}
|
||||
@@ -0,0 +0,0 @@ public class FireBlock extends BaseFireBlock {
|
||||
|
||||
@Override
|
||||
protected boolean canBurn(BlockState state) {
|
||||
- return this.getFlameOdds(state) > 0;
|
||||
+ return state != null && this.getFlameOdds(state) > 0; // Paper - iblockdata can be nullable if chunk is unloaded now
|
||||
}
|
||||
|
||||
@Override
|
Reference in New Issue
Block a user