|
|
@ -14,6 +14,7 @@ import org.bukkit.GameMode;
|
|
|
|
import org.bukkit.Location;
|
|
|
|
import org.bukkit.Location;
|
|
|
|
import org.bukkit.Material;
|
|
|
|
import org.bukkit.Material;
|
|
|
|
import org.bukkit.Sound;
|
|
|
|
import org.bukkit.Sound;
|
|
|
|
|
|
|
|
import org.bukkit.Tag;
|
|
|
|
import org.bukkit.block.Block;
|
|
|
|
import org.bukkit.block.Block;
|
|
|
|
import org.bukkit.block.BlockFace;
|
|
|
|
import org.bukkit.block.BlockFace;
|
|
|
|
import org.bukkit.block.Chest;
|
|
|
|
import org.bukkit.block.Chest;
|
|
|
@ -21,6 +22,7 @@ import org.bukkit.block.CreatureSpawner;
|
|
|
|
import org.bukkit.block.Dispenser;
|
|
|
|
import org.bukkit.block.Dispenser;
|
|
|
|
import org.bukkit.block.Hopper;
|
|
|
|
import org.bukkit.block.Hopper;
|
|
|
|
import org.bukkit.block.data.Ageable;
|
|
|
|
import org.bukkit.block.data.Ageable;
|
|
|
|
|
|
|
|
import org.bukkit.block.data.BlockData;
|
|
|
|
import org.bukkit.block.data.Levelled;
|
|
|
|
import org.bukkit.block.data.Levelled;
|
|
|
|
import org.bukkit.enchantments.Enchantment;
|
|
|
|
import org.bukkit.enchantments.Enchantment;
|
|
|
|
import org.bukkit.entity.ArmorStand;
|
|
|
|
import org.bukkit.entity.ArmorStand;
|
|
|
@ -189,6 +191,10 @@ public class SlimefunSetup {
|
|
|
|
new ItemStack[] {new ItemStack(Material.COOKIE), new ItemStack(Material.PAPER), null, null, null, null, null, null, null})
|
|
|
|
new ItemStack[] {new ItemStack(Material.COOKIE), new ItemStack(Material.PAPER), null, null, null, null, null, null, null})
|
|
|
|
.register(true);
|
|
|
|
.register(true);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
new SlimefunItem(Categories.MACHINES_1, SlimefunItems.OUTPUT_CHEST, "OUTPUT_CHEST", RecipeType.ENHANCED_CRAFTING_TABLE,
|
|
|
|
|
|
|
|
new ItemStack[] {SlimefunItems.LEAD_INGOT, new ItemStack(Material.HOPPER), SlimefunItems.LEAD_INGOT, SlimefunItems.LEAD_INGOT, new ItemStack(Material.CHEST), SlimefunItems.LEAD_INGOT, null, SlimefunItems.LEAD_INGOT, null})
|
|
|
|
|
|
|
|
.register(true);
|
|
|
|
|
|
|
|
|
|
|
|
new SlimefunMachine(Categories.MACHINES_1, SlimefunItems.ENHANCED_CRAFTING_TABLE, "ENHANCED_CRAFTING_TABLE",
|
|
|
|
new SlimefunMachine(Categories.MACHINES_1, SlimefunItems.ENHANCED_CRAFTING_TABLE, "ENHANCED_CRAFTING_TABLE",
|
|
|
|
new ItemStack[] {null, null, null, null, new ItemStack(Material.CRAFTING_TABLE), null, null, new ItemStack(Material.DISPENSER), null},
|
|
|
|
new ItemStack[] {null, null, null, null, new ItemStack(Material.CRAFTING_TABLE), null, null, new ItemStack(Material.DISPENSER), null},
|
|
|
|
new ItemStack[0], Material.CRAFTING_TABLE)
|
|
|
|
new ItemStack[0], Material.CRAFTING_TABLE)
|
|
|
@ -202,9 +208,13 @@ public class SlimefunSetup {
|
|
|
|
if (mb.isMultiBlock(machine)) {
|
|
|
|
if (mb.isMultiBlock(machine)) {
|
|
|
|
if (CSCoreLib.getLib().getProtectionManager().canAccessChest(p.getUniqueId(), b, true)) {
|
|
|
|
if (CSCoreLib.getLib().getProtectionManager().canAccessChest(p.getUniqueId(), b, true)) {
|
|
|
|
if (Slimefun.hasUnlocked(p, machine.getItem(), true)) {
|
|
|
|
if (Slimefun.hasUnlocked(p, machine.getItem(), true)) {
|
|
|
|
Dispenser disp = (Dispenser) b.getRelative(BlockFace.DOWN).getState();
|
|
|
|
// Objects dispBlock and disp have been split up, in order to add the output chest functionallity, which is the only functionallity
|
|
|
|
|
|
|
|
// that is dependant on the dispenser's block methods.
|
|
|
|
|
|
|
|
// the Dispenser disp still remains the same though, and as such doesn't break any existing code which involves said object.
|
|
|
|
|
|
|
|
Block dispBlock = b.getRelative(BlockFace.DOWN);
|
|
|
|
|
|
|
|
Dispenser disp = (Dispenser) dispBlock.getState();
|
|
|
|
|
|
|
|
Inventory inv = disp.getInventory();
|
|
|
|
|
|
|
|
|
|
|
|
final Inventory inv = disp.getInventory();
|
|
|
|
|
|
|
|
List<ItemStack[]> inputs = RecipeType.getRecipeInputList(machine);
|
|
|
|
List<ItemStack[]> inputs = RecipeType.getRecipeInputList(machine);
|
|
|
|
|
|
|
|
|
|
|
|
for (int i = 0; i < inputs.size(); i++) {
|
|
|
|
for (int i = 0; i < inputs.size(); i++) {
|
|
|
@ -231,9 +241,11 @@ public class SlimefunSetup {
|
|
|
|
for (int j = 0; j < inv.getContents().length; j++) {
|
|
|
|
for (int j = 0; j < inv.getContents().length; j++) {
|
|
|
|
inv2.setItem(j, inv.getContents()[j] != null ? (inv.getContents()[j].getAmount() > 1 ? new CustomItem(inv.getContents()[j], inv.getContents()[j].getAmount() - 1): null): null);
|
|
|
|
inv2.setItem(j, inv.getContents()[j] != null ? (inv.getContents()[j].getAmount() > 1 ? new CustomItem(inv.getContents()[j], inv.getContents()[j].getAmount() - 1): null): null);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (InvUtils.fits(inv2, adding)) {
|
|
|
|
|
|
|
|
SlimefunItem sfItem = SlimefunItem.getByItem(adding);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Inventory outputInv = SlimefunMachine.findValidOutputInv(adding, dispBlock, inv, inv2);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (outputInv != null) {
|
|
|
|
|
|
|
|
SlimefunItem sfItem = SlimefunItem.getByItem(adding);
|
|
|
|
if (sfItem instanceof SlimefunBackpack) {
|
|
|
|
if (sfItem instanceof SlimefunBackpack) {
|
|
|
|
ItemStack backpack = null;
|
|
|
|
ItemStack backpack = null;
|
|
|
|
|
|
|
|
|
|
|
@ -300,7 +312,8 @@ public class SlimefunSetup {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
p.getWorld().playSound(b.getLocation(), Sound.BLOCK_WOODEN_BUTTON_CLICK_ON, 1, 1);
|
|
|
|
p.getWorld().playSound(b.getLocation(), Sound.BLOCK_WOODEN_BUTTON_CLICK_ON, 1, 1);
|
|
|
|
|
|
|
|
|
|
|
|
inv.addItem(adding);
|
|
|
|
outputInv.addItem(adding);
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else Messages.local.sendTranslation(p, "machines.full-inventory", true);
|
|
|
|
else Messages.local.sendTranslation(p, "machines.full-inventory", true);
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -338,7 +351,7 @@ public class SlimefunSetup {
|
|
|
|
|
|
|
|
|
|
|
|
new SlimefunMachine(Categories.MACHINES_1, SlimefunItems.GRIND_STONE, "GRIND_STONE",
|
|
|
|
new SlimefunMachine(Categories.MACHINES_1, SlimefunItems.GRIND_STONE, "GRIND_STONE",
|
|
|
|
new ItemStack[] {null, null, null, null, new ItemStack(Material.OAK_FENCE), null, null, new CustomItem(Material.DISPENSER, "Dispenser (Facing up)"), null},
|
|
|
|
new ItemStack[] {null, null, null, null, new ItemStack(Material.OAK_FENCE), null, null, new CustomItem(Material.DISPENSER, "Dispenser (Facing up)"), null},
|
|
|
|
new ItemStack[] {new ItemStack(Material.BLAZE_ROD), new ItemStack(Material.BLAZE_POWDER, 4), new ItemStack(Material.BONE), new ItemStack(Material.BONE_MEAL, 4), new ItemStack(Material.GRAVEL), new ItemStack(Material.FLINT), new ItemStack(Material.NETHER_WART), new CustomItem(SlimefunItems.MAGIC_LUMP_1, 2), new ItemStack(Material.ENDER_EYE), new CustomItem(SlimefunItems.ENDER_LUMP_1, 2), new ItemStack(Material.COBBLESTONE), new ItemStack(Material.GRAVEL), new ItemStack(Material.WHEAT), SlimefunItems.WHEAT_FLOUR, new ItemStack(Material.DIRT), SlimefunItems.STONE_CHUNK},
|
|
|
|
new ItemStack[] {new ItemStack(Material.BLAZE_ROD), new ItemStack(Material.BLAZE_POWDER, 4), new ItemStack(Material.BONE), new ItemStack(Material.BONE_MEAL, 4), new ItemStack(Material.GRAVEL), new ItemStack(Material.FLINT), new ItemStack(Material.NETHER_WART), new CustomItem(SlimefunItems.MAGIC_LUMP_1, 2), new ItemStack(Material.ENDER_EYE), new CustomItem(SlimefunItems.ENDER_LUMP_1, 2), new ItemStack(Material.COBBLESTONE), new ItemStack(Material.GRAVEL), new ItemStack(Material.WHEAT), SlimefunItems.WHEAT_FLOUR, new ItemStack(Material.DIRT), SlimefunItems.STONE_CHUNK, new ItemStack(Material.SANDSTONE), new ItemStack(Material.SAND, 4), new ItemStack(Material.RED_SANDSTONE), new ItemStack(Material.RED_SAND, 4)},
|
|
|
|
Material.OAK_FENCE)
|
|
|
|
Material.OAK_FENCE)
|
|
|
|
.register(true, new MultiBlockInteractionHandler() {
|
|
|
|
.register(true, new MultiBlockInteractionHandler() {
|
|
|
|
|
|
|
|
|
|
|
@ -350,17 +363,19 @@ public class SlimefunSetup {
|
|
|
|
if (mb.isMultiBlock(machine)) {
|
|
|
|
if (mb.isMultiBlock(machine)) {
|
|
|
|
if (CSCoreLib.getLib().getProtectionManager().canAccessChest(p.getUniqueId(), b, true)) {
|
|
|
|
if (CSCoreLib.getLib().getProtectionManager().canAccessChest(p.getUniqueId(), b, true)) {
|
|
|
|
if (Slimefun.hasUnlocked(p, machine.getItem(), true)) {
|
|
|
|
if (Slimefun.hasUnlocked(p, machine.getItem(), true)) {
|
|
|
|
Dispenser disp = (Dispenser) b.getRelative(BlockFace.DOWN).getState();
|
|
|
|
Block dispBlock = b.getRelative(BlockFace.DOWN);
|
|
|
|
|
|
|
|
Dispenser disp = (Dispenser) dispBlock.getState();
|
|
|
|
Inventory inv = disp.getInventory();
|
|
|
|
Inventory inv = disp.getInventory();
|
|
|
|
for (ItemStack current: inv.getContents()) {
|
|
|
|
for (ItemStack current: inv.getContents()) {
|
|
|
|
for (ItemStack convert: RecipeType.getRecipeInputs(machine)) {
|
|
|
|
for (ItemStack convert: RecipeType.getRecipeInputs(machine)) {
|
|
|
|
if (convert != null && SlimefunManager.isItemSimiliar(current, convert, true)) {
|
|
|
|
if (convert != null && SlimefunManager.isItemSimiliar(current, convert, true)) {
|
|
|
|
ItemStack output = RecipeType.getRecipeOutput(machine, convert);
|
|
|
|
ItemStack output = RecipeType.getRecipeOutput(machine, convert);
|
|
|
|
if (InvUtils.fits(inv, output)) {
|
|
|
|
Inventory outputInv = SlimefunMachine.findValidOutputInv(output, dispBlock, inv);
|
|
|
|
|
|
|
|
if (outputInv != null) {
|
|
|
|
ItemStack removing = current.clone();
|
|
|
|
ItemStack removing = current.clone();
|
|
|
|
removing.setAmount(1);
|
|
|
|
removing.setAmount(1);
|
|
|
|
inv.removeItem(removing);
|
|
|
|
inv.removeItem(removing);
|
|
|
|
inv.addItem(output);
|
|
|
|
outputInv.addItem(output);
|
|
|
|
p.getWorld().playSound(p.getLocation(), Sound.BLOCK_WOODEN_BUTTON_CLICK_ON, 1, 1);
|
|
|
|
p.getWorld().playSound(p.getLocation(), Sound.BLOCK_WOODEN_BUTTON_CLICK_ON, 1, 1);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else Messages.local.sendTranslation(p, "machines.full-inventory", true);
|
|
|
|
else Messages.local.sendTranslation(p, "machines.full-inventory", true);
|
|
|
@ -391,8 +406,9 @@ public class SlimefunSetup {
|
|
|
|
if (mb.isMultiBlock(machine)) {
|
|
|
|
if (mb.isMultiBlock(machine)) {
|
|
|
|
if (CSCoreLib.getLib().getProtectionManager().canAccessChest(p.getUniqueId(), b, true)) {
|
|
|
|
if (CSCoreLib.getLib().getProtectionManager().canAccessChest(p.getUniqueId(), b, true)) {
|
|
|
|
if (Slimefun.hasUnlocked(p, machine.getItem(), true)) {
|
|
|
|
if (Slimefun.hasUnlocked(p, machine.getItem(), true)) {
|
|
|
|
Dispenser disp = (Dispenser) b.getRelative(BlockFace.DOWN).getState();
|
|
|
|
Block dispBlock = b.getRelative(BlockFace.DOWN);
|
|
|
|
final Inventory inv = disp.getInventory();
|
|
|
|
Dispenser disp = (Dispenser) dispBlock.getState();
|
|
|
|
|
|
|
|
Inventory inv = disp.getInventory();
|
|
|
|
List<ItemStack[]> inputs = RecipeType.getRecipeInputList(machine);
|
|
|
|
List<ItemStack[]> inputs = RecipeType.getRecipeInputList(machine);
|
|
|
|
|
|
|
|
|
|
|
|
for (int i = 0; i < inputs.size(); i++) {
|
|
|
|
for (int i = 0; i < inputs.size(); i++) {
|
|
|
@ -407,7 +423,8 @@ public class SlimefunSetup {
|
|
|
|
if (craft) {
|
|
|
|
if (craft) {
|
|
|
|
final ItemStack adding = RecipeType.getRecipeOutputList(machine, inputs.get(i)).clone();
|
|
|
|
final ItemStack adding = RecipeType.getRecipeOutputList(machine, inputs.get(i)).clone();
|
|
|
|
if (Slimefun.hasUnlocked(p, adding, true)) {
|
|
|
|
if (Slimefun.hasUnlocked(p, adding, true)) {
|
|
|
|
if (InvUtils.fits(inv, adding)) {
|
|
|
|
Inventory outputInv = SlimefunMachine.findValidOutputInv(adding, dispBlock, inv);
|
|
|
|
|
|
|
|
if (outputInv != null) {
|
|
|
|
for (ItemStack removing: inputs.get(i)) {
|
|
|
|
for (ItemStack removing: inputs.get(i)) {
|
|
|
|
if (removing != null) inv.removeItem(removing);
|
|
|
|
if (removing != null) inv.removeItem(removing);
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -418,7 +435,7 @@ public class SlimefunSetup {
|
|
|
|
p.getWorld().playSound(p.getLocation(), Sound.BLOCK_ANVIL_USE, 1F, 2F);
|
|
|
|
p.getWorld().playSound(p.getLocation(), Sound.BLOCK_ANVIL_USE, 1F, 2F);
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
p.getWorld().playSound(p.getLocation(), Sound.ENTITY_ARROW_HIT_PLAYER, 1F, 1F);
|
|
|
|
p.getWorld().playSound(p.getLocation(), Sound.ENTITY_ARROW_HIT_PLAYER, 1F, 1F);
|
|
|
|
inv.addItem(adding);
|
|
|
|
outputInv.addItem(adding);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}, j*20L);
|
|
|
|
}, j*20L);
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -451,17 +468,19 @@ public class SlimefunSetup {
|
|
|
|
if (mb.isMultiBlock(machine)) {
|
|
|
|
if (mb.isMultiBlock(machine)) {
|
|
|
|
if (CSCoreLib.getLib().getProtectionManager().canAccessChest(p.getUniqueId(), b, true)) {
|
|
|
|
if (CSCoreLib.getLib().getProtectionManager().canAccessChest(p.getUniqueId(), b, true)) {
|
|
|
|
if (Slimefun.hasUnlocked(p, machine.getItem(), true)) {
|
|
|
|
if (Slimefun.hasUnlocked(p, machine.getItem(), true)) {
|
|
|
|
Dispenser disp = (Dispenser) b.getRelative(BlockFace.DOWN).getState();
|
|
|
|
Block dispBlock = b.getRelative(BlockFace.DOWN);
|
|
|
|
|
|
|
|
Dispenser disp = (Dispenser) dispBlock.getState();
|
|
|
|
Inventory inv = disp.getInventory();
|
|
|
|
Inventory inv = disp.getInventory();
|
|
|
|
for (ItemStack current: inv.getContents()) {
|
|
|
|
for (ItemStack current: inv.getContents()) {
|
|
|
|
for (ItemStack convert: RecipeType.getRecipeInputs(machine)) {
|
|
|
|
for (ItemStack convert: RecipeType.getRecipeInputs(machine)) {
|
|
|
|
if (convert != null && SlimefunManager.isItemSimiliar(current, convert, true)) {
|
|
|
|
if (convert != null && SlimefunManager.isItemSimiliar(current, convert, true)) {
|
|
|
|
ItemStack adding = RecipeType.getRecipeOutput(machine, convert);
|
|
|
|
ItemStack adding = RecipeType.getRecipeOutput(machine, convert);
|
|
|
|
if (InvUtils.fits(inv, adding)) {
|
|
|
|
Inventory outputInv = SlimefunMachine.findValidOutputInv(adding, dispBlock, inv);
|
|
|
|
|
|
|
|
if (outputInv != null) {
|
|
|
|
ItemStack removing = current.clone();
|
|
|
|
ItemStack removing = current.clone();
|
|
|
|
removing.setAmount(convert.getAmount());
|
|
|
|
removing.setAmount(convert.getAmount());
|
|
|
|
inv.removeItem(removing);
|
|
|
|
inv.removeItem(removing);
|
|
|
|
inv.addItem(adding);
|
|
|
|
outputInv.addItem(adding);
|
|
|
|
p.getWorld().playEffect(b.getLocation(), Effect.STEP_SOUND, 1);
|
|
|
|
p.getWorld().playEffect(b.getLocation(), Effect.STEP_SOUND, 1);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else Messages.local.sendTranslation(p, "machines.full-inventory", true);
|
|
|
|
else Messages.local.sendTranslation(p, "machines.full-inventory", true);
|
|
|
@ -492,13 +511,15 @@ public class SlimefunSetup {
|
|
|
|
if (mb.isMultiBlock(machine)) {
|
|
|
|
if (mb.isMultiBlock(machine)) {
|
|
|
|
if (CSCoreLib.getLib().getProtectionManager().canAccessChest(p.getUniqueId(), b, true)) {
|
|
|
|
if (CSCoreLib.getLib().getProtectionManager().canAccessChest(p.getUniqueId(), b, true)) {
|
|
|
|
if (Slimefun.hasUnlocked(p, machine.getItem(), true)) {
|
|
|
|
if (Slimefun.hasUnlocked(p, machine.getItem(), true)) {
|
|
|
|
Dispenser disp = (Dispenser) b.getRelative(BlockFace.DOWN).getState();
|
|
|
|
Block dispBlock = b.getRelative(BlockFace.DOWN);
|
|
|
|
final Inventory inv = disp.getInventory();
|
|
|
|
Dispenser disp = (Dispenser) dispBlock.getState();
|
|
|
|
|
|
|
|
Inventory inv = disp.getInventory();
|
|
|
|
for (ItemStack current: inv.getContents()) {
|
|
|
|
for (ItemStack current: inv.getContents()) {
|
|
|
|
for (ItemStack convert: RecipeType.getRecipeInputs(machine)) {
|
|
|
|
for (ItemStack convert: RecipeType.getRecipeInputs(machine)) {
|
|
|
|
if (convert != null && SlimefunManager.isItemSimiliar(current, convert, true)) {
|
|
|
|
if (convert != null && SlimefunManager.isItemSimiliar(current, convert, true)) {
|
|
|
|
final ItemStack adding = RecipeType.getRecipeOutput(machine, convert);
|
|
|
|
final ItemStack adding = RecipeType.getRecipeOutput(machine, convert);
|
|
|
|
if (InvUtils.fits(inv, adding)) {
|
|
|
|
Inventory outputInv = SlimefunMachine.findValidOutputInv(adding, dispBlock, inv);
|
|
|
|
|
|
|
|
if (outputInv != null) {
|
|
|
|
ItemStack removing = current.clone();
|
|
|
|
ItemStack removing = current.clone();
|
|
|
|
removing.setAmount(convert.getAmount());
|
|
|
|
removing.setAmount(convert.getAmount());
|
|
|
|
inv.removeItem(removing);
|
|
|
|
inv.removeItem(removing);
|
|
|
@ -509,7 +530,7 @@ public class SlimefunSetup {
|
|
|
|
p.getWorld().playSound(p.getLocation(), j == 1 ? Sound.BLOCK_PISTON_CONTRACT : Sound.BLOCK_PISTON_EXTEND, 1F, j == 0 ? 1F : 2F);
|
|
|
|
p.getWorld().playSound(p.getLocation(), j == 1 ? Sound.BLOCK_PISTON_CONTRACT : Sound.BLOCK_PISTON_EXTEND, 1F, j == 0 ? 1F : 2F);
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
p.getWorld().playSound(p.getLocation(), Sound.ENTITY_ARROW_HIT_PLAYER, 1F, 1F);
|
|
|
|
p.getWorld().playSound(p.getLocation(), Sound.ENTITY_ARROW_HIT_PLAYER, 1F, 1F);
|
|
|
|
inv.addItem(adding);
|
|
|
|
outputInv.addItem(adding);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}, i*20L);
|
|
|
|
}, i*20L);
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -709,7 +730,8 @@ public class SlimefunSetup {
|
|
|
|
if (mb.isMultiBlock(machine)) {
|
|
|
|
if (mb.isMultiBlock(machine)) {
|
|
|
|
if (CSCoreLib.getLib().getProtectionManager().canAccessChest(p.getUniqueId(), b, true)) {
|
|
|
|
if (CSCoreLib.getLib().getProtectionManager().canAccessChest(p.getUniqueId(), b, true)) {
|
|
|
|
if (Slimefun.hasUnlocked(p, machine.getItem(), true)) {
|
|
|
|
if (Slimefun.hasUnlocked(p, machine.getItem(), true)) {
|
|
|
|
Dispenser disp = (Dispenser) b.getRelative(BlockFace.DOWN).getState();
|
|
|
|
Block dispBlock = b.getRelative(BlockFace.DOWN);
|
|
|
|
|
|
|
|
Dispenser disp = (Dispenser) dispBlock.getState();
|
|
|
|
Inventory inv = disp.getInventory();
|
|
|
|
Inventory inv = disp.getInventory();
|
|
|
|
List<ItemStack[]> inputs = RecipeType.getRecipeInputList(machine);
|
|
|
|
List<ItemStack[]> inputs = RecipeType.getRecipeInputList(machine);
|
|
|
|
|
|
|
|
|
|
|
@ -730,23 +752,27 @@ public class SlimefunSetup {
|
|
|
|
if (craft) {
|
|
|
|
if (craft) {
|
|
|
|
ItemStack adding = RecipeType.getRecipeOutputList(machine, inputs.get(i)).clone();
|
|
|
|
ItemStack adding = RecipeType.getRecipeOutputList(machine, inputs.get(i)).clone();
|
|
|
|
if (Slimefun.hasUnlocked(p, adding, true)) {
|
|
|
|
if (Slimefun.hasUnlocked(p, adding, true)) {
|
|
|
|
if (InvUtils.fits(inv, adding)) {
|
|
|
|
Inventory outputInv = SlimefunMachine.findValidOutputInv(adding, dispBlock, inv);
|
|
|
|
|
|
|
|
if (outputInv != null) {
|
|
|
|
for (ItemStack removing: inputs.get(i)) {
|
|
|
|
for (ItemStack removing: inputs.get(i)) {
|
|
|
|
if (removing != null) inv.removeItem(removing);
|
|
|
|
if (removing != null) inv.removeItem(removing);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
inv.addItem(adding);
|
|
|
|
outputInv.addItem(adding);
|
|
|
|
p.getWorld().playSound(p.getLocation(), Sound.BLOCK_LAVA_POP, 1, 1);
|
|
|
|
p.getWorld().playSound(p.getLocation(), Sound.BLOCK_LAVA_POP, 1, 1);
|
|
|
|
p.getWorld().playEffect(b.getLocation(), Effect.MOBSPAWNER_FLAMES, 1);
|
|
|
|
p.getWorld().playEffect(b.getLocation(), Effect.MOBSPAWNER_FLAMES, 1);
|
|
|
|
Block raw_disp = b.getRelative(BlockFace.DOWN);
|
|
|
|
// Block raw_disp = b.getRelative(BlockFace.DOWN);
|
|
|
|
|
|
|
|
// raw_disp has been removed since the outputInv functionality already uses such an object which is declared above as dispBlock.
|
|
|
|
|
|
|
|
// The chamber methods have been updated to reflect this change.
|
|
|
|
|
|
|
|
// Maybe this code snippet should be turned into a loop?
|
|
|
|
Hopper chamber = null;
|
|
|
|
Hopper chamber = null;
|
|
|
|
if (BlockStorage.check(raw_disp.getRelative(BlockFace.EAST).getState().getBlock(), "IGNITION_CHAMBER")) {
|
|
|
|
if (BlockStorage.check(dispBlock.getRelative(BlockFace.EAST).getState().getBlock(), "IGNITION_CHAMBER")) {
|
|
|
|
chamber = (Hopper) raw_disp.getRelative(BlockFace.EAST).getState();
|
|
|
|
chamber = (Hopper) dispBlock.getRelative(BlockFace.EAST).getState();
|
|
|
|
} else if (BlockStorage.check(raw_disp.getRelative(BlockFace.WEST).getState().getBlock(), "IGNITION_CHAMBER")) {
|
|
|
|
} else if (BlockStorage.check(dispBlock.getRelative(BlockFace.WEST).getState().getBlock(), "IGNITION_CHAMBER")) {
|
|
|
|
chamber = (Hopper) raw_disp.getRelative(BlockFace.WEST).getState();
|
|
|
|
chamber = (Hopper) dispBlock.getRelative(BlockFace.WEST).getState();
|
|
|
|
} else if (BlockStorage.check(raw_disp.getRelative(BlockFace.NORTH).getState().getBlock(), "IGNITION_CHAMBER")) {
|
|
|
|
} else if (BlockStorage.check(dispBlock.getRelative(BlockFace.NORTH).getState().getBlock(), "IGNITION_CHAMBER")) {
|
|
|
|
chamber = (Hopper) raw_disp.getRelative(BlockFace.NORTH).getState();
|
|
|
|
chamber = (Hopper) dispBlock.getRelative(BlockFace.NORTH).getState();
|
|
|
|
} else if (BlockStorage.check(raw_disp.getRelative(BlockFace.SOUTH).getState().getBlock(), "IGNITION_CHAMBER")){
|
|
|
|
} else if (BlockStorage.check(dispBlock.getRelative(BlockFace.SOUTH).getState().getBlock(), "IGNITION_CHAMBER")){
|
|
|
|
chamber = (Hopper) raw_disp.getRelative(BlockFace.SOUTH).getState();
|
|
|
|
chamber = (Hopper) dispBlock.getRelative(BlockFace.SOUTH).getState();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (SlimefunStartup.chance(100, (Integer) Slimefun.getItemValue("SMELTERY", "chance.fireBreak"))) {
|
|
|
|
if (SlimefunStartup.chance(100, (Integer) Slimefun.getItemValue("SMELTERY", "chance.fireBreak"))) {
|
|
|
@ -810,13 +836,15 @@ public class SlimefunSetup {
|
|
|
|
if (mb.isMultiBlock(machine)) {
|
|
|
|
if (mb.isMultiBlock(machine)) {
|
|
|
|
if (CSCoreLib.getLib().getProtectionManager().canAccessChest(p.getUniqueId(), b, true)) {
|
|
|
|
if (CSCoreLib.getLib().getProtectionManager().canAccessChest(p.getUniqueId(), b, true)) {
|
|
|
|
if (Slimefun.hasUnlocked(p, machine.getItem(), true)) {
|
|
|
|
if (Slimefun.hasUnlocked(p, machine.getItem(), true)) {
|
|
|
|
Dispenser disp = (Dispenser) b.getRelative(BlockFace.UP).getRelative(BlockFace.UP).getState();
|
|
|
|
Block dispBlock = b.getRelative(BlockFace.UP).getRelative(BlockFace.UP);
|
|
|
|
|
|
|
|
Dispenser disp = (Dispenser) dispBlock.getState();
|
|
|
|
final Inventory inv = disp.getInventory();
|
|
|
|
final Inventory inv = disp.getInventory();
|
|
|
|
for (ItemStack current: inv.getContents()) {
|
|
|
|
for (ItemStack current: inv.getContents()) {
|
|
|
|
for (ItemStack convert: RecipeType.getRecipeInputs(machine)) {
|
|
|
|
for (ItemStack convert: RecipeType.getRecipeInputs(machine)) {
|
|
|
|
if (convert != null && SlimefunManager.isItemSimiliar(current, convert, true)) {
|
|
|
|
if (convert != null && SlimefunManager.isItemSimiliar(current, convert, true)) {
|
|
|
|
final ItemStack adding = RecipeType.getRecipeOutput(machine, convert);
|
|
|
|
final ItemStack adding = RecipeType.getRecipeOutput(machine, convert);
|
|
|
|
if (InvUtils.fits(inv, adding)) {
|
|
|
|
Inventory outputInv = SlimefunMachine.findValidOutputInv(adding, dispBlock, inv);
|
|
|
|
|
|
|
|
if (outputInv != null) {
|
|
|
|
ItemStack removing = current.clone();
|
|
|
|
ItemStack removing = current.clone();
|
|
|
|
removing.setAmount(convert.getAmount());
|
|
|
|
removing.setAmount(convert.getAmount());
|
|
|
|
inv.removeItem(removing);
|
|
|
|
inv.removeItem(removing);
|
|
|
@ -831,7 +859,7 @@ public class SlimefunSetup {
|
|
|
|
p.getWorld().playSound(b.getLocation(), Sound.ENTITY_TNT_PRIMED, 1F, 1F);
|
|
|
|
p.getWorld().playSound(b.getLocation(), Sound.ENTITY_TNT_PRIMED, 1F, 1F);
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
p.getWorld().playSound(p.getLocation(), Sound.ENTITY_ARROW_HIT_PLAYER, 1F, 1F);
|
|
|
|
p.getWorld().playSound(p.getLocation(), Sound.ENTITY_ARROW_HIT_PLAYER, 1F, 1F);
|
|
|
|
inv.addItem(adding);
|
|
|
|
outputInv.addItem(adding);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}, i*20L);
|
|
|
|
}, i*20L);
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -1130,13 +1158,14 @@ public class SlimefunSetup {
|
|
|
|
if (mb.isMultiBlock(machine)) {
|
|
|
|
if (mb.isMultiBlock(machine)) {
|
|
|
|
if (CSCoreLib.getLib().getProtectionManager().canAccessChest(p.getUniqueId(), b, true)) {
|
|
|
|
if (CSCoreLib.getLib().getProtectionManager().canAccessChest(p.getUniqueId(), b, true)) {
|
|
|
|
if (Slimefun.hasUnlocked(p, machine.getItem(), true)) {
|
|
|
|
if (Slimefun.hasUnlocked(p, machine.getItem(), true)) {
|
|
|
|
Dispenser disp = null;
|
|
|
|
Block dispBlock = null;
|
|
|
|
|
|
|
|
// Maybe this could be implemented by instead looping over a BlockFace<> array?
|
|
|
|
if (b.getRelative(1, 0, 0).getType() == Material.DISPENSER) disp = (Dispenser) b.getRelative(1, 0, 0).getState();
|
|
|
|
if (b.getRelative(1, 0, 0).getType() == Material.DISPENSER) dispBlock = b.getRelative(1, 0, 0);
|
|
|
|
else if (b.getRelative(0, 0, 1).getType() == Material.DISPENSER) disp = (Dispenser) b.getRelative(0, 0, 1).getState();
|
|
|
|
else if (b.getRelative(0, 0, 1).getType() == Material.DISPENSER) dispBlock = b.getRelative(0, 0, 1);
|
|
|
|
else if (b.getRelative(-1, 0, 0).getType() == Material.DISPENSER) disp = (Dispenser) b.getRelative(-1, 0, 0).getState();
|
|
|
|
else if (b.getRelative(-1, 0, 0).getType() == Material.DISPENSER) dispBlock = b.getRelative(-1, 0, 0);
|
|
|
|
else if (b.getRelative(0, 0, -1).getType() == Material.DISPENSER) disp = (Dispenser) b.getRelative(0, 0, -1).getState();
|
|
|
|
else if (b.getRelative(0, 0, -1).getType() == Material.DISPENSER) dispBlock = b.getRelative(0, 0, -1);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Dispenser disp = (Dispenser) dispBlock.getState();
|
|
|
|
final Inventory inv = disp.getInventory();
|
|
|
|
final Inventory inv = disp.getInventory();
|
|
|
|
List<ItemStack[]> inputs = RecipeType.getRecipeInputList(machine);
|
|
|
|
List<ItemStack[]> inputs = RecipeType.getRecipeInputList(machine);
|
|
|
|
|
|
|
|
|
|
|
@ -1164,7 +1193,8 @@ public class SlimefunSetup {
|
|
|
|
for (int j = 0; j < inv.getContents().length; j++) {
|
|
|
|
for (int j = 0; j < inv.getContents().length; j++) {
|
|
|
|
inv2.setItem(j, inv.getContents()[j] != null ? (inv.getContents()[j].getAmount() > 1 ? new CustomItem(inv.getContents()[j], inv.getContents()[j].getAmount() - 1): null): null);
|
|
|
|
inv2.setItem(j, inv.getContents()[j] != null ? (inv.getContents()[j].getAmount() > 1 ? new CustomItem(inv.getContents()[j], inv.getContents()[j].getAmount() - 1): null): null);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (InvUtils.fits(inv2, adding)) {
|
|
|
|
Inventory outputInv = SlimefunMachine.findValidOutputInv(adding, dispBlock, inv, inv2);
|
|
|
|
|
|
|
|
if (outputInv != null) {
|
|
|
|
SlimefunItem sfItem = SlimefunItem.getByItem(adding);
|
|
|
|
SlimefunItem sfItem = SlimefunItem.getByItem(adding);
|
|
|
|
|
|
|
|
|
|
|
|
if (sfItem instanceof SlimefunBackpack) {
|
|
|
|
if (sfItem instanceof SlimefunBackpack) {
|
|
|
@ -1238,7 +1268,7 @@ public class SlimefunSetup {
|
|
|
|
p.getWorld().playSound(b.getLocation(), Sound.BLOCK_WOODEN_BUTTON_CLICK_ON, 1F, 1F);
|
|
|
|
p.getWorld().playSound(b.getLocation(), Sound.BLOCK_WOODEN_BUTTON_CLICK_ON, 1F, 1F);
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
p.getWorld().playSound(p.getLocation(), Sound.ENTITY_ARROW_HIT_PLAYER, 1F, 1F);
|
|
|
|
p.getWorld().playSound(p.getLocation(), Sound.ENTITY_ARROW_HIT_PLAYER, 1F, 1F);
|
|
|
|
inv.addItem(adding);
|
|
|
|
outputInv.addItem(adding);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}, j*20L);
|
|
|
|
}, j*20L);
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -1352,7 +1382,8 @@ public class SlimefunSetup {
|
|
|
|
if (mb.isMultiBlock(machine)) {
|
|
|
|
if (mb.isMultiBlock(machine)) {
|
|
|
|
if (CSCoreLib.getLib().getProtectionManager().canAccessChest(p.getUniqueId(), b, true)) {
|
|
|
|
if (CSCoreLib.getLib().getProtectionManager().canAccessChest(p.getUniqueId(), b, true)) {
|
|
|
|
if (Slimefun.hasUnlocked(p, machine.getItem(), true)) {
|
|
|
|
if (Slimefun.hasUnlocked(p, machine.getItem(), true)) {
|
|
|
|
Dispenser disp = (Dispenser) b.getRelative(BlockFace.UP).getState();
|
|
|
|
Block dispBlock = b.getRelative(BlockFace.UP);
|
|
|
|
|
|
|
|
Dispenser disp = (Dispenser) dispBlock.getState();
|
|
|
|
Inventory inv = disp.getInventory();
|
|
|
|
Inventory inv = disp.getInventory();
|
|
|
|
for (ItemStack current: inv.getContents()) {
|
|
|
|
for (ItemStack current: inv.getContents()) {
|
|
|
|
if (current != null) {
|
|
|
|
if (current != null) {
|
|
|
@ -1367,25 +1398,37 @@ public class SlimefunSetup {
|
|
|
|
else if (SlimefunStartup.chance(100, 25)) adding = SlimefunItems.LEAD_DUST;
|
|
|
|
else if (SlimefunStartup.chance(100, 25)) adding = SlimefunItems.LEAD_DUST;
|
|
|
|
else if (SlimefunStartup.chance(100, 25)) adding = SlimefunItems.SILVER_DUST;
|
|
|
|
else if (SlimefunStartup.chance(100, 25)) adding = SlimefunItems.SILVER_DUST;
|
|
|
|
|
|
|
|
|
|
|
|
if (inv.firstEmpty() != -1 || (legacy_ore_washer && InvUtils.fits(inv, adding))) {
|
|
|
|
Inventory outputInv = null;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!legacy_ore_washer) {
|
|
|
|
|
|
|
|
// This is a fancy way of checking if there is empty space in the inv; by checking if an unobtainable item could fit in it.
|
|
|
|
|
|
|
|
// However, due to the way the method findValidOutputInv() functions, the dummyAdding will never actually be added to the real inventory,
|
|
|
|
|
|
|
|
// so it really doesn't matter what item the ItemStack is made by. SlimefunItems.DEBUG_FISH however, signals that it's
|
|
|
|
|
|
|
|
// not supposed to be given to the player.
|
|
|
|
|
|
|
|
ItemStack dummyAdding = SlimefunItems.DEBUG_FISH;
|
|
|
|
|
|
|
|
outputInv = SlimefunMachine.findValidOutputInv(dummyAdding, dispBlock, inv);
|
|
|
|
|
|
|
|
} else outputInv = SlimefunMachine.findValidOutputInv(adding, dispBlock, inv);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (outputInv != null) {
|
|
|
|
ItemStack removing = current.clone();
|
|
|
|
ItemStack removing = current.clone();
|
|
|
|
removing.setAmount(1);
|
|
|
|
removing.setAmount(1);
|
|
|
|
inv.removeItem(removing);
|
|
|
|
inv.removeItem(removing);
|
|
|
|
inv.addItem(adding);
|
|
|
|
outputInv.addItem(adding);
|
|
|
|
p.getWorld().playSound(b.getLocation(), Sound.ENTITY_PLAYER_SPLASH, 1, 1);
|
|
|
|
p.getWorld().playSound(b.getLocation(), Sound.ENTITY_PLAYER_SPLASH, 1, 1);
|
|
|
|
p.getWorld().playEffect(b.getLocation(), Effect.STEP_SOUND, Material.WATER);
|
|
|
|
p.getWorld().playEffect(b.getLocation(), Effect.STEP_SOUND, Material.WATER);
|
|
|
|
if (InvUtils.fits(inv, SlimefunItems.STONE_CHUNK)) inv.addItem(SlimefunItems.STONE_CHUNK);
|
|
|
|
if (InvUtils.fits(outputInv, SlimefunItems.STONE_CHUNK)) outputInv.addItem(SlimefunItems.STONE_CHUNK);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else Messages.local.sendTranslation(p, "machines.full-inventory", true);
|
|
|
|
else Messages.local.sendTranslation(p, "machines.full-inventory", true);
|
|
|
|
return true;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (SlimefunManager.isItemSimiliar(current, new ItemStack(Material.SAND, 4), false)) {
|
|
|
|
else if (SlimefunManager.isItemSimiliar(current, new ItemStack(Material.SAND, 4), false)) {
|
|
|
|
ItemStack adding = SlimefunItems.SALT;
|
|
|
|
ItemStack adding = SlimefunItems.SALT;
|
|
|
|
if (InvUtils.fits(inv, adding)) {
|
|
|
|
Inventory outputInv = SlimefunMachine.findValidOutputInv(adding, dispBlock, inv);
|
|
|
|
|
|
|
|
if (outputInv != null) {
|
|
|
|
ItemStack removing = current.clone();
|
|
|
|
ItemStack removing = current.clone();
|
|
|
|
removing.setAmount(4);
|
|
|
|
removing.setAmount(4);
|
|
|
|
inv.removeItem(removing);
|
|
|
|
inv.removeItem(removing);
|
|
|
|
inv.addItem(adding);
|
|
|
|
outputInv.addItem(adding);
|
|
|
|
p.getWorld().playEffect(b.getLocation(), Effect.STEP_SOUND, Material.WATER);
|
|
|
|
p.getWorld().playEffect(b.getLocation(), Effect.STEP_SOUND, Material.WATER);
|
|
|
|
p.getWorld().playSound(b.getLocation(), Sound.ENTITY_PLAYER_SPLASH, 1, 1);
|
|
|
|
p.getWorld().playSound(b.getLocation(), Sound.ENTITY_PLAYER_SPLASH, 1, 1);
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -1394,11 +1437,12 @@ public class SlimefunSetup {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (SlimefunManager.isItemSimiliar(current, SlimefunItems.PULVERIZED_ORE, true)) {
|
|
|
|
else if (SlimefunManager.isItemSimiliar(current, SlimefunItems.PULVERIZED_ORE, true)) {
|
|
|
|
ItemStack adding = SlimefunItems.PURE_ORE_CLUSTER;
|
|
|
|
ItemStack adding = SlimefunItems.PURE_ORE_CLUSTER;
|
|
|
|
if (InvUtils.fits(inv, adding)) {
|
|
|
|
Inventory outputInv = SlimefunMachine.findValidOutputInv(adding, dispBlock, inv);
|
|
|
|
|
|
|
|
if (outputInv != null) {
|
|
|
|
ItemStack removing = current.clone();
|
|
|
|
ItemStack removing = current.clone();
|
|
|
|
removing.setAmount(1);
|
|
|
|
removing.setAmount(1);
|
|
|
|
inv.removeItem(removing);
|
|
|
|
inv.removeItem(removing);
|
|
|
|
inv.addItem(adding);
|
|
|
|
outputInv.addItem(adding);
|
|
|
|
p.getWorld().playEffect(b.getLocation(), Effect.STEP_SOUND, Material.WATER);
|
|
|
|
p.getWorld().playEffect(b.getLocation(), Effect.STEP_SOUND, Material.WATER);
|
|
|
|
p.getWorld().playSound(b.getLocation(), Sound.ENTITY_PLAYER_SPLASH, 1, 1);
|
|
|
|
p.getWorld().playSound(b.getLocation(), Sound.ENTITY_PLAYER_SPLASH, 1, 1);
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -2535,17 +2579,19 @@ public class SlimefunSetup {
|
|
|
|
if (mb.isMultiBlock(machine)) {
|
|
|
|
if (mb.isMultiBlock(machine)) {
|
|
|
|
if (CSCoreLib.getLib().getProtectionManager().canAccessChest(p.getUniqueId(), b, true)) {
|
|
|
|
if (CSCoreLib.getLib().getProtectionManager().canAccessChest(p.getUniqueId(), b, true)) {
|
|
|
|
if (Slimefun.hasUnlocked(p, SlimefunItems.JUICER, true)) {
|
|
|
|
if (Slimefun.hasUnlocked(p, SlimefunItems.JUICER, true)) {
|
|
|
|
Dispenser disp = (Dispenser) b.getRelative(BlockFace.DOWN).getState();
|
|
|
|
Block dispBlock = b.getRelative(BlockFace.DOWN);
|
|
|
|
|
|
|
|
Dispenser disp = (Dispenser) dispBlock.getState();
|
|
|
|
Inventory inv = disp.getInventory();
|
|
|
|
Inventory inv = disp.getInventory();
|
|
|
|
for (ItemStack current: inv.getContents()) {
|
|
|
|
for (ItemStack current: inv.getContents()) {
|
|
|
|
for (ItemStack convert: RecipeType.getRecipeInputs(machine)) {
|
|
|
|
for (ItemStack convert: RecipeType.getRecipeInputs(machine)) {
|
|
|
|
if (convert != null && SlimefunManager.isItemSimiliar(current, convert, true)) {
|
|
|
|
if (convert != null && SlimefunManager.isItemSimiliar(current, convert, true)) {
|
|
|
|
ItemStack adding = RecipeType.getRecipeOutput(machine, convert);
|
|
|
|
ItemStack adding = RecipeType.getRecipeOutput(machine, convert);
|
|
|
|
if (InvUtils.fits(inv, adding)) {
|
|
|
|
Inventory outputInv = SlimefunMachine.findValidOutputInv(adding, dispBlock, inv);
|
|
|
|
|
|
|
|
if (outputInv != null) {
|
|
|
|
ItemStack removing = current.clone();
|
|
|
|
ItemStack removing = current.clone();
|
|
|
|
removing.setAmount(1);
|
|
|
|
removing.setAmount(1);
|
|
|
|
inv.removeItem(removing);
|
|
|
|
inv.removeItem(removing);
|
|
|
|
inv.addItem(adding);
|
|
|
|
outputInv.addItem(adding);
|
|
|
|
p.getWorld().playSound(b.getLocation(), Sound.ENTITY_PLAYER_SPLASH, 1F, 1F);
|
|
|
|
p.getWorld().playSound(b.getLocation(), Sound.ENTITY_PLAYER_SPLASH, 1F, 1F);
|
|
|
|
p.getWorld().playEffect(b.getLocation(), Effect.STEP_SOUND, Material.HAY_BLOCK);
|
|
|
|
p.getWorld().playEffect(b.getLocation(), Effect.STEP_SOUND, Material.HAY_BLOCK);
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -2679,13 +2725,18 @@ public class SlimefunSetup {
|
|
|
|
.register(true);
|
|
|
|
.register(true);
|
|
|
|
|
|
|
|
|
|
|
|
new SlimefunItem(Categories.TECH_MISC, SlimefunItems.ELECTRIC_MOTOR, "ELECTRIC_MOTOR", RecipeType.ENHANCED_CRAFTING_TABLE,
|
|
|
|
new SlimefunItem(Categories.TECH_MISC, SlimefunItems.ELECTRIC_MOTOR, "ELECTRIC_MOTOR", RecipeType.ENHANCED_CRAFTING_TABLE,
|
|
|
|
new ItemStack[] {SlimefunItems.COPPER_INGOT, SlimefunItems.COPPER_INGOT, SlimefunItems.COPPER_INGOT, null, SlimefunItems.ELECTRO_MAGNET, null, SlimefunItems.COPPER_INGOT, SlimefunItems.COPPER_INGOT, SlimefunItems.COPPER_INGOT})
|
|
|
|
new ItemStack[] {SlimefunItems.COPPER_WIRE, SlimefunItems.COPPER_WIRE, SlimefunItems.COPPER_WIRE, null, SlimefunItems.ELECTRO_MAGNET, null, SlimefunItems.COPPER_WIRE, SlimefunItems.COPPER_WIRE, SlimefunItems.COPPER_WIRE})
|
|
|
|
.register(true);
|
|
|
|
.register(true);
|
|
|
|
|
|
|
|
|
|
|
|
new SlimefunItem(Categories.TECH_MISC, SlimefunItems.HEATING_COIL, "HEATING_COIL", RecipeType.ENHANCED_CRAFTING_TABLE,
|
|
|
|
new SlimefunItem(Categories.TECH_MISC, SlimefunItems.HEATING_COIL, "HEATING_COIL", RecipeType.ENHANCED_CRAFTING_TABLE,
|
|
|
|
new ItemStack[] {SlimefunItems.COPPER_INGOT, SlimefunItems.COPPER_INGOT, SlimefunItems.COPPER_INGOT, SlimefunItems.COPPER_INGOT, SlimefunItems.ELECTRIC_MOTOR, SlimefunItems.COPPER_INGOT, SlimefunItems.COPPER_INGOT, SlimefunItems.COPPER_INGOT, SlimefunItems.COPPER_INGOT})
|
|
|
|
new ItemStack[] {SlimefunItems.COPPER_WIRE, SlimefunItems.COPPER_WIRE, SlimefunItems.COPPER_WIRE, SlimefunItems.COPPER_WIRE, SlimefunItems.ELECTRIC_MOTOR, SlimefunItems.COPPER_WIRE, SlimefunItems.COPPER_WIRE, SlimefunItems.COPPER_WIRE, SlimefunItems.COPPER_WIRE})
|
|
|
|
.register(true);
|
|
|
|
.register(true);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
new SlimefunItem(Categories.TECH_MISC, SlimefunItems.COPPER_WIRE, "COPPER_WIRE", RecipeType.ENHANCED_CRAFTING_TABLE,
|
|
|
|
|
|
|
|
new ItemStack[] {null, null, null, SlimefunItems.COPPER_INGOT, SlimefunItems.COPPER_INGOT, SlimefunItems.COPPER_INGOT, null, null, null}, new CustomItem(SlimefunItems.COPPER_WIRE, 8))
|
|
|
|
|
|
|
|
.register(true);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@SuppressWarnings("unchecked")
|
|
|
|
@SuppressWarnings("unchecked")
|
|
|
|
final String[] blockPlacerBlacklist = Slimefun.getItemValue("BLOCK_PLACER", "unplaceable-blocks") != null ? ((List<String>) Slimefun.getItemValue("BLOCK_PLACER", "unplaceable-blocks")).toArray(new String[((List<String>) Slimefun.getItemValue("BLOCK_PLACER", "unplaceable-blocks")).size()]) : new String[] {"STRUCTURE_BLOCK"};
|
|
|
|
final String[] blockPlacerBlacklist = Slimefun.getItemValue("BLOCK_PLACER", "unplaceable-blocks") != null ? ((List<String>) Slimefun.getItemValue("BLOCK_PLACER", "unplaceable-blocks")).toArray(new String[((List<String>) Slimefun.getItemValue("BLOCK_PLACER", "unplaceable-blocks")).size()]) : new String[] {"STRUCTURE_BLOCK"};
|
|
|
|
|
|
|
|
|
|
|
@ -3611,30 +3662,30 @@ public class SlimefunSetup {
|
|
|
|
registerFuel(new MachineFuel(3, new ItemStack(Material.POTATO)));
|
|
|
|
registerFuel(new MachineFuel(3, new ItemStack(Material.POTATO)));
|
|
|
|
registerFuel(new MachineFuel(3, new ItemStack(Material.SUGAR_CANE)));
|
|
|
|
registerFuel(new MachineFuel(3, new ItemStack(Material.SUGAR_CANE)));
|
|
|
|
registerFuel(new MachineFuel(3, new ItemStack(Material.NETHER_WART)));
|
|
|
|
registerFuel(new MachineFuel(3, new ItemStack(Material.NETHER_WART)));
|
|
|
|
registerFuel(new MachineFuel(2, new ItemStack(Material.DANDELION)));
|
|
|
|
|
|
|
|
registerFuel(new MachineFuel(2, new ItemStack(Material.POPPY)));
|
|
|
|
|
|
|
|
registerFuel(new MachineFuel(2, new ItemStack(Material.RED_MUSHROOM)));
|
|
|
|
registerFuel(new MachineFuel(2, new ItemStack(Material.RED_MUSHROOM)));
|
|
|
|
registerFuel(new MachineFuel(2, new ItemStack(Material.BROWN_MUSHROOM)));
|
|
|
|
registerFuel(new MachineFuel(2, new ItemStack(Material.BROWN_MUSHROOM)));
|
|
|
|
registerFuel(new MachineFuel(2, new ItemStack(Material.VINE)));
|
|
|
|
registerFuel(new MachineFuel(2, new ItemStack(Material.VINE)));
|
|
|
|
registerFuel(new MachineFuel(2, new ItemStack(Material.CACTUS)));
|
|
|
|
registerFuel(new MachineFuel(2, new ItemStack(Material.CACTUS)));
|
|
|
|
registerFuel(new MachineFuel(2, new ItemStack(Material.LILY_PAD)));
|
|
|
|
registerFuel(new MachineFuel(2, new ItemStack(Material.LILY_PAD)));
|
|
|
|
registerFuel(new MachineFuel(8, new ItemStack(Material.CHORUS_FRUIT)));
|
|
|
|
registerFuel(new MachineFuel(8, new ItemStack(Material.CHORUS_FRUIT)));
|
|
|
|
|
|
|
|
registerFuel(new MachineFuel(1, new ItemStack(Material.BAMBOO)));
|
|
|
|
|
|
|
|
registerFuel(new MachineFuel(1, new ItemStack(Material.KELP)));
|
|
|
|
|
|
|
|
registerFuel(new MachineFuel(2, new ItemStack(Material.DRIED_KELP)));
|
|
|
|
|
|
|
|
registerFuel(new MachineFuel(20, new ItemStack(Material.DRIED_KELP_BLOCK)));
|
|
|
|
|
|
|
|
registerFuel(new MachineFuel(1, new ItemStack(Material.SEAGRASS)));
|
|
|
|
|
|
|
|
registerFuel(new MachineFuel(2, new ItemStack(Material.SEA_PICKLE)));
|
|
|
|
|
|
|
|
|
|
|
|
// Leaves
|
|
|
|
// Leaves
|
|
|
|
registerFuel(new MachineFuel(1, new ItemStack(Material.OAK_LEAVES)));
|
|
|
|
for(Material m:Tag.LEAVES.getValues())
|
|
|
|
registerFuel(new MachineFuel(1, new ItemStack(Material.BIRCH_LEAVES)));
|
|
|
|
registerFuel(new MachineFuel(1, new ItemStack(m)));
|
|
|
|
registerFuel(new MachineFuel(1, new ItemStack(Material.SPRUCE_LEAVES)));
|
|
|
|
|
|
|
|
registerFuel(new MachineFuel(1, new ItemStack(Material.JUNGLE_LEAVES)));
|
|
|
|
|
|
|
|
registerFuel(new MachineFuel(1, new ItemStack(Material.ACACIA_LEAVES)));
|
|
|
|
|
|
|
|
registerFuel(new MachineFuel(1, new ItemStack(Material.DARK_OAK_LEAVES)));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Saplings
|
|
|
|
// Saplings
|
|
|
|
registerFuel(new MachineFuel(1, new ItemStack(Material.OAK_SAPLING)));
|
|
|
|
for (Material m:Tag.SAPLINGS.getValues())
|
|
|
|
registerFuel(new MachineFuel(1, new ItemStack(Material.BIRCH_SAPLING)));
|
|
|
|
registerFuel(new MachineFuel(1, new ItemStack(m)));
|
|
|
|
registerFuel(new MachineFuel(1, new ItemStack(Material.SPRUCE_SAPLING)));
|
|
|
|
|
|
|
|
registerFuel(new MachineFuel(1, new ItemStack(Material.JUNGLE_SAPLING)));
|
|
|
|
// Small Flowers (formally just dandelions and poppies.
|
|
|
|
registerFuel(new MachineFuel(1, new ItemStack(Material.ACACIA_SAPLING)));
|
|
|
|
for(Material m:Tag.SMALL_FLOWERS.getValues())
|
|
|
|
registerFuel(new MachineFuel(1, new ItemStack(Material.DARK_OAK_SAPLING)));
|
|
|
|
registerFuel(new MachineFuel(1, new ItemStack(m)));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|