mirror of
https://github.com/PurpurMC/Purpur.git
synced 2026-02-18 00:47:42 +01:00
70 lines
3.8 KiB
Diff
70 lines
3.8 KiB
Diff
From efdbf6479d70b20959933d43eae954e9d1d2b9c9 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
|
|
|
|
---
|
|
.../net/minecraft/server/BlockCampfire.java | 20 ++++++++++++++++++-
|
|
.../net/pl3x/purpur/PurpurWorldConfig.java | 5 +++++
|
|
2 files changed, 24 insertions(+), 1 deletion(-)
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/BlockCampfire.java b/src/main/java/net/minecraft/server/BlockCampfire.java
|
|
index 5cbe8e68e..904bf47b8 100644
|
|
--- a/src/main/java/net/minecraft/server/BlockCampfire.java
|
|
+++ b/src/main/java/net/minecraft/server/BlockCampfire.java
|
|
@@ -72,8 +72,26 @@ 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)));
|
|
+ }
|
|
+ if (iblockdata.get(BlockCampfire.d) && iblockdata.get(BlockCampfire.b)) {
|
|
+ world.setTypeAndData(pos, iblockdata.set(BlockCampfire.b, false), 3);
|
|
+ }
|
|
+ }
|
|
+ // 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));
|
|
}
|
|
@@ -107,7 +125,7 @@ public class BlockCampfire extends BlockTileEntity implements IBlockWaterlogged
|
|
|
|
@Override
|
|
public boolean place(GeneratorAccess generatoraccess, BlockPosition blockposition, IBlockData iblockdata, Fluid fluid) {
|
|
- if (!(Boolean) iblockdata.get(BlockProperties.C) && fluid.getType() == FluidTypes.WATER) {
|
|
+ if (!(Boolean) iblockdata.get(BlockCampfire.d) && fluid.getType() == FluidTypes.WATER) { // Purpur
|
|
boolean flag = (Boolean) iblockdata.get(BlockCampfire.b);
|
|
|
|
if (flag) {
|
|
diff --git a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
|
index 5e9c633ac..6e6d6defd 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
|
|
|