mirror of
https://github.com/PaperMC/Paper.git
synced 2025-03-13 19:28:03 +01:00
Make certain game mechanics configurable
Boat drops and rail placement at this time
This commit is contained in:
parent
d1cbf1b137
commit
eb70bd92ab
3 changed files with 173 additions and 64 deletions
172
Spigot-Server-Patches/Configurable-game-mechanics-changes.patch
Normal file
172
Spigot-Server-Patches/Configurable-game-mechanics-changes.patch
Normal file
|
@ -0,0 +1,172 @@
|
|||
From 0000000000000000000000000000000000000000 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/BlockMinecartTrackAbstract.java b/src/main/java/net/minecraft/server/BlockMinecartTrackAbstract.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/server/BlockMinecartTrackAbstract.java
|
||||
+++ b/src/main/java/net/minecraft/server/BlockMinecartTrackAbstract.java
|
||||
@@ -0,0 +0,0 @@ public abstract class BlockMinecartTrackAbstract extends Block {
|
||||
}
|
||||
|
||||
public boolean canPlace(World world, int i, int j, int k) {
|
||||
- return World.a((IBlockAccess) world, i, j - 1, k);
|
||||
+ return checkPlace(world, i, j, k); // PaperSpigot - Moved, pass it all along
|
||||
}
|
||||
|
||||
public void onPlace(World world, int i, int j, int k) {
|
||||
@@ -0,0 +0,0 @@ public abstract class BlockMinecartTrackAbstract extends Block {
|
||||
|
||||
boolean flag = false;
|
||||
|
||||
- if (!World.a((IBlockAccess) world, i, j - 1, k)) {
|
||||
+ // PaperSpigot start - Replace !World.a with our own check - Less picky rails
|
||||
+ if (!checkPlace(world, i, j, k)) {
|
||||
flag = true;
|
||||
}
|
||||
|
||||
- if (i1 == 2 && !World.a((IBlockAccess) world, i + 1, j, k)) {
|
||||
+ if (i1 == 2 && !checkPlace(world, i, j, k)) {
|
||||
flag = true;
|
||||
}
|
||||
|
||||
- if (i1 == 3 && !World.a((IBlockAccess) world, i - 1, j, k)) {
|
||||
+ if (i1 == 3 && !checkPlace(world, i, j, k)) {
|
||||
flag = true;
|
||||
}
|
||||
|
||||
- if (i1 == 4 && !World.a((IBlockAccess) world, i, j, k - 1)) {
|
||||
+ if (i1 == 4 && !checkPlace(world, i, j, k)) {
|
||||
flag = true;
|
||||
}
|
||||
|
||||
- if (i1 == 5 && !World.a((IBlockAccess) world, i, j, k + 1)) {
|
||||
+ if (i1 == 5 && !checkPlace(world, i, j, k)) {
|
||||
flag = true;
|
||||
}
|
||||
+ // PaperSpigot end
|
||||
|
||||
if (flag) {
|
||||
// PaperSpigot start - Rails dupe workaround
|
||||
@@ -0,0 +0,0 @@ public abstract class BlockMinecartTrackAbstract extends Block {
|
||||
world.applyPhysics(i, j - 1, k, block);
|
||||
}
|
||||
}
|
||||
+
|
||||
+ /**
|
||||
+ * PaperSpigot - Customizable rail placement on extra blocks
|
||||
+ */
|
||||
+ private boolean checkPlace(World world, int i, int j, int k) {
|
||||
+ Block block = World.getBlock(world, i, j - 1, k);
|
||||
+ if (world.paperSpigotConfig.lessPickyRails) {
|
||||
+ if (block instanceof BlockFence) {
|
||||
+ return true;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ return World.canPlace(world, block, i, j - 1, k);
|
||||
+ }
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/server/EntityBoat.java b/src/main/java/net/minecraft/server/EntityBoat.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/server/EntityBoat.java
|
||||
+++ b/src/main/java/net/minecraft/server/EntityBoat.java
|
||||
@@ -0,0 +0,0 @@ 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
|
||||
}
|
||||
@@ -0,0 +0,0 @@ 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
|
||||
}
|
||||
@@ -0,0 +0,0 @@ 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/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/server/World.java
|
||||
+++ b/src/main/java/net/minecraft/server/World.java
|
||||
@@ -0,0 +0,0 @@ public abstract class World implements IBlockAccess {
|
||||
iworldaccess.b();
|
||||
}
|
||||
}
|
||||
+
|
||||
+ /**
|
||||
+ * PaperSpigot - Gets block at location
|
||||
+ */
|
||||
+ public static Block getBlock(IBlockAccess iblockaccess, int i, int j, int k) {
|
||||
+ return iblockaccess.getType(i, j, k);
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * PaperSpigot - Checks if block placement is allowed (used in BlockMinecartTrackAbstract and similar)
|
||||
+ */
|
||||
+ public static boolean canPlace(IBlockAccess iblockaccess, Block block, int i, int j, int k) {
|
||||
+ int l = iblockaccess.getData(i, j, k);
|
||||
+
|
||||
+ return block.getMaterial().k() && block.d() ? true : (block instanceof BlockStairs ? (l & 4) == 4 : (block instanceof BlockStepAbstract ? (l & 8) == 8 : (block instanceof BlockHopper ? true : (block instanceof BlockSnow ? (l & 7) == 7 : false))));
|
||||
+ }
|
||||
}
|
||||
diff --git a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java b/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java
|
||||
+++ b/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java
|
||||
@@ -0,0 +0,0 @@ public class PaperSpigotWorldConfig
|
||||
removeUnloadedTNTEntities = getBoolean("remove-unloaded.tnt-entities", true);
|
||||
removeUnloadedFallingBlocks = getBoolean("remove-unloaded.falling-blocks", true);
|
||||
}
|
||||
+
|
||||
+ public boolean boatsDropBoats;
|
||||
+ public boolean lessPickyRails;
|
||||
+ private void mechanicsChanges()
|
||||
+ {
|
||||
+ boatsDropBoats = getBoolean( "game-mechanics.boats-drop-boats", false );
|
||||
+ lessPickyRails = getBoolean( "game-mechanics.less-picky-rail-placement", false );
|
||||
+ }
|
||||
}
|
||||
--
|
|
@ -42,6 +42,4 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ weaknessEffectModifier = getDouble( "effect-modifiers.weakness", -0.5D );
|
||||
+ }
|
||||
}
|
||||
--
|
||||
1.9.4.msysgit.1
|
||||
|
||||
--
|
|
@ -1,61 +0,0 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Zach Brown <1254957+zachbr@users.noreply.github.com>
|
||||
Date: Fri, 30 May 2014 19:42:50 -0500
|
||||
Subject: [PATCH] Make destroyed boats drop the boat item
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/EntityBoat.java b/src/main/java/net/minecraft/server/EntityBoat.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/server/EntityBoat.java
|
||||
+++ b/src/main/java/net/minecraft/server/EntityBoat.java
|
||||
@@ -0,0 +0,0 @@ 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);
|
||||
- }
|
||||
+ // PaperSpigot start - Boats should drop boats!!!11
|
||||
+ //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);
|
||||
+ //}
|
||||
|
||||
- for (k = 0; k < 2; ++k) {
|
||||
- this.a(Items.STICK, 1, 0.0F);
|
||||
+ for (k = 0; k < 1; ++k) {
|
||||
+ this.a(Items.BOAT, 1, 0.0F);
|
||||
}
|
||||
+ // PaperSpigot end
|
||||
}
|
||||
// CraftBukkit end
|
||||
}
|
||||
@@ -0,0 +0,0 @@ public class EntityBoat extends Entity {
|
||||
|
||||
int l;
|
||||
|
||||
- for (l = 0; l < 3; ++l) {
|
||||
- this.a(Item.getItemOf(Blocks.WOOD), 1, 0.0F);
|
||||
- }
|
||||
+ // PaperSpigot start - Boats should drop boats!!!11
|
||||
+ //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);
|
||||
+ //}
|
||||
|
||||
- for (l = 0; l < 2; ++l) {
|
||||
- this.a(Items.STICK, 1, 0.0F);
|
||||
+ for (l = 0; l < 1; ++l) {
|
||||
+ this.a(Items.BOAT, 1, 0.0F);
|
||||
}
|
||||
+ // PaperSpigot end
|
||||
}
|
||||
// CraftBukkit end
|
||||
}
|
||||
--
|
Loading…
Add table
Reference in a new issue