By default only allow existing blocks to tick.

- Revert back to default FAWE behaviour where placed blocks do not tick by default (until a restart, or another edit is done in the same chunksection without changing the block)
This commit is contained in:
dordsor21 2020-05-08 16:16:08 +01:00
parent 56972ee40b
commit c757b01803
2 changed files with 40 additions and 13 deletions

View File

@ -1,5 +1,6 @@
package com.boydti.fawe.bukkit.adapter; package com.boydti.fawe.bukkit.adapter;
import com.boydti.fawe.config.Settings;
import com.sk89q.worldedit.bukkit.WorldEditPlugin; import com.sk89q.worldedit.bukkit.WorldEditPlugin;
import com.sk89q.worldedit.math.BlockVector3; import com.sk89q.worldedit.math.BlockVector3;
import com.sk89q.worldedit.world.block.BlockID; import com.sk89q.worldedit.world.block.BlockID;
@ -68,6 +69,24 @@ public class NMSAdapter {
case BlockID.VOID_AIR: case BlockID.VOID_AIR:
air++; air++;
break; break;
default:
if (!Settings.IMP.EXPERIMENTAL.ALLOW_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);
ticking_blocks
.put(BlockVector3.at(i & 15, (i >> 8) & 15, (i >> 4) & 15),
WorldEditPlugin.getInstance().getBukkitImplAdapter()
.getInternalBlockStateId(state).orElse(0));
}
}
} }
set[i] = ordinal; set[i] = ordinal;
break; break;
@ -78,19 +97,21 @@ public class NMSAdapter {
air++; air++;
break; break;
} }
boolean ticking; if (Settings.IMP.EXPERIMENTAL.ALLOW_TICK_PLACED) {
if (ordinal != lastOrdinal) { boolean ticking;
ticking = BlockTypesCache.ticking[ordinal]; if (ordinal != lastOrdinal) {
lastOrdinal = ordinal; ticking = BlockTypesCache.ticking[ordinal];
lastticking = ticking; lastOrdinal = ordinal;
} else { lastticking = ticking;
ticking = lastticking; } else {
} ticking = lastticking;
if (ticking) { }
BlockState state = BlockState.getFromOrdinal(ordinal); if (ticking) {
ticking_blocks.put(BlockVector3.at(i & 15, (i >> 8) & 15, (i >> 4) & 15), BlockState state = BlockState.getFromOrdinal(ordinal);
WorldEditPlugin.getInstance().getBukkitImplAdapter() ticking_blocks.put(BlockVector3.at(i & 15, (i >> 8) & 15, (i >> 4) & 15),
.getInternalBlockStateId(state).orElse(0)); WorldEditPlugin.getInstance().getBukkitImplAdapter()
.getInternalBlockStateId(state).orElse(0));
}
} }
int palette = blockToPalette[ordinal]; int palette = blockToPalette[ordinal];
if (palette == Integer.MAX_VALUE) { if (palette == Integer.MAX_VALUE) {

View File

@ -369,6 +369,12 @@ public class Settings extends Config {
"Other experimental features" "Other experimental features"
}) })
public boolean OTHER = false; public boolean OTHER = false;
@Comment({
"Allow blocks placed by WorldEdit to tick. This could cause the big lags.",
"This has no effect on existing blocks one way or the other."
})
public boolean ALLOW_TICK_PLACED = false;
} }
public static class WEB { public static class WEB {