mirror of
https://github.com/Samsuik/Sakura.git
synced 2025-12-29 11:49:07 +00:00
87 lines
4.0 KiB
Diff
87 lines
4.0 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 33a247ac617c17e7c0cf1614ca485398c60ea579..ad8a3f5c41bcd2860d6872655b6b2ef25b6d349c 100644
|
|
--- a/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java
|
|
+++ b/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java
|
|
@@ -64,6 +64,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 - configure cannon mechanics
|
|
|
|
public FallingBlockEntity(EntityType<? extends FallingBlockEntity> type, Level world) {
|
|
super(type, world);
|
|
@@ -72,6 +73,7 @@ public class FallingBlockEntity extends Entity {
|
|
this.fallDamageMax = 40;
|
|
this.isFallingBlock = true; // Sakura
|
|
this.loadChunks = world.sakuraConfig().cannons.loadChunks; // Sakura - falling blocks load chunks
|
|
+ this.heightParity = world.sakuraConfig().cannons.mechanics.fallingBlockParity; // Sakura - configure cannon mechanics
|
|
}
|
|
|
|
public FallingBlockEntity(Level world, double x, double y, double z, BlockState block) {
|
|
@@ -182,6 +184,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 ab4bcf2383e060a348eb172d1b36310cbbe17f72..683d44becb21689b95ba4babd235ee9199f4f6d8 100644
|
|
--- a/src/main/java/net/minecraft/world/entity/item/PrimedTnt.java
|
|
+++ b/src/main/java/net/minecraft/world/entity/item/PrimedTnt.java
|
|
@@ -42,6 +42,12 @@ public class PrimedTnt extends Entity {
|
|
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
|
|
@@ -199,7 +205,7 @@ public class PrimedTnt extends Entity {
|
|
// 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 && this.level.sakuraConfig().cannons.mechanics.tntFlowsInWater && super.isPushedByFluid(); // Sakura - cannon mechanics
|
|
}
|
|
// 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 65bac64214112ebd9e067202fe13293abe10559d..d43431c7609866cb5ba89b68fea909f5ff76f825 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
|