-
-
Notifications
You must be signed in to change notification settings - Fork 375
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Option for beds to explode on villager sleep (#638)
- Loading branch information
Showing
1 changed file
with
49 additions
and
0 deletions.
There are no files selected for viewing
49 changes: 49 additions & 0 deletions
49
patches/server/0255-Option-for-beds-to-explode-on-villager-sleep.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 | ||
From: 12emin34 <macanovic.emin@gmail.com> | ||
Date: Tue, 31 Aug 2021 16:48:29 +0200 | ||
Subject: [PATCH] Option for beds to explode on villager sleep | ||
|
||
|
||
diff --git a/src/main/java/net/minecraft/world/entity/npc/Villager.java b/src/main/java/net/minecraft/world/entity/npc/Villager.java | ||
index 597d21bd2d7dde000e02986557be205380e2aa0a..e5adfd16d132828727040b56a90c1173c9b71a44 100644 | ||
--- a/src/main/java/net/minecraft/world/entity/npc/Villager.java | ||
+++ b/src/main/java/net/minecraft/world/entity/npc/Villager.java | ||
@@ -1175,10 +1175,16 @@ public class Villager extends AbstractVillager implements ReputationEventHandler | ||
|
||
@Override | ||
public void startSleeping(BlockPos pos) { | ||
- super.startSleeping(pos); | ||
- this.brain.setMemory(MemoryModuleType.LAST_SLEPT, this.level.getGameTime()); // CraftBukkit - decompile error | ||
- this.brain.eraseMemory(MemoryModuleType.WALK_TARGET); | ||
- this.brain.eraseMemory(MemoryModuleType.CANT_REACH_WALK_TARGET_SINCE); | ||
+ // Purpur start | ||
+ if (level.purpurConfig.bedExplodeOnVillagerSleep && this.level.getBlockState(pos).getBlock() instanceof net.minecraft.world.level.block.BedBlock) { | ||
+ this.level.explode(null, DamageSource.explosion((net.minecraft.world.level.Explosion) null), null, (double) pos.getX() + 0.5D, (double) pos.getY() + 0.5D, (double) pos.getZ() + 0.5D, (float) this.level.purpurConfig.bedExplosionPower, this.level.purpurConfig.bedExplosionFire, this.level.purpurConfig.bedExplosionEffect); | ||
+ } else { | ||
+ super.startSleeping(pos); | ||
+ this.brain.setMemory(MemoryModuleType.LAST_SLEPT, this.level.getGameTime()); // CraftBukkit - decompile error | ||
+ this.brain.eraseMemory(MemoryModuleType.WALK_TARGET); | ||
+ this.brain.eraseMemory(MemoryModuleType.CANT_REACH_WALK_TARGET_SINCE); | ||
+ } | ||
+ // Purpur end | ||
} | ||
|
||
@Override | ||
diff --git a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java | ||
index 467cc1e7166875c929b4d39f7ed3d7c2f12991e6..702ed3dd224982989060295f3ca07a6459072c65 100644 | ||
--- a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java | ||
+++ b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java | ||
@@ -731,11 +731,13 @@ public class PurpurWorldConfig { | ||
} | ||
|
||
public boolean bedExplode = true; | ||
+ public boolean bedExplodeOnVillagerSleep = false; | ||
public double bedExplosionPower = 5.0D; | ||
public boolean bedExplosionFire = true; | ||
public Explosion.BlockInteraction bedExplosionEffect = Explosion.BlockInteraction.DESTROY; | ||
private void bedSettings() { | ||
bedExplode = getBoolean("blocks.bed.explode", bedExplode); | ||
+ bedExplodeOnVillagerSleep = getBoolean("blocks.bed.explode-on-villager-sleep", bedExplodeOnVillagerSleep); | ||
bedExplosionPower = getDouble("blocks.bed.explosion-power", bedExplosionPower); | ||
bedExplosionFire = getBoolean("blocks.bed.explosion-fire", bedExplosionFire); | ||
try { |