Mirror von
https://github.com/PaperMC/Paper.git
synchronisiert 2024-12-18 20:40:08 +01:00
Minor optimization in BlockGrass by only checking light once instead of twice. Thanks to oloflarsson for the PR.
Dieser Commit ist enthalten in:
Ursprung
b369805590
Commit
23adb0d02f
@ -21,8 +21,9 @@ public class BlockGrass extends Block {
|
|||||||
|
|
||||||
public void a(World world, int i, int j, int k, Random random) {
|
public void a(World world, int i, int j, int k, Random random) {
|
||||||
if (!world.isStatic) {
|
if (!world.isStatic) {
|
||||||
if (world.getLightLevel(i, j + 1, k) < 4 && Block.q[world.getTypeId(i, j + 1, k)] > 2) {
|
// CraftBukkit start - reuse getLightLevel
|
||||||
// CraftBukkit start
|
int lightLevel = world.getLightLevel(i, j + 1, k);
|
||||||
|
if (lightLevel < 4 && Block.q[world.getTypeId(i, j + 1, k)] > 2) {
|
||||||
org.bukkit.World bworld = world.getWorld();
|
org.bukkit.World bworld = world.getWorld();
|
||||||
org.bukkit.block.BlockState blockState = bworld.getBlockAt(i, j, k).getState();
|
org.bukkit.block.BlockState blockState = bworld.getBlockAt(i, j, k).getState();
|
||||||
blockState.setTypeId(Block.DIRT.id);
|
blockState.setTypeId(Block.DIRT.id);
|
||||||
@ -33,8 +34,8 @@ public class BlockGrass extends Block {
|
|||||||
if (!event.isCancelled()) {
|
if (!event.isCancelled()) {
|
||||||
blockState.update(true);
|
blockState.update(true);
|
||||||
}
|
}
|
||||||
// CraftBukkit end
|
} else if (lightLevel >= 9) {
|
||||||
} else if (world.getLightLevel(i, j + 1, k) >= 9) {
|
// CraftBukkit end
|
||||||
for (int l = 0; l < 4; ++l) {
|
for (int l = 0; l < 4; ++l) {
|
||||||
int i1 = i + random.nextInt(3) - 1;
|
int i1 = i + random.nextInt(3) - 1;
|
||||||
int j1 = j + random.nextInt(5) - 3;
|
int j1 = j + random.nextInt(5) - 3;
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren