summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristos Miniotis <chrismin1302@gmail.com>2018-08-08 04:06:36 +0300
committermd_5 <git@md-5.net>2018-08-08 18:07:02 +1000
commitc4220dc24ff459639108d17aa63be152e3964b79 (patch)
tree9d9bf7da47cd31d2fcf3f2b2dd3553c7c5ad784a
parent53d3ac0a970b311f51c97a6652bb49d550c3067e (diff)
downloadcraftbukkit-c4220dc24ff459639108d17aa63be152e3964b79.tar
craftbukkit-c4220dc24ff459639108d17aa63be152e3964b79.tar.gz
craftbukkit-c4220dc24ff459639108d17aa63be152e3964b79.tar.lz
craftbukkit-c4220dc24ff459639108d17aa63be152e3964b79.tar.xz
craftbukkit-c4220dc24ff459639108d17aa63be152e3964b79.zip
Add Unit Tests for geHardness and getBlastResistance
-rw-r--r--nms-patches/Block.patch9
-rw-r--r--src/test/java/org/bukkit/PerMaterialTest.java14
2 files changed, 23 insertions, 0 deletions
diff --git a/nms-patches/Block.patch b/nms-patches/Block.patch
index 1c99929a..ee6badf7 100644
--- a/nms-patches/Block.patch
+++ b/nms-patches/Block.patch
@@ -1,5 +1,14 @@
--- a/net/minecraft/server/Block.java
+++ b/net/minecraft/server/Block.java
+@@ -17,7 +17,7 @@
+ public static final RegistryBlocks<MinecraftKey, Block> REGISTRY = new RegistryBlocks(Block.a);
+ public static final RegistryBlockID<IBlockData> REGISTRY_ID = new RegistryBlockID();
+ protected final int g;
+- protected final float strength;
++ public final float strength; // PAIL: private -> public
+ protected final float durability;
+ protected final boolean j;
+ protected final SoundEffectType stepSound;
@@ -212,7 +212,7 @@
}
diff --git a/src/test/java/org/bukkit/PerMaterialTest.java b/src/test/java/org/bukkit/PerMaterialTest.java
index 98bd2fbb..57e779ec 100644
--- a/src/test/java/org/bukkit/PerMaterialTest.java
+++ b/src/test/java/org/bukkit/PerMaterialTest.java
@@ -215,4 +215,18 @@ public class PerMaterialTest extends AbstractTestingBase {
assertFalse(material.isInteractable());
}
}
+
+ @Test
+ public void testBlockHardness() {
+ if (material.isBlock()) {
+ assertThat(material.getHardness(), is(CraftMagicNumbers.getBlock(material).strength));
+ }
+ }
+
+ @Test
+ public void testBlastResistance() {
+ if (material.isBlock()) {
+ assertThat(material.getBlastResistance(), is(CraftMagicNumbers.getBlock(material).k())); // PAIL getDurability
+ }
+ }
}