Update to Minecraft 1.13-pre7

By: md_5 <git@md-5.net>
This commit is contained in:
Bukkit/Spigot
2018-07-15 10:00:00 +10:00
parent debc7172fd
commit 767e4f6ccf
199 changed files with 8301 additions and 3637 deletions

View File

@@ -30,15 +30,15 @@ public class MaterialDataTest {
{
@SuppressWarnings("deprecation")
Door door = new Door();
assertThat("Constructed with default door type",door.getItemType(),equalTo(Material.WOODEN_DOOR));
assertThat("Constructed with default door type",door.getItemType(),equalTo(Material.LEGACY_WOODEN_DOOR));
assertThat("Constructed with default top or bottom",door.isTopHalf(),equalTo(false));
assertThat("Constructed with default direction",door.getFacing(),equalTo(BlockFace.WEST));
assertThat("Constructed with default open state",door.isOpen(),equalTo(false));
Material[] types = new Material[] { Material.WOODEN_DOOR,
Material.IRON_DOOR_BLOCK, Material.SPRUCE_DOOR,
Material.BIRCH_DOOR, Material.JUNGLE_DOOR,
Material.ACACIA_DOOR, Material.DARK_OAK_DOOR };
Material[] types = new Material[] { Material.LEGACY_WOODEN_DOOR,
Material.LEGACY_IRON_DOOR_BLOCK, Material.LEGACY_SPRUCE_DOOR,
Material.LEGACY_BIRCH_DOOR, Material.LEGACY_JUNGLE_DOOR,
Material.LEGACY_ACACIA_DOOR, Material.LEGACY_DARK_OAK_DOOR };
BlockFace[] directions = new BlockFace[] { BlockFace.WEST, BlockFace.NORTH, BlockFace.EAST, BlockFace.SOUTH };
boolean[] openStates = new boolean[] {false, true};
boolean[] hingeStates = new boolean[] {false, true};
@@ -77,17 +77,17 @@ public class MaterialDataTest {
@Test
public void testWood() {
Wood wood = new Wood();
assertThat("Constructed with default wood type", wood.getItemType(), equalTo(Material.WOOD));
assertThat("Constructed with default wood type", wood.getItemType(), equalTo(Material.LEGACY_WOOD));
assertThat("Constructed with default tree species", wood.getSpecies(), equalTo(TreeSpecies.GENERIC));
TreeSpecies[] allSpecies = TreeSpecies.values();
for (TreeSpecies species : allSpecies) {
wood = new Wood(species);
assertThat("Constructed with default wood type", wood.getItemType(), equalTo(Material.WOOD));
assertThat("Constructed with default wood type", wood.getItemType(), equalTo(Material.LEGACY_WOOD));
assertThat("Constructed with correct tree species", wood.getSpecies(), equalTo(species));
}
Material[] types = new Material[]{Material.WOOD, Material.WOOD_DOUBLE_STEP};
Material[] types = new Material[]{Material.LEGACY_WOOD, Material.LEGACY_WOOD_DOUBLE_STEP};
for (Material type : types) {
wood = new Wood(type);
assertThat("Constructed with correct wood type", wood.getItemType(), equalTo(type));
@@ -104,16 +104,16 @@ public class MaterialDataTest {
@Test
public void testTree() {
Tree tree = new Tree();
assertThat("Constructed with default tree type", tree.getItemType(), equalTo(Material.LOG));
assertThat("Constructed with default tree type", tree.getItemType(), equalTo(Material.LEGACY_LOG));
assertThat("Constructed with default tree species", tree.getSpecies(), equalTo(TreeSpecies.GENERIC));
assertThat("Constructed with default direction", tree.getDirection(), equalTo(BlockFace.UP));
tree = new Tree(Material.LOG);
assertThat("Constructed with correct tree type", tree.getItemType(), equalTo(Material.LOG));
tree = new Tree(Material.LEGACY_LOG);
assertThat("Constructed with correct tree type", tree.getItemType(), equalTo(Material.LEGACY_LOG));
assertThat("Constructed with default tree species", tree.getSpecies(), equalTo(TreeSpecies.GENERIC));
assertThat("Constructed with default direction", tree.getDirection(), equalTo(BlockFace.UP));
Material[] types = new Material[]{Material.LOG, Material.LOG_2};
Material[] types = new Material[]{Material.LEGACY_LOG, Material.LEGACY_LOG_2};
TreeSpecies[][] allSpecies = new TreeSpecies[][]{
{TreeSpecies.GENERIC, TreeSpecies.REDWOOD, TreeSpecies.BIRCH, TreeSpecies.JUNGLE},
{TreeSpecies.ACACIA, TreeSpecies.DARK_OAK}
@@ -144,18 +144,18 @@ public class MaterialDataTest {
@Test
public void testLeaves() {
Leaves leaves = new Leaves();
assertThat("Constructed with default leaf type", leaves.getItemType(), equalTo(Material.LEAVES));
assertThat("Constructed with default leaf type", leaves.getItemType(), equalTo(Material.LEGACY_LEAVES));
assertThat("Constructed with default tree species", leaves.getSpecies(), equalTo(TreeSpecies.GENERIC));
assertThat("Constructed with default decayable", leaves.isDecayable(), equalTo(true));
assertThat("Constructed with default decaying", leaves.isDecaying(), equalTo(false));
leaves = new Leaves(Material.LEAVES);
assertThat("Constructed with correct leaf type", leaves.getItemType(), equalTo(Material.LEAVES));
leaves = new Leaves(Material.LEGACY_LEAVES);
assertThat("Constructed with correct leaf type", leaves.getItemType(), equalTo(Material.LEGACY_LEAVES));
assertThat("Constructed with default tree species", leaves.getSpecies(), equalTo(TreeSpecies.GENERIC));
assertThat("Constructed with default decayable", leaves.isDecayable(), equalTo(true));
assertThat("Constructed with default decaying", leaves.isDecaying(), equalTo(false));
Material[] types = new Material[]{Material.LEAVES, Material.LEAVES_2};
Material[] types = new Material[]{Material.LEGACY_LEAVES, Material.LEGACY_LEAVES_2};
TreeSpecies[][] allSpecies = new TreeSpecies[][]{
{TreeSpecies.GENERIC, TreeSpecies.REDWOOD, TreeSpecies.BIRCH, TreeSpecies.JUNGLE},
{TreeSpecies.ACACIA, TreeSpecies.DARK_OAK}
@@ -198,7 +198,7 @@ public class MaterialDataTest {
@Test
public void testWoodenStep() {
WoodenStep woodenStep = new WoodenStep();
assertThat("Constructed with default step type", woodenStep.getItemType(), equalTo(Material.WOOD_STEP));
assertThat("Constructed with default step type", woodenStep.getItemType(), equalTo(Material.LEGACY_WOOD_STEP));
assertThat("Constructed with default tree species", woodenStep.getSpecies(), equalTo(TreeSpecies.GENERIC));
assertThat("Constructed with default inversion", woodenStep.isInverted(), equalTo(false));
@@ -206,12 +206,12 @@ public class MaterialDataTest {
boolean[] inversion = new boolean[]{true, false};
for (TreeSpecies species : allSpecies) {
woodenStep = new WoodenStep(species);
assertThat("Constructed with default step type", woodenStep.getItemType(), equalTo(Material.WOOD_STEP));
assertThat("Constructed with default step type", woodenStep.getItemType(), equalTo(Material.LEGACY_WOOD_STEP));
assertThat("Constructed with correct tree species", woodenStep.getSpecies(), equalTo(species));
assertThat("Constructed with default inversion", woodenStep.isInverted(), equalTo(false));
for (boolean isInverted : inversion) {
woodenStep = new WoodenStep(species, isInverted);
assertThat("Constructed with default step type", woodenStep.getItemType(), equalTo(Material.WOOD_STEP));
assertThat("Constructed with default step type", woodenStep.getItemType(), equalTo(Material.LEGACY_WOOD_STEP));
assertThat("Constructed with correct tree species", woodenStep.getSpecies(), equalTo(species));
assertThat("Constructed with correct inversion", woodenStep.isInverted(), equalTo(isInverted));
}
@@ -221,7 +221,7 @@ public class MaterialDataTest {
@Test
public void testSapling() {
Sapling sapling = new Sapling();
assertThat("Constructed with default sapling type", sapling.getItemType(), equalTo(Material.SAPLING));
assertThat("Constructed with default sapling type", sapling.getItemType(), equalTo(Material.LEGACY_SAPLING));
assertThat("Constructed with default tree species", sapling.getSpecies(), equalTo(TreeSpecies.GENERIC));
assertThat("Constructed with default growable", sapling.isInstantGrowable(), equalTo(false));
@@ -229,12 +229,12 @@ public class MaterialDataTest {
boolean[] growable = new boolean[]{true, false};
for (TreeSpecies species : allSpecies) {
sapling = new Sapling(species);
assertThat("Constructed with default sapling type", sapling.getItemType(), equalTo(Material.SAPLING));
assertThat("Constructed with default sapling type", sapling.getItemType(), equalTo(Material.LEGACY_SAPLING));
assertThat("Constructed with correct tree species", sapling.getSpecies(), equalTo(species));
assertThat("Constructed with default growable", sapling.isInstantGrowable(), equalTo(false));
for (boolean isInstantGrowable : growable) {
sapling = new Sapling(species, isInstantGrowable);
assertThat("Constructed with default sapling type", sapling.getItemType(), equalTo(Material.SAPLING));
assertThat("Constructed with default sapling type", sapling.getItemType(), equalTo(Material.LEGACY_SAPLING));
assertThat("Constructed with correct tree species", sapling.getSpecies(), equalTo(species));
assertThat("Constructed with correct growable", sapling.isInstantGrowable(), equalTo(isInstantGrowable));
}
@@ -243,7 +243,7 @@ public class MaterialDataTest {
@Test
public void testMushroom() {
Material[] mushroomTypes = new Material[] { Material.HUGE_MUSHROOM_1, Material.HUGE_MUSHROOM_2 };
Material[] mushroomTypes = new Material[] { Material.LEGACY_HUGE_MUSHROOM_1, Material.LEGACY_HUGE_MUSHROOM_2 };
BlockFace[] setFaces = new BlockFace[] { BlockFace.SELF, BlockFace.UP, BlockFace.NORTH,
BlockFace.SOUTH, BlockFace.EAST, BlockFace.WEST, BlockFace.NORTH_EAST, BlockFace.NORTH_WEST,
BlockFace.SOUTH_EAST, BlockFace.SOUTH_WEST };
@@ -270,18 +270,18 @@ public class MaterialDataTest {
@Test
public void testCrops() {
Crops crops = new Crops();
assertThat("Constructed with default crops type", crops.getItemType(), equalTo(Material.CROPS));
assertThat("Constructed with default crops type", crops.getItemType(), equalTo(Material.LEGACY_CROPS));
assertThat("Constructed with default crop state", crops.getState(), equalTo(CropState.SEEDED));
CropState[] allStates = CropState.values();
for (CropState state : allStates) {
crops = new Crops(state);
assertThat("Constructed with default crops type", crops.getItemType(), equalTo(Material.CROPS));
assertThat("Constructed with default crops type", crops.getItemType(), equalTo(Material.LEGACY_CROPS));
assertThat("Constructed with correct crop state", crops.getState(), equalTo(state));
}
// The crops which fully implement all crop states
Material[] allCrops = new Material[] {Material.CROPS, Material.CARROT, Material.POTATO};
Material[] allCrops = new Material[] {Material.LEGACY_CROPS, Material.LEGACY_CARROT, Material.LEGACY_POTATO};
for (Material crop : allCrops) {
crops = new Crops(crop);
assertThat("Constructed with correct crops type", crops.getItemType(), equalTo(crop));
@@ -298,17 +298,17 @@ public class MaterialDataTest {
// Setting different crop states for beetroot will return the following when retrieved back
CropState[] beetrootStates = new CropState[] {CropState.SEEDED, CropState.SEEDED, CropState.SMALL, CropState.SMALL, CropState.TALL, CropState.TALL, CropState.RIPE, CropState.RIPE};
assertThat("Beetroot state translations match size", beetrootStates.length, equalTo(allStates.length));
crops = new Crops(Material.BEETROOT_BLOCK);
assertThat("Constructed with correct crops type", crops.getItemType(), equalTo(Material.BEETROOT_BLOCK));
crops = new Crops(Material.LEGACY_BEETROOT_BLOCK);
assertThat("Constructed with correct crops type", crops.getItemType(), equalTo(Material.LEGACY_BEETROOT_BLOCK));
assertThat("Constructed with default crop state", crops.getState(), equalTo(CropState.SEEDED));
for (int s = 0; s < beetrootStates.length; s++) {
crops = new Crops(Material.BEETROOT_BLOCK, allStates[s]);
assertThat("Constructed with correct crops type", crops.getItemType(), equalTo(Material.BEETROOT_BLOCK));
crops = new Crops(Material.LEGACY_BEETROOT_BLOCK, allStates[s]);
assertThat("Constructed with correct crops type", crops.getItemType(), equalTo(Material.LEGACY_BEETROOT_BLOCK));
assertThat("Constructed with correct crop state", crops.getState(), equalTo(beetrootStates[s]));
}
// In case you want to treat NetherWarts as Crops, although they really aren't
crops = new Crops(Material.NETHER_WARTS);
crops = new Crops(Material.LEGACY_NETHER_WARTS);
NetherWarts warts = new NetherWarts();
assertThat("Constructed with correct crops type", crops.getItemType(), equalTo(warts.getItemType()));
assertThat("Constructed with default crop state", crops.getState(), equalTo(CropState.SEEDED));
@@ -317,7 +317,7 @@ public class MaterialDataTest {
NetherWartsState[] allWartStates = NetherWartsState.values();
assertThat("Nether Warts state translations match size", allWartStates.length, equalTo(allStates.length));
for (int s = 0; s < allStates.length; s++) {
crops = new Crops(Material.NETHER_WARTS, allStates[s]);
crops = new Crops(Material.LEGACY_NETHER_WARTS, allStates[s]);
warts = new NetherWarts(allWartStates[s]);
assertThat("Constructed with correct crops type", crops.getItemType(), equalTo(warts.getItemType()));
assertThat("Constructed with correct crop state", crops.getState(), equalTo(allStates[s]));
@@ -328,7 +328,7 @@ public class MaterialDataTest {
@Test
public void testDiode() {
Diode diode = new Diode();
assertThat("Constructed with backward compatible diode state", diode.getItemType(), equalTo(Material.DIODE_BLOCK_ON));
assertThat("Constructed with backward compatible diode state", diode.getItemType(), equalTo(Material.LEGACY_DIODE_BLOCK_ON));
assertThat("Constructed with backward compatible powered", diode.isPowered(), equalTo(true));
assertThat("Constructed with default delay", diode.getDelay(), equalTo(1));
assertThat("Constructed with default direction", diode.getFacing(), equalTo(BlockFace.NORTH));
@@ -338,19 +338,19 @@ public class MaterialDataTest {
boolean[] states = new boolean[] {false, true};
for (BlockFace direction : directions) {
diode = new Diode(direction);
assertThat("Constructed with default diode state", diode.getItemType(), equalTo(Material.DIODE_BLOCK_OFF));
assertThat("Constructed with default diode state", diode.getItemType(), equalTo(Material.LEGACY_DIODE_BLOCK_OFF));
assertThat("Constructed with default powered", diode.isPowered(), equalTo(false));
assertThat("Constructed with default delay", diode.getDelay(), equalTo(1));
assertThat("Constructed with correct direction", diode.getFacing(), equalTo(direction));
for (int delay : delays) {
diode = new Diode(direction, delay);
assertThat("Constructed with default diode state", diode.getItemType(), equalTo(Material.DIODE_BLOCK_OFF));
assertThat("Constructed with default diode state", diode.getItemType(), equalTo(Material.LEGACY_DIODE_BLOCK_OFF));
assertThat("Constructed with default powered", diode.isPowered(), equalTo(false));
assertThat("Constructed with correct delay", diode.getDelay(), equalTo(delay));
assertThat("Constructed with correct direction", diode.getFacing(), equalTo(direction));
for (boolean state : states) {
diode = new Diode(direction, delay, state);
assertThat("Constructed with correct diode state", diode.getItemType(), equalTo(state ? Material.DIODE_BLOCK_ON : Material.DIODE_BLOCK_OFF));
assertThat("Constructed with correct diode state", diode.getItemType(), equalTo(state ? Material.LEGACY_DIODE_BLOCK_ON : Material.LEGACY_DIODE_BLOCK_OFF));
assertThat("Constructed with default powered", diode.isPowered(), equalTo(state));
assertThat("Constructed with correct delay", diode.getDelay(), equalTo(delay));
assertThat("Constructed with correct direction", diode.getFacing(), equalTo(direction));
@@ -362,7 +362,7 @@ public class MaterialDataTest {
@Test
public void testComparator() {
Comparator comparator = new Comparator();
assertThat("Constructed with default comparator state", comparator.getItemType(), equalTo(Material.REDSTONE_COMPARATOR_OFF));
assertThat("Constructed with default comparator state", comparator.getItemType(), equalTo(Material.LEGACY_REDSTONE_COMPARATOR_OFF));
assertThat("Constructed with default powered", comparator.isPowered(), equalTo(false));
assertThat("Constructed with default being powered", comparator.isBeingPowered(), equalTo(false));
assertThat("Constructed with default mode", comparator.isSubtractionMode(), equalTo(false));
@@ -373,21 +373,21 @@ public class MaterialDataTest {
boolean[] states = new boolean[] {false, true};
for (BlockFace direction : directions) {
comparator = new Comparator(direction);
assertThat("Constructed with default comparator state", comparator.getItemType(), equalTo(Material.REDSTONE_COMPARATOR_OFF));
assertThat("Constructed with default comparator state", comparator.getItemType(), equalTo(Material.LEGACY_REDSTONE_COMPARATOR_OFF));
assertThat("Constructed with default powered", comparator.isPowered(), equalTo(false));
assertThat("Constructed with default being powered", comparator.isBeingPowered(), equalTo(false));
assertThat("Constructed with default mode", comparator.isSubtractionMode(), equalTo(false));
assertThat("Constructed with correct direction", comparator.getFacing(), equalTo(direction));
for (boolean mode : modes) {
comparator = new Comparator(direction, mode);
assertThat("Constructed with default comparator state", comparator.getItemType(), equalTo(Material.REDSTONE_COMPARATOR_OFF));
assertThat("Constructed with default comparator state", comparator.getItemType(), equalTo(Material.LEGACY_REDSTONE_COMPARATOR_OFF));
assertThat("Constructed with default powered", comparator.isPowered(), equalTo(false));
assertThat("Constructed with default being powered", comparator.isBeingPowered(), equalTo(false));
assertThat("Constructed with correct mode", comparator.isSubtractionMode(), equalTo(mode));
assertThat("Constructed with correct direction", comparator.getFacing(), equalTo(direction));
for (boolean state : states) {
comparator = new Comparator(direction, mode, state);
assertThat("Constructed with correct comparator state", comparator.getItemType(), equalTo(state ? Material.REDSTONE_COMPARATOR_ON : Material.REDSTONE_COMPARATOR_OFF));
assertThat("Constructed with correct comparator state", comparator.getItemType(), equalTo(state ? Material.LEGACY_REDSTONE_COMPARATOR_ON : Material.LEGACY_REDSTONE_COMPARATOR_OFF));
assertThat("Constructed with correct powered", comparator.isPowered(), equalTo(state));
assertThat("Constructed with default being powered", comparator.isBeingPowered(), equalTo(false));
assertThat("Constructed with correct mode", comparator.isSubtractionMode(), equalTo(mode));
@@ -395,7 +395,7 @@ public class MaterialDataTest {
// Check if the game sets the fourth bit, that block data is still interpreted correctly
comparator.setData((byte)((comparator.getData() & 0x7) | 0x8));
assertThat("Constructed with correct comparator state", comparator.getItemType(), equalTo(state ? Material.REDSTONE_COMPARATOR_ON : Material.REDSTONE_COMPARATOR_OFF));
assertThat("Constructed with correct comparator state", comparator.getItemType(), equalTo(state ? Material.LEGACY_REDSTONE_COMPARATOR_ON : Material.LEGACY_REDSTONE_COMPARATOR_OFF));
assertThat("Constructed with correct powered", comparator.isPowered(), equalTo(state));
assertThat("Constructed with correct being powered", comparator.isBeingPowered(), equalTo(true));
assertThat("Constructed with correct mode", comparator.isSubtractionMode(), equalTo(mode));
@@ -408,7 +408,7 @@ public class MaterialDataTest {
@Test
public void testHopper() {
Hopper hopper = new Hopper();
assertThat("Constructed with default hopper type", hopper.getItemType(), equalTo(Material.HOPPER));
assertThat("Constructed with default hopper type", hopper.getItemType(), equalTo(Material.LEGACY_HOPPER));
assertThat("Constructed with default active state", hopper.isActive(), equalTo(true));
assertThat("Constructed with default powered state", hopper.isPowered(), equalTo(false));
assertThat("Constructed with default direction", hopper.getFacing(), equalTo(BlockFace.DOWN));
@@ -417,13 +417,13 @@ public class MaterialDataTest {
boolean[] activeStates = new boolean[] {true, false};
for (BlockFace direction : directions) {
hopper = new Hopper(direction);
assertThat("Constructed with default hopper type", hopper.getItemType(), equalTo(Material.HOPPER));
assertThat("Constructed with default hopper type", hopper.getItemType(), equalTo(Material.LEGACY_HOPPER));
assertThat("Constructed with default active state", hopper.isActive(), equalTo(true));
assertThat("Constructed with correct powered state", hopper.isPowered(), equalTo(false));
assertThat("Constructed with correct direction", hopper.getFacing(), equalTo(direction));
for(boolean isActive : activeStates) {
hopper = new Hopper(direction, isActive);
assertThat("Constructed with default hopper type", hopper.getItemType(), equalTo(Material.HOPPER));
assertThat("Constructed with default hopper type", hopper.getItemType(), equalTo(Material.LEGACY_HOPPER));
assertThat("Constructed with correct active state", hopper.isActive(), equalTo(isActive));
assertThat("Constructed with correct powered state", hopper.isPowered(), equalTo(!isActive));
assertThat("Constructed with correct direction", hopper.getFacing(), equalTo(direction));