mirror of
https://github.com/plexusorg/Plex-FAWE.git
synced 2025-01-09 17:27:38 +00:00
Settings.IMP is terrible. Don't initialise it thousands of times.
This commit is contained in:
parent
c757b01803
commit
56c720914e
@ -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,13 +29,24 @@ public class NMSAdapter {
|
|||||||
air++;
|
air++;
|
||||||
break;
|
break;
|
||||||
default:
|
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);
|
BlockState state = BlockState.getFromOrdinal(ordinal);
|
||||||
if (state.getMaterial().isTicksRandomly()) {
|
ticking_blocks
|
||||||
ticking_blocks.put(BlockVector3.at(i & 15, (i >> 8) & 15, (i >> 4) & 15),
|
.put(BlockVector3.at(i & 15, (i >> 8) & 15, (i >> 4) & 15),
|
||||||
WorldEditPlugin.getInstance().getBukkitImplAdapter()
|
WorldEditPlugin.getInstance().getBukkitImplAdapter()
|
||||||
.getInternalBlockStateId(state).orElse(0));
|
.getInternalBlockStateId(state).orElse(0));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
int palette = blockToPalette[ordinal];
|
int palette = blockToPalette[ordinal];
|
||||||
if (palette == Integer.MAX_VALUE) {
|
if (palette == Integer.MAX_VALUE) {
|
||||||
blockToPalette[ordinal] = palette = num_palette;
|
blockToPalette[ordinal] = palette = num_palette;
|
||||||
@ -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];
|
||||||
|
Loading…
Reference in New Issue
Block a user