mirror of
https://github.com/Samsuik/Sakura.git
synced 2025-12-23 08:49:25 +00:00
87 lines
3.9 KiB
Diff
87 lines
3.9 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: Samsuik <40902469+Samsuik@users.noreply.github.com>
|
|
Date: Sun, 15 Oct 2023 22:48:35 +0100
|
|
Subject: [PATCH] Cannon Mechanics
|
|
|
|
|
|
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 b7f9c8a6de4c07f230f99b6bfa1332166e696b49..7de6f027fc8a9e7d44ae1e5fa99690dcb04a89c7 100644
|
|
--- a/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java
|
|
+++ b/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java
|
|
@@ -67,6 +67,7 @@ public class FallingBlockEntity extends Entity {
|
|
public CompoundTag blockData;
|
|
protected static final EntityDataAccessor<BlockPos> DATA_START_POS = SynchedEntityData.defineId(FallingBlockEntity.class, EntityDataSerializers.BLOCK_POS);
|
|
public boolean autoExpire = true; // Paper - Auto expire setting
|
|
+ public boolean heightParity; // Sakura
|
|
|
|
public FallingBlockEntity(EntityType<? extends FallingBlockEntity> type, Level world) {
|
|
super(type, world);
|
|
@@ -75,6 +76,7 @@ public class FallingBlockEntity extends Entity {
|
|
this.fallDamageMax = 40;
|
|
this.isFallingBlock = true; // Sakura
|
|
this.loadChunks = world.sakuraConfig().cannons.sand.loadsChunks; // Sakura - load chunks
|
|
+ this.heightParity = world.sakuraConfig().cannons.mechanics.fallingBlockParity; // Sakura
|
|
}
|
|
|
|
public FallingBlockEntity(Level world, double x, double y, double z, BlockState block) {
|
|
@@ -183,6 +185,12 @@ public class FallingBlockEntity extends Entity {
|
|
return itemEntity;
|
|
}
|
|
// Sakura end
|
|
+ // Sakura start
|
|
+ @Override
|
|
+ public final double getEyeY() {
|
|
+ return heightParity ? getY() : super.getEyeY();
|
|
+ }
|
|
+ // Sakura end
|
|
|
|
@Override
|
|
public void tick() {
|
|
diff --git a/src/main/java/net/minecraft/world/entity/item/PrimedTnt.java b/src/main/java/net/minecraft/world/entity/item/PrimedTnt.java
|
|
index ebfd24f9fb90071288f0c872c0e3fbd58bb3f2b9..d534bc3ff8d5995ced0f9f89261cdcf1835698f4 100644
|
|
--- a/src/main/java/net/minecraft/world/entity/item/PrimedTnt.java
|
|
+++ b/src/main/java/net/minecraft/world/entity/item/PrimedTnt.java
|
|
@@ -53,6 +53,12 @@ public class PrimedTnt extends Entity implements TraceableEntity {
|
|
this.yo = y;
|
|
this.zo = z;
|
|
this.owner = igniter;
|
|
+ // Sakura start
|
|
+ switch (world.sakuraConfig().cannons.mechanics.tntSpread) {
|
|
+ case NONE -> multiplyDeltaMovement(0, 0, 0);
|
|
+ case Y -> multiplyDeltaMovement(0, 1, 0);
|
|
+ }
|
|
+ // Sakura end
|
|
}
|
|
|
|
@Override
|
|
@@ -255,7 +261,7 @@ public class PrimedTnt extends Entity implements TraceableEntity {
|
|
// Paper start - Optional prevent TNT from moving in water
|
|
@Override
|
|
public boolean isPushedByFluid() {
|
|
- return !level().paperConfig().fixes.preventTntFromMovingInWater && super.isPushedByFluid();
|
|
+ return !level().paperConfig().fixes.preventTntFromMovingInWater && level().sakuraConfig().cannons.mechanics.tntFlowsInWater && super.isPushedByFluid(); // Sakura - convenience
|
|
}
|
|
// Paper end
|
|
}
|
|
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftFallingBlock.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftFallingBlock.java
|
|
index c64ab06b62334e5ab1ab5ad78fa400de45c15723..94667eab6d756ee170eb49e2e434c7a3b0df2d67 100644
|
|
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftFallingBlock.java
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftFallingBlock.java
|
|
@@ -34,6 +34,16 @@ public class CraftFallingBlock extends CraftEntity implements FallingBlock {
|
|
public void setStacked(int stacked) {
|
|
getHandle().setStacked(stacked);
|
|
}
|
|
+
|
|
+ @Override
|
|
+ public void setHeightParity(boolean parity) {
|
|
+ getHandle().heightParity = parity;
|
|
+ }
|
|
+
|
|
+ @Override
|
|
+ public boolean getHeightParity() {
|
|
+ return getHandle().heightParity;
|
|
+ }
|
|
// Sakura end
|
|
|
|
@Override
|