private void placeBlock(Block worldBlock, BlockDef block) { if (block.face == null && block.metadata == 0) { worldBlock.setType(block.material); } else { //I would prefer to do this without depreciated method and the weird torch hack, //but the bukkit/spigot API seems to be buggy. If I set the block type with setType and then //set the direction, attachable blocks will for some reason pop off, even if I //tell setType to disable physics updates. if (block.face != null) { Torch torch = new Torch(); torch.setFacingDirection(block.face); worldBlock.setTypeIdAndData(block.material.getId(), torch.getData(), true); } else { worldBlock.setTypeIdAndData(block.material.getId(), block.metadata, true); } } }
public void addLightToWall(int x, int y, int z,BlockFace dir) { World w = Castle.getInstance().getWorld(); Block b = w.getBlockAt(x, y, z); // a hack. Creating a torch will cause it // to drop, unless there's something under it. // Even when it's attached to a wall. // Madness. Block bunder = w.getBlockAt(x, y-1, z); if(canOverwrite(bunder) && canOverwrite(b)){ bunder.setType(Material.DIRT); Torch t = new Torch(Material.TORCH); t.setFacingDirection(dir); b.setType(Material.TORCH); b.setData(t.getData()); bunder.setType(Material.AIR); } }
public Torch() { }
@Deprecated public Torch(int type) { }
public Torch(Material type) { }
@Deprecated public Torch(int type, byte data) { }
@Deprecated public Torch(Material type, byte data) { }
public Torch clone() { return null; }