mirror of
https://github.com/Samsuik/Sakura.git
synced 2025-12-28 03:09:07 +00:00
Add configurable falling block stacking restrictions
This commit is contained in:
@@ -597,10 +597,10 @@ index 0000000000000000000000000000000000000000..ebaa184d795dd57e97c4663f731e1284
|
||||
+}
|
||||
diff --git a/src/main/java/me/samsuik/sakura/configuration/WorldConfiguration.java b/src/main/java/me/samsuik/sakura/configuration/WorldConfiguration.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..14b9617b7da433283def16bb6f98d2abfe99bf8a
|
||||
index 0000000000000000000000000000000000000000..429c5477d10d0d3743fa5cf5e36cb6ce29731dba
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/me/samsuik/sakura/configuration/WorldConfiguration.java
|
||||
@@ -0,0 +1,114 @@
|
||||
@@ -0,0 +1,125 @@
|
||||
+package me.samsuik.sakura.configuration;
|
||||
+
|
||||
+import com.mojang.logging.LogUtils;
|
||||
@@ -614,6 +614,7 @@ index 0000000000000000000000000000000000000000..14b9617b7da433283def16bb6f98d2ab
|
||||
+import me.samsuik.sakura.explosion.durable.DurableMaterial;
|
||||
+import net.minecraft.Util;
|
||||
+import net.minecraft.resources.ResourceLocation;
|
||||
+import net.minecraft.world.entity.item.FallingBlockEntity;
|
||||
+import net.minecraft.world.level.block.Block;
|
||||
+import net.minecraft.world.level.block.Blocks;
|
||||
+import org.slf4j.Logger;
|
||||
@@ -654,6 +655,16 @@ index 0000000000000000000000000000000000000000..14b9617b7da433283def16bb6f98d2ab
|
||||
+ public class Sand extends ConfigurationPart {
|
||||
+ public boolean loadsChunks;
|
||||
+ public boolean despawnInsideMovingPistons = true;
|
||||
+
|
||||
+ @NestedSetting({"prevent-stacking", "against-border"})
|
||||
+ public boolean preventAgainstBorder = false;
|
||||
+ @NestedSetting({"prevent-stacking", "world-height"})
|
||||
+ public boolean preventAtWorldHeight = false;
|
||||
+
|
||||
+ public boolean isFallingBlockInBounds(FallingBlockEntity entity) {
|
||||
+ return (!preventAgainstBorder || !io.papermc.paper.util.CollisionUtil.isCollidingWithBorderEdge(entity.level().getWorldBorder(), entity.getBoundingBox()))
|
||||
+ && (!preventAtWorldHeight || entity.blockPosition().getY() < entity.level().getMaxBuildHeight() - 1);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ public Explosion explosion = new Explosion();
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Samsuik <40902469+Samsuik@users.noreply.github.com>
|
||||
Date: Thu, 16 Nov 2023 20:53:51 +0000
|
||||
Subject: [PATCH] Falling Block Stacking Restrictions
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java b/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java
|
||||
index 78fe35df4ef92f56d5ea2e80131fb7f4e71c9bea..bf52aafe542ca735181e461d1f9cbc39b8d88220 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java
|
||||
@@ -260,7 +260,7 @@ public class FallingBlockEntity extends Entity {
|
||||
boolean flag3 = FallingBlock.isFree(this.level().getBlockState(blockposition.below())) && (!flag || !flag1);
|
||||
boolean flag4 = this.blockState.canSurvive(this.level(), blockposition) && !flag3;
|
||||
|
||||
- if (flag2 && flag4) {
|
||||
+ if (flag2 && flag4 && level().sakuraConfig().cannons.sand.isFallingBlockInBounds(this)) { // Sakura
|
||||
if (this.blockState.hasProperty(BlockStateProperties.WATERLOGGED) && this.level().getFluidState(blockposition).getType() == Fluids.WATER) {
|
||||
this.blockState = (BlockState) this.blockState.setValue(BlockStateProperties.WATERLOGGED, true);
|
||||
}
|
||||
Reference in New Issue
Block a user