9
0
mirror of https://github.com/Samsuik/Sakura.git synced 2025-12-30 04:09:09 +00:00

Rename useBlockCacheAcrossExplosions

This commit is contained in:
Samsuik
2025-09-25 10:56:21 +01:00
parent 7dfd66c10c
commit 3a043110ca
4 changed files with 21 additions and 3 deletions

View File

@@ -28,7 +28,7 @@ import java.util.Set;
public final class WorldConfiguration extends ConfigurationPart {
private static final Logger LOGGER = LogUtils.getClassLogger();
static final int CURRENT_VERSION = 11; // (when you change the version, change the comment, so it conflicts on rebases): rename filter bad nbt from spawn eggs
static final int CURRENT_VERSION = 12; // (when you change the version, change the comment, so it conflicts on rebases): rename filter bad nbt from spawn eggs
private transient final ResourceLocation worldKey;
WorldConfiguration(ResourceLocation worldKey) {
@@ -85,7 +85,7 @@ public final class WorldConfiguration extends ConfigurationPart {
public class Explosion extends ConfigurationPart {
public boolean optimiseProtectedRegions = false;
public boolean avoidRedundantBlockSearches = false;
public boolean useBlockCacheAcrossExplosions = false;
public boolean reuseBlockCacheAcrossExplosions = false;
public Map<Block, DurableMaterial> durableMaterials = Util.make(new Reference2ObjectOpenHashMap<>(), map -> {
map.put(Blocks.OBSIDIAN, new DurableMaterial(4, Blocks.COBBLESTONE.getExplosionResistance(), true));

View File

@@ -32,6 +32,7 @@ public final class ConfigurationTransformations {
V9_RenameAllowNonTntBreakingDurableBlocks.apply(versionedBuilder);
V10_DurableMaterialOnlyDamagedByTnt.apply(versionedBuilder);
V11_RemovePhysicsVersion.apply(versionedBuilder);
V12_RenameUseBlockCacheAcrossExplosions.apply(versionedBuilder);
// ADD FUTURE VERSIONED TRANSFORMS TO versionedBuilder HERE
versionedBuilder.build().apply(node);
}

View File

@@ -0,0 +1,17 @@
package me.samsuik.sakura.configuration.transformation.world;
import me.samsuik.sakura.configuration.transformation.ConfigurationTransformations;
import org.spongepowered.configurate.NodePath;
import org.spongepowered.configurate.transformation.ConfigurationTransformation;
import static org.spongepowered.configurate.transformation.TransformAction.rename;
public final class V12_RenameUseBlockCacheAcrossExplosions {
private static final int VERSION = 12;
private static final NodePath USE_BLOCK_CACHE_ACROSS_EXPLOSIONS_PATH = NodePath.path("cannons", "explosion", "use-block-cache-across-explosions");
private static final String NEW_NAME = "reuse-block-cache-across-explosions";
public static void apply(final ConfigurationTransformation.VersionedBuilder builder) {
builder.addVersion(VERSION, ConfigurationTransformations.transform(USE_BLOCK_CACHE_ACROSS_EXPLOSIONS_PATH, rename(NEW_NAME)));
}
}

View File

@@ -84,7 +84,7 @@ public abstract class SpecialisedExplosion<T extends Entity> extends ServerExplo
protected void postExplosion(final List<BlockPos> foundBlocks, final boolean destroyedBlocks) {
// Reuse the block cache between explosions. This can help a lot when searching for blocks and raytracing.
// This is disabled by default as it's incompatible with plugins that modify blocks in the explosion event.
if (this.level().sakuraConfig().cannons.explosion.useBlockCacheAcrossExplosions && !foundBlocks.isEmpty() && !destroyedBlocks) {
if (this.level().sakuraConfig().cannons.explosion.reuseBlockCacheAcrossExplosions && !foundBlocks.isEmpty() && !destroyedBlocks) {
this.markBlocksInCacheAsExplodable(foundBlocks);
} else {
super.blockCache.clear();