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

Using 1.13 Materials for Machines

This commit is contained in:
MisterErwin 2018-09-04 18:53:28 +02:00 committed by TheBusyBiscuit
parent d46aaad34c
commit 9ab28ad47c
11 changed files with 37 additions and 35 deletions

View File

@ -1,5 +1,6 @@
package me.mrCookieSlime.Slimefun.Objects.SlimefunItem.machines;
import me.mrCookieSlime.CSCoreLibPlugin.compatibility.MaterialHook;
import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.entity.Player;
@ -43,7 +44,7 @@ public class AdvancedCargoOutputNode extends SlimefunItem {
public void newInstance(final BlockMenu menu, final Block b) {
try {
if (!BlockStorage.hasBlockInfo(b) || BlockStorage.getLocationInfo(b.getLocation(), "filter-type") == null || BlockStorage.getLocationInfo(b.getLocation(), "filter-type").equals("whitelist")) {
menu.replaceExistingItem(15, new CustomItem(new MaterialData(Material.WOOL), "&7Type: &rWhitelist", "", "&e> Click to change it to Blacklist"));
menu.replaceExistingItem(15, new CustomItem(new MaterialData(Material.WHITE_WOOL), "&7Type: &rWhitelist", "", "&e> Click to change it to Blacklist"));
menu.addMenuClickHandler(15, new MenuClickHandler() {
@Override
@ -55,7 +56,7 @@ public class AdvancedCargoOutputNode extends SlimefunItem {
});
}
else {
menu.replaceExistingItem(15, new CustomItem(new MaterialData(Material.WOOL, (byte) 15), "&7Type: &8Blacklist", "", "&e> Click to change it to Whitelist"));
menu.replaceExistingItem(15, new CustomItem(new MaterialData(Material.BLACK_WOOL), "&7Type: &8Blacklist", "", "&e> Click to change it to Whitelist"));
menu.addMenuClickHandler(15, new MenuClickHandler() {
@Override
@ -80,7 +81,7 @@ public class AdvancedCargoOutputNode extends SlimefunItem {
});
}
else {
menu.replaceExistingItem(16, new CustomItem(new MaterialData(Material.GOLD_SWORD, (byte) 20), "&7Include Sub-IDs/Durability: &2\u2714", "", "&e> Click to toggle whether the Durability has to match"));
menu.replaceExistingItem(16, new CustomItem(new MaterialData(Material.GOLDEN_SWORD, (byte) 20), "&7Include Sub-IDs/Durability: &2\u2714", "", "&e> Click to toggle whether the Durability has to match"));
menu.addMenuClickHandler(16, new MenuClickHandler() {
@Override
@ -93,7 +94,7 @@ public class AdvancedCargoOutputNode extends SlimefunItem {
}
if (!BlockStorage.hasBlockInfo(b) || BlockStorage.getLocationInfo(b.getLocation(), "filter-lore") == null || BlockStorage.getLocationInfo(b.getLocation(), "filter-lore").equals("true")) {
menu.replaceExistingItem(25, new CustomItem(new MaterialData(Material.EMPTY_MAP), "&7Include Lore: &2\u2714", "", "&e> Click to toggle whether the Lore has to match"));
menu.replaceExistingItem(25, new CustomItem(new MaterialData(Material.MAP), "&7Include Lore: &2\u2714", "", "&e> Click to toggle whether the Lore has to match"));
menu.addMenuClickHandler(25, new MenuClickHandler() {
@Override
@ -105,7 +106,7 @@ public class AdvancedCargoOutputNode extends SlimefunItem {
});
}
else {
menu.replaceExistingItem(25, new CustomItem(new MaterialData(Material.EMPTY_MAP), "&7Include Lore: &4\u2718", "", "&e> Click to toggle whether the Lore has to match"));
menu.replaceExistingItem(25, new CustomItem(new MaterialData(Material.MAP), "&7Include Lore: &4\u2718", "", "&e> Click to toggle whether the Lore has to match"));
menu.addMenuClickHandler(25, new MenuClickHandler() {
@Override
@ -146,7 +147,7 @@ public class AdvancedCargoOutputNode extends SlimefunItem {
});
}
else {
menu.replaceExistingItem(42, new CustomItem(new MaterialData(Material.WOOL, (byte) channel), "&bChannel ID: &3" + (channel + 1)));
menu.replaceExistingItem(42, new CustomItem(new MaterialData(MaterialHook.WoolColours[channel]), "&bChannel ID: &3" + (channel + 1)));
menu.addMenuClickHandler(42, new MenuClickHandler() {
@Override
@ -227,7 +228,7 @@ public class AdvancedCargoOutputNode extends SlimefunItem {
@SuppressWarnings("deprecation")
protected void constructMenu(BlockMenuPreset preset) {
for (int i: border) {
preset.addItem(i, new CustomItem(new MaterialData(Material.STAINED_GLASS_PANE, (byte) 9), " "),
preset.addItem(i, new CustomItem(new MaterialData(Material.CYAN_STAINED_GLASS_PANE), " "),
new MenuClickHandler() {
@Override

View File

@ -79,7 +79,7 @@ public abstract class AutoAnvil extends AContainer {
else progress.put(b, timeleft - 1);
}
else {
BlockStorage.getInventory(b).replaceExistingItem(22, new CustomItem(new MaterialData(Material.STAINED_GLASS_PANE, (byte) 15), " "));
BlockStorage.getInventory(b).replaceExistingItem(22, new CustomItem(new MaterialData(Material.BLACK_STAINED_GLASS_PANE), " "));
pushItems(b, processing.get(b).getOutput());
progress.remove(b);

View File

@ -80,7 +80,7 @@ public class AutoDisenchanter extends AContainer {
else progress.put(b, timeleft - 1);
}
else {
BlockStorage.getInventory(b).replaceExistingItem(22, new CustomItem(new MaterialData(Material.STAINED_GLASS_PANE, (byte) 15), " "));
BlockStorage.getInventory(b).replaceExistingItem(22, new CustomItem(new MaterialData(Material.BLACK_STAINED_GLASS_PANE), " "));
pushItems(b, processing.get(b).getOutput());
progress.remove(b);

View File

@ -43,7 +43,7 @@ public class AutoEnchanter extends AContainer {
@Override
public ItemStack getProgressBar() {
return new ItemStack(Material.GOLD_CHESTPLATE);
return new ItemStack(Material.GOLDEN_CHESTPLATE);
}
@Override
@ -81,7 +81,7 @@ public class AutoEnchanter extends AContainer {
else progress.put(b, timeleft - 1);
}
else {
BlockStorage.getInventory(b).replaceExistingItem(22, new CustomItem(new MaterialData(Material.STAINED_GLASS_PANE, (byte) 15), " "));
BlockStorage.getInventory(b).replaceExistingItem(22, new CustomItem(new MaterialData(Material.BLACK_STAINED_GLASS_PANE), " "));
pushItems(b, processing.get(b).getOutput());
progress.remove(b);

View File

@ -59,7 +59,7 @@ public abstract class AutomatedCraftingChamber extends SlimefunItem {
@Override
public void newInstance(final BlockMenu menu, final Block b) {
if (!BlockStorage.hasBlockInfo(b) || BlockStorage.getLocationInfo(b.getLocation(), "enabled") == null || BlockStorage.getLocationInfo(b.getLocation(), "enabled").equals("false")) {
menu.replaceExistingItem(6, new CustomItem(new MaterialData(Material.SULPHUR), "&7Enabled: &4\u2718", "", "&e> Click to enable this Machine"));
menu.replaceExistingItem(6, new CustomItem(new MaterialData(Material.GUNPOWDER), "&7Enabled: &4\u2718", "", "&e> Click to enable this Machine"));
menu.addMenuClickHandler(6, new MenuClickHandler() {
@Override
@ -139,7 +139,7 @@ public abstract class AutomatedCraftingChamber extends SlimefunItem {
@SuppressWarnings("deprecation")
protected void constructMenu(BlockMenuPreset preset) {
for (int i: border) {
preset.addItem(i, new CustomItem(new MaterialData(Material.STAINED_GLASS_PANE, (byte) 7), " "),
preset.addItem(i, new CustomItem(new MaterialData(Material.GRAY_STAINED_GLASS_PANE), " "),
new MenuClickHandler() {
@Override
@ -150,7 +150,7 @@ public abstract class AutomatedCraftingChamber extends SlimefunItem {
});
}
for (int i: border_in) {
preset.addItem(i, new CustomItem(new MaterialData(Material.STAINED_GLASS_PANE, (byte) 11), " "),
preset.addItem(i, new CustomItem(new MaterialData(Material.BLUE_STAINED_GLASS_PANE), " "),
new MenuClickHandler() {
@Override
@ -161,7 +161,7 @@ public abstract class AutomatedCraftingChamber extends SlimefunItem {
});
}
for (int i: border_out) {
preset.addItem(i, new CustomItem(new MaterialData(Material.STAINED_GLASS_PANE, (byte) 1), " "),
preset.addItem(i, new CustomItem(new MaterialData(Material.ORANGE_STAINED_GLASS_PANE), " "),
new MenuClickHandler() {
@Override
@ -187,7 +187,7 @@ public abstract class AutomatedCraftingChamber extends SlimefunItem {
});
}
preset.addItem(2, new CustomItem(new MaterialData(Material.WORKBENCH), "&eRecipe", "", "&bPut in the Recipe you want to craft", "&4Enhanced Crafting Table Recipes ONLY"),
preset.addItem(2, new CustomItem(new MaterialData(Material.CRAFTING_TABLE), "&eRecipe", "", "&bPut in the Recipe you want to craft", "&4Enhanced Crafting Table Recipes ONLY"),
new MenuClickHandler() {
@Override
@ -212,7 +212,7 @@ public abstract class AutomatedCraftingChamber extends SlimefunItem {
int size = BlockStorage.getInventory(b).toInventory().getSize();
Inventory inv = Bukkit.createInventory(null, size);
for (int i = 0; i < size; i++) {
inv.setItem(i, new CustomItem(Material.COMMAND, " &4ALL YOUR PLACEHOLDERS ARE BELONG TO US", 0));
inv.setItem(i, new CustomItem(Material.COMMAND_BLOCK, " &4ALL YOUR PLACEHOLDERS ARE BELONG TO US", 0));
}
for (int slot: getOutputSlots()) {
inv.setItem(slot, BlockStorage.getInventory(b).getItemInSlot(slot));

View File

@ -1,5 +1,6 @@
package me.mrCookieSlime.Slimefun.Objects.SlimefunItem.machines;
import me.mrCookieSlime.CSCoreLibPlugin.compatibility.MaterialHook;
import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.entity.Player;
@ -53,7 +54,7 @@ public class CargoCraftingNode extends SlimefunItem {
}
});
menu.replaceExistingItem(42, new CustomItem(new MaterialData(Material.WOOL, (byte) ((!BlockStorage.hasBlockInfo(b) || BlockStorage.getLocationInfo(b.getLocation(), "frequency") == null) ? 0: (Integer.parseInt(BlockStorage.getLocationInfo(b.getLocation(), "frequency"))))), "&bChannel ID: &3" + (((!BlockStorage.hasBlockInfo(b) || BlockStorage.getLocationInfo(b.getLocation(), "frequency") == null) ? 0: (Integer.parseInt(BlockStorage.getLocationInfo(b.getLocation(), "frequency")))) + 1)));
menu.replaceExistingItem(42, new CustomItem(new MaterialData(((!BlockStorage.hasBlockInfo(b) || BlockStorage.getLocationInfo(b.getLocation(), "frequency") == null) ? Material.WHITE_WOOL: MaterialHook.WoolColours[(Integer.parseInt(BlockStorage.getLocationInfo(b.getLocation(), "frequency")))])), "&bChannel ID: &3" + (((!BlockStorage.hasBlockInfo(b) || BlockStorage.getLocationInfo(b.getLocation(), "frequency") == null) ? 0: (Integer.parseInt(BlockStorage.getLocationInfo(b.getLocation(), "frequency")))) + 1)));
menu.addMenuClickHandler(42, new MenuClickHandler() {
@Override
@ -122,7 +123,7 @@ public class CargoCraftingNode extends SlimefunItem {
@SuppressWarnings("deprecation")
protected void constructMenu(BlockMenuPreset preset) {
for (int i: border) {
preset.addItem(i, new CustomItem(new MaterialData(Material.STAINED_GLASS_PANE, (byte) 9), " "),
preset.addItem(i, new CustomItem(new MaterialData(Material.CYAN_STAINED_GLASS_PANE), " "),
new MenuClickHandler() {
@Override
@ -133,7 +134,7 @@ public class CargoCraftingNode extends SlimefunItem {
});
}
preset.addItem(2, new CustomItem(new MaterialData(Material.WORKBENCH), "&eRecipe", "", "&bPut in the Recipe you want to craft"),
preset.addItem(2, new CustomItem(new MaterialData(Material.CRAFTING_TABLE), "&eRecipe", "", "&bPut in the Recipe you want to craft"),
new MenuClickHandler() {
@Override

View File

@ -52,7 +52,7 @@ public class ChargingBench extends AContainer {
@Override
public ItemStack getProgressBar() {
return new ItemStack(Material.GOLD_PICKAXE);
return new ItemStack(Material.GOLDEN_PICKAXE);
}
@Override

View File

@ -35,7 +35,7 @@ public abstract class ElectricDustWasher extends AContainer {
@Override
public ItemStack getProgressBar() {
return new ItemStack(Material.GOLD_SPADE);
return new ItemStack(Material.GOLDEN_SHOVEL);
}
@Override
@ -73,7 +73,7 @@ public abstract class ElectricDustWasher extends AContainer {
if (ChargableBlock.getCharge(b) < getEnergyConsumption()) return;
ChargableBlock.addCharge(b, -getEnergyConsumption());
BlockStorage.getInventory(b).replaceExistingItem(22, new CustomItem(new MaterialData(Material.STAINED_GLASS_PANE, (byte) 15), " "));
BlockStorage.getInventory(b).replaceExistingItem(22, new CustomItem(new MaterialData(Material.BLACK_STAINED_GLASS_PANE), " "));
pushItems(b, processing.get(b).getOutput());
progress.remove(b);

View File

@ -35,7 +35,7 @@ public abstract class ElectricGoldPan extends AContainer {
@Override
public ItemStack getProgressBar() {
return new ItemStack(Material.DIAMOND_SPADE);
return new ItemStack(Material.DIAMOND_SHOVEL);
}
@Override
@ -72,7 +72,7 @@ public abstract class ElectricGoldPan extends AContainer {
if (ChargableBlock.getCharge(b) < getEnergyConsumption()) return;
ChargableBlock.addCharge(b, -getEnergyConsumption());
BlockStorage.getInventory(b).replaceExistingItem(22, new CustomItem(new MaterialData(Material.STAINED_GLASS_PANE, (byte) 15), " "));
BlockStorage.getInventory(b).replaceExistingItem(22, new CustomItem(new MaterialData(Material.BLACK_STAINED_GLASS_PANE), " "));
pushItems(b, processing.get(b).getOutput());
progress.remove(b);

View File

@ -126,7 +126,7 @@ public abstract class ElectricSmeltery extends AContainer {
@SuppressWarnings("deprecation")
protected void constructMenu(BlockMenuPreset preset) {
for (int i: border) {
preset.addItem(i, new CustomItem(new MaterialData(Material.STAINED_GLASS_PANE, (byte) 7), " "),
preset.addItem(i, new CustomItem(new MaterialData(Material.GRAY_STAINED_GLASS_PANE), " "),
new MenuClickHandler() {
@Override
@ -137,7 +137,7 @@ public abstract class ElectricSmeltery extends AContainer {
});
}
for (int i: border_in) {
preset.addItem(i, new CustomItem(new MaterialData(Material.STAINED_GLASS_PANE, (byte) 9), " "),
preset.addItem(i, new CustomItem(new MaterialData(Material.CYAN_STAINED_GLASS_PANE), " "),
new MenuClickHandler() {
@Override
@ -148,7 +148,7 @@ public abstract class ElectricSmeltery extends AContainer {
});
}
for (int i: border_out) {
preset.addItem(i, new CustomItem(new MaterialData(Material.STAINED_GLASS_PANE, (byte) 1), " "),
preset.addItem(i, new CustomItem(new MaterialData(Material.ORANGE_STAINED_GLASS_PANE), " "),
new MenuClickHandler() {
@Override
@ -159,7 +159,7 @@ public abstract class ElectricSmeltery extends AContainer {
});
}
preset.addItem(22, new CustomItem(new MaterialData(Material.STAINED_GLASS_PANE, (byte) 15), " "),
preset.addItem(22, new CustomItem(new MaterialData(Material.BLACK_STAINED_GLASS_PANE), " "),
new MenuClickHandler() {
@Override

View File

@ -75,7 +75,7 @@ public class FluidPump extends SlimefunItem{
@SuppressWarnings("deprecation")
protected void constructMenu(BlockMenuPreset preset) {
for (int i: border) {
preset.addItem(i, new CustomItem(new MaterialData(Material.STAINED_GLASS_PANE, (byte) 7), " "),
preset.addItem(i, new CustomItem(new MaterialData(Material.GRAY_STAINED_GLASS_PANE), " "),
new MenuClickHandler() {
@Override
@ -86,7 +86,7 @@ public class FluidPump extends SlimefunItem{
});
}
for (int i: border_in) {
preset.addItem(i, new CustomItem(new MaterialData(Material.STAINED_GLASS_PANE, (byte) 9), " "),
preset.addItem(i, new CustomItem(new MaterialData(Material.CYAN_STAINED_GLASS_PANE), " "),
new MenuClickHandler() {
@Override
@ -97,7 +97,7 @@ public class FluidPump extends SlimefunItem{
});
}
for (int i: border_out) {
preset.addItem(i, new CustomItem(new MaterialData(Material.STAINED_GLASS_PANE, (byte) 1), " "),
preset.addItem(i, new CustomItem(new MaterialData(Material.ORANGE_STAINED_GLASS_PANE), " "),
new MenuClickHandler() {
@Override
@ -138,7 +138,7 @@ public class FluidPump extends SlimefunItem{
protected void tick(Block b) {
Block fluid = b.getRelative(BlockFace.DOWN);
if (fluid.getType().equals(Material.STATIONARY_LAVA)) {
if (fluid.getType().equals(Material.LAVA)) {
for (int slot: getInputSlots()) {
if (SlimefunManager.isItemSimiliar(BlockStorage.getInventory(b).getItemInSlot(slot), new ItemStack(Material.BUCKET), true)) {
if (ChargableBlock.getCharge(b) < getEnergyConsumption()) return;
@ -160,7 +160,7 @@ public class FluidPump extends SlimefunItem{
}
}
}
else if (fluid.getType().equals(Material.STATIONARY_WATER)) {
else if (fluid.getType().equals(Material.WATER)) {
for (int slot: getInputSlots()) {
if (SlimefunManager.isItemSimiliar(BlockStorage.getInventory(b).getItemInSlot(slot), new ItemStack(Material.BUCKET), true)) {
if (ChargableBlock.getCharge(b) < getEnergyConsumption()) return;
@ -211,7 +211,7 @@ public class FluidPump extends SlimefunItem{
int size = BlockStorage.getInventory(b).toInventory().getSize();
Inventory inv = Bukkit.createInventory(null, size);
for (int i = 0; i < size; i++) {
inv.setItem(i, new CustomItem(Material.COMMAND, " &4ALL YOUR PLACEHOLDERS ARE BELONG TO US", 0));
inv.setItem(i, new CustomItem(Material.COMMAND_BLOCK, " &4ALL YOUR PLACEHOLDERS ARE BELONG TO US", 0));
}
for (int slot: getOutputSlots()) {
inv.setItem(slot, BlockStorage.getInventory(b).getItemInSlot(slot));