mirror of
https://github.com/PurpurMC/Purpur.git
synced 2026-02-17 16:37:43 +01:00
84 lines
5.2 KiB
Diff
84 lines
5.2 KiB
Diff
From dd79210dd48515873533b7a50d14eab5db537495 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 | 16 ++++++++++++++--
|
|
.../java/net/pl3x/purpur/PurpurWorldConfig.java | 2 ++
|
|
2 files changed, 16 insertions(+), 2 deletions(-)
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/BlockCampfire.java b/src/main/java/net/minecraft/server/BlockCampfire.java
|
|
index 3b95dfaaa..418fa6d1f 100644
|
|
--- a/src/main/java/net/minecraft/server/BlockCampfire.java
|
|
+++ b/src/main/java/net/minecraft/server/BlockCampfire.java
|
|
@@ -9,7 +9,7 @@ public class BlockCampfire extends BlockTileEntity implements IBlockWaterlogged
|
|
protected static final VoxelShape a = Block.a(0.0D, 0.0D, 0.0D, 16.0D, 7.0D, 16.0D);
|
|
public static final BlockStateBoolean b = BlockProperties.r; public static BlockStateBoolean lit() { return b; } // Purpur - OBFHELPER
|
|
public static final BlockStateBoolean c = BlockProperties.y; public static BlockStateBoolean signalFire() { return c; } // Purpur - OBFHELPER
|
|
- public static final BlockStateBoolean d = BlockProperties.C;
|
|
+ public static final BlockStateBoolean d = BlockProperties.C; public static BlockStateBoolean waterlogged() { return d; } // Purpur - OBFHELPER
|
|
public static final BlockStateDirection e = BlockProperties.N;
|
|
private static final VoxelShape f = Block.a(6.0D, 0.0D, 6.0D, 10.0D, 16.0D, 10.0D);
|
|
|
|
@@ -75,8 +75,19 @@ public class BlockCampfire extends BlockTileEntity implements IBlockWaterlogged
|
|
}
|
|
|
|
// Purpur start
|
|
+ @Override
|
|
+ public void onPlace(IBlockData iblockdata, World world, BlockPosition pos, IBlockData iblockdata1, boolean flag) {
|
|
+ world.getBlockTickList().a(pos, this, tickRate(world));
|
|
+ }
|
|
+
|
|
@Override
|
|
public void tick(IBlockData iblockdata, WorldServer world, BlockPosition pos, Random random) {
|
|
+ if (world.purpurConfig.campfireFallWithGravity && 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(waterlogged()) && iblockdata.get(lit())) {
|
|
+ world.setTypeAndData(pos, iblockdata.set(lit(), false), 3);
|
|
+ }
|
|
if (world.purpurConfig.campfireBurnOutInRain && world.getTime() % 20 == 0L && iblockdata.get(lit()) && world.isRainingAt(pos.shift(EnumDirection.UP))) {
|
|
world.setTypeAndData(pos, iblockdata.set(lit(), false), 3);
|
|
}
|
|
@@ -91,6 +102,7 @@ public class BlockCampfire extends BlockTileEntity implements IBlockWaterlogged
|
|
|
|
@Override
|
|
public IBlockData updateState(IBlockData iblockdata, EnumDirection enumdirection, IBlockData iblockdata1, GeneratorAccess generatoraccess, BlockPosition blockposition, BlockPosition blockposition1) {
|
|
+ generatoraccess.getBlockTickList().a(blockposition, this, tickRate(generatoraccess)); // Purpur - Campfires should fall with gravity
|
|
if ((Boolean) iblockdata.get(BlockCampfire.d)) {
|
|
generatoraccess.getFluidTickList().a(blockposition, FluidTypes.WATER, FluidTypes.WATER.a((IWorldReader) generatoraccess));
|
|
}
|
|
@@ -119,7 +131,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 a761b2c73..d6405b2ec 100644
|
|
--- a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
|
+++ b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
|
@@ -82,6 +82,7 @@ public class PurpurWorldConfig {
|
|
public boolean campfireRegenBoostRequireLineOfSight = false;
|
|
public boolean campfireRequireRegenPotion = true;
|
|
public boolean campfireBurnOutInRain = false;
|
|
+ public boolean campfireFallWithGravity = false;
|
|
private void campfireSettings() {
|
|
campfireRegenInterval = getInt("blocks.campfire.regen.interval", campfireRegenInterval);
|
|
campfireRegenDuration = getInt("blocks.campfire.regen.duration", campfireRegenDuration);
|
|
@@ -94,6 +95,7 @@ public class PurpurWorldConfig {
|
|
campfireRegenBoostRequireLineOfSight = getBoolean("blocks.campfire.regen.boost-require-line-of-sight", campfireRegenBoostRequireLineOfSight);
|
|
campfireRequireRegenPotion = getBoolean("blocks.campfire.regen.requires-potion-to-activate", campfireRequireRegenPotion);
|
|
campfireBurnOutInRain = getBoolean("blocks.campfire.burn-out-in-rain", campfireBurnOutInRain);
|
|
+ campfireFallWithGravity = getBoolean("blocks.campfire.fall-with-gravity", campfireFallWithGravity);
|
|
}
|
|
|
|
public boolean farmlandGetsMoistFromBelow = false;
|
|
--
|
|
2.26.2
|
|
|