CavePVP-Stuff/cSpigot-master/spigot-server-Patches/0044-Configurable-game-mechanics-changes.patch

99 lines
4.1 KiB
Diff
Raw Normal View History

2023-05-01 20:59:40 +02:00
From f5d98c382b50e3f7717597771a70e4bf48a2c777 Mon Sep 17 00:00:00 2001
From: gsand <gsandowns@gmail.com>
Date: Fri, 24 Oct 2014 22:09:58 -0500
Subject: [PATCH] Configurable game mechanics changes
diff --git a/src/main/java/net/minecraft/server/BlockTorch.java b/src/main/java/net/minecraft/server/BlockTorch.java
index d95aff288..8de558104 100644
--- a/src/main/java/net/minecraft/server/BlockTorch.java
+++ b/src/main/java/net/minecraft/server/BlockTorch.java
@@ -32,7 +32,8 @@ public class BlockTorch extends Block {
} else {
Block block = world.getType(i, j, k);
- return block == Blocks.FENCE || block == Blocks.NETHER_FENCE || block == Blocks.GLASS || block == Blocks.COBBLE_WALL;
+ // PaperSpigot - Allow torch placement on stained glass as well
+ return world.paperSpigotConfig.lessPickyTorches ? block == Blocks.FENCE || block == Blocks.NETHER_FENCE || block == Blocks.GLASS || block == Blocks.STAINED_GLASS || block == Blocks.COBBLE_WALL : block == Blocks.FENCE || block == Blocks.NETHER_FENCE || block == Blocks.GLASS || block == Blocks.COBBLE_WALL;
}
}
diff --git a/src/main/java/net/minecraft/server/EntityBoat.java b/src/main/java/net/minecraft/server/EntityBoat.java
index c9f2b1372..7c4c303be 100644
--- a/src/main/java/net/minecraft/server/EntityBoat.java
+++ b/src/main/java/net/minecraft/server/EntityBoat.java
@@ -337,13 +337,7 @@ public class EntityBoat extends Entity {
if (!destroyEvent.isCancelled()) {
this.die();
- for (k = 0; k < 3; ++k) {
- this.a(Item.getItemOf(Blocks.WOOD), 1, 0.0F);
- }
-
- for (k = 0; k < 2; ++k) {
- this.a(Items.STICK, 1, 0.0F);
- }
+ breakNaturally(); // PaperSpigot - Customizable boat drops
}
// CraftBukkit end
}
@@ -452,15 +446,7 @@ public class EntityBoat extends Entity {
if (!destroyEvent.isCancelled()) {
this.die();
- int l;
-
- for (l = 0; l < 3; ++l) {
- this.a(Item.getItemOf(Blocks.WOOD), 1, 0.0F);
- }
-
- for (l = 0; l < 2; ++l) {
- this.a(Items.STICK, 1, 0.0F);
- }
+ breakNaturally(); // PaperSpigot - Customizable boat drops
}
// CraftBukkit end
}
@@ -495,4 +481,21 @@ public class EntityBoat extends Entity {
public int i() {
return this.datawatcher.getInt(18);
}
+
+ /**
+ * PaperSpigot - Handles boat drops depending on the user's config setting
+ */
+ public void breakNaturally() {
+ if (this.world.paperSpigotConfig.boatsDropBoats) {
+ this.a(Items.BOAT, 1, 0.0F);
+ } else {
+ for (int k = 0; k < 3; ++k) {
+ this.a(Item.getItemOf(Blocks.WOOD), 1, 0.0F);
+ }
+
+ for (int k = 0; k < 2; ++k) {
+ this.a(Items.STICK, 1, 0.0F);
+ }
+ }
+ }
}
diff --git a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java b/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java
index f80c075c3..686b45703 100644
--- a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java
+++ b/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java
@@ -188,4 +188,12 @@ public class PaperSpigotWorldConfig
removeUnloadedTNTEntities = getBoolean( "remove-unloaded.tnt-entities", true );
removeUnloadedFallingBlocks = getBoolean( "remove-unloaded.falling-blocks", true );
}
+
+ public boolean boatsDropBoats;
+ public boolean lessPickyTorches;
+ private void mechanicsChanges()
+ {
+ boatsDropBoats = getBoolean( "game-mechanics.boats-drop-boats", false );
+ lessPickyTorches = getBoolean( "game-mechanics.less-picky-torch-placement", false );
+ }
}
--
2.13.3