port some generator fixes

- fix a regression for minecart entity type's class
- stable alphanumeric order for fields and data holder fields for CraftBlockData
- properly register bed and conduit block entity metas
This commit is contained in:
Lulu13022002
2025-06-10 17:04:49 +02:00
parent 7e68259ce9
commit 8d5be7ed9f
23 changed files with 447 additions and 437 deletions

View File

@@ -21,11 +21,11 @@ public class CraftGlowLichen extends CraftBlockData implements GlowLichen {
private static final Map<BlockFace, BooleanProperty> PROPERTY_BY_DIRECTION = Map.of(
BlockFace.DOWN, BlockStateProperties.DOWN,
BlockFace.UP, BlockStateProperties.UP,
BlockFace.EAST, BlockStateProperties.EAST,
BlockFace.NORTH, BlockStateProperties.NORTH,
BlockFace.SOUTH, BlockStateProperties.SOUTH,
BlockFace.WEST, BlockStateProperties.WEST,
BlockFace.EAST, BlockStateProperties.EAST
BlockFace.UP, BlockStateProperties.UP,
BlockFace.WEST, BlockStateProperties.WEST
);
public CraftGlowLichen(BlockState state) {

View File

@@ -18,11 +18,11 @@ import org.bukkit.craftbukkit.block.data.CraftBlockData;
public class CraftHugeMushroom extends CraftBlockData implements MultipleFacing {
private static final Map<BlockFace, BooleanProperty> PROPERTY_BY_DIRECTION = Map.of(
BlockFace.DOWN, HugeMushroomBlock.DOWN,
BlockFace.UP, HugeMushroomBlock.UP,
BlockFace.EAST, HugeMushroomBlock.EAST,
BlockFace.NORTH, HugeMushroomBlock.NORTH,
BlockFace.SOUTH, HugeMushroomBlock.SOUTH,
BlockFace.WEST, HugeMushroomBlock.WEST,
BlockFace.EAST, HugeMushroomBlock.EAST
BlockFace.UP, HugeMushroomBlock.UP,
BlockFace.WEST, HugeMushroomBlock.WEST
);
public CraftHugeMushroom(BlockState state) {

View File

@@ -21,11 +21,11 @@ public class CraftMultiface extends CraftBlockData implements ResinClump {
private static final Map<BlockFace, BooleanProperty> PROPERTY_BY_DIRECTION = Map.of(
BlockFace.DOWN, BlockStateProperties.DOWN,
BlockFace.UP, BlockStateProperties.UP,
BlockFace.EAST, BlockStateProperties.EAST,
BlockFace.NORTH, BlockStateProperties.NORTH,
BlockFace.SOUTH, BlockStateProperties.SOUTH,
BlockFace.WEST, BlockStateProperties.WEST,
BlockFace.EAST, BlockStateProperties.EAST
BlockFace.UP, BlockStateProperties.UP,
BlockFace.WEST, BlockStateProperties.WEST
);
public CraftMultiface(BlockState state) {

View File

@@ -21,11 +21,11 @@ public class CraftSculkVein extends CraftBlockData implements SculkVein {
private static final Map<BlockFace, BooleanProperty> PROPERTY_BY_DIRECTION = Map.of(
BlockFace.DOWN, BlockStateProperties.DOWN,
BlockFace.UP, BlockStateProperties.UP,
BlockFace.EAST, BlockStateProperties.EAST,
BlockFace.NORTH, BlockStateProperties.NORTH,
BlockFace.SOUTH, BlockStateProperties.SOUTH,
BlockFace.WEST, BlockStateProperties.WEST,
BlockFace.EAST, BlockStateProperties.EAST
BlockFace.UP, BlockStateProperties.UP,
BlockFace.WEST, BlockStateProperties.WEST
);
public CraftSculkVein(BlockState state) {

View File

@@ -23,8 +23,8 @@ public class CraftTripWire extends CraftBlockData implements Tripwire {
private static final BooleanProperty POWERED = TripWireBlock.POWERED;
private static final Map<BlockFace, BooleanProperty> PROPERTY_BY_DIRECTION = Map.of(
BlockFace.NORTH, TripWireBlock.NORTH,
BlockFace.EAST, TripWireBlock.EAST,
BlockFace.NORTH, TripWireBlock.NORTH,
BlockFace.SOUTH, TripWireBlock.SOUTH,
BlockFace.WEST, TripWireBlock.WEST
);

View File

@@ -3,6 +3,7 @@ package org.bukkit.craftbukkit.inventory;
import com.destroystokyo.paper.inventory.meta.ArmorStandMeta;
import java.util.function.BiFunction;
import net.minecraft.world.item.BannerItem;
import net.minecraft.world.item.BedItem;
import net.minecraft.world.item.BlockItem;
import net.minecraft.world.item.BundleItem;
import net.minecraft.world.item.Item;
@@ -247,7 +248,8 @@ public final class CraftItemMetas {
|| itemType == ItemType.SUSPICIOUS_GRAVEL || itemType == ItemType.CRAFTER
|| itemType == ItemType.TRIAL_SPAWNER || itemType == ItemType.VAULT
|| itemType == ItemType.CREAKING_HEART || itemType == ItemType.TEST_BLOCK
|| itemType == ItemType.TEST_INSTANCE_BLOCK) {
|| itemType == ItemType.TEST_INSTANCE_BLOCK || itemHandle instanceof BedItem
|| itemType == ItemType.CONDUIT) {
return CraftItemMetas.asType(CraftItemMetas.BLOCK_STATE_META_DATA);
}
if (itemType == ItemType.SHIELD) {

View File

@@ -12,6 +12,8 @@ import net.minecraft.nbt.CompoundTag;
import net.minecraft.world.item.BlockItem;
import net.minecraft.world.item.Item;
import net.minecraft.world.item.StandingAndWallBlockItem;
import net.minecraft.world.level.block.AbstractBannerBlock;
import net.minecraft.world.level.block.AbstractSkullBlock;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.EntityBlock;
import org.bukkit.Bukkit;
@@ -174,9 +176,8 @@ public class ItemMetaTest {
if (block != null) {
ItemStack stack = CraftItemStack.asNewCraftStack(Item.byBlock(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;
if (block instanceof AbstractSkullBlock || block instanceof AbstractBannerBlock) {
continue; // those blocks have a special meta
}
ItemMeta meta = stack.getItemMeta();