Hi!
I’m trying to create a bed programmatically. I had following code for inserting custom blocks (e. g. TV from Mr. Crayfish’s Furniture Mod), and it worked fine there. customBlockCommand.blockType
is the ID of the block type you can see in Minecraft, when you press the F3 button.
internal open fun createCustomBlock(
customBlockCommand: CustomBlock,
coords: McCoords
) {
if (game == null) {
logger.error("Game is null. Can't insert custom block.")
return
}
val customBlockType:Optional<BlockType> = game.registry.getType(
BlockType::class.java,
customBlockCommand.blockType)
if (!customBlockType.isPresent) {
logger.error("Block type '${customBlockCommand.blockType}' doesn't exist")
return
}
val loc = createSpongeLocation(
x = coords.x + customBlockCommand.x,
y = coords.y + customBlockCommand.elevation,
z = coords.z + customBlockCommand.z
)
setBlockType(loc, customBlockType.get())
}
But when I try to insert a bed with it (customBlockCommand.blockType
is equal to minecraft:bed
), it doesn’t work - only half of the bed is created. If do it twice, i. e. try to put two bed blocks next to each other, then one half of the bed is created, and the other is lying on the floor (can be picked up).
How can I insert a bed correctly?
Thanks in advance
Dmitri Pisarenko