Mirror von
https://github.com/IntellectualSites/FastAsyncWorldEdit.git
synchronisiert 2024-11-09 13:00:05 +01:00
Reverted to old manual lighting system that doesn't call notch's block lighting functions directly.
Dieser Commit ist enthalten in:
Ursprung
8ce3f4d77a
Commit
0ba3da2641
@ -22,6 +22,9 @@ package com.sk89q.worldedit.bukkit;
|
|||||||
import java.lang.reflect.Constructor;
|
import java.lang.reflect.Constructor;
|
||||||
import java.lang.reflect.Field;
|
import java.lang.reflect.Field;
|
||||||
import java.lang.reflect.Method;
|
import java.lang.reflect.Method;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
import org.bukkit.block.Block;
|
import org.bukkit.block.Block;
|
||||||
import org.bukkit.block.BlockState;
|
import org.bukkit.block.BlockState;
|
||||||
import org.bukkit.block.Furnace;
|
import org.bukkit.block.Furnace;
|
||||||
@ -43,6 +46,7 @@ import org.bukkit.entity.Wolf;
|
|||||||
import org.bukkit.inventory.Inventory;
|
import org.bukkit.inventory.Inventory;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
|
import org.bukkit.Chunk;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.TreeType;
|
import org.bukkit.TreeType;
|
||||||
@ -746,7 +750,7 @@ public class BukkitWorld extends LocalWorld {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void fixLighting(Iterable<BlockVector2D> chunks) {
|
public void fixLighting(Iterable<BlockVector2D> chunks) {
|
||||||
if (fastLightingAvailable) {
|
if (!fastLightingAvailable) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -768,23 +772,40 @@ public class BukkitWorld extends LocalWorld {
|
|||||||
// Fix blocklight
|
// Fix blocklight
|
||||||
Chunk_blocklightMap.set(notchChunk, NibbleArray_ctor.newInstance(length, 7));
|
Chunk_blocklightMap.set(notchChunk, NibbleArray_ctor.newInstance(length, 7));
|
||||||
|
|
||||||
|
Chunk chunk = world.getChunkAt(chunkX, chunkZ);
|
||||||
|
|
||||||
|
List<BlockState> lightEmitters = new ArrayList<BlockState>();
|
||||||
|
|
||||||
for (int x = 0; x < chunkSizeX; ++x) {
|
for (int x = 0; x < chunkSizeX; ++x) {
|
||||||
final boolean xBorder = x == 0 || x == chunkSizeX - 1;
|
boolean xBorder = x == 0 || x == chunkSizeX - 1;
|
||||||
for (int z = 0; z < chunkSizeZ; ++z) {
|
for (int z = 0; z < chunkSizeZ; ++z) {
|
||||||
final boolean zBorder = z == 0 || z == chunkSizeZ - 1;
|
boolean zBorder = z == 0 || z == chunkSizeZ - 1;
|
||||||
for (int y = 0; y < chunkSizeY; ++y) {
|
for (int y = 0; y < chunkSizeY; ++y) {
|
||||||
final int index = y + z * chunkSizeY + x * chunkSizeY * chunkSizeZ;
|
final int index = y + z * chunkSizeY + x * chunkSizeY * chunkSizeZ;
|
||||||
final byte blockID = blocks[index];
|
byte blockID = blocks[index];
|
||||||
if (BlockType.emitsLight(blockID)) {
|
if (!BlockType.emitsLight(blockID)) {
|
||||||
Chunk_relightBlock.invoke(notchChunk, x, y, z);
|
if (xBorder || zBorder && BlockType.isTranslucent(blockID)) {
|
||||||
|
lightEmitters.add(chunk.getBlock(x, y, z).getState());
|
||||||
|
if (blockID == 20) {
|
||||||
|
blocks[index] = 0;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if ((xBorder || zBorder) && BlockType.isTranslucent(blockID)) {
|
blocks[index] = 20;
|
||||||
Chunk_relightBlock.invoke(notchChunk, x, y, z);
|
}
|
||||||
}
|
|
||||||
|
}
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
lightEmitters.add(chunk.getBlock(x, y, z).getState());
|
||||||
|
|
||||||
|
blocks[index] = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for (BlockState lightEmitter : lightEmitters) {
|
||||||
|
lightEmitter.update(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren