Block underTorch = d3.getRelative(BlockFace.DOWN, 1);
if (underTorch.isEmpty()) {
underTorch.setType(Material.COBBLESTONE);
}
curBlock.getRelative(BlockFace.DOWN, 2).setType(Material.REDSTONE_TORCH_ON);
PoweredRail rail = new PoweredRail(Material.POWERED_RAIL);
rail.setDirection(facing, sloping);
rail.setPowered(true);
curBlock.setTypeIdAndData(rail.getItemTypeId(), rail.getData(), true);
} else {
Rails rail = new Rails(Material.RAILS);
rail.setDirection(facing, sloping);
curBlock.setTypeIdAndData(rail.getItemTypeId(), rail.getData(), true);
}
}