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