mirror of
https://github.com/plexusorg/Plex-FAWE.git
synced 2025-06-11 20:13:55 +00:00
Upstream merges and a few code cleanups
This commit is contained in:
@ -192,11 +192,11 @@ public class BukkitChunk_1_13 extends IntFaweChunk<Chunk, BukkitQueue_1_13> {
|
||||
|
||||
byte[] newBlockBytes = newBlockLight.asBytes();
|
||||
byte[] blockLightBytes = blockLight.asBytes();
|
||||
for (int i = 0; i < 2048; i++) newBlockBytes[i] = blockLightBytes[i];
|
||||
System.arraycopy(blockLightBytes, 0, newBlockBytes, 0, 2048);
|
||||
if (skyLight != null) {
|
||||
byte[] newSkyBytes = newSkyLight.asBytes();
|
||||
byte[] skyLightBytes = skyLight.asBytes();
|
||||
for (int i = 0; i < 2048; i++) newSkyBytes[i] = skyLightBytes[i];
|
||||
System.arraycopy(skyLightBytes, 0, newSkyBytes, 0, 2048);
|
||||
}
|
||||
|
||||
// Copy counters
|
||||
@ -241,7 +241,7 @@ public class BukkitChunk_1_13 extends IntFaweChunk<Chunk, BukkitQueue_1_13> {
|
||||
Object[] currArray = ((Object[]) BukkitQueue_1_13.fieldLinearBlocks.get(currentPalette));
|
||||
Object[] newArray = ((Object[]) BukkitQueue_1_13.fieldLinearBlocks.get(newPalette));
|
||||
BukkitQueue_1_13.fieldLinearIndex.set(newPalette, BukkitQueue_1_13.fieldLinearIndex.get(currentPalette));
|
||||
for (int i = 0; i < newArray.length; i++) newArray[i] = currArray[i];
|
||||
System.arraycopy(currArray, 0, newArray, 0, newArray.length);
|
||||
}
|
||||
|
||||
BukkitQueue_1_13.fieldPalette.set(paletteBlock, newPalette);
|
||||
@ -348,8 +348,7 @@ public class BukkitChunk_1_13 extends IntFaweChunk<Chunk, BukkitQueue_1_13> {
|
||||
// Remove entities
|
||||
HashSet<UUID> entsToRemove = this.getEntityRemoves();
|
||||
if (!entsToRemove.isEmpty()) {
|
||||
for (int i = 0; i < entities.length; i++) {
|
||||
Collection<Entity> ents = entities[i];
|
||||
for (Collection<Entity> ents : entities) {
|
||||
if (!ents.isEmpty()) {
|
||||
Iterator<Entity> iter = ents.iterator();
|
||||
while (iter.hasNext()) {
|
||||
@ -445,13 +444,11 @@ public class BukkitChunk_1_13 extends IntFaweChunk<Chunk, BukkitQueue_1_13> {
|
||||
UUID uuid = entity.getUniqueID();
|
||||
entityTagMap.put("UUIDMost", new LongTag(uuid.getMostSignificantBits()));
|
||||
entityTagMap.put("UUIDLeast", new LongTag(uuid.getLeastSignificantBits()));
|
||||
if (nativeTag != null) {
|
||||
NBTTagCompound tag = (NBTTagCompound) BukkitQueue_1_13.fromNative(nativeTag);
|
||||
for (String name : Constants.NO_COPY_ENTITY_NBT_FIELDS) {
|
||||
tag.remove(name);
|
||||
}
|
||||
entity.f(tag);
|
||||
NBTTagCompound tag = (NBTTagCompound) BukkitQueue_1_13.fromNative(nativeTag);
|
||||
for (String name : Constants.NO_COPY_ENTITY_NBT_FIELDS) {
|
||||
tag.remove(name);
|
||||
}
|
||||
entity.f(tag);
|
||||
entity.setLocation(x, y, z, yaw, pitch);
|
||||
synchronized (BukkitQueue_0.class) {
|
||||
nmsWorld.addEntity(entity, CreatureSpawnEvent.SpawnReason.CUSTOM);
|
||||
@ -547,9 +544,7 @@ public class BukkitChunk_1_13 extends IntFaweChunk<Chunk, BukkitQueue_1_13> {
|
||||
// Trim tiles
|
||||
HashMap<BlockPosition, TileEntity> toRemove = null;
|
||||
if (!tiles.isEmpty()) {
|
||||
Iterator<Map.Entry<BlockPosition, TileEntity>> iterator = tiles.entrySet().iterator();
|
||||
while (iterator.hasNext()) {
|
||||
Map.Entry<BlockPosition, TileEntity> tile = iterator.next();
|
||||
for (Map.Entry<BlockPosition, TileEntity> tile : tiles.entrySet()) {
|
||||
BlockPosition pos = tile.getKey();
|
||||
int lx = pos.getX() & 15;
|
||||
int ly = pos.getY();
|
||||
@ -629,4 +624,4 @@ public class BukkitChunk_1_13 extends IntFaweChunk<Chunk, BukkitQueue_1_13> {
|
||||
}
|
||||
return this;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -691,27 +691,24 @@ public class BukkitQueue_1_13 extends BukkitQueue_0<net.minecraft.server.v1_13_R
|
||||
sections[layer] = new ChunkSection(layer << 4, nmsWorld.worldProvider.g());
|
||||
}
|
||||
}
|
||||
TaskManager.IMP.sync(new Supplier<Object>() {
|
||||
@Override
|
||||
public Object get() {
|
||||
try {
|
||||
int dirtyBits = fieldDirtyBits.getInt(playerChunk);
|
||||
if (dirtyBits == 0) {
|
||||
((CraftWorld) getWorld()).getHandle().getPlayerChunkMap().a(playerChunk);
|
||||
}
|
||||
if (mask == 0) {
|
||||
dirtyBits = 65535;
|
||||
} else {
|
||||
dirtyBits |= mask;
|
||||
}
|
||||
|
||||
fieldDirtyBits.set(playerChunk, dirtyBits);
|
||||
fieldDirtyCount.set(playerChunk, 64);
|
||||
} catch (IllegalAccessException e) {
|
||||
e.printStackTrace();
|
||||
TaskManager.IMP.sync(() -> {
|
||||
try {
|
||||
int dirtyBits = fieldDirtyBits.getInt(playerChunk);
|
||||
if (dirtyBits == 0) {
|
||||
((CraftWorld) getWorld()).getHandle().getPlayerChunkMap().a(playerChunk);
|
||||
}
|
||||
return null;
|
||||
if (mask == 0) {
|
||||
dirtyBits = 65535;
|
||||
} else {
|
||||
dirtyBits |= mask;
|
||||
}
|
||||
|
||||
fieldDirtyBits.set(playerChunk, dirtyBits);
|
||||
fieldDirtyCount.set(playerChunk, 64);
|
||||
} catch (IllegalAccessException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return null;
|
||||
});
|
||||
}
|
||||
// if (mask == 0) {
|
||||
@ -754,8 +751,7 @@ public class BukkitQueue_1_13 extends BukkitQueue_0<net.minecraft.server.v1_13_R
|
||||
public boolean hasEntities(net.minecraft.server.v1_13_R2.Chunk nmsChunk) {
|
||||
try {
|
||||
final Collection<Entity>[] entities = nmsChunk.entitySlices;
|
||||
for (int i = 0; i < entities.length; i++) {
|
||||
Collection<Entity> slice = entities[i];
|
||||
for (Collection<Entity> slice : entities) {
|
||||
if (slice != null && !slice.isEmpty()) {
|
||||
return true;
|
||||
}
|
||||
@ -781,8 +777,7 @@ public class BukkitQueue_1_13 extends BukkitQueue_0<net.minecraft.server.v1_13_R
|
||||
|
||||
@Override
|
||||
public void setFullbright(ChunkSection[] sections) {
|
||||
for (int i = 0; i < sections.length; i++) {
|
||||
ChunkSection section = sections[i];
|
||||
for (ChunkSection section : sections) {
|
||||
if (section != null) {
|
||||
byte[] bytes = section.getSkyLightArray().asBytes();
|
||||
Arrays.fill(bytes, (byte) 255);
|
||||
|
Reference in New Issue
Block a user