mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-19 17:15:23 +01:00
SPIGOT-4489: NOTE_BLOCK incorrectly has BlockStateMeta
This commit is contained in:
parent
c2035aa1d0
commit
b1d149cfd0
@ -199,7 +199,6 @@ public final class CraftItemFactory implements ItemFactory {
|
|||||||
case DROPPER:
|
case DROPPER:
|
||||||
case SIGN:
|
case SIGN:
|
||||||
case SPAWNER:
|
case SPAWNER:
|
||||||
case NOTE_BLOCK:
|
|
||||||
case BREWING_STAND:
|
case BREWING_STAND:
|
||||||
case ENCHANTING_TABLE:
|
case ENCHANTING_TABLE:
|
||||||
case COMMAND_BLOCK:
|
case COMMAND_BLOCK:
|
||||||
|
@ -461,7 +461,6 @@ public final class CraftItemStack extends ItemStack {
|
|||||||
case DROPPER:
|
case DROPPER:
|
||||||
case SIGN:
|
case SIGN:
|
||||||
case SPAWNER:
|
case SPAWNER:
|
||||||
case NOTE_BLOCK:
|
|
||||||
case BREWING_STAND:
|
case BREWING_STAND:
|
||||||
case ENCHANTING_TABLE:
|
case ENCHANTING_TABLE:
|
||||||
case COMMAND_BLOCK:
|
case COMMAND_BLOCK:
|
||||||
|
@ -3,7 +3,6 @@ package org.bukkit.craftbukkit.inventory;
|
|||||||
import com.google.common.base.Objects;
|
import com.google.common.base.Objects;
|
||||||
import com.google.common.collect.ImmutableMap;
|
import com.google.common.collect.ImmutableMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import net.minecraft.server.BlockJukeBox;
|
|
||||||
import net.minecraft.server.EnumColor;
|
import net.minecraft.server.EnumColor;
|
||||||
import net.minecraft.server.NBTBase;
|
import net.minecraft.server.NBTBase;
|
||||||
import net.minecraft.server.NBTTagCompound;
|
import net.minecraft.server.NBTTagCompound;
|
||||||
@ -175,7 +174,6 @@ public class CraftMetaBlockState extends CraftMetaItem implements BlockStateMeta
|
|||||||
case DROPPER:
|
case DROPPER:
|
||||||
case SIGN:
|
case SIGN:
|
||||||
case SPAWNER:
|
case SPAWNER:
|
||||||
case NOTE_BLOCK:
|
|
||||||
case BREWING_STAND:
|
case BREWING_STAND:
|
||||||
case ENCHANTING_TABLE:
|
case ENCHANTING_TABLE:
|
||||||
case COMMAND_BLOCK:
|
case COMMAND_BLOCK:
|
||||||
|
@ -175,21 +175,23 @@ public class ItemMetaTest extends AbstractTestingBase {
|
|||||||
|
|
||||||
for (Block block : queue) {
|
for (Block block : queue) {
|
||||||
if (block != null) {
|
if (block != null) {
|
||||||
|
ItemStack stack = CraftItemStack.asNewCraftStack(Item.getItemOf(block));
|
||||||
|
|
||||||
|
// Command blocks aren't unit testable atm
|
||||||
|
if (stack.getType() == Material.COMMAND_BLOCK || stack.getType() == Material.CHAIN_COMMAND_BLOCK || stack.getType() == Material.REPEATING_COMMAND_BLOCK) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
ItemMeta meta = stack.getItemMeta();
|
||||||
if (block instanceof ITileEntity) {
|
if (block instanceof ITileEntity) {
|
||||||
ItemStack stack = CraftItemStack.asNewCraftStack(Item.getItemOf(block));
|
|
||||||
|
|
||||||
// Command blocks aren't unit testable atm
|
|
||||||
if (stack.getType() == Material.COMMAND_BLOCK || stack.getType() == Material.CHAIN_COMMAND_BLOCK || stack.getType() == Material.REPEATING_COMMAND_BLOCK) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
ItemMeta meta = stack.getItemMeta();
|
|
||||||
assertTrue(stack + " has meta of type " + meta + " expected BlockStateMeta", meta instanceof BlockStateMeta);
|
assertTrue(stack + " has meta of type " + meta + " expected BlockStateMeta", meta instanceof BlockStateMeta);
|
||||||
|
|
||||||
BlockStateMeta blockState = (BlockStateMeta) meta;
|
BlockStateMeta blockState = (BlockStateMeta) meta;
|
||||||
assertNotNull(stack + " has null block state", blockState.getBlockState());
|
assertNotNull(stack + " has null block state", blockState.getBlockState());
|
||||||
|
|
||||||
blockState.setBlockState(blockState.getBlockState());
|
blockState.setBlockState(blockState.getBlockState());
|
||||||
|
} else {
|
||||||
|
assertTrue(stack + " has unexpected meta of type BlockStateMeta (but is not a tile)", !(meta instanceof BlockStateMeta));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user