#1325: Use CraftBlockType and CraftItemType instead of CraftMagicNumbers to convert between minecraft and bukkit block / item representation

By: DerFrZocker <derrieple@gmail.com>
This commit is contained in:
CraftBukkit/Spigot
2023-12-29 08:36:38 +11:00
parent b245f22351
commit d15575db91
32 changed files with 137 additions and 102 deletions

View File

@@ -8,7 +8,8 @@ import org.bukkit.Color;
import org.bukkit.Effect;
import org.bukkit.Material;
import org.bukkit.block.BlockFace;
import org.bukkit.craftbukkit.util.CraftMagicNumbers;
import org.bukkit.craftbukkit.block.CraftBlockType;
import org.bukkit.craftbukkit.inventory.CraftItemType;
import org.bukkit.potion.Potion;
public class CraftEffect {
@@ -26,7 +27,7 @@ public class CraftEffect {
break;
case RECORD_PLAY:
Preconditions.checkArgument(data == Material.AIR || ((Material) data).isRecord(), "Invalid record type for Material %s!", data);
datavalue = Item.getId(CraftMagicNumbers.getItem((Material) data));
datavalue = Item.getId(CraftItemType.bukkitToMinecraft((Material) data));
break;
case SMOKE:
switch ((BlockFace) data) {
@@ -60,7 +61,7 @@ public class CraftEffect {
break;
case STEP_SOUND:
Preconditions.checkArgument(((Material) data).isBlock(), "Material %s is not a block!", data);
datavalue = Block.getId(CraftMagicNumbers.getBlock((Material) data).defaultBlockState());
datavalue = Block.getId(CraftBlockType.bukkitToMinecraft((Material) data).defaultBlockState());
break;
case COMPOSTER_FILL_ATTEMPT:
datavalue = ((Boolean) data) ? 1 : 0;