3
0
Mirror von https://github.com/IntellectualSites/FastAsyncWorldEdit.git synchronisiert 2024-11-03 01:50:07 +01:00

Settings.IMP is terrible. Don't initialise it thousands of times.

Dieser Commit ist enthalten in:
dordsor21 2020-05-08 18:17:47 +01:00
Ursprung c757b01803
Commit 56c720914e

Datei anzeigen

@ -15,6 +15,9 @@ public class NMSAdapter {
int[] num_palette_buffer, char[] set, Map<BlockVector3, Integer> ticking_blocks) {
int air = 0;
int num_palette = 0;
char lastOrdinal = BlockID.__RESERVED__;
boolean lastticking = false;
boolean tick_placed = Settings.IMP.EXPERIMENTAL.ALLOW_TICK_PLACED;
for (int i = 0; i < 4096; i++) {
char ordinal = set[i];
switch (ordinal) {
@ -26,13 +29,24 @@ public class NMSAdapter {
air++;
break;
default:
if (!tick_placed) {
boolean ticking;
if (ordinal != lastOrdinal) {
ticking = BlockTypesCache.ticking[ordinal];
lastOrdinal = ordinal;
lastticking = ticking;
} else {
ticking = lastticking;
}
if (ticking) {
BlockState state = BlockState.getFromOrdinal(ordinal);
if (state.getMaterial().isTicksRandomly()) {
ticking_blocks.put(BlockVector3.at(i & 15, (i >> 8) & 15, (i >> 4) & 15),
ticking_blocks
.put(BlockVector3.at(i & 15, (i >> 8) & 15, (i >> 4) & 15),
WorldEditPlugin.getInstance().getBukkitImplAdapter()
.getInternalBlockStateId(state).orElse(0));
}
}
}
int palette = blockToPalette[ordinal];
if (palette == Integer.MAX_VALUE) {
blockToPalette[ordinal] = palette = num_palette;
@ -53,6 +67,7 @@ public class NMSAdapter {
char[] getArr = null;
char lastOrdinal = BlockID.__RESERVED__;
boolean lastticking = false;
boolean tick_placed = Settings.IMP.EXPERIMENTAL.ALLOW_TICK_PLACED;
for (int i = 0; i < 4096; i++) {
char ordinal = set[i];
switch (ordinal) {
@ -70,7 +85,7 @@ public class NMSAdapter {
air++;
break;
default:
if (!Settings.IMP.EXPERIMENTAL.ALLOW_TICK_PLACED) {
if (!tick_placed) {
boolean ticking;
if (ordinal != lastOrdinal) {
ticking = BlockTypesCache.ticking[ordinal];
@ -97,7 +112,7 @@ public class NMSAdapter {
air++;
break;
}
if (Settings.IMP.EXPERIMENTAL.ALLOW_TICK_PLACED) {
if (tick_placed) {
boolean ticking;
if (ordinal != lastOrdinal) {
ticking = BlockTypesCache.ticking[ordinal];