Campfires should fall with gravity

This commit is contained in:
William Blake Galbreath
2019-05-23 17:48:37 -05:00
parent cf1c2c4ee2
commit 2a83044398
2 changed files with 71 additions and 7 deletions

View File

@@ -33,14 +33,16 @@ verbose
* **default**: false
* **description**: Sets whether the server should dump all configuration values to the server log on startup.
* enable-tick-overload
- **default**: false
- **description**: Enable/disable the vanilla tick overload detection ("Can't keep up! Is the server overloaded?")
enable-tick-overload
~~~~~~~~~~~~~~~~~~~~
* **default**: false
* **description**: Enable/disable the vanilla tick overload detection ("Can't keep up! Is the server overloaded?")
* enable-tps-catchup
- **default**: false
- **description**: Enable/disable Spigot's TPS catchup (makes everything tick faster than 20 tps after
lag spikes, which can cause more lag - also skews /tps reports by ruining the average with above 20 tps entries)
enable-tps-catchup
~~~~~~~~~~~~~~~~~~
* **default**: false
* **description**: Enable/disable Spigot's TPS catchup (makes everything tick faster than 20 tps after
lag spikes, which can cause more lag - also skews /tps reports by ruining the average with above 20 tps entries)
logger
~~~~~~
@@ -82,6 +84,11 @@ World Settings
World settings are on a per-world basis. The child-node `default` is used for all worlds that do not have their own specific settings.
campfire-obeys-gravity
~~~~~~~~~~~~~~~~~~~~
* **default**: true
* **description**: When true, campfires will fall to the ground (like anvils do) instead of floating in the air
campfire-regen
~~~~~~~~~~~~~~
* interval

View File

@@ -0,0 +1,57 @@
From b734f40218f86431a0774e90e1e55b1c1dcc9401 Mon Sep 17 00:00:00 2001
From: William Blake Galbreath <blake.galbreath@gmail.com>
Date: Thu, 23 May 2019 16:20:21 -0500
Subject: [PATCH] Campfires should fall with gravity
---
.../java/net/minecraft/server/BlockCampfire.java | 15 +++++++++++++++
.../java/net/pl3x/purpur/PurpurWorldConfig.java | 5 +++++
2 files changed, 20 insertions(+)
diff --git a/src/main/java/net/minecraft/server/BlockCampfire.java b/src/main/java/net/minecraft/server/BlockCampfire.java
index e77fed937..410532886 100644
--- a/src/main/java/net/minecraft/server/BlockCampfire.java
+++ b/src/main/java/net/minecraft/server/BlockCampfire.java
@@ -72,8 +72,23 @@ public class BlockCampfire extends BlockTileEntity implements IBlockWaterlogged
return (IBlockData) ((IBlockData) ((IBlockData) ((IBlockData) this.getBlockData().set(BlockCampfire.d, flag)).set(BlockCampfire.c, this.j(world.getType(blockposition.down())))).set(BlockCampfire.b, !flag)).set(BlockCampfire.e, blockactioncontext.f());
}
+ // Purpur start - Campfires should fall with gravity
+ @Override
+ public void onPlace(IBlockData iblockdata, World world, BlockPosition pos, IBlockData iblockdata1, boolean flag) {
+ world.getBlockTickList().a(pos, this, this.a((IWorldReader) world));
+ }
+
+ @Override
+ public void tick(IBlockData iblockdata, World world, BlockPosition pos, Random random) {
+ if (world.purpurConfig.campfireObeysGravity && BlockFalling.canFallThrough(world.getType(pos.down())) && pos.getY() >= 0) {
+ world.addEntity(new EntityFallingBlock(world, pos.getX() + 0.5D, pos.getY(), pos.getZ() + 0.5D, world.getType(pos)));
+ }
+ }
+ // Purpur end
+
@Override
public IBlockData updateState(IBlockData iblockdata, EnumDirection enumdirection, IBlockData iblockdata1, GeneratorAccess generatoraccess, BlockPosition blockposition, BlockPosition blockposition1) {
+ generatoraccess.getBlockTickList().a(blockposition, this, this.a((IWorldReader) generatoraccess)); // Purpur - Campfires should fall with gravity
if ((Boolean) iblockdata.get(BlockCampfire.d)) {
generatoraccess.getFluidTickList().a(blockposition, FluidTypes.WATER, FluidTypes.WATER.a((IWorldReader) generatoraccess));
}
diff --git a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
index becb6f3b7..e598099dd 100644
--- a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
+++ b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
@@ -61,6 +61,11 @@ public class PurpurWorldConfig {
return config.getString("world-settings." + worldName + "." + path, config.getString("world-settings.default." + path));
}
+ public boolean campfireObeysGravity = true;
+ private void campfireObeysGravity() {
+ campfireObeysGravity = getBoolean("campfire-obeys-gravity", campfireObeysGravity);
+ }
+
public int campfireRegenInterval = 40;
public int campfireRegenDuration = 80;
public int campfireRegenRange = 5;
--
2.20.1