mirror of
https://github.com/Samsuik/Sakura.git
synced 2025-12-21 15:59:26 +00:00
87 lines
4.1 KiB
Diff
87 lines
4.1 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 63490856a582db74c47e87d3a2ee414ce2456643..2b6ca6a04013f684397ede74f1d3a295b2dbafd7 100644
|
|
--- a/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java
|
|
+++ b/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java
|
|
@@ -68,6 +68,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 - Expand FallingBlock API
|
|
+ public boolean heightParity; // Sakura - configure cannon mechanics
|
|
|
|
public FallingBlockEntity(EntityType<? extends FallingBlockEntity> type, Level world) {
|
|
super(type, world);
|
|
@@ -76,6 +77,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) {
|
|
@@ -185,6 +187,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 dbebba5c36b034270d4c238966957bc25a35aa86..5bc7e9c135d02fe8817643bd21d8f245a6e984df 100644
|
|
--- a/src/main/java/net/minecraft/world/entity/item/PrimedTnt.java
|
|
+++ b/src/main/java/net/minecraft/world/entity/item/PrimedTnt.java
|
|
@@ -54,6 +54,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
|
|
@@ -225,7 +231,7 @@ public class PrimedTnt extends Entity implements TraceableEntity {
|
|
// Paper start - Option to 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 - Option to prevent TNT from moving in water
|
|
}
|
|
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftFallingBlock.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftFallingBlock.java
|
|
index 0afa2cfb04b5097788927076669e85fe24041df9..8e678a811e232bbd78de45b80fae47964bdf8f98 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
|