Solved How do you place a door?

Discussion in 'Spigot Plugin Development' started by Hex_27, Feb 1, 2020.

  1. This is my code
    Code (Java):
            //Bukkit.getLogger().info( data.getBlockData(x, y, z).getClass().getName());
            Door door = (Door) Bukkit.createBlockData(mat);
            door = (Door) Bukkit.createBlockData(mat);;
    the data object
    Code (Java):
    public class PopulatorDataPostGen extends PopulatorDataAbstract {
        private World w;
        private Chunk c;
        public PopulatorDataPostGen(Chunk c){
            this.w = c.getWorld();
            this.c = c;

        public Material getType(int x, int y, int z) {
            return w.getBlockAt(x,y,z).getType();

        public BlockData getBlockData(int x, int y, int z) {
            return w.getBlockAt(x,y,z).getBlockData();

        public void setType(int x, int y, int z, Material type) {
            //if(type == Material.DIRT) Bukkit.getLogger().info("Set " + x + "," + y + "," + z + " to dirt.");
            w.getBlockAt(x, y, z).setType(type);

        public void setBlockData(int x, int y, int z, BlockData data) {

        public Biome getBiome(int rawX, int rawY, int rawZ) {
            return w.getBlockAt(rawX,rawY,rawZ).getBiome();

        public int getChunkX() {
            return c.getX();

        public int getChunkZ() {
            return c.getZ();

        public void addEntity(int rawX, int rawY, int rawZ, EntityType type) {
            c.getWorld().spawnEntity(new Location(c.getWorld(),rawX,rawY,rawZ), type);

    Placing doors seems to break them, and though the doors are set, 2 iron door drops spawn with every door.
  2. Code (Java):
    protected void putDoor(final DoorPlacementInstruction instr) {
    final Block bottom = getWorld().getBlockAt(
    (int) instr.x(),
    (int) instr.y(),
    (int) instr.z()
    final Block top = bottom.getRelative(BlockFace.UP, 1);
    top.setTypeIdAndData(64, (byte) 0x8, true);
    bottom.setTypeIdAndData(64, (byte) 0x4, true);
  3. md_5

    Administrator Developer

    That's not 1.15.1 code

    @Hex_27 you probably need applyPhysics=false on (at least) the first half set
    • Agree Agree x 1
  4. You’re totally right, my bad
  5. I'll try that
  6. Yep worked
  7. How you can place door ?
    I'm looking and I can't find, you know?