Java Code Examples for org.bukkit.Material#FURNACE
The following examples show how to use
org.bukkit.Material#FURNACE .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: FixModule.java From Modern-LWC with MIT License | 6 votes |
@Override public void onProtectionInteract(LWCProtectionInteractEvent event) { if (event.getResult() == Result.CANCEL) { return; } if (!event.hasAction("fix")) { return; } LWC lwc = event.getLWC(); LWCPlayer player = lwc.wrapPlayer(event.getPlayer()); Protection protection = event.getProtection(); Block block = protection.getBlock(); if (!lwc.canAdminProtection(event.getPlayer(), protection)) { return; } // Should we fix orientation? if (DoubleChestMatcher.PROTECTABLES_CHESTS.contains(block.getType()) || block.getType() == Material.FURNACE || block.getType() == Material.DISPENSER) { lwc.adjustChestDirection(block, event.getEvent().getBlockFace()); lwc.sendLocale(player, "lwc.fix.fixed", "block", block.getType().toString().toLowerCase()); player.removeAction(player.getAction("fix")); } }
Example 2
Source File: GameMap.java From AnnihilationPro with MIT License | 6 votes |
public void addEnderFurnace(FacingObject furnace) { MapKey key = MapKey.getKey(furnace.getLocation()); if(!enderFurnaces.containsKey(key)) { try { Block block = furnace.getLocation().toLocation().getBlock(); if(block.getType() != Material.FURNACE && block.getType() != Material.BURNING_FURNACE) block.setType(Material.BURNING_FURNACE); Furnace f = new Furnace(Material.BURNING_FURNACE); f.setFacingDirection(furnace.getFacingDirection()); BlockState s = block.getState(); s.setData(f); s.update(true); } catch(Exception e) { } enderFurnaces.put(key, furnace); } }
Example 3
Source File: AttributionListener.java From GlobalWarming with GNU Lesser General Public License v3.0 | 5 votes |
/** * Set furnaces as inactive * * @param event block break event */ @EventHandler public void onBlockBreak(BlockBreakEvent event) { Material bType = event.getBlock().getType(); //Ignore blocks that aren't furnaces or saplings: if ((bType != Material.FURNACE && bType != Material.BLAST_FURNACE && bType != Material.SMOKER) && !bType.name().endsWith("SAPLING")) { return; } //Ignore if the block's world-climate is disabled: if (!ClimateEngine.getInstance().isClimateEngineEnabled(event.getBlock().getWorld().getUID())) { return; } //Delete tracked records: Location location = event.getBlock().getLocation(); if (bType == Material.FURNACE || bType == Material.BLAST_FURNACE || bType == Material.SMOKER) { //Furnace destroyed: // - Any "contribution" records based on a deleted furnace will // no longer be able to look it up (this is OK, just be aware) FurnaceTable furnaceTable = gw.getTableManager().getFurnaceTable(); if (furnaceTable.deleteLocation(location) == null) { gw.getLogger().info(String.format("Untracked furnace destroyed @ %s", location.toString())); } } else if (event.getBlock().getType().name().endsWith("SAPLING")) { //Sapling destroyed: // - Any "reduction" records based on a deleted sapling will // no longer be able to look it up (this is OK, just be aware) TreeTable treeTable = gw.getTableManager().getTreeTable(); if (treeTable.deleteLocation(location) == null) { gw.getLogger().info(String.format("Untracked sapling destroyed @ %s", location.toString())); } } }
Example 4
Source File: Kitchen.java From ExoticGarden with GNU General Public License v3.0 | 5 votes |
private static Furnace locateFurnace(Block b) { if (b.getRelative(BlockFace.EAST).getType() == Material.FURNACE) { return (Furnace) b.getRelative(BlockFace.EAST).getState(); } else if (b.getRelative(BlockFace.WEST).getType() == Material.FURNACE) { return (Furnace) b.getRelative(BlockFace.WEST).getState(); } else if (b.getRelative(BlockFace.NORTH).getType() == Material.FURNACE) { return (Furnace) b.getRelative(BlockFace.NORTH).getState(); } else { return (Furnace) b.getRelative(BlockFace.SOUTH).getState(); } }
Example 5
Source File: GameMap.java From AnnihilationPro with MIT License | 5 votes |
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true) public void signClickCheck(PlayerInteractEvent event) { if(event.getAction() == Action.RIGHT_CLICK_BLOCK) { Block b = event.getClickedBlock(); if(b != null) { //Bukkit.getLogger().info("Error test 1"); if(b.getType() == Material.FURNACE || b.getType() == Material.BURNING_FURNACE) { //Bukkit.getLogger().info("Error test 1"); MapKey key = MapKey.getKey(b.getLocation()); if(this.enderFurnaces.containsKey(key)) { //Bukkit.getLogger().info("Error test 2"); event.setCancelled(true); AnniPlayer p = AnniPlayer.getPlayer(event.getPlayer().getUniqueId()); if(p != null) { // Bukkit.getLogger().info("Error test 3"); // if(p.getFurnace() != null) // { // Bukkit.getLogger().info("Error test 4"); p.openFurnace(); // } // else // Bukkit.getLogger().warning("[Annihilation] Someones enderfurnace was null!"); } } } } } }
Example 6
Source File: GameMap.java From AnnihilationPro with MIT License | 5 votes |
@EventHandler(priority = EventPriority.LOW,ignoreCancelled = true) public void signBreakCheck(BlockBreakEvent event) { if(event.getBlock() != null && event.getPlayer().getGameMode() != GameMode.CREATIVE) { if(event.getBlock().getType() == Material.FURNACE || event.getBlock().getType() == Material.BURNING_FURNACE) { MapKey key = MapKey.getKey(event.getBlock().getLocation()); if(this.enderFurnaces.containsKey(key)) event.setCancelled(true); } } }
Example 7
Source File: EnhancedFurnace.java From Slimefun4 with GNU General Public License v3.0 | 5 votes |
@Override public BlockTicker getItemHandler() { return new BlockTicker() { @Override public void tick(Block b, SlimefunItem item, Config data) { if (b.getType() != Material.FURNACE) { // The Furnace has been destroyed, we can clear the block data BlockStorage.clearBlockInfo(b); } else { Furnace furnace = (Furnace) b.getState(); if (furnace.getCookTime() > 0) { int cookTime = furnace.getCookTime() + getSpeed() * 10; furnace.setCookTime((short) Math.min(cookTime, furnace.getCookTimeTotal() - 1)); furnace.update(true, false); } } } @Override public boolean isSynchronized() { return true; } }; }
Example 8
Source File: IndustrialMiner.java From Slimefun4 with GNU General Public License v3.0 | 5 votes |
public IndustrialMiner(Category category, SlimefunItemStack item, Material baseMaterial, boolean silkTouch, int range) { super(category, item, new ItemStack[] { null, null, null, new CustomItem(Material.PISTON, "Piston (facing up)"), new ItemStack(Material.CHEST), new CustomItem(Material.PISTON, "Piston (facing up)"), new ItemStack(baseMaterial), new ItemStack(SlimefunPlugin.getMinecraftVersion().isAtLeast(MinecraftVersion.MINECRAFT_1_14) ? Material.BLAST_FURNACE : Material.FURNACE), new ItemStack(baseMaterial) }, new ItemStack[0], BlockFace.UP); this.range = range; this.silkTouch = silkTouch; registerDefaultFuelTypes(); }
Example 9
Source File: SignListener.java From PlayerVaults with GNU General Public License v3.0 | 5 votes |
private boolean isInvalidBlock(Material material) { if (PlayerVaults.getInstance().getVersion().contains("v1_13")) { PlayerVaults.debug("[PlayerVaults] [Debug/SignListener] Block material checked for >= 1.13"); return material == Material.CHEST || material == Material.TRAPPED_CHEST || material == Material.ENDER_CHEST || material == Material.FURNACE || material == Material.BREWING_STAND || material == Material.ENCHANTING_TABLE || material == Material.BEACON; } PlayerVaults.debug("[PlayerVaults] [Debug/SignListener] Block material checked for < 1.13"); return material == Material.CHEST || material == Material.TRAPPED_CHEST || material == Material.ENDER_CHEST || material == Material.FURNACE || material == Material.valueOf("BURNING_FURNACE") || material == Material.BREWING_STAND || material == Material.valueOf("ENCHANTMENT_TABLE") || material == Material.BEACON; }
Example 10
Source File: BlockListener.java From MineTinker with GNU General Public License v3.0 | 4 votes |
@EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true) public void onClick(PlayerInteractEvent event) { Player player = event.getPlayer(); ItemStack norm = null; if (event.getHand() == EquipmentSlot.HAND) { norm = player.getInventory().getItemInMainHand(); } else if (event.getHand() == EquipmentSlot.OFF_HAND) { norm = player.getInventory().getItemInOffHand(); } if (norm == null) return; if (event.getAction() == Action.RIGHT_CLICK_AIR) { if (modManager.isModifierItem(norm)) { event.setCancelled(true); } } else if (event.getAction() == Action.RIGHT_CLICK_BLOCK) { Block block = event.getClickedBlock(); if (block == null) { return; } if (!player.isSneaking()) { Material type = block.getType(); if (type == Material.ANVIL || type == Material.CRAFTING_TABLE || type == Material.CHEST || type == Material.ENDER_CHEST || type == Material.DROPPER || type == Material.HOPPER || type == Material.DISPENSER || type == Material.TRAPPED_CHEST || type == Material.FURNACE || type == Material.ENCHANTING_TABLE) { return; } } if (modManager.isModifierItem(norm)) { event.setCancelled(true); return; } if (block.getType() == Material.getMaterial(MineTinker.getPlugin().getConfig().getString("BlockToEnchantModifiers", Material.BOOKSHELF.name()))) { ItemStack item = player.getInventory().getItemInMainHand(); for (Modifier m : modManager.getAllMods()) { if (m.getModItem().getType().equals(item.getType())) { if (!m.isEnchantable()) continue; m.enchantItem(player); event.setCancelled(true); break; } } } } }
Example 11
Source File: Furnace.java From Kettle with GNU General Public License v3.0 | 4 votes |
public Furnace() { super(Material.FURNACE); }
Example 12
Source File: LWC.java From Modern-LWC with MIT License | 4 votes |
/** * Deposit items into an inventory chest Works with double chests. * * @param block * @param itemStack * @return remaining items (if any) */ @SuppressWarnings("deprecation") public Map<Integer, ItemStack> depositItems(Block block, ItemStack itemStack) { BlockState blockState; if ((blockState = block.getState()) != null && (blockState instanceof InventoryHolder)) { Block doubleChestBlock = null; InventoryHolder holder = (InventoryHolder) blockState; if (DoubleChestMatcher.PROTECTABLES_CHESTS.contains(block.getType())) { doubleChestBlock = findAdjacentDoubleChest(block); } else if (block.getType() == Material.FURNACE) { Inventory inventory = holder.getInventory(); if (inventory.getItem(0) != null && inventory.getItem(1) != null) { if (inventory.getItem(0).getType() == itemStack.getType() && inventory.getItem(0).getData().getData() == itemStack.getData().getData() && inventory.getItem(0) .getMaxStackSize() >= (inventory.getItem(0).getAmount() + itemStack.getAmount())) { // ItemStack fits on Slot 0 } else if (inventory.getItem(1).getType() == itemStack.getType() && inventory.getItem(1).getData().getData() == itemStack.getData().getData() && inventory.getItem(1) .getMaxStackSize() >= (inventory.getItem(1).getAmount() + itemStack.getAmount())) { // ItemStack fits on Slot 1 } else { return null; } } } if (itemStack.getAmount() <= 0) { return new HashMap<Integer, ItemStack>(); } Map<Integer, ItemStack> remaining = holder.getInventory().addItem(itemStack); // we have remainders, deal with it if (remaining.size() > 0) { int key = remaining.keySet().iterator().next(); ItemStack remainingItemStack = remaining.get(key); // is it a double chest ????? if (doubleChestBlock != null) { InventoryHolder holder2 = (InventoryHolder) doubleChestBlock.getState(); remaining = holder2.getInventory().addItem(remainingItemStack); } // recheck remaining in the event of double chest being used if (remaining.size() > 0) { return remaining; } } } return new HashMap<Integer, ItemStack>(); }
Example 13
Source File: Kitchen.java From ExoticGarden with GNU General Public License v3.0 | 4 votes |
public Kitchen(ExoticGarden plugin, Category category) { super(category, new SlimefunItemStack("KITCHEN", Material.CAULDRON, "&eKitchen", "", "&a&oYou can make a bunch of different yummies here!", "&a&oThe result goes in the Furnace output slot"), new ItemStack[] { new CustomItem(Material.BRICK_STAIRS, "&oBrick Stairs (upside down)"), new CustomItem(Material.BRICK_STAIRS, "&oBrick Stairs (upside down)"), new ItemStack(Material.BRICKS), new ItemStack(Material.STONE_PRESSURE_PLATE), new ItemStack(Material.IRON_TRAPDOOR), new ItemStack(Material.BOOKSHELF), new ItemStack(Material.FURNACE), new ItemStack(Material.DISPENSER), new ItemStack(Material.CRAFTING_TABLE) }, new ItemStack[0], BlockFace.SELF); this.plugin = plugin; }