papermc/Spigot-Server-Patches/0045-Configurable-game-mechanics-changes.patch

99 lines
4.1 KiB
Diff
Raw Normal View History

From 87f63a5ecd0f0459f65ccf07aa38b5b47b99a3a8 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 d95aff2..784d4c0 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 c9f2b13..7c4c303 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 f80c075..6b789e4 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 );
+ }
}
--
1.9.1