1
mirror of https://github.com/StarWishsama/Slimefun4.git synced 2024-09-20 03:35:51 +00:00

Changed the way of detect the Chamber

This commit is contained in:
AtomicScience 2017-11-20 15:48:52 +03:00
parent 7270eee3c4
commit 89b1da7db8

View File

@ -749,30 +749,30 @@ public class SlimefunSetup {
p.getWorld().playEffect(b.getLocation(), Effect.MOBSPAWNER_FLAMES, 1);
Block raw_disp = b.getRelative(BlockFace.DOWN);
Hopper resf = null;
boolean isIgnitionChamberInstalled = false;
if(raw_disp.getRelative(BlockFace.EAST).getState().getBlock().getType().name() == "HOPPER") {
if(BlockStorage.check(raw_disp.getRelative(BlockFace.EAST).getState().getBlock(), "IGNITION_CHAMBER")) {
resf = (Hopper) raw_disp.getRelative(BlockFace.EAST).getState();
} else if (raw_disp.getRelative(BlockFace.WEST).getState().getBlock().getType().name() == "HOPPER") {
isIgnitionChamberInstalled = true;
} else if (BlockStorage.check(raw_disp.getRelative(BlockFace.WEST).getState().getBlock(), "IGNITION_CHAMBER")) {
resf = (Hopper) raw_disp.getRelative(BlockFace.WEST).getState();
} else if (raw_disp.getRelative(BlockFace.NORTH).getState().getBlock().getType().name() == "HOPPER") {
isIgnitionChamberInstalled = true;
} else if (BlockStorage.check(raw_disp.getRelative(BlockFace.NORTH).getState().getBlock(), "IGNITION_CHAMBER")) {
resf = (Hopper) raw_disp.getRelative(BlockFace.NORTH).getState();
} else if (raw_disp.getRelative(BlockFace.SOUTH).getState().getBlock().getType().name() == "HOPPER"){
isIgnitionChamberInstalled = true;
} else if (BlockStorage.check(raw_disp.getRelative(BlockFace.SOUTH).getState().getBlock(), "IGNITION_CHAMBER")){
resf = (Hopper) raw_disp.getRelative(BlockFace.SOUTH).getState();
}
boolean isIgniteChamberInstalled = false;
if(resf != null) {
if(resf.getCustomName().equalsIgnoreCase(SlimefunItems.IGNITION_CHAMBER.getItemMeta().getDisplayName())) isIgniteChamberInstalled = true;
isIgnitionChamberInstalled = true;
}
if (SlimefunStartup.chance(100, (Integer) Slimefun.getItemValue("SMELTERY", "chance.fireBreak"))) {
if(isIgniteChamberInstalled) {
if(isIgnitionChamberInstalled) {
if(resf.getInventory().contains(Material.FLINT_AND_STEEL)) {
ItemStack item = resf.getInventory().getItem(resf.getInventory().first(Material.FLINT_AND_STEEL));
item.setDurability((short) (item.getDurability() + 1));
if(item.getDurability() >= 64) {
item.setAmount(0); p.getWorld().playSound(p.getLocation(), Sound.ENTITY_ITEM_BREAK, 1, 1);
item.setAmount(0);
if(item.getDurability() >= item.getType().getMaxDurability()) {
item.setAmount(0);
p.getWorld().playSound(p.getLocation(), Sound.ENTITY_ITEM_BREAK, 1, 1);
}
p.getWorld().playSound(p.getLocation(), Sound.ITEM_FLINTANDSTEEL_USE, 1, 1);
} else {