mirror of
https://github.com/StarWishsama/Slimefun4.git
synced 2024-09-20 11:45:51 +00:00
Add files via upload
This commit is contained in:
parent
b855766239
commit
ff9d0a08cf
@ -361,6 +361,7 @@ public class SlimefunItems {
|
|||||||
public static ItemStack GRIND_STONE = new CustomItem(Material.DISPENSER, "&bGrind Stone", 0, new String[] {"", "&a&oGrinds Items for more Efficiency"});
|
public static ItemStack GRIND_STONE = new CustomItem(Material.DISPENSER, "&bGrind Stone", 0, new String[] {"", "&a&oGrinds Items for more Efficiency"});
|
||||||
public static ItemStack ARMOR_FORGE = new CustomItem(Material.ANVIL, "&6Armor Forge", 0, new String[] {"", "&a&oGives you the Ability to create powerful Armor"});
|
public static ItemStack ARMOR_FORGE = new CustomItem(Material.ANVIL, "&6Armor Forge", 0, new String[] {"", "&a&oGives you the Ability to create powerful Armor"});
|
||||||
public static ItemStack SMELTERY = new CustomItem(Material.FURNACE, "&6Smeltery", 0, new String[] {"", "&a&oActs as a high-temperature Furnace for Metals"});
|
public static ItemStack SMELTERY = new CustomItem(Material.FURNACE, "&6Smeltery", 0, new String[] {"", "&a&oActs as a high-temperature Furnace for Metals"});
|
||||||
|
public static ItemStack IGNITION_CHAMBER = new CustomItem(new ItemStack(Material.HOPPER), "&4Automatic Ignition Chamber", "&rAre you constantly enraged by the fading fire under the Smelter too?", "&rWe found the solution!", "&rJust easily place this Chamber near the dispencer", "&rof your Smelter, and block under it will be ignited automatically!", "&e&oRequires Flint'n Steels to run");
|
||||||
public static ItemStack ORE_CRUSHER = new CustomItem(Material.DISPENSER, "&bOre Crusher", 0, new String[] {"", "&a&oCrushes Ores to double them"});
|
public static ItemStack ORE_CRUSHER = new CustomItem(Material.DISPENSER, "&bOre Crusher", 0, new String[] {"", "&a&oCrushes Ores to double them"});
|
||||||
public static ItemStack COMPRESSOR = new CustomItem(Material.PISTON_BASE, "&bCompressor", 0, new String[] {"", "&a&oCompresses Items"});
|
public static ItemStack COMPRESSOR = new CustomItem(Material.PISTON_BASE, "&bCompressor", 0, new String[] {"", "&a&oCompresses Items"});
|
||||||
public static ItemStack PRESSURE_CHAMBER = new CustomItem(Material.GLASS, "&bPressure Chamber", 0, new String[] {"", "&a&oCompresses Items even more"});
|
public static ItemStack PRESSURE_CHAMBER = new CustomItem(Material.GLASS, "&bPressure Chamber", 0, new String[] {"", "&a&oCompresses Items even more"});
|
||||||
|
@ -70,6 +70,7 @@ public class Messages {
|
|||||||
local.setDefault("commands.research.reset", "&cYou have reset %player%'s Knowledge");
|
local.setDefault("commands.research.reset", "&cYou have reset %player%'s Knowledge");
|
||||||
local.setDefault("commands.research.reset-target", "&cYour Knowledge has been reset");
|
local.setDefault("commands.research.reset-target", "&cYour Knowledge has been reset");
|
||||||
local.setDefault("machines.in-use", "&cThis Block's Inventory is currently opened by a different Player.");
|
local.setDefault("machines.in-use", "&cThis Block's Inventory is currently opened by a different Player.");
|
||||||
|
local.setDefault("machines.ignition-chamber-no-flint", "&cAutomatic Ignition Chamber failed to ignite block because of no Flint'n steel found");
|
||||||
|
|
||||||
local.setDefault("gps.waypoint.new", "&ePlease type in a Name for your new Waypoint in the Chat. &7(Color Codes supported!)");
|
local.setDefault("gps.waypoint.new", "&ePlease type in a Name for your new Waypoint in the Chat. &7(Color Codes supported!)");
|
||||||
local.setDefault("gps.waypoint.added", "&aSuccessfully added a new Waypoint");
|
local.setDefault("gps.waypoint.added", "&aSuccessfully added a new Waypoint");
|
||||||
|
@ -18,6 +18,7 @@ import org.bukkit.block.BlockFace;
|
|||||||
import org.bukkit.block.Chest;
|
import org.bukkit.block.Chest;
|
||||||
import org.bukkit.block.CreatureSpawner;
|
import org.bukkit.block.CreatureSpawner;
|
||||||
import org.bukkit.block.Dispenser;
|
import org.bukkit.block.Dispenser;
|
||||||
|
import org.bukkit.block.Hopper;
|
||||||
import org.bukkit.enchantments.Enchantment;
|
import org.bukkit.enchantments.Enchantment;
|
||||||
import org.bukkit.entity.ArmorStand;
|
import org.bukkit.entity.ArmorStand;
|
||||||
import org.bukkit.entity.Arrow;
|
import org.bukkit.entity.Arrow;
|
||||||
@ -704,62 +705,100 @@ public class SlimefunSetup {
|
|||||||
.register(true);
|
.register(true);
|
||||||
|
|
||||||
new SlimefunMachine(Categories.MACHINES_1, SlimefunItems.SMELTERY, "SMELTERY",
|
new SlimefunMachine(Categories.MACHINES_1, SlimefunItems.SMELTERY, "SMELTERY",
|
||||||
new ItemStack[] {null, new ItemStack(Material.NETHER_FENCE), null, new ItemStack(Material.NETHER_BRICK), new CustomItem(Material.DISPENSER, "Dispenser (Facing up)", 0), new ItemStack(Material.NETHER_BRICK), null, new ItemStack(Material.FLINT_AND_STEEL), null},
|
new ItemStack[] {null, new ItemStack(Material.NETHER_FENCE), null, new ItemStack(Material.NETHER_BRICK), new CustomItem(Material.DISPENSER, "Ðàçäàò÷èê (Íàïðàâëåí ââåðõ)", 0), new ItemStack(Material.NETHER_BRICK), null, new ItemStack(Material.FLINT_AND_STEEL), null},
|
||||||
new ItemStack[] {SlimefunItems.IRON_DUST, new ItemStack(Material.IRON_INGOT)}, Material.NETHER_FENCE,
|
new ItemStack[] {SlimefunItems.IRON_DUST, new ItemStack(Material.IRON_INGOT)}, Material.NETHER_FENCE,
|
||||||
new String[] {"chance.fireBreak"}, new Integer[] {34})
|
new String[] {"chance.fireBreak"}, new Integer[] {34})
|
||||||
.register(true, new MultiBlockInteractionHandler() {
|
.register(true, new MultiBlockInteractionHandler() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onInteract(Player p, MultiBlock mb, Block b) {
|
public boolean onInteract(Player p, MultiBlock mb, Block b) {
|
||||||
|
|
||||||
SlimefunMachine machine = (SlimefunMachine) SlimefunItem.getByName("SMELTERY");
|
SlimefunMachine machine = (SlimefunMachine) SlimefunItem.getByName("SMELTERY");
|
||||||
|
|
||||||
if (mb.isMultiBlock(machine)) {
|
if (mb.isMultiBlock(machine)) {
|
||||||
if (Slimefun.hasUnlocked(p, machine.getItem(), true)) {
|
if (Slimefun.hasUnlocked(p, machine.getItem(), true)) {
|
||||||
Dispenser disp = (Dispenser) b.getRelative(BlockFace.DOWN).getState();
|
Dispenser disp = (Dispenser) b.getRelative(BlockFace.DOWN).getState();
|
||||||
Inventory inv = disp.getInventory();
|
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++) {
|
||||||
boolean craft = true;
|
boolean craft = true;
|
||||||
for (ItemStack converting: inputs.get(i)) {
|
for (ItemStack converting: inputs.get(i)) {
|
||||||
if (converting != null) {
|
if (converting != null) {
|
||||||
for (int j = 0; j < inv.getContents().length; j++) {
|
for (int j = 0; j < inv.getContents().length; j++) {
|
||||||
if (j == (inv.getContents().length - 1) && !SlimefunManager.isItemSimiliar(converting, inv.getContents()[j], true, SlimefunManager.DataType.ALWAYS)) {
|
if (j == (inv.getContents().length - 1) && !SlimefunManager.isItemSimiliar(converting, inv.getContents()[j], true, SlimefunManager.DataType.ALWAYS)) {
|
||||||
craft = false;
|
craft = false;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
else if (SlimefunManager.isItemSimiliar(inv.getContents()[j], converting, true, SlimefunManager.DataType.ALWAYS)) break;
|
else if (SlimefunManager.isItemSimiliar(inv.getContents()[j], converting, true, SlimefunManager.DataType.ALWAYS)) break;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (craft) {
|
|
||||||
ItemStack adding = RecipeType.getRecipeOutputList(machine, inputs.get(i));
|
|
||||||
if (Slimefun.hasUnlocked(p, adding, true)) {
|
|
||||||
if (InvUtils.fits(inv, adding)) {
|
|
||||||
for (ItemStack removing: inputs.get(i)) {
|
|
||||||
if (removing != null) inv.removeItem(removing);
|
|
||||||
}
|
|
||||||
inv.addItem(adding);
|
|
||||||
p.getWorld().playSound(p.getLocation(), Sound.BLOCK_LAVA_POP, 1, 1);
|
|
||||||
p.getWorld().playEffect(b.getLocation(), Effect.MOBSPAWNER_FLAMES, 1);;
|
|
||||||
if (SlimefunStartup.chance(100, (Integer) Slimefun.getItemValue("SMELTERY", "chance.fireBreak"))) {
|
|
||||||
BlockBreaker.nullify(b.getRelative(BlockFace.DOWN).getRelative(BlockFace.DOWN));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else Messages.local.sendTranslation(p, "machines.full-inventory", true);
|
|
||||||
|
if (craft) {
|
||||||
|
ItemStack adding = RecipeType.getRecipeOutputList(machine, inputs.get(i));
|
||||||
|
if (Slimefun.hasUnlocked(p, adding, true)) {
|
||||||
|
if (InvUtils.fits(inv, adding)) {
|
||||||
|
for (ItemStack removing: inputs.get(i)) {
|
||||||
|
if (removing != null) inv.removeItem(removing);
|
||||||
|
}
|
||||||
|
inv.addItem(adding);
|
||||||
|
p.getWorld().playSound(p.getLocation(), Sound.BLOCK_LAVA_POP, 1, 1);
|
||||||
|
p.getWorld().playEffect(b.getLocation(), Effect.MOBSPAWNER_FLAMES, 1);
|
||||||
|
Block raw_disp = b.getRelative(BlockFace.DOWN);
|
||||||
|
Hopper resf = null;
|
||||||
|
|
||||||
|
if(raw_disp.getRelative(BlockFace.EAST).getState().getBlock().getType().name() == "HOPPER") {
|
||||||
|
resf = (Hopper) raw_disp.getRelative(BlockFace.EAST).getState();
|
||||||
|
} else if (raw_disp.getRelative(BlockFace.WEST).getState().getBlock().getType().name() == "HOPPER") {
|
||||||
|
resf = (Hopper) raw_disp.getRelative(BlockFace.WEST).getState();
|
||||||
|
} else if (raw_disp.getRelative(BlockFace.NORTH).getState().getBlock().getType().name() == "HOPPER") {
|
||||||
|
resf = (Hopper) raw_disp.getRelative(BlockFace.NORTH).getState();
|
||||||
|
} else if (raw_disp.getRelative(BlockFace.SOUTH).getState().getBlock().getType().name() == "HOPPER"){
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (SlimefunStartup.chance(100, (Integer) Slimefun.getItemValue("SMELTERY", "chance.fireBreak"))) {
|
||||||
|
if(isIgniteChamberInstalled) {
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
p.getWorld().playSound(p.getLocation(), Sound.ITEM_FLINTANDSTEEL_USE, 1, 1);
|
||||||
|
} else {
|
||||||
|
Messages.local.sendTranslation(p, "machines.ignition-chamber-no-flint", true);
|
||||||
|
BlockBreaker.nullify(b.getRelative(BlockFace.DOWN).getRelative(BlockFace.DOWN));
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
BlockBreaker.nullify(b.getRelative(BlockFace.DOWN).getRelative(BlockFace.DOWN));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else Messages.local.sendTranslation(p, "machines.full-inventory", true);
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return true;
|
Messages.local.sendTranslation(p, "machines.pattern-not-found", true);
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
Messages.local.sendTranslation(p, "machines.pattern-not-found", true);
|
else return false;
|
||||||
}
|
}
|
||||||
return true;
|
});
|
||||||
}
|
|
||||||
else return false;
|
|
||||||
}
|
new SlimefunItem(Categories.MACHINES_1, SlimefunItems.IGNITION_CHAMBER, "IGNITION_CHAMBER", RecipeType.ENHANCED_CRAFTING_TABLE,
|
||||||
});
|
new ItemStack[] {SlimefunItems.STEEL_PLATE, SlimefunItems.BASIC_CIRCUIT_BOARD, SlimefunItems.STEEL_PLATE, SlimefunItems.ELECTRIC_MOTOR, SlimefunItems.STEEL_PLATE, SlimefunItems.ELECTRIC_MOTOR, null, new ItemStack(Material.HOPPER), null})
|
||||||
|
.register(true);
|
||||||
|
|
||||||
new SlimefunMachine(Categories.MACHINES_1, SlimefunItems.PRESSURE_CHAMBER, "PRESSURE_CHAMBER",
|
new SlimefunMachine(Categories.MACHINES_1, SlimefunItems.PRESSURE_CHAMBER, "PRESSURE_CHAMBER",
|
||||||
new ItemStack[] {new ItemStack(Material.STEP), new CustomItem(Material.DISPENSER, "Dispenser (Facing down)", 0), new ItemStack(Material.STEP), new ItemStack(Material.PISTON_BASE), new ItemStack(Material.GLASS), new ItemStack(Material.PISTON_BASE), new ItemStack(Material.PISTON_BASE), new ItemStack(Material.CAULDRON_ITEM), new ItemStack(Material.PISTON_BASE)},
|
new ItemStack[] {new ItemStack(Material.STEP), new CustomItem(Material.DISPENSER, "Dispenser (Facing down)", 0), new ItemStack(Material.STEP), new ItemStack(Material.PISTON_BASE), new ItemStack(Material.GLASS), new ItemStack(Material.PISTON_BASE), new ItemStack(Material.PISTON_BASE), new ItemStack(Material.CAULDRON_ITEM), new ItemStack(Material.PISTON_BASE)},
|
||||||
|
@ -18,6 +18,7 @@ import org.bukkit.event.block.Action;
|
|||||||
import org.bukkit.event.entity.EntityChangeBlockEvent;
|
import org.bukkit.event.entity.EntityChangeBlockEvent;
|
||||||
import org.bukkit.event.inventory.CraftItemEvent;
|
import org.bukkit.event.inventory.CraftItemEvent;
|
||||||
import org.bukkit.event.inventory.InventoryClickEvent;
|
import org.bukkit.event.inventory.InventoryClickEvent;
|
||||||
|
import org.bukkit.event.inventory.InventoryMoveItemEvent;
|
||||||
import org.bukkit.event.inventory.InventoryType;
|
import org.bukkit.event.inventory.InventoryType;
|
||||||
import org.bukkit.event.player.PlayerInteractEvent;
|
import org.bukkit.event.player.PlayerInteractEvent;
|
||||||
import org.bukkit.event.player.PlayerItemConsumeEvent;
|
import org.bukkit.event.player.PlayerItemConsumeEvent;
|
||||||
@ -58,6 +59,13 @@ public class ItemListener implements Listener {
|
|||||||
plugin.getServer().getPluginManager().registerEvents(this, plugin);
|
plugin.getServer().getPluginManager().registerEvents(this, plugin);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public void onIgnitionChamberItemMove(InventoryMoveItemEvent e) {
|
||||||
|
if(e.getInitiator().getName().equalsIgnoreCase(SlimefunItems.IGNITION_CHAMBER.getItemMeta().getDisplayName()) && e.getInitiator().getType() == InventoryType.HOPPER) {
|
||||||
|
e.setCancelled(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@SuppressWarnings("deprecation")
|
@SuppressWarnings("deprecation")
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void debug(PlayerInteractEvent e) {
|
public void debug(PlayerInteractEvent e) {
|
||||||
|
Loading…
Reference in New Issue
Block a user