diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/api/events/PlayerRightClickEvent.java b/src/main/java/io/github/thebusybiscuit/slimefun4/api/events/PlayerRightClickEvent.java index 30c9c927af..d00df4c8fa 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/api/events/PlayerRightClickEvent.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/api/events/PlayerRightClickEvent.java @@ -92,13 +92,13 @@ public PlayerInteractEvent getInteractEvent() { /** * This method returns the {@link ItemStack} that was held in the hand of the {@link Player}. * It will never return null, should there be no {@link ItemStack} then it will return - * {@code new ItemStack(Material.AIR)}. + * {@code ItemStack.of(Material.AIR)}. * * @return The {@link ItemStack} that the {@link Player} right clicked with */ @Nonnull public ItemStack getItem() { - return itemStack.orElse(new ItemStack(Material.AIR)); + return itemStack.orElse(ItemStack.of(Material.AIR)); } /** diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/api/items/SlimefunItemStack.java b/src/main/java/io/github/thebusybiscuit/slimefun4/api/items/SlimefunItemStack.java index 8ae4a86baa..9f2b2388ba 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/api/items/SlimefunItemStack.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/api/items/SlimefunItemStack.java @@ -78,7 +78,7 @@ public SlimefunItemStack(@Nonnull String id, @Nonnull ItemStack item, @Nonnull C } public SlimefunItemStack(@Nonnull String id, @Nonnull Material type, @Nonnull Consumer consumer) { - this(id, new ItemStack(type), consumer); + this(id, ItemStack.of(type), consumer); } public SlimefunItemStack(@Nonnull String id, @Nonnull Material type, @Nullable String name, @Nonnull Consumer consumer) { @@ -109,7 +109,7 @@ public SlimefunItemStack(@Nonnull String id, @Nonnull ItemStack item, @Nullable } public SlimefunItemStack(@Nonnull String id, @Nonnull Material type, @Nullable String name, String... lore) { - this(id, new ItemStack(type), name, lore); + this(id, ItemStack.of(type), name, lore); } public SlimefunItemStack(@Nonnull String id, @Nonnull Material type, @Nonnull Color color, @Nullable String name, String... lore) { @@ -284,7 +284,7 @@ public void lock() { private static @Nonnull ItemStack getSkull(@Nonnull String id, @Nonnull String texture) { if (Slimefun.getMinecraftVersion() == MinecraftVersion.UNIT_TEST) { - return new ItemStack(Material.PLAYER_HEAD); + return ItemStack.of(Material.PLAYER_HEAD); } PlayerSkin skin = PlayerSkin.fromBase64(getTexture(id, texture)); diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/api/recipes/RecipeType.java b/src/main/java/io/github/thebusybiscuit/slimefun4/api/recipes/RecipeType.java index e22c947b67..ee1ad97245 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/api/recipes/RecipeType.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/api/recipes/RecipeType.java @@ -113,7 +113,7 @@ public RecipeType(NamespacedKey key, ItemStack item) { } public RecipeType(MinecraftRecipe recipe) { - this.item = new ItemStack(recipe.getMachine()); + this.item = ItemStack.of(recipe.getMachine()); this.machine = ""; this.key = NamespacedKey.minecraft(recipe.getRecipeClass().getSimpleName().toLowerCase(Locale.ROOT).replace("recipe", "")); } diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/core/guide/options/GuideModeOption.java b/src/main/java/io/github/thebusybiscuit/slimefun4/core/guide/options/GuideModeOption.java index f86694211d..b84b94dec8 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/core/guide/options/GuideModeOption.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/core/guide/options/GuideModeOption.java @@ -47,7 +47,7 @@ public Optional getDisplayItem(Player p, ItemStack guide) { if (current.isPresent()) { SlimefunGuideMode selectedMode = current.get(); - ItemStack item = new ItemStack(Material.AIR); + ItemStack item = ItemStack.of(Material.AIR); if (selectedMode == SlimefunGuideMode.SURVIVAL_MODE) { item.setType(Material.CHEST); diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/core/networks/cargo/ItemStackAndInteger.java b/src/main/java/io/github/thebusybiscuit/slimefun4/core/networks/cargo/ItemStackAndInteger.java index d149efdc79..fa827257ef 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/core/networks/cargo/ItemStackAndInteger.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/core/networks/cargo/ItemStackAndInteger.java @@ -42,7 +42,7 @@ public void add(int amount) { private void initializeItem() { if (this.item instanceof ItemStackWrapper) { - ItemStack copy = new ItemStack(item.getType(), item.getAmount()); + ItemStack copy = ItemStack.of(item.getType(), item.getAmount()); if (this.item.hasItemMeta()) { copy.setItemMeta(this.item.getItemMeta()); } diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/core/services/localization/SlimefunLocalization.java b/src/main/java/io/github/thebusybiscuit/slimefun4/core/services/localization/SlimefunLocalization.java index 893e3baf21..2e59552325 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/core/services/localization/SlimefunLocalization.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/core/services/localization/SlimefunLocalization.java @@ -315,7 +315,7 @@ protected void loadEmbeddedLanguages() { if (item == null) { // Fixes #3088 - return new ItemStack(Material.AIR); + return ItemStack.of(Material.AIR); } Language language = getLanguage(p); diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/guide/SurvivalSlimefunGuide.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/guide/SurvivalSlimefunGuide.java index 83e43be65f..a11a545648 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/guide/SurvivalSlimefunGuide.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/guide/SurvivalSlimefunGuide.java @@ -484,7 +484,7 @@ private void showRecipeChoices(T recipe, ItemStack[] recipeIt RecipeChoice[] choices = Slimefun.getMinecraftRecipeService().getRecipeShape(recipe); if (choices.length == 1 && choices[0] instanceof MaterialChoice materialChoice) { - recipeItems[4] = new ItemStack(materialChoice.getChoices().get(0)); + recipeItems[4] = ItemStack.of(materialChoice.getChoices().get(0)); if (materialChoice.getChoices().size() > 1) { task.add(recipeSlots[4], materialChoice); @@ -492,7 +492,7 @@ private void showRecipeChoices(T recipe, ItemStack[] recipeIt } else { for (int i = 0; i < choices.length; i++) { if (choices[i] instanceof MaterialChoice materialChoice) { - recipeItems[i] = new ItemStack(materialChoice.getChoices().get(0)); + recipeItems[i] = ItemStack.of(materialChoice.getChoices().get(0)); if (materialChoice.getChoices().size() > 1) { task.add(recipeSlots[i], materialChoice); diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/androids/FarmerAndroid.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/androids/FarmerAndroid.java index cd8b72c723..a4b7387e75 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/androids/FarmerAndroid.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/androids/FarmerAndroid.java @@ -69,13 +69,13 @@ private ItemStack getDropFromCrop(Material crop) { Random random = ThreadLocalRandom.current(); return switch (crop) { - case WHEAT -> new ItemStack(Material.WHEAT, random.nextInt(2) + 1); - case POTATOES -> new ItemStack(Material.POTATO, random.nextInt(3) + 1); - case CARROTS -> new ItemStack(Material.CARROT, random.nextInt(3) + 1); - case BEETROOTS -> new ItemStack(Material.BEETROOT, random.nextInt(3) + 1); - case COCOA -> new ItemStack(Material.COCOA_BEANS, random.nextInt(3) + 1); - case NETHER_WART -> new ItemStack(Material.NETHER_WART, random.nextInt(3) + 1); - case SWEET_BERRY_BUSH -> new ItemStack(Material.SWEET_BERRIES, random.nextInt(3) + 1); + case WHEAT -> ItemStack.of(Material.WHEAT, random.nextInt(2) + 1); + case POTATOES -> ItemStack.of(Material.POTATO, random.nextInt(3) + 1); + case CARROTS -> ItemStack.of(Material.CARROT, random.nextInt(3) + 1); + case BEETROOTS -> ItemStack.of(Material.BEETROOT, random.nextInt(3) + 1); + case COCOA -> ItemStack.of(Material.COCOA_BEANS, random.nextInt(3) + 1); + case NETHER_WART -> ItemStack.of(Material.NETHER_WART, random.nextInt(3) + 1); + case SWEET_BERRY_BUSH -> ItemStack.of(Material.SWEET_BERRIES, random.nextInt(3) + 1); default -> null; }; } diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/androids/FishermanAndroid.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/androids/FishermanAndroid.java index a6ce80e2fe..b81d6a7e52 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/androids/FishermanAndroid.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/androids/FishermanAndroid.java @@ -28,23 +28,23 @@ public FishermanAndroid(ItemGroup itemGroup, int tier, SlimefunItemStack item, R // Fish for (Material fish : Tag.ITEMS_FISHES.getValues()) { - fishingLoot.add(new ItemStack(fish), 25); + fishingLoot.add(ItemStack.of(fish), 25); } // Junk - fishingLoot.add(new ItemStack(Material.BONE), 10); - fishingLoot.add(new ItemStack(Material.STRING), 10); - fishingLoot.add(new ItemStack(Material.INK_SAC), 8); - fishingLoot.add(new ItemStack(Material.KELP), 6); - fishingLoot.add(new ItemStack(Material.STICK), 5); - fishingLoot.add(new ItemStack(Material.ROTTEN_FLESH), 3); - fishingLoot.add(new ItemStack(Material.LEATHER), 2); - fishingLoot.add(new ItemStack(Material.BAMBOO), 3); + fishingLoot.add(ItemStack.of(Material.BONE), 10); + fishingLoot.add(ItemStack.of(Material.STRING), 10); + fishingLoot.add(ItemStack.of(Material.INK_SAC), 8); + fishingLoot.add(ItemStack.of(Material.KELP), 6); + fishingLoot.add(ItemStack.of(Material.STICK), 5); + fishingLoot.add(ItemStack.of(Material.ROTTEN_FLESH), 3); + fishingLoot.add(ItemStack.of(Material.LEATHER), 2); + fishingLoot.add(ItemStack.of(Material.BAMBOO), 3); // "loot" - fishingLoot.add(new ItemStack(Material.SADDLE), 1); - fishingLoot.add(new ItemStack(Material.NAME_TAG), 1); - fishingLoot.add(new ItemStack(Material.NAUTILUS_SHELL), 1); + fishingLoot.add(ItemStack.of(Material.SADDLE), 1); + fishingLoot.add(ItemStack.of(Material.NAME_TAG), 1); + fishingLoot.add(ItemStack.of(Material.NAUTILUS_SHELL), 1); } @Override diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/androids/MinerAndroid.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/androids/MinerAndroid.java index 8d041bafb5..6616bbc5f9 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/androids/MinerAndroid.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/androids/MinerAndroid.java @@ -52,7 +52,7 @@ public class MinerAndroid extends ProgrammableAndroid { // Determines the drops a miner android will get - private final ItemStack effectivePickaxe = new ItemStack(Material.DIAMOND_PICKAXE); + private final ItemStack effectivePickaxe = ItemStack.of(Material.DIAMOND_PICKAXE); private final ItemSetting firesEvent = new ItemSetting<>(this, "trigger-event-for-generators", false); private final ItemSetting applyOptimizations = new ItemSetting<>(this, "reduced-block-updates", true); diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/androids/ProgrammableAndroid.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/androids/ProgrammableAndroid.java index 8db9826bc7..b135daca94 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/androids/ProgrammableAndroid.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/androids/ProgrammableAndroid.java @@ -595,27 +595,27 @@ public void setScript(@Nonnull Location l, @Nonnull String script) { private void registerDefaultFuelTypes() { switch (getFuelSource()) { case SOLID -> { - registerFuelType(new MachineFuel(80, new ItemStack(Material.COAL_BLOCK))); - registerFuelType(new MachineFuel(45, new ItemStack(Material.BLAZE_ROD))); - registerFuelType(new MachineFuel(70, new ItemStack(Material.DRIED_KELP_BLOCK))); + registerFuelType(new MachineFuel(80, ItemStack.of(Material.COAL_BLOCK))); + registerFuelType(new MachineFuel(45, ItemStack.of(Material.BLAZE_ROD))); + registerFuelType(new MachineFuel(70, ItemStack.of(Material.DRIED_KELP_BLOCK))); // Coal, Charcoal & Bamboo - registerFuelType(new MachineFuel(8, new ItemStack(Material.COAL))); - registerFuelType(new MachineFuel(8, new ItemStack(Material.CHARCOAL))); - registerFuelType(new MachineFuel(1, new ItemStack(Material.BAMBOO))); + registerFuelType(new MachineFuel(8, ItemStack.of(Material.COAL))); + registerFuelType(new MachineFuel(8, ItemStack.of(Material.CHARCOAL))); + registerFuelType(new MachineFuel(1, ItemStack.of(Material.BAMBOO))); // Logs for (Material mat : Tag.LOGS.getValues()) { - registerFuelType(new MachineFuel(2, new ItemStack(mat))); + registerFuelType(new MachineFuel(2, ItemStack.of(mat))); } // Wooden Planks for (Material mat : Tag.PLANKS.getValues()) { - registerFuelType(new MachineFuel(1, new ItemStack(mat))); + registerFuelType(new MachineFuel(1, ItemStack.of(mat))); } } case LIQUID -> { - registerFuelType(new MachineFuel(100, new ItemStack(Material.LAVA_BUCKET))); + registerFuelType(new MachineFuel(100, ItemStack.of(Material.LAVA_BUCKET))); registerFuelType(new MachineFuel(200, SlimefunItems.OIL_BUCKET)); registerFuelType(new MachineFuel(500, SlimefunItems.FUEL_BUCKET)); } @@ -828,7 +828,7 @@ private void consumeFuel(Block b, BlockMenu menu) { menu.consumeItem(43); if (getFuelSource() == AndroidFuelSource.LIQUID) { - menu.pushItem(new ItemStack(Material.BUCKET), getOutputSlots()); + menu.pushItem(ItemStack.of(Material.BUCKET), getOutputSlots()); } int fuelLevel = fuel.getTicks(); diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/androids/WoodcutterAndroid.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/androids/WoodcutterAndroid.java index 0133cb3b25..075a75d23d 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/androids/WoodcutterAndroid.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/androids/WoodcutterAndroid.java @@ -71,7 +71,7 @@ protected boolean chopTree(Block b, BlockMenu menu, BlockFace face) { @ParametersAreNonnullByDefault private void breakLog(Block log, Block android, BlockMenu menu, BlockFace face) { - ItemStack drop = new ItemStack(log.getType()); + ItemStack drop = ItemStack.of(log.getType()); // We try to push the log into the android's inventory, but nothing happens if it does not fit menu.pushItem(drop, getOutputSlots()); @@ -179,7 +179,7 @@ private void replant(@Nonnull Block block) { block.setType(saplingType); } else { // Simply drop the sapling if the soil does not fit - block.getWorld().dropItemNaturally(block.getLocation(), new ItemStack(saplingType)); + block.getWorld().dropItemNaturally(block.getLocation(), ItemStack.of(saplingType)); block.setType(Material.AIR); } } diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/autocrafters/AbstractAutoCrafter.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/autocrafters/AbstractAutoCrafter.java index b75d3c6643..27b05e4566 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/autocrafters/AbstractAutoCrafter.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/autocrafters/AbstractAutoCrafter.java @@ -474,10 +474,10 @@ private ItemStack getLeftoverItem(@Nonnull ItemStack item) { return switch (type) { case WATER_BUCKET, LAVA_BUCKET, - MILK_BUCKET -> new ItemStack(Material.BUCKET); + MILK_BUCKET -> ItemStack.of(Material.BUCKET); case DRAGON_BREATH, POTION, - HONEY_BOTTLE -> new ItemStack(Material.GLASS_BOTTLE); + HONEY_BOTTLE -> ItemStack.of(Material.GLASS_BOTTLE); default -> null; }; } diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/autocrafters/VanillaRecipe.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/autocrafters/VanillaRecipe.java index 0654c4e366..4f4a93ed94 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/autocrafters/VanillaRecipe.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/autocrafters/VanillaRecipe.java @@ -82,7 +82,7 @@ public void show(@Nonnull ChestMenu menu, @Nonnull AsyncRecipeChoiceTask task) { ItemStack[] items = new ItemStack[9]; if (choices.length == 1 && choices[0] instanceof MaterialChoice materialChoice) { - items[4] = new ItemStack(materialChoice.getChoices().get(0)); + items[4] = ItemStack.of(materialChoice.getChoices().get(0)); if (materialChoice.getChoices().size() > 1) { task.add(slots[4], materialChoice); @@ -90,7 +90,7 @@ public void show(@Nonnull ChestMenu menu, @Nonnull AsyncRecipeChoiceTask task) { } else { for (int i = 0; i < choices.length; i++) { if (choices[i] instanceof MaterialChoice materialChoice) { - items[i] = new ItemStack(materialChoice.getChoices().get(0)); + items[i] = ItemStack.of(materialChoice.getChoices().get(0)); if (materialChoice.getChoices().size() > 1) { task.add(slots[i], materialChoice); diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/blocks/Composter.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/blocks/Composter.java index ee0e546090..6e2936d261 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/blocks/Composter.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/blocks/Composter.java @@ -49,23 +49,23 @@ private List getMachineRecipes() { List items = new LinkedList<>(); for (Material leave : Tag.LEAVES.getValues()) { - items.add(new ItemStack(leave, 8)); - items.add(new ItemStack(Material.DIRT)); + items.add(ItemStack.of(leave, 8)); + items.add(ItemStack.of(Material.DIRT)); } for (Material sapling : Tag.SAPLINGS.getValues()) { - items.add(new ItemStack(sapling, 8)); - items.add(new ItemStack(Material.DIRT)); + items.add(ItemStack.of(sapling, 8)); + items.add(ItemStack.of(Material.DIRT)); } - items.add(new ItemStack(Material.STONE, 4)); - items.add(new ItemStack(Material.NETHERRACK)); + items.add(ItemStack.of(Material.STONE, 4)); + items.add(ItemStack.of(Material.NETHERRACK)); - items.add(new ItemStack(Material.SAND, 2)); - items.add(new ItemStack(Material.SOUL_SAND)); + items.add(ItemStack.of(Material.SAND, 2)); + items.add(ItemStack.of(Material.SOUL_SAND)); - items.add(new ItemStack(Material.WHEAT, 4)); - items.add(new ItemStack(Material.NETHER_WART)); + items.add(ItemStack.of(Material.WHEAT, 4)); + items.add(ItemStack.of(Material.NETHER_WART)); return items; } diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/blocks/Crucible.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/blocks/Crucible.java index f11e7a35ad..5b29fdbe50 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/blocks/Crucible.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/blocks/Crucible.java @@ -65,46 +65,46 @@ public List getDisplayRecipes() { private List getMachineRecipes() { List items = new LinkedList<>(); - items.add(new ItemStack(Material.COBBLESTONE, 16)); - items.add(new ItemStack(Material.LAVA_BUCKET)); + items.add(ItemStack.of(Material.COBBLESTONE, 16)); + items.add(ItemStack.of(Material.LAVA_BUCKET)); - items.add(new ItemStack(Material.NETHERRACK, 16)); - items.add(new ItemStack(Material.LAVA_BUCKET)); + items.add(ItemStack.of(Material.NETHERRACK, 16)); + items.add(ItemStack.of(Material.LAVA_BUCKET)); - items.add(new ItemStack(Material.STONE, 12)); - items.add(new ItemStack(Material.LAVA_BUCKET)); + items.add(ItemStack.of(Material.STONE, 12)); + items.add(ItemStack.of(Material.LAVA_BUCKET)); - items.add(new ItemStack(Material.OBSIDIAN, 1)); - items.add(new ItemStack(Material.LAVA_BUCKET)); + items.add(ItemStack.of(Material.OBSIDIAN, 1)); + items.add(ItemStack.of(Material.LAVA_BUCKET)); - items.add(new ItemStack(Material.TERRACOTTA, 12)); - items.add(new ItemStack(Material.LAVA_BUCKET)); + items.add(ItemStack.of(Material.TERRACOTTA, 12)); + items.add(ItemStack.of(Material.LAVA_BUCKET)); for (Material leave : Tag.LEAVES.getValues()) { - items.add(new ItemStack(leave, 16)); - items.add(new ItemStack(Material.WATER_BUCKET)); + items.add(ItemStack.of(leave, 16)); + items.add(ItemStack.of(Material.WATER_BUCKET)); } for (Material sapling : SlimefunTag.TERRACOTTA.getValues()) { - items.add(new ItemStack(sapling, 12)); - items.add(new ItemStack(Material.LAVA_BUCKET)); + items.add(ItemStack.of(sapling, 12)); + items.add(ItemStack.of(Material.LAVA_BUCKET)); } - items.add(new ItemStack(Material.BLACKSTONE, 8)); - items.add(new ItemStack(Material.LAVA_BUCKET)); + items.add(ItemStack.of(Material.BLACKSTONE, 8)); + items.add(ItemStack.of(Material.LAVA_BUCKET)); - items.add(new ItemStack(Material.BASALT, 12)); - items.add(new ItemStack(Material.LAVA_BUCKET)); + items.add(ItemStack.of(Material.BASALT, 12)); + items.add(ItemStack.of(Material.LAVA_BUCKET)); if (Slimefun.getMinecraftVersion().isAtLeast(MinecraftVersion.MINECRAFT_1_17)) { - items.add(new ItemStack(Material.COBBLED_DEEPSLATE, 12)); - items.add(new ItemStack(Material.LAVA_BUCKET)); + items.add(ItemStack.of(Material.COBBLED_DEEPSLATE, 12)); + items.add(ItemStack.of(Material.LAVA_BUCKET)); - items.add(new ItemStack(Material.DEEPSLATE, 10)); - items.add(new ItemStack(Material.LAVA_BUCKET)); + items.add(ItemStack.of(Material.DEEPSLATE, 10)); + items.add(ItemStack.of(Material.LAVA_BUCKET)); - items.add(new ItemStack(Material.TUFF, 8)); - items.add(new ItemStack(Material.LAVA_BUCKET)); + items.add(ItemStack.of(Material.TUFF, 8)); + items.add(ItemStack.of(Material.LAVA_BUCKET)); } return items; diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/generators/BioGenerator.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/generators/BioGenerator.java index cbbf092f6e..edbeacc758 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/generators/BioGenerator.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/generators/BioGenerator.java @@ -25,83 +25,83 @@ public BioGenerator(ItemGroup itemGroup, SlimefunItemStack item, RecipeType reci @Override protected void registerDefaultFuelTypes() { - registerFuel(new MachineFuel(2, new ItemStack(Material.ROTTEN_FLESH))); - registerFuel(new MachineFuel(2, new ItemStack(Material.SPIDER_EYE))); - registerFuel(new MachineFuel(2, new ItemStack(Material.BONE))); - registerFuel(new MachineFuel(2, new ItemStack(Material.STRING))); - registerFuel(new MachineFuel(3, new ItemStack(Material.APPLE))); - registerFuel(new MachineFuel(3, new ItemStack(Material.MELON_SLICE))); - registerFuel(new MachineFuel(27, new ItemStack(Material.MELON))); - registerFuel(new MachineFuel(3, new ItemStack(Material.PUMPKIN))); - registerFuel(new MachineFuel(3, new ItemStack(Material.PUMPKIN_SEEDS))); - registerFuel(new MachineFuel(3, new ItemStack(Material.MELON_SEEDS))); - registerFuel(new MachineFuel(3, new ItemStack(Material.WHEAT))); - registerFuel(new MachineFuel(3, new ItemStack(Material.WHEAT_SEEDS))); - registerFuel(new MachineFuel(3, new ItemStack(Material.CARROT))); - registerFuel(new MachineFuel(3, new ItemStack(Material.POTATO))); - registerFuel(new MachineFuel(3, new ItemStack(Material.SUGAR_CANE))); - registerFuel(new MachineFuel(3, new ItemStack(Material.NETHER_WART))); - 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.VINE))); - registerFuel(new MachineFuel(2, new ItemStack(Material.CACTUS))); - registerFuel(new MachineFuel(2, new ItemStack(Material.LILY_PAD))); - registerFuel(new MachineFuel(8, new ItemStack(Material.CHORUS_FRUIT))); - 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))); - registerFuel(new MachineFuel(1, new ItemStack(Material.BAMBOO))); - registerFuel(new MachineFuel(2, new ItemStack(Material.SWEET_BERRIES))); - registerFuel(new MachineFuel(2, new ItemStack(Material.COCOA_BEANS))); - registerFuel(new MachineFuel(3, new ItemStack(Material.BEETROOT))); - registerFuel(new MachineFuel(3, new ItemStack(Material.BEETROOT_SEEDS))); + registerFuel(new MachineFuel(2, ItemStack.of(Material.ROTTEN_FLESH))); + registerFuel(new MachineFuel(2, ItemStack.of(Material.SPIDER_EYE))); + registerFuel(new MachineFuel(2, ItemStack.of(Material.BONE))); + registerFuel(new MachineFuel(2, ItemStack.of(Material.STRING))); + registerFuel(new MachineFuel(3, ItemStack.of(Material.APPLE))); + registerFuel(new MachineFuel(3, ItemStack.of(Material.MELON_SLICE))); + registerFuel(new MachineFuel(27, ItemStack.of(Material.MELON))); + registerFuel(new MachineFuel(3, ItemStack.of(Material.PUMPKIN))); + registerFuel(new MachineFuel(3, ItemStack.of(Material.PUMPKIN_SEEDS))); + registerFuel(new MachineFuel(3, ItemStack.of(Material.MELON_SEEDS))); + registerFuel(new MachineFuel(3, ItemStack.of(Material.WHEAT))); + registerFuel(new MachineFuel(3, ItemStack.of(Material.WHEAT_SEEDS))); + registerFuel(new MachineFuel(3, ItemStack.of(Material.CARROT))); + registerFuel(new MachineFuel(3, ItemStack.of(Material.POTATO))); + registerFuel(new MachineFuel(3, ItemStack.of(Material.SUGAR_CANE))); + registerFuel(new MachineFuel(3, ItemStack.of(Material.NETHER_WART))); + registerFuel(new MachineFuel(2, ItemStack.of(Material.RED_MUSHROOM))); + registerFuel(new MachineFuel(2, ItemStack.of(Material.BROWN_MUSHROOM))); + registerFuel(new MachineFuel(2, ItemStack.of(Material.VINE))); + registerFuel(new MachineFuel(2, ItemStack.of(Material.CACTUS))); + registerFuel(new MachineFuel(2, ItemStack.of(Material.LILY_PAD))); + registerFuel(new MachineFuel(8, ItemStack.of(Material.CHORUS_FRUIT))); + registerFuel(new MachineFuel(1, ItemStack.of(Material.KELP))); + registerFuel(new MachineFuel(2, ItemStack.of(Material.DRIED_KELP))); + registerFuel(new MachineFuel(20, ItemStack.of(Material.DRIED_KELP_BLOCK))); + registerFuel(new MachineFuel(1, ItemStack.of(Material.SEAGRASS))); + registerFuel(new MachineFuel(2, ItemStack.of(Material.SEA_PICKLE))); + registerFuel(new MachineFuel(1, ItemStack.of(Material.BAMBOO))); + registerFuel(new MachineFuel(2, ItemStack.of(Material.SWEET_BERRIES))); + registerFuel(new MachineFuel(2, ItemStack.of(Material.COCOA_BEANS))); + registerFuel(new MachineFuel(3, ItemStack.of(Material.BEETROOT))); + registerFuel(new MachineFuel(3, ItemStack.of(Material.BEETROOT_SEEDS))); // Small Flowers (formally just dandelions and poppies). for (Material m : Tag.SMALL_FLOWERS.getValues()) { - registerFuel(new MachineFuel(1, new ItemStack(m))); + registerFuel(new MachineFuel(1, ItemStack.of(m))); } - registerFuel(new MachineFuel(4, new ItemStack(Material.HONEYCOMB))); - registerFuel(new MachineFuel(40, new ItemStack(Material.HONEYCOMB_BLOCK))); + registerFuel(new MachineFuel(4, ItemStack.of(Material.HONEYCOMB))); + registerFuel(new MachineFuel(40, ItemStack.of(Material.HONEYCOMB_BLOCK))); - registerFuel(new MachineFuel(4, new ItemStack(Material.SHROOMLIGHT))); - registerFuel(new MachineFuel(2, new ItemStack(Material.CRIMSON_FUNGUS))); - registerFuel(new MachineFuel(2, new ItemStack(Material.WARPED_FUNGUS))); + registerFuel(new MachineFuel(4, ItemStack.of(Material.SHROOMLIGHT))); + registerFuel(new MachineFuel(2, ItemStack.of(Material.CRIMSON_FUNGUS))); + registerFuel(new MachineFuel(2, ItemStack.of(Material.WARPED_FUNGUS))); registerFuel(new MachineFuel(16, SlimefunItems.STRANGE_NETHER_GOO)); if (Slimefun.getMinecraftVersion().isAtLeast(MinecraftVersion.MINECRAFT_1_17)) { - registerFuel(new MachineFuel(2, new ItemStack(Material.GLOW_BERRIES))); - registerFuel(new MachineFuel(3, new ItemStack(Material.SMALL_DRIPLEAF))); - registerFuel(new MachineFuel(3, new ItemStack(Material.BIG_DRIPLEAF))); - registerFuel(new MachineFuel(2, new ItemStack(Material.GLOW_LICHEN))); - registerFuel(new MachineFuel(20, new ItemStack(Material.SPORE_BLOSSOM))); + registerFuel(new MachineFuel(2, ItemStack.of(Material.GLOW_BERRIES))); + registerFuel(new MachineFuel(3, ItemStack.of(Material.SMALL_DRIPLEAF))); + registerFuel(new MachineFuel(3, ItemStack.of(Material.BIG_DRIPLEAF))); + registerFuel(new MachineFuel(2, ItemStack.of(Material.GLOW_LICHEN))); + registerFuel(new MachineFuel(20, ItemStack.of(Material.SPORE_BLOSSOM))); } // Leaves for (Material m : Tag.LEAVES.getValues()) { - registerFuel(new MachineFuel(1, new ItemStack(m))); + registerFuel(new MachineFuel(1, ItemStack.of(m))); } // Saplings for (Material m : Tag.SAPLINGS.getValues()) { - registerFuel(new MachineFuel(1, new ItemStack(m))); + registerFuel(new MachineFuel(1, ItemStack.of(m))); } // Corals for (Material m : Tag.CORALS.getValues()) { - registerFuel(new MachineFuel(2, new ItemStack(m))); + registerFuel(new MachineFuel(2, ItemStack.of(m))); } for (Material m : Tag.CORAL_BLOCKS.getValues()) { - registerFuel(new MachineFuel(2, new ItemStack(m))); + registerFuel(new MachineFuel(2, ItemStack.of(m))); } } @Override public ItemStack getProgressBar() { - return new ItemStack(Material.GOLDEN_HOE); + return ItemStack.of(Material.GOLDEN_HOE); } } diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/generators/CoalGenerator.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/generators/CoalGenerator.java index cb2a488441..788625ee4a 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/generators/CoalGenerator.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/generators/CoalGenerator.java @@ -23,69 +23,69 @@ public CoalGenerator(ItemGroup itemGroup, SlimefunItemStack item, RecipeType rec @Override protected void registerDefaultFuelTypes() { - registerFuel(new MachineFuel(80, new ItemStack(Material.COAL_BLOCK))); - registerFuel(new MachineFuel(12, new ItemStack(Material.BLAZE_ROD))); - registerFuel(new MachineFuel(20, new ItemStack(Material.DRIED_KELP_BLOCK))); + registerFuel(new MachineFuel(80, ItemStack.of(Material.COAL_BLOCK))); + registerFuel(new MachineFuel(12, ItemStack.of(Material.BLAZE_ROD))); + registerFuel(new MachineFuel(20, ItemStack.of(Material.DRIED_KELP_BLOCK))); // Boats for (Material mat : Tag.ITEMS_BOATS.getValues()) { - registerFuel(new MachineFuel(5, new ItemStack(mat))); + registerFuel(new MachineFuel(5, ItemStack.of(mat))); } // Coal & Charcoal - registerFuel(new MachineFuel(8, new ItemStack(Material.COAL))); - registerFuel(new MachineFuel(8, new ItemStack(Material.CHARCOAL))); + registerFuel(new MachineFuel(8, ItemStack.of(Material.COAL))); + registerFuel(new MachineFuel(8, ItemStack.of(Material.CHARCOAL))); // Logs for (Material mat : Tag.LOGS.getValues()) { - registerFuel(new MachineFuel(4, new ItemStack(mat))); + registerFuel(new MachineFuel(4, ItemStack.of(mat))); } // Wooden Planks for (Material mat : Tag.PLANKS.getValues()) { - registerFuel(new MachineFuel(1, new ItemStack(mat))); + registerFuel(new MachineFuel(1, ItemStack.of(mat))); } // Wooden Slabs for (Material mat : Tag.WOODEN_SLABS.getValues()) { - registerFuel(new MachineFuel(1, new ItemStack(mat))); + registerFuel(new MachineFuel(1, ItemStack.of(mat))); } // Wooden Buttons for (Material mat : Tag.WOODEN_BUTTONS.getValues()) { - registerFuel(new MachineFuel(1, new ItemStack(mat))); + registerFuel(new MachineFuel(1, ItemStack.of(mat))); } // Wooden Fences for (Material mat : Tag.WOODEN_FENCES.getValues()) { - registerFuel(new MachineFuel(1, new ItemStack(mat))); + registerFuel(new MachineFuel(1, ItemStack.of(mat))); } // wooden Trapdoors for (Material mat : Tag.WOODEN_TRAPDOORS.getValues()) { - registerFuel(new MachineFuel(3, new ItemStack(mat))); + registerFuel(new MachineFuel(3, ItemStack.of(mat))); } // Wooden Pressure Plates for (Material mat : Tag.WOODEN_PRESSURE_PLATES.getValues()) { - registerFuel(new MachineFuel(2, new ItemStack(mat))); + registerFuel(new MachineFuel(2, ItemStack.of(mat))); } // Wooden Doors for (Material mat : Tag.WOODEN_DOORS.getValues()) { - registerFuel(new MachineFuel(2, new ItemStack(mat))); + registerFuel(new MachineFuel(2, ItemStack.of(mat))); } // Signs for (Material mat : Tag.STANDING_SIGNS.getValues()) { - registerFuel(new MachineFuel(2, new ItemStack(mat))); + registerFuel(new MachineFuel(2, ItemStack.of(mat))); } } @Nonnull @Override public ItemStack getProgressBar() { - return new ItemStack(Material.FLINT_AND_STEEL); + return ItemStack.of(Material.FLINT_AND_STEEL); } } diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/generators/CombustionGenerator.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/generators/CombustionGenerator.java index 6d9bc6993b..fdcba893f0 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/generators/CombustionGenerator.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/generators/CombustionGenerator.java @@ -28,7 +28,7 @@ protected void registerDefaultFuelTypes() { @Override public ItemStack getProgressBar() { - return new ItemStack(Material.FLINT_AND_STEEL); + return ItemStack.of(Material.FLINT_AND_STEEL); } } diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/generators/LavaGenerator.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/generators/LavaGenerator.java index 59100fbeb1..897a8dc368 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/generators/LavaGenerator.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/generators/LavaGenerator.java @@ -21,12 +21,12 @@ public LavaGenerator(ItemGroup itemGroup, SlimefunItemStack item, RecipeType rec @Override protected void registerDefaultFuelTypes() { - registerFuel(new MachineFuel(40, new ItemStack(Material.LAVA_BUCKET))); + registerFuel(new MachineFuel(40, ItemStack.of(Material.LAVA_BUCKET))); } @Override public ItemStack getProgressBar() { - return new ItemStack(Material.FLINT_AND_STEEL); + return ItemStack.of(Material.FLINT_AND_STEEL); } } diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/generators/MagnesiumGenerator.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/generators/MagnesiumGenerator.java index 110b7fff05..9a06b8a5c1 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/generators/MagnesiumGenerator.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/generators/MagnesiumGenerator.java @@ -27,7 +27,7 @@ protected void registerDefaultFuelTypes() { @Override public ItemStack getProgressBar() { - return new ItemStack(Material.FLINT_AND_STEEL); + return ItemStack.of(Material.FLINT_AND_STEEL); } } diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/machines/AutoAnvil.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/machines/AutoAnvil.java index 16329948bf..08937dc096 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/machines/AutoAnvil.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/machines/AutoAnvil.java @@ -34,7 +34,7 @@ public AutoAnvil(ItemGroup itemGroup, int repairFactor, SlimefunItemStack item, @Override public ItemStack getProgressBar() { - return new ItemStack(Material.IRON_PICKAXE); + return ItemStack.of(Material.IRON_PICKAXE); } @Override diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/machines/AutoBrewer.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/machines/AutoBrewer.java index 962bc2d32f..2da756ac0e 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/machines/AutoBrewer.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/machines/AutoBrewer.java @@ -112,36 +112,36 @@ public AutoBrewer(ItemGroup itemGroup, SlimefunItemStack item, RecipeType recipe if (type == PotionType.WATER) { if (input == Material.FERMENTED_SPIDER_EYE) { potion.setBasePotionType(PotionType.WEAKNESS); - return new ItemStack(potionType); + return ItemStack.of(potionType); } else if (input == Material.NETHER_WART) { potion.setBasePotionType(PotionType.AWKWARD); - return new ItemStack(potionType); + return ItemStack.of(potionType); } else if (potionType == Material.POTION && input == Material.GUNPOWDER) { - return new ItemStack(Material.SPLASH_POTION); + return ItemStack.of(Material.SPLASH_POTION); } else if (potionType == Material.SPLASH_POTION && input == Material.DRAGON_BREATH) { - return new ItemStack(Material.LINGERING_POTION); + return ItemStack.of(Material.LINGERING_POTION); } } else if (input == Material.FERMENTED_SPIDER_EYE) { PotionType fermented = fermentations.get(type); if (fermented != null) { potion.setBasePotionType(fermented); - return new ItemStack(potionType); + return ItemStack.of(potionType); } } else if (input == Material.REDSTONE && type.isExtendable() && !type.isUpgradeable()) { // Fixes #3390 - Potions can only be either extended or upgraded. Not both. potion.setBasePotionType(type); - return new ItemStack(potionType); + return ItemStack.of(potionType); } else if (input == Material.GLOWSTONE_DUST && type.isUpgradeable() && !type.isExtendable()) { // Fixes #3390 - Potions can only be either extended or upgraded. Not both. potion.setBasePotionType(type); - return new ItemStack(potionType); + return ItemStack.of(potionType); } else if (type == PotionType.AWKWARD) { PotionType potionRecipe = potionRecipes.get(input); if (potionRecipe != null) { potion.setBasePotionType(potionRecipe); - return new ItemStack(potionType); + return ItemStack.of(potionType); } } @@ -156,36 +156,36 @@ private ItemStack brewPreBasePotionType(Material input, Material potionType, Pot if (type == PotionType.WATER) { if (input == Material.FERMENTED_SPIDER_EYE) { potion.setBasePotionData(new PotionData(PotionType.WEAKNESS, false, false)); - return new ItemStack(potionType); + return ItemStack.of(potionType); } else if (input == Material.NETHER_WART) { potion.setBasePotionData(new PotionData(PotionType.AWKWARD, false, false)); - return new ItemStack(potionType); + return ItemStack.of(potionType); } else if (potionType == Material.POTION && input == Material.GUNPOWDER) { - return new ItemStack(Material.SPLASH_POTION); + return ItemStack.of(Material.SPLASH_POTION); } else if (potionType == Material.SPLASH_POTION && input == Material.DRAGON_BREATH) { - return new ItemStack(Material.LINGERING_POTION); + return ItemStack.of(Material.LINGERING_POTION); } } else if (input == Material.FERMENTED_SPIDER_EYE) { PotionType fermented = fermentations.get(type); if (fermented != null) { potion.setBasePotionData(new PotionData(fermented, data.isExtended(), data.isUpgraded())); - return new ItemStack(potionType); + return ItemStack.of(potionType); } } else if (input == Material.REDSTONE && type.isExtendable() && !data.isUpgraded()) { // Fixes #3390 - Potions can only be either extended or upgraded. Not both. potion.setBasePotionData(new PotionData(type, true, false)); - return new ItemStack(potionType); + return ItemStack.of(potionType); } else if (input == Material.GLOWSTONE_DUST && type.isUpgradeable() && !data.isExtended()) { // Fixes #3390 - Potions can only be either extended or upgraded. Not both. potion.setBasePotionData(new PotionData(type, false, true)); - return new ItemStack(potionType); + return ItemStack.of(potionType); } else if (type == PotionType.AWKWARD) { PotionType potionRecipe = potionRecipes.get(input); if (potionRecipe != null) { potion.setBasePotionData(new PotionData(potionRecipe, false, false)); - return new ItemStack(potionType); + return ItemStack.of(potionType); } } return null; @@ -205,7 +205,7 @@ private boolean isPotion(@Nonnull Material mat) { @Override public @Nonnull ItemStack getProgressBar() { - return new ItemStack(Material.FISHING_ROD); + return ItemStack.of(Material.FISHING_ROD); } @Override diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/machines/AutoDrier.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/machines/AutoDrier.java index 0be46da7f9..94f3554f51 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/machines/AutoDrier.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/machines/AutoDrier.java @@ -40,61 +40,61 @@ public AutoDrier(ItemGroup itemGroup, SlimefunItemStack item, RecipeType recipeT @Override protected void registerDefaultRecipes() { recipeList = new ArrayList<>(); - recipeList.add(new ItemStack(Material.ROTTEN_FLESH)); - recipeList.add(new ItemStack(Material.LEATHER)); + recipeList.add(ItemStack.of(Material.ROTTEN_FLESH)); + recipeList.add(ItemStack.of(Material.LEATHER)); - recipeList.add(new ItemStack(Material.WET_SPONGE)); - recipeList.add(new ItemStack(Material.SPONGE)); + recipeList.add(ItemStack.of(Material.WET_SPONGE)); + recipeList.add(ItemStack.of(Material.SPONGE)); - recipeList.add(new ItemStack(Material.KELP)); - recipeList.add(new ItemStack(Material.DRIED_KELP)); + recipeList.add(ItemStack.of(Material.KELP)); + recipeList.add(ItemStack.of(Material.DRIED_KELP)); - recipeList.add(new ItemStack(Material.POTION)); - recipeList.add(new ItemStack(Material.GLASS_BOTTLE)); + recipeList.add(ItemStack.of(Material.POTION)); + recipeList.add(ItemStack.of(Material.GLASS_BOTTLE)); - recipeList.add(new ItemStack(Material.SPLASH_POTION)); - recipeList.add(new ItemStack(Material.GLASS_BOTTLE)); + recipeList.add(ItemStack.of(Material.SPLASH_POTION)); + recipeList.add(ItemStack.of(Material.GLASS_BOTTLE)); - recipeList.add(new ItemStack(Material.LINGERING_POTION)); - recipeList.add(new ItemStack(Material.GLASS_BOTTLE)); + recipeList.add(ItemStack.of(Material.LINGERING_POTION)); + recipeList.add(ItemStack.of(Material.GLASS_BOTTLE)); - recipeList.add(new ItemStack(Material.WATER_BUCKET)); - recipeList.add(new ItemStack(Material.BUCKET)); + recipeList.add(ItemStack.of(Material.WATER_BUCKET)); + recipeList.add(ItemStack.of(Material.BUCKET)); - recipeList.add(new ItemStack(Material.COOKED_BEEF)); + recipeList.add(ItemStack.of(Material.COOKED_BEEF)); recipeList.add(SlimefunItems.BEEF_JERKY); - recipeList.add(new ItemStack(Material.COOKED_PORKCHOP)); + recipeList.add(ItemStack.of(Material.COOKED_PORKCHOP)); recipeList.add(SlimefunItems.PORK_JERKY); - recipeList.add(new ItemStack(Material.COOKED_CHICKEN)); + recipeList.add(ItemStack.of(Material.COOKED_CHICKEN)); recipeList.add(SlimefunItems.CHICKEN_JERKY); - recipeList.add(new ItemStack(Material.COOKED_MUTTON)); + recipeList.add(ItemStack.of(Material.COOKED_MUTTON)); recipeList.add(SlimefunItems.MUTTON_JERKY); - recipeList.add(new ItemStack(Material.COOKED_RABBIT)); + recipeList.add(ItemStack.of(Material.COOKED_RABBIT)); recipeList.add(SlimefunItems.RABBIT_JERKY); - recipeList.add(new ItemStack(Material.COOKED_COD)); + recipeList.add(ItemStack.of(Material.COOKED_COD)); recipeList.add(SlimefunItems.FISH_JERKY); - recipeList.add(new ItemStack(Material.COOKED_SALMON)); + recipeList.add(ItemStack.of(Material.COOKED_SALMON)); recipeList.add(SlimefunItems.FISH_JERKY); if (Slimefun.getMinecraftVersion().isAtLeast(MinecraftVersion.MINECRAFT_1_19)) { - recipeList.add(new ItemStack(Material.MUD)); - recipeList.add(new ItemStack(Material.CLAY)); + recipeList.add(ItemStack.of(Material.MUD)); + recipeList.add(ItemStack.of(Material.CLAY)); } for (Material sapling : Tag.SAPLINGS.getValues()) { - recipeList.add(new ItemStack(sapling)); - recipeList.add(new ItemStack(Material.STICK, 2)); + recipeList.add(ItemStack.of(sapling)); + recipeList.add(ItemStack.of(Material.STICK, 2)); } for (Material leaves : Tag.LEAVES.getValues()) { - recipeList.add(new ItemStack(leaves)); - recipeList.add(new ItemStack(Material.STICK)); + recipeList.add(ItemStack.of(leaves)); + recipeList.add(ItemStack.of(Material.STICK)); } // Now convert them to machine recipes @@ -105,7 +105,7 @@ protected void registerDefaultRecipes() { @Override public ItemStack getProgressBar() { - return new ItemStack(Material.FLINT_AND_STEEL); + return ItemStack.of(Material.FLINT_AND_STEEL); } @Override diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/machines/CarbonPress.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/machines/CarbonPress.java index 4772b718d4..d2ecb452be 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/machines/CarbonPress.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/machines/CarbonPress.java @@ -23,9 +23,9 @@ public CarbonPress(ItemGroup itemGroup, SlimefunItemStack item, RecipeType recip @Override protected void registerDefaultRecipes() { - registerRecipe(15, new ItemStack[] { new ItemStack(Material.CHARCOAL, 4) }, new ItemStack[] { new ItemStack(Material.COAL) }); - registerRecipe(20, new ItemStack[] { new ItemStack(Material.COAL, 8) }, new ItemStack[] { SlimefunItems.CARBON }); - registerRecipe(180, new ItemStack[] { new ItemStack(Material.COAL_BLOCK, 8) }, new ItemStack[] { new SlimefunItemStack(SlimefunItems.CARBON, 9) }); + registerRecipe(15, new ItemStack[] { ItemStack.of(Material.CHARCOAL, 4) }, new ItemStack[] { ItemStack.of(Material.COAL) }); + registerRecipe(20, new ItemStack[] { ItemStack.of(Material.COAL, 8) }, new ItemStack[] { SlimefunItems.CARBON }); + registerRecipe(180, new ItemStack[] { ItemStack.of(Material.COAL_BLOCK, 8) }, new ItemStack[] { new SlimefunItemStack(SlimefunItems.CARBON, 9) }); registerRecipe(30, new ItemStack[] { new CustomItemStack(SlimefunItems.CARBON, 4) }, new ItemStack[] { SlimefunItems.COMPRESSED_CARBON }); registerRecipe(60, new ItemStack[] { SlimefunItems.CARBON_CHUNK, SlimefunItems.SYNTHETIC_DIAMOND }, new ItemStack[] { SlimefunItems.RAW_CARBONADO }); registerRecipe(60, new ItemStack[] { SlimefunItems.CARBON_CHUNK }, new ItemStack[] { SlimefunItems.SYNTHETIC_DIAMOND }); @@ -39,7 +39,7 @@ public String getMachineIdentifier() { @Override public ItemStack getProgressBar() { - return new ItemStack(Material.DIAMOND_PICKAXE); + return ItemStack.of(Material.DIAMOND_PICKAXE); } } diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/machines/ChargingBench.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/machines/ChargingBench.java index b535e44b40..f3f9d961c3 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/machines/ChargingBench.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/machines/ChargingBench.java @@ -30,7 +30,7 @@ public ChargingBench(ItemGroup itemGroup, SlimefunItemStack item, RecipeType rec @Override public ItemStack getProgressBar() { - return new ItemStack(Material.GOLDEN_PICKAXE); + return ItemStack.of(Material.GOLDEN_PICKAXE); } @Override diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/machines/ElectricDustWasher.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/machines/ElectricDustWasher.java index ad56c3d8a9..6716990b36 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/machines/ElectricDustWasher.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/machines/ElectricDustWasher.java @@ -40,7 +40,7 @@ public ElectricDustWasher(ItemGroup itemGroup, SlimefunItemStack item, RecipeTyp @Override public ItemStack getProgressBar() { - return new ItemStack(Material.GOLDEN_SHOVEL); + return ItemStack.of(Material.GOLDEN_SHOVEL); } @Override @@ -61,8 +61,8 @@ protected MachineRecipe findNextRecipe(BlockMenu menu) { } } else if (SlimefunUtils.isItemSimilar(input, SlimefunItems.PULVERIZED_ORE, true)) { recipe = new MachineRecipe(4 / getSpeed(), new ItemStack[] { SlimefunItems.PULVERIZED_ORE }, new ItemStack[] { SlimefunItems.PURE_ORE_CLUSTER }); - } else if (SlimefunUtils.isItemSimilar(input, new ItemStack(Material.SAND), true)) { - recipe = new MachineRecipe(4 / getSpeed(), new ItemStack[] { new ItemStack(Material.SAND) }, new ItemStack[] { SlimefunItems.SALT }); + } else if (SlimefunUtils.isItemSimilar(input, ItemStack.of(Material.SAND), true)) { + recipe = new MachineRecipe(4 / getSpeed(), new ItemStack[] { ItemStack.of(Material.SAND) }, new ItemStack[] { SlimefunItems.SALT }); } if (recipe != null && menu.fits(recipe.getOutput()[0], getOutputSlots())) { diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/machines/ElectricFurnace.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/machines/ElectricFurnace.java index c77e660dfb..c480da6b98 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/machines/ElectricFurnace.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/machines/ElectricFurnace.java @@ -39,7 +39,7 @@ public void registerDefaultRecipes() { if (choice instanceof MaterialChoice materialChoice) { for (Material input : materialChoice.getChoices()) { - registerRecipe(4, new ItemStack[] { new ItemStack(input) }, new ItemStack[] { recipe.getResult() }); + registerRecipe(4, new ItemStack[] { ItemStack.of(input) }, new ItemStack[] { recipe.getResult() }); } } } @@ -53,7 +53,7 @@ public String getMachineIdentifier() { @Override public ItemStack getProgressBar() { - return new ItemStack(Material.FLINT_AND_STEEL); + return ItemStack.of(Material.FLINT_AND_STEEL); } } diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/machines/ElectricGoldPan.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/machines/ElectricGoldPan.java index a454482f8e..6aeb11bbb1 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/machines/ElectricGoldPan.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/machines/ElectricGoldPan.java @@ -81,7 +81,7 @@ public boolean isOutputLimitOverridden() { @Override public ItemStack getProgressBar() { - return new ItemStack(Material.DIAMOND_SHOVEL); + return ItemStack.of(Material.DIAMOND_SHOVEL); } @Override diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/machines/ElectricIngotFactory.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/machines/ElectricIngotFactory.java index 287383f517..1106e1344b 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/machines/ElectricIngotFactory.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/machines/ElectricIngotFactory.java @@ -23,7 +23,7 @@ public String getMachineIdentifier() { @Override public ItemStack getProgressBar() { - return new ItemStack(Material.FLINT_AND_STEEL); + return ItemStack.of(Material.FLINT_AND_STEEL); } } diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/machines/ElectricIngotPulverizer.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/machines/ElectricIngotPulverizer.java index 28c2638822..88839a6e43 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/machines/ElectricIngotPulverizer.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/machines/ElectricIngotPulverizer.java @@ -35,7 +35,7 @@ public ElectricIngotPulverizer(ItemGroup itemGroup, SlimefunItemStack item, Reci @Override public ItemStack getProgressBar() { - return new ItemStack(Material.IRON_PICKAXE); + return ItemStack.of(Material.IRON_PICKAXE); } @Override @@ -54,10 +54,10 @@ public List getDisplayRecipes() { protected void registerDefaultRecipes() { // this is an extra recipe on top of PostSetup.loadSmelteryRecipes() for converting // Vanilla Gold Ingot to Slimefun gold dust and Vanilla Copper Ingot into Slimefun copper dust - registerRecipe(3, new ItemStack(Material.GOLD_INGOT), SlimefunItems.GOLD_DUST); + registerRecipe(3, ItemStack.of(Material.GOLD_INGOT), SlimefunItems.GOLD_DUST); if (Slimefun.getMinecraftVersion().isAtLeast(MinecraftVersion.MINECRAFT_1_17)) { - registerRecipe(3, new ItemStack(Material.COPPER_INGOT), SlimefunItems.COPPER_DUST); + registerRecipe(3, ItemStack.of(Material.COPPER_INGOT), SlimefunItems.COPPER_DUST); } } diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/machines/ElectricOreGrinder.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/machines/ElectricOreGrinder.java index 19a6425eea..5a5f854372 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/machines/ElectricOreGrinder.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/machines/ElectricOreGrinder.java @@ -27,7 +27,7 @@ public String getMachineIdentifier() { @Override public ItemStack getProgressBar() { - return new ItemStack(Material.IRON_PICKAXE); + return ItemStack.of(Material.IRON_PICKAXE); } } diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/machines/ElectricPress.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/machines/ElectricPress.java index b5cb6f2f4d..1dae67176a 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/machines/ElectricPress.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/machines/ElectricPress.java @@ -32,58 +32,58 @@ public ElectricPress(ItemGroup itemGroup, SlimefunItemStack item, RecipeType rec @Override protected void registerDefaultRecipes() { - addRecipe(4, new SlimefunItemStack(SlimefunItems.STONE_CHUNK, 3), new ItemStack(Material.COBBLESTONE)); - addRecipe(4, new ItemStack(Material.FLINT, 6), new ItemStack(Material.COBBLESTONE)); - addRecipe(5, new ItemStack(Material.GLASS), new ItemStack(Material.GLASS_PANE, 3)); - addRecipe(4, new ItemStack(Material.SNOWBALL, 4), new ItemStack(Material.SNOW_BLOCK)); - addRecipe(4, new ItemStack(Material.MAGMA_CREAM, 4), new ItemStack(Material.MAGMA_BLOCK)); - addRecipe(4, new ItemStack(Material.SLIME_BALL, 9), new ItemStack(Material.SLIME_BLOCK)); - - addRecipe(3, new ItemStack(Material.DRIED_KELP, 9), new ItemStack(Material.DRIED_KELP_BLOCK)); - addRecipe(3, new ItemStack(Material.BONE_MEAL, 9), new ItemStack(Material.BONE_BLOCK)); - addRecipe(3, new ItemStack(Material.CLAY_BALL, 4), new ItemStack(Material.CLAY)); - addRecipe(3, new ItemStack(Material.BRICK, 4), new ItemStack(Material.BRICKS)); + addRecipe(4, new SlimefunItemStack(SlimefunItems.STONE_CHUNK, 3), ItemStack.of(Material.COBBLESTONE)); + addRecipe(4, ItemStack.of(Material.FLINT, 6), ItemStack.of(Material.COBBLESTONE)); + addRecipe(5, ItemStack.of(Material.GLASS), ItemStack.of(Material.GLASS_PANE, 3)); + addRecipe(4, ItemStack.of(Material.SNOWBALL, 4), ItemStack.of(Material.SNOW_BLOCK)); + addRecipe(4, ItemStack.of(Material.MAGMA_CREAM, 4), ItemStack.of(Material.MAGMA_BLOCK)); + addRecipe(4, ItemStack.of(Material.SLIME_BALL, 9), ItemStack.of(Material.SLIME_BLOCK)); + + addRecipe(3, ItemStack.of(Material.DRIED_KELP, 9), ItemStack.of(Material.DRIED_KELP_BLOCK)); + addRecipe(3, ItemStack.of(Material.BONE_MEAL, 9), ItemStack.of(Material.BONE_BLOCK)); + addRecipe(3, ItemStack.of(Material.CLAY_BALL, 4), ItemStack.of(Material.CLAY)); + addRecipe(3, ItemStack.of(Material.BRICK, 4), ItemStack.of(Material.BRICKS)); addRecipe(6, SlimefunItems.COPPER_INGOT, new CustomItemStack(SlimefunItems.COPPER_WIRE, 3)); addRecipe(16, new SlimefunItemStack(SlimefunItems.STEEL_INGOT, 8), SlimefunItems.STEEL_PLATE); addRecipe(18, new SlimefunItemStack(SlimefunItems.REINFORCED_ALLOY_INGOT, 8), SlimefunItems.REINFORCED_PLATE); - addRecipe(8, new ItemStack(Material.NETHER_WART), new CustomItemStack(SlimefunItems.MAGIC_LUMP_1, 2)); + addRecipe(8, ItemStack.of(Material.NETHER_WART), new CustomItemStack(SlimefunItems.MAGIC_LUMP_1, 2)); addRecipe(10, new SlimefunItemStack(SlimefunItems.MAGIC_LUMP_1, 4), SlimefunItems.MAGIC_LUMP_2); addRecipe(12, new SlimefunItemStack(SlimefunItems.MAGIC_LUMP_2, 4), SlimefunItems.MAGIC_LUMP_3); - addRecipe(10, new ItemStack(Material.ENDER_EYE), new CustomItemStack(SlimefunItems.ENDER_LUMP_1, 2)); + addRecipe(10, ItemStack.of(Material.ENDER_EYE), new CustomItemStack(SlimefunItems.ENDER_LUMP_1, 2)); addRecipe(12, new SlimefunItemStack(SlimefunItems.ENDER_LUMP_1, 4), SlimefunItems.ENDER_LUMP_2); addRecipe(14, new SlimefunItemStack(SlimefunItems.ENDER_LUMP_2, 4), SlimefunItems.ENDER_LUMP_3); addRecipe(18, new SlimefunItemStack(SlimefunItems.TINY_URANIUM, 9), SlimefunItems.SMALL_URANIUM); addRecipe(24, new SlimefunItemStack(SlimefunItems.SMALL_URANIUM, 4), SlimefunItems.URANIUM); - addRecipe(4, new ItemStack(Material.QUARTZ, 4), new ItemStack(Material.QUARTZ_BLOCK)); - addRecipe(4, new ItemStack(Material.IRON_NUGGET, 9), new ItemStack(Material.IRON_INGOT)); - addRecipe(4, new ItemStack(Material.GOLD_NUGGET, 9), new ItemStack(Material.GOLD_INGOT)); - addRecipe(4, new ItemStack(Material.COAL, 9), new ItemStack(Material.COAL_BLOCK)); - addRecipe(4, new ItemStack(Material.SAND, 4), new ItemStack(Material.SANDSTONE)); - addRecipe(4, new ItemStack(Material.RED_SAND, 4), new ItemStack(Material.RED_SANDSTONE)); + addRecipe(4, ItemStack.of(Material.QUARTZ, 4), ItemStack.of(Material.QUARTZ_BLOCK)); + addRecipe(4, ItemStack.of(Material.IRON_NUGGET, 9), ItemStack.of(Material.IRON_INGOT)); + addRecipe(4, ItemStack.of(Material.GOLD_NUGGET, 9), ItemStack.of(Material.GOLD_INGOT)); + addRecipe(4, ItemStack.of(Material.COAL, 9), ItemStack.of(Material.COAL_BLOCK)); + addRecipe(4, ItemStack.of(Material.SAND, 4), ItemStack.of(Material.SANDSTONE)); + addRecipe(4, ItemStack.of(Material.RED_SAND, 4), ItemStack.of(Material.RED_SANDSTONE)); - addRecipe(5, new ItemStack(Material.IRON_INGOT, 9), new ItemStack(Material.IRON_BLOCK)); - addRecipe(5, new ItemStack(Material.GOLD_INGOT, 9), new ItemStack(Material.GOLD_BLOCK)); + addRecipe(5, ItemStack.of(Material.IRON_INGOT, 9), ItemStack.of(Material.IRON_BLOCK)); + addRecipe(5, ItemStack.of(Material.GOLD_INGOT, 9), ItemStack.of(Material.GOLD_BLOCK)); - addRecipe(6, new ItemStack(Material.REDSTONE, 9), new ItemStack(Material.REDSTONE_BLOCK)); - addRecipe(6, new ItemStack(Material.LAPIS_LAZULI, 9), new ItemStack(Material.LAPIS_BLOCK)); + addRecipe(6, ItemStack.of(Material.REDSTONE, 9), ItemStack.of(Material.REDSTONE_BLOCK)); + addRecipe(6, ItemStack.of(Material.LAPIS_LAZULI, 9), ItemStack.of(Material.LAPIS_BLOCK)); - addRecipe(8, new ItemStack(Material.EMERALD, 9), new ItemStack(Material.EMERALD_BLOCK)); - addRecipe(8, new ItemStack(Material.DIAMOND, 9), new ItemStack(Material.DIAMOND_BLOCK)); + addRecipe(8, ItemStack.of(Material.EMERALD, 9), ItemStack.of(Material.EMERALD_BLOCK)); + addRecipe(8, ItemStack.of(Material.DIAMOND, 9), ItemStack.of(Material.DIAMOND_BLOCK)); - addRecipe(16, new ItemStack(Material.NETHERITE_INGOT, 9), new ItemStack(Material.NETHERITE_BLOCK)); + addRecipe(16, ItemStack.of(Material.NETHERITE_INGOT, 9), ItemStack.of(Material.NETHERITE_BLOCK)); if (Slimefun.getMinecraftVersion().isAtLeast(MinecraftVersion.MINECRAFT_1_17)) { - addRecipe(4, new ItemStack(Material.AMETHYST_SHARD, 4), new ItemStack(Material.AMETHYST_BLOCK)); + addRecipe(4, ItemStack.of(Material.AMETHYST_SHARD, 4), ItemStack.of(Material.AMETHYST_BLOCK)); - addRecipe(5, new ItemStack(Material.COPPER_INGOT, 9), new ItemStack(Material.COPPER_BLOCK)); - addRecipe(5, new ItemStack(Material.RAW_IRON, 9), new ItemStack(Material.RAW_IRON_BLOCK)); - addRecipe(5, new ItemStack(Material.RAW_GOLD, 9), new ItemStack(Material.RAW_GOLD_BLOCK)); - addRecipe(5, new ItemStack(Material.RAW_COPPER, 9), new ItemStack(Material.RAW_COPPER_BLOCK)); + addRecipe(5, ItemStack.of(Material.COPPER_INGOT, 9), ItemStack.of(Material.COPPER_BLOCK)); + addRecipe(5, ItemStack.of(Material.RAW_IRON, 9), ItemStack.of(Material.RAW_IRON_BLOCK)); + addRecipe(5, ItemStack.of(Material.RAW_GOLD, 9), ItemStack.of(Material.RAW_GOLD_BLOCK)); + addRecipe(5, ItemStack.of(Material.RAW_COPPER, 9), ItemStack.of(Material.RAW_COPPER_BLOCK)); } } @@ -94,7 +94,7 @@ private void addRecipe(int seconds, ItemStack input, ItemStack output) { @Override public ItemStack getProgressBar() { - return new ItemStack(Material.IRON_HOE); + return ItemStack.of(Material.IRON_HOE); } diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/machines/ElectricSmeltery.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/machines/ElectricSmeltery.java index 2218339998..ae04ff9777 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/machines/ElectricSmeltery.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/machines/ElectricSmeltery.java @@ -129,7 +129,7 @@ protected void constructMenu(BlockMenuPreset preset) { @Override public ItemStack getProgressBar() { - return new ItemStack(Material.FLINT_AND_STEEL); + return ItemStack.of(Material.FLINT_AND_STEEL); } @Override diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/machines/ElectrifiedCrucible.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/machines/ElectrifiedCrucible.java index ff5a33474b..c0d68bc6e4 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/machines/ElectrifiedCrucible.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/machines/ElectrifiedCrucible.java @@ -21,27 +21,27 @@ public ElectrifiedCrucible(ItemGroup itemGroup, SlimefunItemStack item, RecipeTy @Override protected void registerDefaultRecipes() { - registerRecipe(10, new ItemStack[] { new ItemStack(Material.BUCKET), new ItemStack(Material.COBBLESTONE, 16) }, new ItemStack[] { new ItemStack(Material.LAVA_BUCKET) }); - registerRecipe(8, new ItemStack[] { new ItemStack(Material.BUCKET), new ItemStack(Material.NETHERRACK, 16) }, new ItemStack[] { new ItemStack(Material.LAVA_BUCKET) }); - registerRecipe(8, new ItemStack[] { new ItemStack(Material.BUCKET), new ItemStack(Material.STONE, 12) }, new ItemStack[] { new ItemStack(Material.LAVA_BUCKET) }); - registerRecipe(8, new ItemStack[] { new ItemStack(Material.BUCKET), new ItemStack(Material.TERRACOTTA, 12) }, new ItemStack[] { new ItemStack(Material.LAVA_BUCKET) }); - registerRecipe(10, new ItemStack[] { new ItemStack(Material.BUCKET), new ItemStack(Material.OBSIDIAN) }, new ItemStack[] { new ItemStack(Material.LAVA_BUCKET) }); + registerRecipe(10, new ItemStack[] { ItemStack.of(Material.BUCKET), ItemStack.of(Material.COBBLESTONE, 16) }, new ItemStack[] { ItemStack.of(Material.LAVA_BUCKET) }); + registerRecipe(8, new ItemStack[] { ItemStack.of(Material.BUCKET), ItemStack.of(Material.NETHERRACK, 16) }, new ItemStack[] { ItemStack.of(Material.LAVA_BUCKET) }); + registerRecipe(8, new ItemStack[] { ItemStack.of(Material.BUCKET), ItemStack.of(Material.STONE, 12) }, new ItemStack[] { ItemStack.of(Material.LAVA_BUCKET) }); + registerRecipe(8, new ItemStack[] { ItemStack.of(Material.BUCKET), ItemStack.of(Material.TERRACOTTA, 12) }, new ItemStack[] { ItemStack.of(Material.LAVA_BUCKET) }); + registerRecipe(10, new ItemStack[] { ItemStack.of(Material.BUCKET), ItemStack.of(Material.OBSIDIAN) }, new ItemStack[] { ItemStack.of(Material.LAVA_BUCKET) }); for (Material terracotta : SlimefunTag.TERRACOTTA.getValues()) { - registerRecipe(8, new ItemStack[] { new ItemStack(Material.BUCKET), new ItemStack(terracotta, 12) }, new ItemStack[] { new ItemStack(Material.LAVA_BUCKET) }); + registerRecipe(8, new ItemStack[] { ItemStack.of(Material.BUCKET), ItemStack.of(terracotta, 12) }, new ItemStack[] { ItemStack.of(Material.LAVA_BUCKET) }); } for (Material leaves : Tag.LEAVES.getValues()) { - registerRecipe(10, new ItemStack[] { new ItemStack(Material.BUCKET), new ItemStack(leaves, 16) }, new ItemStack[] { new ItemStack(Material.WATER_BUCKET) }); + registerRecipe(10, new ItemStack[] { ItemStack.of(Material.BUCKET), ItemStack.of(leaves, 16) }, new ItemStack[] { ItemStack.of(Material.WATER_BUCKET) }); } - registerRecipe(10, new ItemStack[] { new ItemStack(Material.BUCKET), new ItemStack(Material.BLACKSTONE, 8) }, new ItemStack[] { new ItemStack(Material.LAVA_BUCKET) }); - registerRecipe(10, new ItemStack[] { new ItemStack(Material.BUCKET), new ItemStack(Material.BASALT, 12) }, new ItemStack[] { new ItemStack(Material.LAVA_BUCKET) }); + registerRecipe(10, new ItemStack[] { ItemStack.of(Material.BUCKET), ItemStack.of(Material.BLACKSTONE, 8) }, new ItemStack[] { ItemStack.of(Material.LAVA_BUCKET) }); + registerRecipe(10, new ItemStack[] { ItemStack.of(Material.BUCKET), ItemStack.of(Material.BASALT, 12) }, new ItemStack[] { ItemStack.of(Material.LAVA_BUCKET) }); if (Slimefun.getMinecraftVersion().isAtLeast(MinecraftVersion.MINECRAFT_1_17)) { - registerRecipe(10, new ItemStack[] { new ItemStack(Material.BUCKET), new ItemStack(Material.COBBLED_DEEPSLATE, 12) }, new ItemStack[] { new ItemStack(Material.LAVA_BUCKET) }); - registerRecipe(10, new ItemStack[] { new ItemStack(Material.BUCKET), new ItemStack(Material.DEEPSLATE, 10) }, new ItemStack[] { new ItemStack(Material.LAVA_BUCKET) }); - registerRecipe(10, new ItemStack[] { new ItemStack(Material.BUCKET), new ItemStack(Material.TUFF, 8) }, new ItemStack[] { new ItemStack(Material.LAVA_BUCKET) }); + registerRecipe(10, new ItemStack[] { ItemStack.of(Material.BUCKET), ItemStack.of(Material.COBBLED_DEEPSLATE, 12) }, new ItemStack[] { ItemStack.of(Material.LAVA_BUCKET) }); + registerRecipe(10, new ItemStack[] { ItemStack.of(Material.BUCKET), ItemStack.of(Material.DEEPSLATE, 10) }, new ItemStack[] { ItemStack.of(Material.LAVA_BUCKET) }); + registerRecipe(10, new ItemStack[] { ItemStack.of(Material.BUCKET), ItemStack.of(Material.TUFF, 8) }, new ItemStack[] { ItemStack.of(Material.LAVA_BUCKET) }); } } @@ -52,7 +52,7 @@ public String getMachineIdentifier() { @Override public ItemStack getProgressBar() { - return new ItemStack(Material.FLINT_AND_STEEL); + return ItemStack.of(Material.FLINT_AND_STEEL); } } diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/machines/FluidPump.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/machines/FluidPump.java index 729fd2ff51..b52a37be44 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/machines/FluidPump.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/machines/FluidPump.java @@ -57,8 +57,8 @@ public class FluidPump extends SimpleSlimefunItem implements Invent private final int[] inputBorder = { 9, 10, 11, 12, 18, 21, 27, 28, 29, 30 }; private final int[] outputBorder = { 14, 15, 16, 17, 23, 26, 32, 33, 34, 35 }; - private final ItemStack emptyBucket = ItemStackWrapper.wrap(new ItemStack(Material.BUCKET)); - private final ItemStack emptyBottle = ItemStackWrapper.wrap(new ItemStack(Material.GLASS_BOTTLE)); + private final ItemStack emptyBucket = ItemStackWrapper.wrap(ItemStack.of(Material.BUCKET)); + private final ItemStack emptyBottle = ItemStackWrapper.wrap(ItemStack.of(Material.GLASS_BOTTLE)); @ParametersAreNonnullByDefault public FluidPump(ItemGroup itemGroup, SlimefunItemStack item, RecipeType recipeType, ItemStack[] recipe) { @@ -202,7 +202,7 @@ private Block findNextFluid(@Nonnull Block fluid) { switch (fluid.getType()) { case WATER: case BUBBLE_COLUMN: - ItemStack waterBottle = new ItemStack(Material.POTION); + ItemStack waterBottle = ItemStack.of(Material.POTION); PotionMeta meta = (PotionMeta) waterBottle.getItemMeta(); if (Slimefun.getMinecraftVersion().isBefore(20, 2)) { meta.setBasePotionData(new PotionData(PotionType.WATER)); @@ -212,18 +212,18 @@ private Block findNextFluid(@Nonnull Block fluid) { waterBottle.setItemMeta(meta); return waterBottle; default: - return new ItemStack(Material.GLASS_BOTTLE); + return ItemStack.of(Material.GLASS_BOTTLE); } } private @Nonnull ItemStack getFilledBucket(@Nonnull Block fluid) { return switch (fluid.getType()) { - case LAVA -> new ItemStack(Material.LAVA_BUCKET); + case LAVA -> ItemStack.of(Material.LAVA_BUCKET); case WATER, - BUBBLE_COLUMN -> new ItemStack(Material.WATER_BUCKET); + BUBBLE_COLUMN -> ItemStack.of(Material.WATER_BUCKET); default -> // Fallback for any new liquids - new ItemStack(Material.BUCKET); + ItemStack.of(Material.BUCKET); }; } diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/machines/FoodComposter.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/machines/FoodComposter.java index 04f70d5490..8890a2b787 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/machines/FoodComposter.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/machines/FoodComposter.java @@ -40,7 +40,7 @@ public String getMachineIdentifier() { @Override public ItemStack getProgressBar() { - return new ItemStack(Material.GOLDEN_HOE); + return ItemStack.of(Material.GOLDEN_HOE); } } diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/machines/FoodFabricator.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/machines/FoodFabricator.java index a22efe9f1a..dcf159504c 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/machines/FoodFabricator.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/machines/FoodFabricator.java @@ -19,17 +19,17 @@ public FoodFabricator(ItemGroup itemGroup, SlimefunItemStack item, RecipeType re @Override protected void registerDefaultRecipes() { - registerRecipe(12, new ItemStack[] { SlimefunItems.TIN_CAN, new ItemStack(Material.WHEAT) }, new ItemStack[] { new SlimefunItemStack(SlimefunItems.WHEAT_ORGANIC_FOOD, OrganicFood.OUTPUT) }); - registerRecipe(12, new ItemStack[] { SlimefunItems.TIN_CAN, new ItemStack(Material.CARROT) }, new ItemStack[] { new SlimefunItemStack(SlimefunItems.CARROT_ORGANIC_FOOD, OrganicFood.OUTPUT) }); - registerRecipe(12, new ItemStack[] { SlimefunItems.TIN_CAN, new ItemStack(Material.POTATO) }, new ItemStack[] { new SlimefunItemStack(SlimefunItems.POTATO_ORGANIC_FOOD, OrganicFood.OUTPUT) }); - registerRecipe(12, new ItemStack[] { SlimefunItems.TIN_CAN, new ItemStack(Material.WHEAT_SEEDS) }, new ItemStack[] { new SlimefunItemStack(SlimefunItems.SEEDS_ORGANIC_FOOD, OrganicFood.OUTPUT) }); - registerRecipe(12, new ItemStack[] { SlimefunItems.TIN_CAN, new ItemStack(Material.BEETROOT) }, new ItemStack[] { new SlimefunItemStack(SlimefunItems.BEETROOT_ORGANIC_FOOD, OrganicFood.OUTPUT) }); - registerRecipe(12, new ItemStack[] { SlimefunItems.TIN_CAN, new ItemStack(Material.MELON_SLICE) }, new ItemStack[] { new SlimefunItemStack(SlimefunItems.MELON_ORGANIC_FOOD, OrganicFood.OUTPUT) }); - registerRecipe(12, new ItemStack[] { SlimefunItems.TIN_CAN, new ItemStack(Material.APPLE) }, new ItemStack[] { new SlimefunItemStack(SlimefunItems.APPLE_ORGANIC_FOOD, OrganicFood.OUTPUT) }); - registerRecipe(12, new ItemStack[] { SlimefunItems.TIN_CAN, new ItemStack(Material.DRIED_KELP) }, new ItemStack[] { new SlimefunItemStack(SlimefunItems.KELP_ORGANIC_FOOD, OrganicFood.OUTPUT) }); - registerRecipe(12, new ItemStack[] { SlimefunItems.TIN_CAN, new ItemStack(Material.COCOA_BEANS) }, new ItemStack[] { new SlimefunItemStack(SlimefunItems.COCOA_ORGANIC_FOOD, OrganicFood.OUTPUT) }); - registerRecipe(12, new ItemStack[] { SlimefunItems.TIN_CAN, new ItemStack(Material.SWEET_BERRIES) }, new ItemStack[] { new SlimefunItemStack(SlimefunItems.SWEET_BERRIES_ORGANIC_FOOD, OrganicFood.OUTPUT) }); - registerRecipe(12, new ItemStack[] { SlimefunItems.TIN_CAN, new ItemStack(Material.SEAGRASS) }, new ItemStack[] { new SlimefunItemStack(SlimefunItems.SEAGRASS_ORGANIC_FOOD, OrganicFood.OUTPUT) }); + registerRecipe(12, new ItemStack[] { SlimefunItems.TIN_CAN, ItemStack.of(Material.WHEAT) }, new ItemStack[] { new SlimefunItemStack(SlimefunItems.WHEAT_ORGANIC_FOOD, OrganicFood.OUTPUT) }); + registerRecipe(12, new ItemStack[] { SlimefunItems.TIN_CAN, ItemStack.of(Material.CARROT) }, new ItemStack[] { new SlimefunItemStack(SlimefunItems.CARROT_ORGANIC_FOOD, OrganicFood.OUTPUT) }); + registerRecipe(12, new ItemStack[] { SlimefunItems.TIN_CAN, ItemStack.of(Material.POTATO) }, new ItemStack[] { new SlimefunItemStack(SlimefunItems.POTATO_ORGANIC_FOOD, OrganicFood.OUTPUT) }); + registerRecipe(12, new ItemStack[] { SlimefunItems.TIN_CAN, ItemStack.of(Material.WHEAT_SEEDS) }, new ItemStack[] { new SlimefunItemStack(SlimefunItems.SEEDS_ORGANIC_FOOD, OrganicFood.OUTPUT) }); + registerRecipe(12, new ItemStack[] { SlimefunItems.TIN_CAN, ItemStack.of(Material.BEETROOT) }, new ItemStack[] { new SlimefunItemStack(SlimefunItems.BEETROOT_ORGANIC_FOOD, OrganicFood.OUTPUT) }); + registerRecipe(12, new ItemStack[] { SlimefunItems.TIN_CAN, ItemStack.of(Material.MELON_SLICE) }, new ItemStack[] { new SlimefunItemStack(SlimefunItems.MELON_ORGANIC_FOOD, OrganicFood.OUTPUT) }); + registerRecipe(12, new ItemStack[] { SlimefunItems.TIN_CAN, ItemStack.of(Material.APPLE) }, new ItemStack[] { new SlimefunItemStack(SlimefunItems.APPLE_ORGANIC_FOOD, OrganicFood.OUTPUT) }); + registerRecipe(12, new ItemStack[] { SlimefunItems.TIN_CAN, ItemStack.of(Material.DRIED_KELP) }, new ItemStack[] { new SlimefunItemStack(SlimefunItems.KELP_ORGANIC_FOOD, OrganicFood.OUTPUT) }); + registerRecipe(12, new ItemStack[] { SlimefunItems.TIN_CAN, ItemStack.of(Material.COCOA_BEANS) }, new ItemStack[] { new SlimefunItemStack(SlimefunItems.COCOA_ORGANIC_FOOD, OrganicFood.OUTPUT) }); + registerRecipe(12, new ItemStack[] { SlimefunItems.TIN_CAN, ItemStack.of(Material.SWEET_BERRIES) }, new ItemStack[] { new SlimefunItemStack(SlimefunItems.SWEET_BERRIES_ORGANIC_FOOD, OrganicFood.OUTPUT) }); + registerRecipe(12, new ItemStack[] { SlimefunItems.TIN_CAN, ItemStack.of(Material.SEAGRASS) }, new ItemStack[] { new SlimefunItemStack(SlimefunItems.SEAGRASS_ORGANIC_FOOD, OrganicFood.OUTPUT) }); } @Override @@ -39,7 +39,7 @@ public String getMachineIdentifier() { @Override public ItemStack getProgressBar() { - return new ItemStack(Material.GOLDEN_HOE); + return ItemStack.of(Material.GOLDEN_HOE); } } diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/machines/Freezer.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/machines/Freezer.java index c2ad401d80..a397b692a5 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/machines/Freezer.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/machines/Freezer.java @@ -39,19 +39,19 @@ public Freezer(ItemGroup itemGroup, SlimefunItemStack item, RecipeType recipeTyp protected void registerDefaultRecipes() { // This if statement makes the transformation follow Minecraft logic if (useVanillaRatios.getValue()) { - registerRecipe(4, new ItemStack[] { new ItemStack(Material.ICE, 9) }, new ItemStack[] { new ItemStack(Material.PACKED_ICE) }); - registerRecipe(6, new ItemStack[] { new ItemStack(Material.PACKED_ICE, 9) }, new ItemStack[] { new ItemStack(Material.BLUE_ICE) }); + registerRecipe(4, new ItemStack[] { ItemStack.of(Material.ICE, 9) }, new ItemStack[] { ItemStack.of(Material.PACKED_ICE) }); + registerRecipe(6, new ItemStack[] { ItemStack.of(Material.PACKED_ICE, 9) }, new ItemStack[] { ItemStack.of(Material.BLUE_ICE) }); } else { - registerRecipe(4, new ItemStack[] { new ItemStack(Material.ICE) }, new ItemStack[] { new ItemStack(Material.PACKED_ICE) }); - registerRecipe(6, new ItemStack[] { new ItemStack(Material.PACKED_ICE) }, new ItemStack[] { new ItemStack(Material.BLUE_ICE) }); + registerRecipe(4, new ItemStack[] { ItemStack.of(Material.ICE) }, new ItemStack[] { ItemStack.of(Material.PACKED_ICE) }); + registerRecipe(6, new ItemStack[] { ItemStack.of(Material.PACKED_ICE) }, new ItemStack[] { ItemStack.of(Material.BLUE_ICE) }); } - registerRecipe(2, new ItemStack[] { new ItemStack(Material.WATER_BUCKET) }, new ItemStack[] { new ItemStack(Material.BUCKET), new ItemStack(Material.ICE) }); - registerRecipe(8, new ItemStack[] { new ItemStack(Material.LAVA_BUCKET) }, new ItemStack[] { new ItemStack(Material.BUCKET), new ItemStack(Material.OBSIDIAN) }); - registerRecipe(8, new ItemStack[] { new ItemStack(Material.BLUE_ICE) }, new ItemStack[] { SlimefunItems.REACTOR_COOLANT_CELL }); - registerRecipe(6, new ItemStack[] { new ItemStack(Material.SNOW_BLOCK, 2) }, new ItemStack[] { new ItemStack(Material.ICE) }); - registerRecipe(6, new ItemStack[] { new ItemStack(Material.MAGMA_CREAM) }, new ItemStack[] { new ItemStack(Material.SLIME_BALL) }); - registerRecipe(6, new ItemStack[] { new ItemStack(Material.MAGMA_BLOCK, 2) }, new ItemStack[] { new ItemStack(Material.SLIME_BLOCK) }); + registerRecipe(2, new ItemStack[] { ItemStack.of(Material.WATER_BUCKET) }, new ItemStack[] { ItemStack.of(Material.BUCKET), ItemStack.of(Material.ICE) }); + registerRecipe(8, new ItemStack[] { ItemStack.of(Material.LAVA_BUCKET) }, new ItemStack[] { ItemStack.of(Material.BUCKET), ItemStack.of(Material.OBSIDIAN) }); + registerRecipe(8, new ItemStack[] { ItemStack.of(Material.BLUE_ICE) }, new ItemStack[] { SlimefunItems.REACTOR_COOLANT_CELL }); + registerRecipe(6, new ItemStack[] { ItemStack.of(Material.SNOW_BLOCK, 2) }, new ItemStack[] { ItemStack.of(Material.ICE) }); + registerRecipe(6, new ItemStack[] { ItemStack.of(Material.MAGMA_CREAM) }, new ItemStack[] { ItemStack.of(Material.SLIME_BALL) }); + registerRecipe(6, new ItemStack[] { ItemStack.of(Material.MAGMA_BLOCK, 2) }, new ItemStack[] { ItemStack.of(Material.SLIME_BLOCK) }); } @Override @@ -68,7 +68,7 @@ public List getDisplayRecipes() { @Override public ItemStack getProgressBar() { - return new ItemStack(Material.GOLDEN_PICKAXE); + return ItemStack.of(Material.GOLDEN_PICKAXE); } @Override diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/machines/HeatedPressureChamber.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/machines/HeatedPressureChamber.java index 97505f6dd8..adc3f37427 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/machines/HeatedPressureChamber.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/machines/HeatedPressureChamber.java @@ -88,7 +88,7 @@ protected void registerDefaultRecipes() { registerRecipe(45, new ItemStack[] { SlimefunItems.OIL_BUCKET }, new ItemStack[] { new CustomItemStack(SlimefunItems.PLASTIC_SHEET, 8) }); registerRecipe(30, new ItemStack[] { SlimefunItems.GOLD_24K, SlimefunItems.URANIUM }, new ItemStack[] { SlimefunItems.BLISTERING_INGOT }); registerRecipe(30, new ItemStack[] { SlimefunItems.BLISTERING_INGOT, SlimefunItems.CARBONADO }, new ItemStack[] { SlimefunItems.BLISTERING_INGOT_2 }); - registerRecipe(60, new ItemStack[] { SlimefunItems.BLISTERING_INGOT_2, new ItemStack(Material.NETHER_STAR) }, new ItemStack[] { SlimefunItems.BLISTERING_INGOT_3 }); + registerRecipe(60, new ItemStack[] { SlimefunItems.BLISTERING_INGOT_2, ItemStack.of(Material.NETHER_STAR) }, new ItemStack[] { SlimefunItems.BLISTERING_INGOT_3 }); registerRecipe(90, new ItemStack[] { SlimefunItems.PLUTONIUM, SlimefunItems.URANIUM }, new ItemStack[] { SlimefunItems.BOOSTED_URANIUM }); registerRecipe(60, new ItemStack[] { SlimefunItems.NETHER_ICE, SlimefunItems.PLUTONIUM }, new ItemStack[] { new CustomItemStack(SlimefunItems.ENRICHED_NETHER_ICE, 4) }); registerRecipe(45, new ItemStack[] { SlimefunItems.ENRICHED_NETHER_ICE }, new ItemStack[] { new CustomItemStack(SlimefunItems.NETHER_ICE_COOLANT_CELL, 8) }); @@ -97,7 +97,7 @@ protected void registerDefaultRecipes() { @Override public ItemStack getProgressBar() { - return new ItemStack(Material.FLINT_AND_STEEL); + return ItemStack.of(Material.FLINT_AND_STEEL); } @Override diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/machines/Refinery.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/machines/Refinery.java index 98cc035072..4f157a91ff 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/machines/Refinery.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/machines/Refinery.java @@ -24,7 +24,7 @@ protected void registerDefaultRecipes() { @Override public ItemStack getProgressBar() { - return new ItemStack(Material.FLINT_AND_STEEL); + return ItemStack.of(Material.FLINT_AND_STEEL); } @Override diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/machines/enchanting/AutoDisenchanter.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/machines/enchanting/AutoDisenchanter.java index 61f38c5b75..3b3f817f4e 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/machines/enchanting/AutoDisenchanter.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/machines/enchanting/AutoDisenchanter.java @@ -53,7 +53,7 @@ public AutoDisenchanter(ItemGroup itemGroup, SlimefunItemStack item, RecipeType @Override public ItemStack getProgressBar() { - return new ItemStack(Material.DIAMOND_CHESTPLATE); + return ItemStack.of(Material.DIAMOND_CHESTPLATE); } @Override @@ -106,7 +106,7 @@ protected MachineRecipe findNextRecipe(BlockMenu menu) { ItemStack disenchantedItem = item.clone(); disenchantedItem.setAmount(1); - ItemStack enchantedBook = new ItemStack(Material.ENCHANTED_BOOK); + ItemStack enchantedBook = ItemStack.of(Material.ENCHANTED_BOOK); transferEnchantments(disenchantedItem, enchantedBook, enchantments); MachineRecipe recipe = new MachineRecipe(90 * enchantments.size() / this.getSpeed(), new ItemStack[] { book, item }, new ItemStack[] { disenchantedItem, enchantedBook }); diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/machines/enchanting/AutoEnchanter.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/machines/enchanting/AutoEnchanter.java index db11586454..7e942e33ab 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/machines/enchanting/AutoEnchanter.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/machines/enchanting/AutoEnchanter.java @@ -51,7 +51,7 @@ public AutoEnchanter(ItemGroup itemGroup, SlimefunItemStack item, RecipeType rec @Override public ItemStack getProgressBar() { - return new ItemStack(Material.GOLDEN_CHESTPLATE); + return ItemStack.of(Material.GOLDEN_CHESTPLATE); } @Override @@ -138,7 +138,7 @@ protected MachineRecipe enchant(BlockMenu menu, ItemStack target, ItemStack ench enchantedItem.setAmount(1); enchantedItem.addUnsafeEnchantments(enchantments); - MachineRecipe recipe = new MachineRecipe(75 * enchantments.size() / getSpeed(), new ItemStack[] { target, enchantedBook }, new ItemStack[] { enchantedItem, new ItemStack(Material.BOOK) }); + MachineRecipe recipe = new MachineRecipe(75 * enchantments.size() / getSpeed(), new ItemStack[] { target, enchantedBook }, new ItemStack[] { enchantedItem, ItemStack.of(Material.BOOK) }); if (!InvUtils.fitAll(menu.toInventory(), recipe.getOutput(), getOutputSlots())) { return null; diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/machines/enchanting/BookBinder.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/machines/enchanting/BookBinder.java index 4ac521faa2..1bdf5ada8c 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/machines/enchanting/BookBinder.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/machines/enchanting/BookBinder.java @@ -61,7 +61,7 @@ protected MachineRecipe findNextRecipe(BlockMenu menu) { return null; } - ItemStack book = new ItemStack(Material.ENCHANTED_BOOK); + ItemStack book = ItemStack.of(Material.ENCHANTED_BOOK); EnchantmentStorageMeta enchantMeta = (EnchantmentStorageMeta) book.getItemMeta(); @@ -121,7 +121,7 @@ private boolean hasIllegalEnchants(@Nullable Map enchantme @Override public ItemStack getProgressBar() { - return new ItemStack(Material.IRON_CHESTPLATE); + return ItemStack.of(Material.IRON_CHESTPLATE); } @Override diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/machines/entities/AutoBreeder.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/machines/entities/AutoBreeder.java index e62fd7951d..f7ab17c61b 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/machines/entities/AutoBreeder.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/machines/entities/AutoBreeder.java @@ -65,7 +65,7 @@ public void onBlockBreak(Block b) { protected void constructMenu(BlockMenuPreset preset) { for (int i : border) { - preset.addItem(i, new CustomItemStack(new ItemStack(Material.CYAN_STAINED_GLASS_PANE), " "), (p, slot, item, action) -> false); + preset.addItem(i, new CustomItemStack(ItemStack.of(Material.CYAN_STAINED_GLASS_PANE), " "), (p, slot, item, action) -> false); } } diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/machines/entities/IronGolemAssembler.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/machines/entities/IronGolemAssembler.java index c38602e441..20a0f3ab46 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/machines/entities/IronGolemAssembler.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/machines/entities/IronGolemAssembler.java @@ -45,7 +45,7 @@ public int getEnergyConsumption() { @Override public ItemStack getHead() { - return new ItemStack(Material.CARVED_PUMPKIN); + return ItemStack.of(Material.CARVED_PUMPKIN); } @Override @@ -55,7 +55,7 @@ public Material getHeadBorder() { @Override public ItemStack getBody() { - return new ItemStack(Material.IRON_BLOCK, 4); + return ItemStack.of(Material.IRON_BLOCK, 4); } @Override diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/machines/entities/ProduceCollector.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/machines/entities/ProduceCollector.java index 24ecf5d86d..e7ed856f71 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/machines/entities/ProduceCollector.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/machines/entities/ProduceCollector.java @@ -63,7 +63,7 @@ public ProduceCollector(ItemGroup itemGroup, SlimefunItemStack item, RecipeType @Override protected void registerDefaultRecipes() { // Milk from adult cows and goats - addProduce(new AnimalProduce(new ItemStack(Material.BUCKET), new ItemStack(Material.MILK_BUCKET), n -> { + addProduce(new AnimalProduce(ItemStack.of(Material.BUCKET), ItemStack.of(Material.MILK_BUCKET), n -> { MinecraftVersion version = Slimefun.getMinecraftVersion(); if (n instanceof Cow || (version.isAtLeast(MinecraftVersion.MINECRAFT_1_17) && n instanceof Goat)) { @@ -74,7 +74,7 @@ protected void registerDefaultRecipes() { })); // Mushroom Stew from Mooshrooms - addProduce(new AnimalProduce(new ItemStack(Material.BOWL), new ItemStack(Material.MUSHROOM_STEW), n -> { + addProduce(new AnimalProduce(ItemStack.of(Material.BOWL), ItemStack.of(Material.MUSHROOM_STEW), n -> { if (n instanceof MushroomCow mushroomCow) { return mushroomCow.isAdult(); } else { @@ -117,15 +117,15 @@ public boolean isSynchronized() { List displayRecipes = new ArrayList<>(); displayRecipes.add(new CustomItemStack(Material.BUCKET, null, "&fRequires &bCow &fnearby")); - displayRecipes.add(new ItemStack(Material.MILK_BUCKET)); + displayRecipes.add(ItemStack.of(Material.MILK_BUCKET)); if (Slimefun.getMinecraftVersion().isAtLeast(MinecraftVersion.MINECRAFT_1_17)) { displayRecipes.add(new CustomItemStack(Material.BUCKET, null, "&fRequires &bGoat &fnearby")); - displayRecipes.add(new ItemStack(Material.MILK_BUCKET)); + displayRecipes.add(ItemStack.of(Material.MILK_BUCKET)); } displayRecipes.add(new CustomItemStack(Material.BOWL, null, "&fRequires &bMooshroom &fnearby")); - displayRecipes.add(new ItemStack(Material.MUSHROOM_STEW)); + displayRecipes.add(ItemStack.of(Material.MUSHROOM_STEW)); return displayRecipes; } @@ -172,7 +172,7 @@ private boolean isValidAnimal(Entity n, Predicate predicate) { @Override public @Nonnull ItemStack getProgressBar() { - return new ItemStack(Material.SHEARS); + return ItemStack.of(Material.SHEARS); } } diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/machines/entities/WitherAssembler.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/machines/entities/WitherAssembler.java index cc2c336672..65bf124bb1 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/machines/entities/WitherAssembler.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/machines/entities/WitherAssembler.java @@ -43,7 +43,7 @@ public int getEnergyConsumption() { @Override public ItemStack getHead() { - return new ItemStack(Material.WITHER_SKELETON_SKULL, 3); + return ItemStack.of(Material.WITHER_SKELETON_SKULL, 3); } @Override @@ -53,7 +53,7 @@ public Material getHeadBorder() { @Override public ItemStack getBody() { - return new ItemStack(Material.SOUL_SAND, 4); + return ItemStack.of(Material.SOUL_SAND, 4); } @Override diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/reactors/NetherStarReactor.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/reactors/NetherStarReactor.java index 47f671ac83..3f2512876c 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/reactors/NetherStarReactor.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/electric/reactors/NetherStarReactor.java @@ -37,7 +37,7 @@ protected NetherStarReactor(ItemGroup itemGroup, SlimefunItemStack item, RecipeT @Override protected void registerDefaultFuelTypes() { - registerFuel(new MachineFuel(1800, new ItemStack(Material.NETHER_STAR))); + registerFuel(new MachineFuel(1800, ItemStack.of(Material.NETHER_STAR))); } @Override @@ -58,12 +58,12 @@ public ItemStack getCoolant() { @Override public ItemStack getFuelIcon() { - return new ItemStack(Material.NETHER_STAR); + return ItemStack.of(Material.NETHER_STAR); } @Override public ItemStack getProgressBar() { - return new ItemStack(Material.NETHER_STAR); + return ItemStack.of(Material.NETHER_STAR); } } diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/food/Juice.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/food/Juice.java index f8b61543e1..dbf02d3885 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/food/Juice.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/food/Juice.java @@ -88,13 +88,13 @@ private void removeGlassBottle(Player p, ItemStack item) { if (p.getInventory().getItemInMainHand().getAmount() == 1) { p.getEquipment().getItemInMainHand().setAmount(0); } else { - p.getInventory().removeItem(new ItemStack(Material.GLASS_BOTTLE, 1)); + p.getInventory().removeItem(ItemStack.of(Material.GLASS_BOTTLE, 1)); } } else if (SlimefunUtils.isItemSimilar(item, p.getInventory().getItemInOffHand(), true)) { if (p.getInventory().getItemInOffHand().getAmount() == 1) { p.getEquipment().getItemInOffHand().setAmount(0); } else { - p.getInventory().removeItem(new ItemStack(Material.GLASS_BOTTLE, 1)); + p.getInventory().removeItem(ItemStack.of(Material.GLASS_BOTTLE, 1)); } } } diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/geo/GEOMiner.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/geo/GEOMiner.java index d21815533b..4985c3da6b 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/geo/GEOMiner.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/geo/GEOMiner.java @@ -67,7 +67,7 @@ public class GEOMiner extends SlimefunItem implements RecipeDisplayItem, EnergyN public GEOMiner(ItemGroup itemGroup, SlimefunItemStack item, RecipeType recipeType, ItemStack[] recipe) { super(itemGroup, item, recipeType, recipe); - processor.setProgressBar(new ItemStack(Material.DIAMOND_PICKAXE)); + processor.setProgressBar(ItemStack.of(Material.DIAMOND_PICKAXE)); createPreset(this, getItemName(), this::constructMenu); addItemHandler(onBlockPlace(), onBlockBreak()); } diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/geo/OilPump.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/geo/OilPump.java index 4422117526..8db2570f6d 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/geo/OilPump.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/geo/OilPump.java @@ -32,7 +32,7 @@ public class OilPump extends AContainer implements RecipeDisplayItem { private final GEOResource oil; - private final ItemStack emptyBucket = new ItemStack(Material.BUCKET); + private final ItemStack emptyBucket = ItemStack.of(Material.BUCKET); @ParametersAreNonnullByDefault public OilPump(ItemGroup itemGroup, SlimefunItemStack item, RecipeType recipeType, ItemStack[] recipe) { @@ -84,7 +84,7 @@ public String getMachineIdentifier() { @Override public ItemStack getProgressBar() { - return new ItemStack(Material.DIAMOND_SHOVEL); + return ItemStack.of(Material.DIAMOND_SHOVEL); } @Override diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/magical/runes/EnchantmentRune.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/magical/runes/EnchantmentRune.java index 33e54e7544..e3c73aece4 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/magical/runes/EnchantmentRune.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/magical/runes/EnchantmentRune.java @@ -59,7 +59,7 @@ public EnchantmentRune(ItemGroup itemGroup, SlimefunItemStack item, RecipeType r continue; } - if (enchantment.canEnchantItem(new ItemStack(mat))) { + if (enchantment.canEnchantItem(ItemStack.of(mat))) { enchantments.add(enchantment); } } diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/misc/OrganicFood.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/misc/OrganicFood.java index ac46b6e356..9f84ad152f 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/misc/OrganicFood.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/misc/OrganicFood.java @@ -28,6 +28,6 @@ public class OrganicFood extends SlimefunItem { @ParametersAreNonnullByDefault public OrganicFood(ItemGroup itemGroup, SlimefunItemStack item, Material ingredient) { - super(itemGroup, item, RecipeType.FOOD_FABRICATOR, new ItemStack[] { SlimefunItems.TIN_CAN, new ItemStack(ingredient), null, null, null, null, null, null, null }, new SlimefunItemStack(item, OUTPUT)); + super(itemGroup, item, RecipeType.FOOD_FABRICATOR, new ItemStack[] { SlimefunItems.TIN_CAN, ItemStack.of(ingredient), null, null, null, null, null, null, null }, new SlimefunItemStack(item, OUTPUT)); } } diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/multiblocks/ArmorForge.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/multiblocks/ArmorForge.java index 4ee70ac722..99a1fa3603 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/multiblocks/ArmorForge.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/multiblocks/ArmorForge.java @@ -29,7 +29,7 @@ public class ArmorForge extends AbstractCraftingTable { @ParametersAreNonnullByDefault public ArmorForge(ItemGroup itemGroup, SlimefunItemStack item) { - super(itemGroup, item, new ItemStack[] { null, null, null, null, new ItemStack(Material.ANVIL), null, null, new CustomItemStack(Material.DISPENSER, "Dispenser (Facing up)"), null }, BlockFace.SELF); + super(itemGroup, item, new ItemStack[] { null, null, null, null, ItemStack.of(Material.ANVIL), null, null, new CustomItemStack(Material.DISPENSER, "Dispenser (Facing up)"), null }, BlockFace.SELF); } @Override diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/multiblocks/AutomatedPanningMachine.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/multiblocks/AutomatedPanningMachine.java index ca2d0c7124..ebd5025f42 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/multiblocks/AutomatedPanningMachine.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/multiblocks/AutomatedPanningMachine.java @@ -48,7 +48,7 @@ public class AutomatedPanningMachine extends MultiBlockMachine { @ParametersAreNonnullByDefault public AutomatedPanningMachine(ItemGroup itemGroup, SlimefunItemStack item) { - super(itemGroup, item, new ItemStack[] { null, null, null, null, new ItemStack(Material.OAK_TRAPDOOR), null, null, new ItemStack(Material.CAULDRON), null }, BlockFace.SELF); + super(itemGroup, item, new ItemStack[] { null, null, null, null, ItemStack.of(Material.OAK_TRAPDOOR), null, null, ItemStack.of(Material.CAULDRON), null }, BlockFace.SELF); } @Override diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/multiblocks/Compressor.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/multiblocks/Compressor.java index f0b48882e6..59517da646 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/multiblocks/Compressor.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/multiblocks/Compressor.java @@ -32,22 +32,22 @@ public class Compressor extends MultiBlockMachine { @ParametersAreNonnullByDefault public Compressor(ItemGroup itemGroup, SlimefunItemStack item) { - super(itemGroup, item, new ItemStack[] { null, null, null, null, new ItemStack(Material.NETHER_BRICK_FENCE), null, new ItemStack(Material.PISTON), new CustomItemStack(Material.DISPENSER, "Dispenser (Facing up)"), new ItemStack(Material.PISTON) }, BlockFace.SELF); + super(itemGroup, item, new ItemStack[] { null, null, null, null, ItemStack.of(Material.NETHER_BRICK_FENCE), null, ItemStack.of(Material.PISTON), new CustomItemStack(Material.DISPENSER, "Dispenser (Facing up)"), ItemStack.of(Material.PISTON) }, BlockFace.SELF); } @Override protected void registerDefaultRecipes(List recipes) { recipes.add(new SlimefunItemStack(SlimefunItems.STONE_CHUNK, 4)); - recipes.add(new ItemStack(Material.COBBLESTONE)); + recipes.add(ItemStack.of(Material.COBBLESTONE)); - recipes.add(new ItemStack(Material.FLINT, 8)); - recipes.add(new ItemStack(Material.COBBLESTONE)); + recipes.add(ItemStack.of(Material.FLINT, 8)); + recipes.add(ItemStack.of(Material.COBBLESTONE)); - recipes.add(new ItemStack(Material.COAL_BLOCK, 8)); + recipes.add(ItemStack.of(Material.COAL_BLOCK, 8)); recipes.add(new SlimefunItemStack(SlimefunItems.CARBON, 9)); - recipes.add(new ItemStack(Material.CHARCOAL, 4)); - recipes.add(new ItemStack(Material.COAL)); + recipes.add(ItemStack.of(Material.CHARCOAL, 4)); + recipes.add(ItemStack.of(Material.COAL)); } @Override diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/multiblocks/EnhancedCraftingTable.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/multiblocks/EnhancedCraftingTable.java index 4486197b62..a136cf6ccd 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/multiblocks/EnhancedCraftingTable.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/multiblocks/EnhancedCraftingTable.java @@ -30,7 +30,7 @@ public class EnhancedCraftingTable extends AbstractCraftingTable { @ParametersAreNonnullByDefault public EnhancedCraftingTable(ItemGroup itemGroup, SlimefunItemStack item) { - super(itemGroup, item, new ItemStack[] { null, null, null, null, new ItemStack(Material.CRAFTING_TABLE), null, null, new ItemStack(Material.DISPENSER), null }, BlockFace.SELF); + super(itemGroup, item, new ItemStack[] { null, null, null, null, ItemStack.of(Material.CRAFTING_TABLE), null, null, ItemStack.of(Material.DISPENSER), null }, BlockFace.SELF); } @Override diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/multiblocks/GrindStone.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/multiblocks/GrindStone.java index f149093042..d4b7768063 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/multiblocks/GrindStone.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/multiblocks/GrindStone.java @@ -33,65 +33,65 @@ public class GrindStone extends MultiBlockMachine { @ParametersAreNonnullByDefault public GrindStone(ItemGroup itemGroup, SlimefunItemStack item) { - super(itemGroup, item, new ItemStack[] { null, null, null, null, new ItemStack(Material.OAK_FENCE), null, null, new CustomItemStack(Material.DISPENSER, "Dispenser (Facing up)"), null }, BlockFace.SELF); + super(itemGroup, item, new ItemStack[] { null, null, null, null, ItemStack.of(Material.OAK_FENCE), null, null, new CustomItemStack(Material.DISPENSER, "Dispenser (Facing up)"), null }, BlockFace.SELF); } @Override protected void registerDefaultRecipes(@Nonnull List recipes) { - recipes.add(new ItemStack(Material.BLAZE_ROD)); - recipes.add(new ItemStack(Material.BLAZE_POWDER, 4)); + recipes.add(ItemStack.of(Material.BLAZE_ROD)); + recipes.add(ItemStack.of(Material.BLAZE_POWDER, 4)); - recipes.add(new ItemStack(Material.BONE)); - recipes.add(new ItemStack(Material.BONE_MEAL, 4)); + recipes.add(ItemStack.of(Material.BONE)); + recipes.add(ItemStack.of(Material.BONE_MEAL, 4)); - recipes.add(new ItemStack(Material.BONE_BLOCK)); - recipes.add(new ItemStack(Material.BONE_MEAL, 9)); + recipes.add(ItemStack.of(Material.BONE_BLOCK)); + recipes.add(ItemStack.of(Material.BONE_MEAL, 9)); - recipes.add(new ItemStack(Material.COBBLESTONE)); - recipes.add(new ItemStack(Material.GRAVEL)); + recipes.add(ItemStack.of(Material.COBBLESTONE)); + recipes.add(ItemStack.of(Material.GRAVEL)); - recipes.add(new ItemStack(Material.ANDESITE)); - recipes.add(new ItemStack(Material.GRAVEL)); + recipes.add(ItemStack.of(Material.ANDESITE)); + recipes.add(ItemStack.of(Material.GRAVEL)); - recipes.add(new ItemStack(Material.BLACKSTONE)); - recipes.add(new ItemStack(Material.GRAVEL)); + recipes.add(ItemStack.of(Material.BLACKSTONE)); + recipes.add(ItemStack.of(Material.GRAVEL)); - recipes.add(new ItemStack(Material.DIORITE)); - recipes.add(new ItemStack(Material.GRAVEL)); + recipes.add(ItemStack.of(Material.DIORITE)); + recipes.add(ItemStack.of(Material.GRAVEL)); - recipes.add(new ItemStack(Material.GRANITE)); - recipes.add(new ItemStack(Material.GRAVEL)); + recipes.add(ItemStack.of(Material.GRANITE)); + recipes.add(ItemStack.of(Material.GRAVEL)); - recipes.add(new ItemStack(Material.DIRT)); + recipes.add(ItemStack.of(Material.DIRT)); recipes.add(SlimefunItems.STONE_CHUNK); - recipes.add(new ItemStack(Material.SANDSTONE)); - recipes.add(new ItemStack(Material.SAND, 4)); + recipes.add(ItemStack.of(Material.SANDSTONE)); + recipes.add(ItemStack.of(Material.SAND, 4)); - recipes.add(new ItemStack(Material.RED_SANDSTONE)); - recipes.add(new ItemStack(Material.RED_SAND, 4)); + recipes.add(ItemStack.of(Material.RED_SANDSTONE)); + recipes.add(ItemStack.of(Material.RED_SAND, 4)); - recipes.add(new ItemStack(Material.PRISMARINE_BRICKS)); - recipes.add(new ItemStack(Material.PRISMARINE, 2)); + recipes.add(ItemStack.of(Material.PRISMARINE_BRICKS)); + recipes.add(ItemStack.of(Material.PRISMARINE, 2)); - recipes.add(new ItemStack(Material.PRISMARINE)); - recipes.add(new ItemStack(Material.PRISMARINE_SHARD, 4)); + recipes.add(ItemStack.of(Material.PRISMARINE)); + recipes.add(ItemStack.of(Material.PRISMARINE_SHARD, 4)); - recipes.add(new ItemStack(Material.NETHER_WART_BLOCK)); - recipes.add(new ItemStack(Material.NETHER_WART, 9)); + recipes.add(ItemStack.of(Material.NETHER_WART_BLOCK)); + recipes.add(ItemStack.of(Material.NETHER_WART, 9)); - recipes.add(new ItemStack(Material.QUARTZ_BLOCK)); - recipes.add(new ItemStack(Material.QUARTZ, 4)); + recipes.add(ItemStack.of(Material.QUARTZ_BLOCK)); + recipes.add(ItemStack.of(Material.QUARTZ, 4)); - recipes.add(new ItemStack(Material.BASALT, 2)); - recipes.add(new ItemStack(Material.BLACKSTONE)); + recipes.add(ItemStack.of(Material.BASALT, 2)); + recipes.add(ItemStack.of(Material.BLACKSTONE)); if (Slimefun.getMinecraftVersion().isAtLeast(MinecraftVersion.MINECRAFT_1_17)) { - recipes.add(new ItemStack(Material.AMETHYST_BLOCK)); - recipes.add(new ItemStack(Material.AMETHYST_SHARD, 4)); + recipes.add(ItemStack.of(Material.AMETHYST_BLOCK)); + recipes.add(ItemStack.of(Material.AMETHYST_SHARD, 4)); - recipes.add(new ItemStack(Material.COBBLED_DEEPSLATE)); - recipes.add(new ItemStack(Material.GRAVEL)); + recipes.add(ItemStack.of(Material.COBBLED_DEEPSLATE)); + recipes.add(ItemStack.of(Material.GRAVEL)); } recipes.add(SlimefunItems.MAGIC_LUMP_2); @@ -106,7 +106,7 @@ protected void registerDefaultRecipes(@Nonnull List recipes) { recipes.add(SlimefunItems.ENDER_LUMP_3); recipes.add(new SlimefunItemStack(SlimefunItems.ENDER_LUMP_2, 4)); - recipes.add(new ItemStack(Material.DIAMOND)); + recipes.add(ItemStack.of(Material.DIAMOND)); recipes.add(new SlimefunItemStack(SlimefunItems.CARBON, 4)); } diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/multiblocks/Juicer.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/multiblocks/Juicer.java index a81c731434..40e7d37c8a 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/multiblocks/Juicer.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/multiblocks/Juicer.java @@ -43,7 +43,7 @@ public class Juicer extends MultiBlockMachine { @ParametersAreNonnullByDefault public Juicer(ItemGroup itemGroup, SlimefunItemStack item) { - super(itemGroup, item, new ItemStack[] { null, new ItemStack(Material.GLASS), null, null, new ItemStack(Material.NETHER_BRICK_FENCE), null, null, new CustomItemStack(Material.DISPENSER, "Dispenser (Facing up)"), null }, BlockFace.SELF); + super(itemGroup, item, new ItemStack[] { null, ItemStack.of(Material.GLASS), null, null, ItemStack.of(Material.NETHER_BRICK_FENCE), null, null, new CustomItemStack(Material.DISPENSER, "Dispenser (Facing up)"), null }, BlockFace.SELF); } @Override diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/multiblocks/MagicWorkbench.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/multiblocks/MagicWorkbench.java index 25ce8cdcc8..cf9a9d0d3a 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/multiblocks/MagicWorkbench.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/multiblocks/MagicWorkbench.java @@ -31,7 +31,7 @@ public class MagicWorkbench extends AbstractCraftingTable { @ParametersAreNonnullByDefault public MagicWorkbench(ItemGroup itemGroup, SlimefunItemStack item) { - super(itemGroup, item, new ItemStack[] { null, null, null, null, null, null, new ItemStack(Material.BOOKSHELF), new ItemStack(Material.CRAFTING_TABLE), new ItemStack(Material.DISPENSER) }, BlockFace.UP); + super(itemGroup, item, new ItemStack[] { null, null, null, null, null, null, ItemStack.of(Material.BOOKSHELF), ItemStack.of(Material.CRAFTING_TABLE), ItemStack.of(Material.DISPENSER) }, BlockFace.UP); } @Override diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/multiblocks/MakeshiftSmeltery.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/multiblocks/MakeshiftSmeltery.java index a46b27f2d8..33931315c4 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/multiblocks/MakeshiftSmeltery.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/multiblocks/MakeshiftSmeltery.java @@ -30,7 +30,7 @@ public class MakeshiftSmeltery extends AbstractSmeltery { @ParametersAreNonnullByDefault public MakeshiftSmeltery(ItemGroup itemGroup, SlimefunItemStack item) { - super(itemGroup, item, new ItemStack[] { null, new ItemStack(Material.OAK_FENCE), null, new ItemStack(Material.BRICKS), new CustomItemStack(Material.DISPENSER, "Dispenser (Facing up)"), new ItemStack(Material.BRICKS), null, new ItemStack(Material.FLINT_AND_STEEL), null }, BlockFace.DOWN); + super(itemGroup, item, new ItemStack[] { null, ItemStack.of(Material.OAK_FENCE), null, ItemStack.of(Material.BRICKS), new CustomItemStack(Material.DISPENSER, "Dispenser (Facing up)"), ItemStack.of(Material.BRICKS), null, ItemStack.of(Material.FLINT_AND_STEEL), null }, BlockFace.DOWN); } @Override diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/multiblocks/OreCrusher.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/multiblocks/OreCrusher.java index ea5141f099..5c46709908 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/multiblocks/OreCrusher.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/multiblocks/OreCrusher.java @@ -45,18 +45,18 @@ public class OreCrusher extends MultiBlockMachine { @ParametersAreNonnullByDefault public OreCrusher(ItemGroup itemGroup, SlimefunItemStack item) { - super(itemGroup, item, new ItemStack[] { null, null, null, null, new ItemStack(Material.NETHER_BRICK_FENCE), null, new ItemStack(Material.IRON_BARS), new CustomItemStack(Material.DISPENSER, "Dispenser (Facing up)"), new ItemStack(Material.IRON_BARS) }, BlockFace.SELF); + super(itemGroup, item, new ItemStack[] { null, null, null, null, ItemStack.of(Material.NETHER_BRICK_FENCE), null, ItemStack.of(Material.IRON_BARS), new CustomItemStack(Material.DISPENSER, "Dispenser (Facing up)"), ItemStack.of(Material.IRON_BARS) }, BlockFace.SELF); addItemSetting(doubleOres); } @Override protected void registerDefaultRecipes(List recipes) { - recipes.add(new ItemStack(Material.BLACKSTONE, 8)); - recipes.add(new ItemStack(Material.RED_SAND, 1)); + recipes.add(ItemStack.of(Material.BLACKSTONE, 8)); + recipes.add(ItemStack.of(Material.RED_SAND, 1)); - recipes.add(new ItemStack(Material.COBBLESTONE, 8)); - recipes.add(new ItemStack(Material.SAND, 1)); + recipes.add(ItemStack.of(Material.COBBLESTONE, 8)); + recipes.add(ItemStack.of(Material.SAND, 1)); recipes.add(SlimefunItems.GOLD_4K); recipes.add(SlimefunItems.GOLD_DUST); @@ -91,21 +91,21 @@ protected void registerDefaultRecipes(List recipes) { recipes.add(SlimefunItems.GOLD_24K); recipes.add(new SlimefunItemStack(SlimefunItems.GOLD_DUST, 6)); - recipes.add(new ItemStack(Material.GRAVEL)); - recipes.add(new ItemStack(Material.SAND)); + recipes.add(ItemStack.of(Material.GRAVEL)); + recipes.add(ItemStack.of(Material.SAND)); - recipes.add(new ItemStack(Material.MAGMA_BLOCK)); + recipes.add(ItemStack.of(Material.MAGMA_BLOCK)); recipes.add(SlimefunItems.SULFATE); recipes.add(SlimefunItems.CARBON); - recipes.add(new ItemStack(Material.COAL, 8)); + recipes.add(ItemStack.of(Material.COAL, 8)); recipes.add(SlimefunItems.COMPRESSED_CARBON); recipes.add(new SlimefunItemStack(SlimefunItems.CARBON, 4)); if (Slimefun.getMinecraftVersion().isAtLeast(MinecraftVersion.MINECRAFT_1_17)) { - recipes.add(new ItemStack(Material.COBBLED_DEEPSLATE, 8)); - recipes.add(new ItemStack(Material.SAND, 1)); + recipes.add(ItemStack.of(Material.COBBLED_DEEPSLATE, 8)); + recipes.add(ItemStack.of(Material.SAND, 1)); } } @@ -119,31 +119,31 @@ public void postRegister() { // @formatter:off displayRecipes.addAll(Arrays.asList( - new ItemStack(Material.COAL_ORE), doubleOres.getCoal(), - new ItemStack(Material.LAPIS_ORE), doubleOres.getLapisLazuli(), - new ItemStack(Material.REDSTONE_ORE), doubleOres.getRedstone(), - new ItemStack(Material.DIAMOND_ORE), doubleOres.getDiamond(), - new ItemStack(Material.EMERALD_ORE), doubleOres.getEmerald(), - new ItemStack(Material.NETHER_QUARTZ_ORE), doubleOres.getNetherQuartz() + ItemStack.of(Material.COAL_ORE), doubleOres.getCoal(), + ItemStack.of(Material.LAPIS_ORE), doubleOres.getLapisLazuli(), + ItemStack.of(Material.REDSTONE_ORE), doubleOres.getRedstone(), + ItemStack.of(Material.DIAMOND_ORE), doubleOres.getDiamond(), + ItemStack.of(Material.EMERALD_ORE), doubleOres.getEmerald(), + ItemStack.of(Material.NETHER_QUARTZ_ORE), doubleOres.getNetherQuartz() )); // @formatter:on // Gold ore variants (1.16+) - displayRecipes.add(new ItemStack(Material.NETHER_GOLD_ORE)); + displayRecipes.add(ItemStack.of(Material.NETHER_GOLD_ORE)); displayRecipes.add(doubleOres.getGoldNuggets()); - displayRecipes.add(new ItemStack(Material.GILDED_BLACKSTONE)); + displayRecipes.add(ItemStack.of(Material.GILDED_BLACKSTONE)); displayRecipes.add(doubleOres.getGoldNuggets()); // Raw metal ores (1.17+) if (Slimefun.getMinecraftVersion().isAtLeast(MinecraftVersion.MINECRAFT_1_17)) { - displayRecipes.add(new ItemStack(Material.RAW_IRON)); + displayRecipes.add(ItemStack.of(Material.RAW_IRON)); displayRecipes.add(SlimefunItems.IRON_DUST); - displayRecipes.add(new ItemStack(Material.RAW_COPPER)); + displayRecipes.add(ItemStack.of(Material.RAW_COPPER)); displayRecipes.add(SlimefunItems.COPPER_DUST); - displayRecipes.add(new ItemStack(Material.RAW_GOLD)); + displayRecipes.add(ItemStack.of(Material.RAW_GOLD)); displayRecipes.add(SlimefunItems.GOLD_DUST); } @@ -151,25 +151,25 @@ public void postRegister() { if (Slimefun.getMinecraftVersion().isAtLeast(MinecraftVersion.MINECRAFT_1_17)) { // @formatter:off displayRecipes.addAll(Arrays.asList( - new ItemStack(Material.DEEPSLATE_COAL_ORE), doubleOres.getCoal(), - new ItemStack(Material.DEEPSLATE_LAPIS_ORE), doubleOres.getLapisLazuli(), - new ItemStack(Material.DEEPSLATE_REDSTONE_ORE), doubleOres.getRedstone(), - new ItemStack(Material.DEEPSLATE_DIAMOND_ORE), doubleOres.getDiamond(), - new ItemStack(Material.DEEPSLATE_EMERALD_ORE), doubleOres.getEmerald() + ItemStack.of(Material.DEEPSLATE_COAL_ORE), doubleOres.getCoal(), + ItemStack.of(Material.DEEPSLATE_LAPIS_ORE), doubleOres.getLapisLazuli(), + ItemStack.of(Material.DEEPSLATE_REDSTONE_ORE), doubleOres.getRedstone(), + ItemStack.of(Material.DEEPSLATE_DIAMOND_ORE), doubleOres.getDiamond(), + ItemStack.of(Material.DEEPSLATE_EMERALD_ORE), doubleOres.getEmerald() )); // @formatter:on // More deepslate ores and copper ore - displayRecipes.add(new ItemStack(Material.DEEPSLATE_IRON_ORE)); + displayRecipes.add(ItemStack.of(Material.DEEPSLATE_IRON_ORE)); displayRecipes.add(new SlimefunItemStack(SlimefunItems.IRON_DUST, isOreDoublingEnabled() ? 2 : 1)); - displayRecipes.add(new ItemStack(Material.DEEPSLATE_GOLD_ORE)); + displayRecipes.add(ItemStack.of(Material.DEEPSLATE_GOLD_ORE)); displayRecipes.add(new SlimefunItemStack(SlimefunItems.GOLD_DUST, isOreDoublingEnabled() ? 2 : 1)); - displayRecipes.add(new ItemStack(Material.DEEPSLATE_COPPER_ORE)); + displayRecipes.add(ItemStack.of(Material.DEEPSLATE_COPPER_ORE)); displayRecipes.add(new SlimefunItemStack(SlimefunItems.COPPER_DUST, isOreDoublingEnabled() ? 2 : 1)); - displayRecipes.add(new ItemStack(Material.COPPER_ORE)); + displayRecipes.add(ItemStack.of(Material.COPPER_ORE)); displayRecipes.add(new SlimefunItemStack(SlimefunItems.COPPER_DUST, isOreDoublingEnabled() ? 2 : 1)); } } @@ -218,13 +218,13 @@ public void onInteract(Player p, Block b) { private class DoubleOreSetting extends ItemSetting { - private final ItemStack coal = new ItemStack(Material.COAL, 1); - private final ItemStack lapis = new ItemStack(Material.LAPIS_LAZULI, 7); - private final ItemStack redstone = new ItemStack(Material.REDSTONE, 4); - private final ItemStack diamond = new ItemStack(Material.DIAMOND, 1); - private final ItemStack emerald = new ItemStack(Material.EMERALD, 1); - private final ItemStack quartz = new ItemStack(Material.QUARTZ, 1); - private final ItemStack goldNuggets = new ItemStack(Material.GOLD_NUGGET, 4); + private final ItemStack coal = ItemStack.of(Material.COAL, 1); + private final ItemStack lapis = ItemStack.of(Material.LAPIS_LAZULI, 7); + private final ItemStack redstone = ItemStack.of(Material.REDSTONE, 4); + private final ItemStack diamond = ItemStack.of(Material.DIAMOND, 1); + private final ItemStack emerald = ItemStack.of(Material.EMERALD, 1); + private final ItemStack quartz = ItemStack.of(Material.QUARTZ, 1); + private final ItemStack goldNuggets = ItemStack.of(Material.GOLD_NUGGET, 4); DoubleOreSetting(@Nonnull OreCrusher oreCrusher) { super(oreCrusher, "double-ores", true); diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/multiblocks/OreWasher.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/multiblocks/OreWasher.java index 25a3282369..4907500c1d 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/multiblocks/OreWasher.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/multiblocks/OreWasher.java @@ -58,9 +58,9 @@ public class OreWasher extends MultiBlockMachine { public OreWasher(ItemGroup itemGroup, SlimefunItemStack item) { // @formatter:off super(itemGroup, item, new ItemStack[] { - null, new ItemStack(Material.DISPENSER), null, - null, new ItemStack(Material.OAK_FENCE), null, - null, new ItemStack(Material.CAULDRON), null + null, ItemStack.of(Material.DISPENSER), null, + null, ItemStack.of(Material.OAK_FENCE), null, + null, ItemStack.of(Material.CAULDRON), null }, BlockFace.SELF); // @formatter:on @@ -80,7 +80,7 @@ protected void registerDefaultRecipes(List recipes) { recipes.add(SlimefunItems.SIFTED_ORE); recipes.add(SlimefunItems.GOLD_DUST); - recipes.add(new ItemStack(Material.SAND)); + recipes.add(ItemStack.of(Material.SAND)); recipes.add(SlimefunItems.SALT); } @@ -131,7 +131,7 @@ public void onInteract(Player p, Block b) { } return; - } else if (SlimefunUtils.isItemSimilar(input, new ItemStack(Material.SAND, 2), false)) { + } else if (SlimefunUtils.isItemSimilar(input, ItemStack.of(Material.SAND, 2), false)) { ItemStack output = SlimefunItems.SALT; Inventory outputInv = findOutputInventory(output, dispBlock, inv); diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/multiblocks/PressureChamber.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/multiblocks/PressureChamber.java index c8b75de5a3..3137d19cfd 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/multiblocks/PressureChamber.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/multiblocks/PressureChamber.java @@ -32,7 +32,7 @@ public class PressureChamber extends MultiBlockMachine { @ParametersAreNonnullByDefault public PressureChamber(ItemGroup itemGroup, SlimefunItemStack item) { - super(itemGroup, item, new ItemStack[] { new ItemStack(Material.SMOOTH_STONE_SLAB), new CustomItemStack(Material.DISPENSER, "Dispenser (Facing down)"), new ItemStack(Material.SMOOTH_STONE_SLAB), new ItemStack(Material.PISTON), new ItemStack(Material.GLASS), new ItemStack(Material.PISTON), new ItemStack(Material.PISTON), new ItemStack(Material.CAULDRON), new ItemStack(Material.PISTON) }, BlockFace.UP); + super(itemGroup, item, new ItemStack[] { ItemStack.of(Material.SMOOTH_STONE_SLAB), new CustomItemStack(Material.DISPENSER, "Dispenser (Facing down)"), ItemStack.of(Material.SMOOTH_STONE_SLAB), ItemStack.of(Material.PISTON), ItemStack.of(Material.GLASS), ItemStack.of(Material.PISTON), ItemStack.of(Material.PISTON), ItemStack.of(Material.CAULDRON), ItemStack.of(Material.PISTON) }, BlockFace.UP); } @Override diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/multiblocks/Smeltery.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/multiblocks/Smeltery.java index a55abe12ff..d0c3eb424d 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/multiblocks/Smeltery.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/multiblocks/Smeltery.java @@ -50,7 +50,7 @@ public class Smeltery extends AbstractSmeltery { @ParametersAreNonnullByDefault public Smeltery(ItemGroup itemGroup, SlimefunItemStack item) { - super(itemGroup, item, new ItemStack[] { null, new ItemStack(Material.NETHER_BRICK_FENCE), null, new ItemStack(Material.NETHER_BRICKS), new CustomItemStack(Material.DISPENSER, "Dispenser (Facing up)"), new ItemStack(Material.NETHER_BRICKS), null, new ItemStack(Material.FLINT_AND_STEEL), null }, BlockFace.DOWN); + super(itemGroup, item, new ItemStack[] { null, ItemStack.of(Material.NETHER_BRICK_FENCE), null, ItemStack.of(Material.NETHER_BRICKS), new CustomItemStack(Material.DISPENSER, "Dispenser (Facing up)"), ItemStack.of(Material.NETHER_BRICKS), null, ItemStack.of(Material.FLINT_AND_STEEL), null }, BlockFace.DOWN); addItemSetting(fireBreakingChance); } @@ -58,7 +58,7 @@ public Smeltery(ItemGroup itemGroup, SlimefunItemStack item) { @Override protected void registerDefaultRecipes(@Nonnull List recipes) { recipes.add(SlimefunItems.IRON_DUST); - recipes.add(new ItemStack(Material.IRON_INGOT)); + recipes.add(ItemStack.of(Material.IRON_INGOT)); } @Override diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/multiblocks/TableSaw.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/multiblocks/TableSaw.java index 40bb1b2fdd..d17f8551d0 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/multiblocks/TableSaw.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/multiblocks/TableSaw.java @@ -49,8 +49,8 @@ public TableSaw(ItemGroup group, SlimefunItemStack item) { // @formatter:off super(group, item, new ItemStack[] { null, null, null, - new ItemStack(Material.SMOOTH_STONE_SLAB), new ItemStack(Material.STONECUTTER), new ItemStack(Material.SMOOTH_STONE_SLAB), - null, new ItemStack(Material.IRON_BLOCK), null + ItemStack.of(Material.SMOOTH_STONE_SLAB), ItemStack.of(Material.STONECUTTER), ItemStack.of(Material.SMOOTH_STONE_SLAB), + null, ItemStack.of(Material.IRON_BLOCK), null }, BlockFace.SELF); // @formatter:on @@ -58,14 +58,14 @@ null, new ItemStack(Material.IRON_BLOCK), null Optional planks = getPlanks(log); if (planks.isPresent()) { - displayedRecipes.add(new ItemStack(log)); - displayedRecipes.add(new ItemStack(planks.get(), 8)); + displayedRecipes.add(ItemStack.of(log)); + displayedRecipes.add(ItemStack.of(planks.get(), 8)); } } for (Material plank : Tag.PLANKS.getValues()) { - displayedRecipes.add(new ItemStack(plank)); - displayedRecipes.add(new ItemStack(Material.STICK, 4)); + displayedRecipes.add(ItemStack.of(plank)); + displayedRecipes.add(ItemStack.of(Material.STICK, 4)); } } @@ -129,12 +129,12 @@ public void onInteract(@Nonnull Player p, @Nonnull Block b) { Optional planks = getPlanks(item); if (planks.isPresent()) { - return new ItemStack(planks.get(), 8); + return ItemStack.of(planks.get(), 8); } else { return null; } } else if (Tag.PLANKS.isTagged(item)) { - return new ItemStack(Material.STICK, 4); + return ItemStack.of(Material.STICK, 4); } else { return null; } diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/multiblocks/miner/AdvancedIndustrialMiner.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/multiblocks/miner/AdvancedIndustrialMiner.java index 5cec6e1b1e..ea0df65c26 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/multiblocks/miner/AdvancedIndustrialMiner.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/multiblocks/miner/AdvancedIndustrialMiner.java @@ -30,7 +30,7 @@ public AdvancedIndustrialMiner(ItemGroup itemGroup, SlimefunItemStack item) { @Override protected void registerDefaultFuelTypes() { - fuelTypes.add(new MachineFuel(48, new ItemStack(Material.LAVA_BUCKET))); + fuelTypes.add(new MachineFuel(48, ItemStack.of(Material.LAVA_BUCKET))); fuelTypes.add(new MachineFuel(64, SlimefunItems.OIL_BUCKET)); fuelTypes.add(new MachineFuel(128, SlimefunItems.FUEL_BUCKET)); } diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/multiblocks/miner/IndustrialMiner.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/multiblocks/miner/IndustrialMiner.java index 3ad9381c6c..1f169592e0 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/multiblocks/miner/IndustrialMiner.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/multiblocks/miner/IndustrialMiner.java @@ -63,8 +63,8 @@ public IndustrialMiner(ItemGroup itemGroup, SlimefunItemStack item, Material bas // @formatter:off super(itemGroup, item, new ItemStack[] { null, null, null, - new CustomItemStack(Material.PISTON, "Piston (facing up)"), new ItemStack(Material.CHEST), new CustomItemStack(Material.PISTON, "Piston (facing up)"), - new ItemStack(baseMaterial), new ItemStack(Material.BLAST_FURNACE), new ItemStack(baseMaterial) + new CustomItemStack(Material.PISTON, "Piston (facing up)"), ItemStack.of(Material.CHEST), new CustomItemStack(Material.PISTON, "Piston (facing up)"), + ItemStack.of(baseMaterial), ItemStack.of(Material.BLAST_FURNACE), ItemStack.of(baseMaterial) }, BlockFace.UP); // @formatter:on @@ -107,16 +107,16 @@ public int getRange() { */ protected void registerDefaultFuelTypes() { // Coal & Charcoal - fuelTypes.add(new MachineFuel(4, new ItemStack(Material.COAL))); - fuelTypes.add(new MachineFuel(4, new ItemStack(Material.CHARCOAL))); + fuelTypes.add(new MachineFuel(4, ItemStack.of(Material.COAL))); + fuelTypes.add(new MachineFuel(4, ItemStack.of(Material.CHARCOAL))); - fuelTypes.add(new MachineFuel(40, new ItemStack(Material.COAL_BLOCK))); - fuelTypes.add(new MachineFuel(10, new ItemStack(Material.DRIED_KELP_BLOCK))); - fuelTypes.add(new MachineFuel(4, new ItemStack(Material.BLAZE_ROD))); + fuelTypes.add(new MachineFuel(40, ItemStack.of(Material.COAL_BLOCK))); + fuelTypes.add(new MachineFuel(10, ItemStack.of(Material.DRIED_KELP_BLOCK))); + fuelTypes.add(new MachineFuel(4, ItemStack.of(Material.BLAZE_ROD))); // Logs for (Material mat : Tag.LOGS.getValues()) { - fuelTypes.add(new MachineFuel(1, new ItemStack(mat))); + fuelTypes.add(new MachineFuel(1, ItemStack.of(mat))); } } @@ -130,7 +130,7 @@ protected void registerDefaultFuelTypes() { */ public @Nonnull ItemStack getOutcome(@Nonnull Material material) { if (hasSilkTouch()) { - return new ItemStack(material); + return ItemStack.of(material); } else { Random random = ThreadLocalRandom.current(); return oreDictionary.getDrops(material, random); diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/multiblocks/miner/MiningTask.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/multiblocks/miner/MiningTask.java index 0169f0f846..94d91a49d6 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/multiblocks/miner/MiningTask.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/multiblocks/miner/MiningTask.java @@ -322,7 +322,7 @@ private int grabFuelFrom(@Nonnull Inventory inv) { ItemUtils.consumeItem(item, false); if (miner instanceof AdvancedIndustrialMiner) { - inv.addItem(new ItemStack(Material.BUCKET)); + inv.addItem(ItemStack.of(Material.BUCKET)); } return fuelType.getTicks(); diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/multiblocks/miner/OreDictionary16.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/multiblocks/miner/OreDictionary16.java index f69ebc46d6..be89cd3ffc 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/multiblocks/miner/OreDictionary16.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/multiblocks/miner/OreDictionary16.java @@ -20,17 +20,17 @@ class OreDictionary16 implements OreDictionary { @ParametersAreNonnullByDefault public @Nonnull ItemStack getDrops(Material material, Random random) { return switch (material) { - case COAL_ORE -> new ItemStack(Material.COAL); - case DIAMOND_ORE -> new ItemStack(Material.DIAMOND); - case EMERALD_ORE -> new ItemStack(Material.EMERALD); - case REDSTONE_ORE -> new ItemStack(Material.REDSTONE, 4 + random.nextInt(2)); - case LAPIS_ORE -> new ItemStack(Material.LAPIS_LAZULI, 4 + random.nextInt(4)); - case NETHER_QUARTZ_ORE -> new ItemStack(Material.QUARTZ); - case IRON_ORE -> new ItemStack(Material.IRON_ORE); - case GOLD_ORE -> new ItemStack(Material.GOLD_ORE); - case NETHER_GOLD_ORE -> new ItemStack(Material.GOLD_NUGGET, 2 + random.nextInt(4)); - case ANCIENT_DEBRIS -> new ItemStack(Material.ANCIENT_DEBRIS); - default -> new ItemStack(material); + case COAL_ORE -> ItemStack.of(Material.COAL); + case DIAMOND_ORE -> ItemStack.of(Material.DIAMOND); + case EMERALD_ORE -> ItemStack.of(Material.EMERALD); + case REDSTONE_ORE -> ItemStack.of(Material.REDSTONE, 4 + random.nextInt(2)); + case LAPIS_ORE -> ItemStack.of(Material.LAPIS_LAZULI, 4 + random.nextInt(4)); + case NETHER_QUARTZ_ORE -> ItemStack.of(Material.QUARTZ); + case IRON_ORE -> ItemStack.of(Material.IRON_ORE); + case GOLD_ORE -> ItemStack.of(Material.GOLD_ORE); + case NETHER_GOLD_ORE -> ItemStack.of(Material.GOLD_NUGGET, 2 + random.nextInt(4)); + case ANCIENT_DEBRIS -> ItemStack.of(Material.ANCIENT_DEBRIS); + default -> ItemStack.of(material); }; } diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/multiblocks/miner/OreDictionary17.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/multiblocks/miner/OreDictionary17.java index 7db6e3948e..0b88f174bb 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/multiblocks/miner/OreDictionary17.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/multiblocks/miner/OreDictionary17.java @@ -21,21 +21,21 @@ public ItemStack getDrops(Material material, Random random) { // In 1.17, breaking metal ores should get raw metals. Also support deepslate ores. return switch (material) { case COAL_ORE, - DEEPSLATE_COAL_ORE -> new ItemStack(Material.COAL); + DEEPSLATE_COAL_ORE -> ItemStack.of(Material.COAL); case DIAMOND_ORE, - DEEPSLATE_DIAMOND_ORE -> new ItemStack(Material.DIAMOND); + DEEPSLATE_DIAMOND_ORE -> ItemStack.of(Material.DIAMOND); case EMERALD_ORE, - DEEPSLATE_EMERALD_ORE -> new ItemStack(Material.EMERALD); + DEEPSLATE_EMERALD_ORE -> ItemStack.of(Material.EMERALD); case REDSTONE_ORE, - DEEPSLATE_REDSTONE_ORE -> new ItemStack(Material.REDSTONE, 4 + random.nextInt(2)); + DEEPSLATE_REDSTONE_ORE -> ItemStack.of(Material.REDSTONE, 4 + random.nextInt(2)); case LAPIS_ORE, - DEEPSLATE_LAPIS_ORE -> new ItemStack(Material.LAPIS_LAZULI, 4 + random.nextInt(4)); + DEEPSLATE_LAPIS_ORE -> ItemStack.of(Material.LAPIS_LAZULI, 4 + random.nextInt(4)); case COPPER_ORE, - DEEPSLATE_COPPER_ORE -> new ItemStack(Material.RAW_COPPER); + DEEPSLATE_COPPER_ORE -> ItemStack.of(Material.RAW_COPPER); case IRON_ORE, - DEEPSLATE_IRON_ORE -> new ItemStack(Material.RAW_IRON); + DEEPSLATE_IRON_ORE -> ItemStack.of(Material.RAW_IRON); case GOLD_ORE, - DEEPSLATE_GOLD_ORE -> new ItemStack(Material.RAW_GOLD); + DEEPSLATE_GOLD_ORE -> ItemStack.of(Material.RAW_GOLD); default -> super.getDrops(material, random); }; } diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/tools/ClimbingPick.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/tools/ClimbingPick.java index 265db240ed..6cb6b19f32 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/tools/ClimbingPick.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/tools/ClimbingPick.java @@ -268,7 +268,7 @@ public List getDisplayRecipes() { List display = new ArrayList<>(); for (Material mat : surfaces.keySet()) { - display.add(new ItemStack(mat)); + display.add(ItemStack.of(mat)); } return display; diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/tools/GoldPan.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/tools/GoldPan.java index 08f69ec27a..5496310d24 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/tools/GoldPan.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/tools/GoldPan.java @@ -89,10 +89,10 @@ public Material getInputMaterial() { protected @Nonnull Set getGoldPanDrops() { Set settings = new HashSet<>(); - settings.add(new GoldPanDrop(this, "chance.FLINT", 40, new ItemStack(Material.FLINT))); - settings.add(new GoldPanDrop(this, "chance.CLAY", 20, new ItemStack(Material.CLAY_BALL))); + settings.add(new GoldPanDrop(this, "chance.FLINT", 40, ItemStack.of(Material.FLINT))); + settings.add(new GoldPanDrop(this, "chance.CLAY", 20, ItemStack.of(Material.CLAY_BALL))); settings.add(new GoldPanDrop(this, "chance.SIFTED_ORE", 35, SlimefunItems.SIFTED_ORE)); - settings.add(new GoldPanDrop(this, "chance.IRON_NUGGET", 5, new ItemStack(Material.IRON_NUGGET))); + settings.add(new GoldPanDrop(this, "chance.IRON_NUGGET", 5, ItemStack.of(Material.IRON_NUGGET))); return settings; } @@ -129,7 +129,7 @@ public void updateRandomizer() { ItemStack item = randomizer.getRandom(); // Fixes #2804 - return item != null ? item : new ItemStack(Material.AIR); + return item != null ? item : ItemStack.of(Material.AIR); } @Override @@ -187,7 +187,7 @@ public void updateRandomizer() { } for (Material material : getInputMaterials()) { - recipes.add(new ItemStack(material)); + recipes.add(ItemStack.of(material)); recipes.add(drop.getOutput()); } } @@ -209,7 +209,7 @@ public boolean isValidInput(@Nullable ItemStack itemStack) { } Material material = itemStack.getType(); - return isValidInputMaterial(material) && SlimefunUtils.isItemSimilar(itemStack, new ItemStack(material), true, false); + return isValidInputMaterial(material) && SlimefunUtils.isItemSimilar(itemStack, ItemStack.of(material), true, false); } /** diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/tools/NetherGoldPan.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/tools/NetherGoldPan.java index 18c996547a..2d2d74b5dc 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/tools/NetherGoldPan.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/tools/NetherGoldPan.java @@ -47,12 +47,12 @@ public Material getInputMaterial() { protected @Nonnull Set getGoldPanDrops() { Set settings = new HashSet<>(); - settings.add(new GoldPanDrop(this, "chance.QUARTZ", 50, new ItemStack(Material.QUARTZ))); - settings.add(new GoldPanDrop(this, "chance.GOLD_NUGGET", 25, new ItemStack(Material.GOLD_NUGGET))); - settings.add(new GoldPanDrop(this, "chance.NETHER_WART", 10, new ItemStack(Material.NETHER_WART))); - settings.add(new GoldPanDrop(this, "chance.BLAZE_POWDER", 8, new ItemStack(Material.BLAZE_POWDER))); - settings.add(new GoldPanDrop(this, "chance.GLOWSTONE_DUST", 5, new ItemStack(Material.GLOWSTONE_DUST))); - settings.add(new GoldPanDrop(this, "chance.GHAST_TEAR", 2, new ItemStack(Material.GHAST_TEAR))); + settings.add(new GoldPanDrop(this, "chance.QUARTZ", 50, ItemStack.of(Material.QUARTZ))); + settings.add(new GoldPanDrop(this, "chance.GOLD_NUGGET", 25, ItemStack.of(Material.GOLD_NUGGET))); + settings.add(new GoldPanDrop(this, "chance.NETHER_WART", 10, ItemStack.of(Material.NETHER_WART))); + settings.add(new GoldPanDrop(this, "chance.BLAZE_POWDER", 8, ItemStack.of(Material.BLAZE_POWDER))); + settings.add(new GoldPanDrop(this, "chance.GLOWSTONE_DUST", 5, ItemStack.of(Material.GLOWSTONE_DUST))); + settings.add(new GoldPanDrop(this, "chance.GHAST_TEAR", 2, ItemStack.of(Material.GHAST_TEAR))); return settings; } diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/tools/PickaxeOfContainment.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/tools/PickaxeOfContainment.java index 86499f2bee..4afc519a5d 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/tools/PickaxeOfContainment.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/tools/PickaxeOfContainment.java @@ -78,7 +78,7 @@ public PickaxeOfContainment(ItemGroup itemGroup, SlimefunItemStack item, RecipeT return spawner.getItemForEntityType(entityType); } - return new ItemStack(Material.SPAWNER); + return ItemStack.of(Material.SPAWNER); } } diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/tools/PickaxeOfVeinMining.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/tools/PickaxeOfVeinMining.java index 4cae8ed99d..581ad82f27 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/tools/PickaxeOfVeinMining.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/tools/PickaxeOfVeinMining.java @@ -60,7 +60,7 @@ private void breakBlocks(Player p, List blocks, int fortune, ItemStack to b.getWorld().playEffect(b.getLocation(), Effect.STEP_SOUND, b.getType()); if (tool.containsEnchantment(Enchantment.SILK_TOUCH)) { - b.getWorld().dropItemNaturally(b.getLocation(), new ItemStack(b.getType())); + b.getWorld().dropItemNaturally(b.getLocation(), ItemStack.of(b.getType())); } else { for (ItemStack drop : b.getDrops(tool)) { b.getWorld().dropItemNaturally(b.getLocation(), drop.getType().isBlock() ? drop : new CustomItemStack(drop, fortune)); diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/weapons/SwordOfBeheading.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/weapons/SwordOfBeheading.java index ce40980ded..c182cf05d0 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/weapons/SwordOfBeheading.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/weapons/SwordOfBeheading.java @@ -63,33 +63,33 @@ public EntityKillHandler getItemHandler() { switch (e.getEntityType()) { case ZOMBIE -> { if (random.nextInt(100) < chanceZombie.getValue()) { - e.getDrops().add(new ItemStack(Material.ZOMBIE_HEAD)); + e.getDrops().add(ItemStack.of(Material.ZOMBIE_HEAD)); } } case SKELETON -> { if (random.nextInt(100) < chanceSkeleton.getValue()) { - e.getDrops().add(new ItemStack(Material.SKELETON_SKULL)); + e.getDrops().add(ItemStack.of(Material.SKELETON_SKULL)); } } case CREEPER -> { if (random.nextInt(100) < chanceCreeper.getValue()) { - e.getDrops().add(new ItemStack(Material.CREEPER_HEAD)); + e.getDrops().add(ItemStack.of(Material.CREEPER_HEAD)); } } case WITHER_SKELETON -> { if (random.nextInt(100) < chanceWitherSkeleton.getValue()) { - e.getDrops().add(new ItemStack(Material.WITHER_SKELETON_SKULL)); + e.getDrops().add(ItemStack.of(Material.WITHER_SKELETON_SKULL)); } } case PIGLIN -> { if (Slimefun.getMinecraftVersion().isAtLeast(MinecraftVersion.MINECRAFT_1_20) && random.nextInt(100) < chancePiglin.getValue()) { - e.getDrops().add(new ItemStack(Material.PIGLIN_HEAD)); + e.getDrops().add(ItemStack.of(Material.PIGLIN_HEAD)); } } case PLAYER -> { if (random.nextInt(100) < chancePlayer.getValue()) { - ItemStack skull = new ItemStack(Material.PLAYER_HEAD); + ItemStack skull = ItemStack.of(Material.PLAYER_HEAD); ItemMeta meta = skull.getItemMeta(); ((SkullMeta) meta).setOwningPlayer((Player) e.getEntity()); diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/BlockPhysicsListener.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/BlockPhysicsListener.java index d63289aa46..22e130ad2b 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/BlockPhysicsListener.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/BlockPhysicsListener.java @@ -49,7 +49,7 @@ public void onBlockFall(EntityChangeBlockEvent e) { FallingBlock block = (FallingBlock) e.getEntity(); if (block.getDropItem()) { - block.getWorld().dropItemNaturally(block.getLocation(), new ItemStack(block.getBlockData().getMaterial(), 1)); + block.getWorld().dropItemNaturally(block.getLocation(), ItemStack.of(block.getBlockData().getMaterial(), 1)); } } } diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/ButcherAndroidListener.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/ButcherAndroidListener.java index 9e63107680..5b8f32dedd 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/ButcherAndroidListener.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/ButcherAndroidListener.java @@ -82,15 +82,15 @@ private void addExtraDrops(List drops, EntityType entityType) { Random random = ThreadLocalRandom.current(); if (entityType == EntityType.WITHER_SKELETON && random.nextInt(250) < 2) { - drops.add(new ItemStack(Material.WITHER_SKELETON_SKULL)); + drops.add(ItemStack.of(Material.WITHER_SKELETON_SKULL)); } if (entityType == EntityType.BLAZE) { - drops.add(new ItemStack(Material.BLAZE_ROD, 1 + random.nextInt(1))); + drops.add(ItemStack.of(Material.BLAZE_ROD, 1 + random.nextInt(1))); } if (entityType == EntityType.VINDICATOR) { - drops.add(new ItemStack(Material.EMERALD, 1 + random.nextInt(2))); + drops.add(ItemStack.of(Material.EMERALD, 1 + random.nextInt(2))); } } } diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/EnhancedFurnaceListener.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/EnhancedFurnaceListener.java index c03e238c4a..dfa72918e0 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/EnhancedFurnaceListener.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/EnhancedFurnaceListener.java @@ -87,7 +87,7 @@ public void onItemSmelt(FurnaceSmeltEvent e) { ItemStack item = result.get(); int previous = inventory.getResult() != null ? inventory.getResult().getAmount() : 0; amount = Math.min(item.getMaxStackSize() - previous, amount); - e.setResult(new ItemStack(item.getType(), amount)); + e.setResult(ItemStack.of(item.getType(), amount)); } } } diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/TalismanListener.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/TalismanListener.java index 7a8b29c0df..a678ba415e 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/TalismanListener.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/TalismanListener.java @@ -190,7 +190,7 @@ private Collection getExtraDrops(LivingEntity entity, Collection> entry : iterators.entrySet()) { - inventory.setItem(entry.getKey(), new ItemStack(entry.getValue().next())); + inventory.setItem(entry.getKey(), ItemStack.of(entry.getValue().next())); } } finally { lock.readLock().unlock(); diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/utils/SlimefunUtils.java b/src/main/java/io/github/thebusybiscuit/slimefun4/utils/SlimefunUtils.java index a509b207f3..8c816d0ea6 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/utils/SlimefunUtils.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/utils/SlimefunUtils.java @@ -233,7 +233,7 @@ public static boolean isRadioactive(@Nullable ItemStack item) { if (Slimefun.getMinecraftVersion() == MinecraftVersion.UNIT_TEST) { // com.mojang.authlib.GameProfile does not exist in a Test Environment - return new ItemStack(Material.PLAYER_HEAD); + return ItemStack.of(Material.PLAYER_HEAD); } String base64 = texture; diff --git a/src/main/java/me/mrCookieSlime/Slimefun/Objects/SlimefunItem/abstractItems/AGenerator.java b/src/main/java/me/mrCookieSlime/Slimefun/Objects/SlimefunItem/abstractItems/AGenerator.java index db5555f6c9..06743e1a8d 100644 --- a/src/main/java/me/mrCookieSlime/Slimefun/Objects/SlimefunItem/abstractItems/AGenerator.java +++ b/src/main/java/me/mrCookieSlime/Slimefun/Objects/SlimefunItem/abstractItems/AGenerator.java @@ -161,7 +161,7 @@ public int getGeneratedOutput(Location l, Config data) { ItemStack fuel = operation.getIngredient(); if (isBucket(fuel)) { - inv.pushItem(new ItemStack(Material.BUCKET), getOutputSlots()); + inv.pushItem(ItemStack.of(Material.BUCKET), getOutputSlots()); } inv.replaceExistingItem(22, new CustomItemStack(Material.BLACK_STAINED_GLASS_PANE, " ")); diff --git a/src/test/java/io/github/thebusybiscuit/slimefun4/api/events/TestSlimefunBlockBreakEvent.java b/src/test/java/io/github/thebusybiscuit/slimefun4/api/events/TestSlimefunBlockBreakEvent.java index 9eb9225213..9f6728f940 100644 --- a/src/test/java/io/github/thebusybiscuit/slimefun4/api/events/TestSlimefunBlockBreakEvent.java +++ b/src/test/java/io/github/thebusybiscuit/slimefun4/api/events/TestSlimefunBlockBreakEvent.java @@ -38,7 +38,7 @@ public static void load() { new BlockListener(plugin); - slimefunItem = TestUtilities.mockSlimefunItem(plugin, "FOOD_COMPOSTER", new ItemStack(Material.GREEN_TERRACOTTA)); + slimefunItem = TestUtilities.mockSlimefunItem(plugin, "FOOD_COMPOSTER", ItemStack.of(Material.GREEN_TERRACOTTA)); slimefunItem.register(plugin); } @@ -71,7 +71,7 @@ void testEventIsFired() { @DisplayName("Test the getters are set to the right values") void testGetters() { Player player = new PlayerMock(server, "SomePlayer"); - ItemStack itemStack = new ItemStack(Material.IRON_PICKAXE); + ItemStack itemStack = ItemStack.of(Material.IRON_PICKAXE); player.getInventory().setItemInMainHand(itemStack); World world = server.addSimpleWorld("my_world"); @@ -102,7 +102,7 @@ public void onBlockBreak(SlimefunBlockBreakEvent event) { }, plugin); Player player = new PlayerMock(server, "SomePlayer"); - ItemStack itemStack = new ItemStack(Material.IRON_PICKAXE); + ItemStack itemStack = ItemStack.of(Material.IRON_PICKAXE); player.getInventory().setItemInMainHand(itemStack); World world = server.addSimpleWorld("my_world"); @@ -124,7 +124,7 @@ public void onBlockBreak(SlimefunBlockBreakEvent event) { @DisplayName("Test that breaking a Slimefun block gets queued for deletion") void testBlockBreaksGetQueuedForDeletion() { Player player = new PlayerMock(server, "SomePlayer"); - ItemStack itemStack = new ItemStack(Material.IRON_PICKAXE); + ItemStack itemStack = ItemStack.of(Material.IRON_PICKAXE); player.getInventory().setItemInMainHand(itemStack); World world = server.addSimpleWorld("my_world"); diff --git a/src/test/java/io/github/thebusybiscuit/slimefun4/api/events/TestSlimefunBlockPlaceEvent.java b/src/test/java/io/github/thebusybiscuit/slimefun4/api/events/TestSlimefunBlockPlaceEvent.java index c33db57184..72003e74cb 100644 --- a/src/test/java/io/github/thebusybiscuit/slimefun4/api/events/TestSlimefunBlockPlaceEvent.java +++ b/src/test/java/io/github/thebusybiscuit/slimefun4/api/events/TestSlimefunBlockPlaceEvent.java @@ -40,7 +40,7 @@ public static void load() { new BlockListener(plugin); - slimefunItem = TestUtilities.mockSlimefunItem(plugin, "FOOD_COMPOSTER", new ItemStack(Material.GREEN_TERRACOTTA)); + slimefunItem = TestUtilities.mockSlimefunItem(plugin, "FOOD_COMPOSTER", ItemStack.of(Material.GREEN_TERRACOTTA)); slimefunItem.register(plugin); } diff --git a/src/test/java/io/github/thebusybiscuit/slimefun4/api/events/TestTalismanActivateEvent.java b/src/test/java/io/github/thebusybiscuit/slimefun4/api/events/TestTalismanActivateEvent.java index 40cfc61fe5..0f85611c57 100644 --- a/src/test/java/io/github/thebusybiscuit/slimefun4/api/events/TestTalismanActivateEvent.java +++ b/src/test/java/io/github/thebusybiscuit/slimefun4/api/events/TestTalismanActivateEvent.java @@ -52,7 +52,7 @@ void activateAnvilTalisman(boolean enderVariant, boolean inEnderChest) { player.getEnderChest().clear(); ItemStack talismanItem = enderVariant ? enderTalisman.getItem() : talisman.getItem(); - ItemStack breakableItem = new ItemStack(Material.IRON_PICKAXE); + ItemStack breakableItem = ItemStack.of(Material.IRON_PICKAXE); if (inEnderChest) { player.getEnderChest().setItem(9, talismanItem); diff --git a/src/test/java/io/github/thebusybiscuit/slimefun4/api/profiles/TestGuideHistory.java b/src/test/java/io/github/thebusybiscuit/slimefun4/api/profiles/TestGuideHistory.java index fc8441b463..499c2ff254 100644 --- a/src/test/java/io/github/thebusybiscuit/slimefun4/api/profiles/TestGuideHistory.java +++ b/src/test/java/io/github/thebusybiscuit/slimefun4/api/profiles/TestGuideHistory.java @@ -102,14 +102,14 @@ void testItem() throws InterruptedException { GuideHistory history = profile.getGuideHistory(); Assertions.assertThrows(IllegalArgumentException.class, () -> history.add((ItemStack) null, 1)); - Assertions.assertThrows(IllegalArgumentException.class, () -> history.add(new ItemStack(Material.DIAMOND), -20)); + Assertions.assertThrows(IllegalArgumentException.class, () -> history.add(ItemStack.of(Material.DIAMOND), -20)); Assertions.assertEquals(0, history.size()); - history.add(new ItemStack(Material.REDSTONE), 1); + history.add(ItemStack.of(Material.REDSTONE), 1); Assertions.assertEquals(1, history.size()); // This should not add a new entry but rather only update the page - history.add(new ItemStack(Material.REDSTONE), 2); + history.add(ItemStack.of(Material.REDSTONE), 2); Assertions.assertEquals(1, history.size()); } diff --git a/src/test/java/io/github/thebusybiscuit/slimefun4/core/guide/TestGuideOpening.java b/src/test/java/io/github/thebusybiscuit/slimefun4/core/guide/TestGuideOpening.java index a8685b9736..29d82862d9 100644 --- a/src/test/java/io/github/thebusybiscuit/slimefun4/core/guide/TestGuideOpening.java +++ b/src/test/java/io/github/thebusybiscuit/slimefun4/core/guide/TestGuideOpening.java @@ -85,7 +85,7 @@ void testOpenSlimefunItem() throws InterruptedException { @Test @DisplayName("Test if an ItemStack can be viewed from the History") void testOpenItemStack() throws InterruptedException { - ItemStack item = new ItemStack(Material.REDSTONE_BLOCK); + ItemStack item = ItemStack.of(Material.REDSTONE_BLOCK); SlimefunGuideImplementation guide = Mockito.mock(SlimefunGuideImplementation.class); PlayerProfile profile = prepare(guide, history -> history.add(item, 1)); diff --git a/src/test/java/io/github/thebusybiscuit/slimefun4/core/services/TestCustomTextureService.java b/src/test/java/io/github/thebusybiscuit/slimefun4/core/services/TestCustomTextureService.java index 919de0d374..1f2f38ad2b 100644 --- a/src/test/java/io/github/thebusybiscuit/slimefun4/core/services/TestCustomTextureService.java +++ b/src/test/java/io/github/thebusybiscuit/slimefun4/core/services/TestCustomTextureService.java @@ -40,7 +40,7 @@ void testInitialization() { Assertions.assertFalse(service.isActive()); Assertions.assertNull(service.getVersion()); - SlimefunItem item = TestUtilities.mockSlimefunItem(plugin, "TEXTURE_TEST", new ItemStack(Material.LANTERN)); + SlimefunItem item = TestUtilities.mockSlimefunItem(plugin, "TEXTURE_TEST", ItemStack.of(Material.LANTERN)); service.register(Arrays.asList(null, item, null), false); Assertions.assertThrows(IllegalArgumentException.class, () -> service.register(null, false)); @@ -57,7 +57,7 @@ void testInitialization() { void testSetTexture() { Config config = new Config("plugins/temporary"); CustomTextureService service = new CustomTextureService(config); - SlimefunItem item = TestUtilities.mockSlimefunItem(plugin, "TEXTURE_TEST", new ItemStack(Material.LANTERN)); + SlimefunItem item = TestUtilities.mockSlimefunItem(plugin, "TEXTURE_TEST", ItemStack.of(Material.LANTERN)); String version = "Unit Test v1.0"; config.setValue(item.getId(), 300); @@ -69,7 +69,7 @@ void testSetTexture() { Assertions.assertEquals(version, service.getVersion()); Assertions.assertEquals(300, service.getModelData(item.getId())); - ItemStack stack = new ItemStack(Material.DIAMOND); + ItemStack stack = ItemStack.of(Material.DIAMOND); service.setTexture(stack, item.getId()); Assertions.assertTrue(stack.getItemMeta().hasCustomModelData()); diff --git a/src/test/java/io/github/thebusybiscuit/slimefun4/core/services/TestItemDataService.java b/src/test/java/io/github/thebusybiscuit/slimefun4/core/services/TestItemDataService.java index ec323ff6f4..84955281ce 100644 --- a/src/test/java/io/github/thebusybiscuit/slimefun4/core/services/TestItemDataService.java +++ b/src/test/java/io/github/thebusybiscuit/slimefun4/core/services/TestItemDataService.java @@ -42,7 +42,7 @@ void testInitialization() { @DisplayName("Test setting item data for an ItemStack") void testSetDataItem() { CustomItemDataService service = new CustomItemDataService(plugin, "test"); - ItemStack item = new ItemStack(Material.EMERALD); + ItemStack item = ItemStack.of(Material.EMERALD); service.setItemData(item, "Hello World"); Optional data = service.getItemData(item); @@ -55,7 +55,7 @@ void testSetDataItem() { @DisplayName("Test setting item data for an ItemMeta") void testSetDataItemMeta() { CustomItemDataService service = new CustomItemDataService(plugin, "test"); - ItemStack item = new ItemStack(Material.EMERALD); + ItemStack item = ItemStack.of(Material.EMERALD); ItemMeta meta = item.getItemMeta(); service.setItemData(meta, "Hello World"); diff --git a/src/test/java/io/github/thebusybiscuit/slimefun4/core/services/TestRecipeService.java b/src/test/java/io/github/thebusybiscuit/slimefun4/core/services/TestRecipeService.java index bc30dbf583..83bdd28e82 100644 --- a/src/test/java/io/github/thebusybiscuit/slimefun4/core/services/TestRecipeService.java +++ b/src/test/java/io/github/thebusybiscuit/slimefun4/core/services/TestRecipeService.java @@ -46,7 +46,7 @@ void testRecipe() { MinecraftRecipeService service = new MinecraftRecipeService(plugin); NamespacedKey key = new NamespacedKey(plugin, "furnace_recipe_test"); - ItemStack result = new ItemStack(Material.EMERALD_BLOCK); + ItemStack result = ItemStack.of(Material.EMERALD_BLOCK); FurnaceRecipe recipe = new FurnaceRecipe(key, result, new MaterialChoice(Material.DIAMOND), 1, 2); server.addRecipe(recipe); @@ -67,7 +67,7 @@ void testNoRecipes() { service.refresh(); Assertions.assertEquals(0, service.getRecipesFor(null).length); - Assertions.assertEquals(0, service.getRecipesFor(new ItemStack(Material.BEDROCK)).length); + Assertions.assertEquals(0, service.getRecipesFor(ItemStack.of(Material.BEDROCK)).length); } @Test @@ -76,29 +76,29 @@ void testFurnaceOutput() { MinecraftRecipeService service = new MinecraftRecipeService(plugin); NamespacedKey key = new NamespacedKey(plugin, "furnace_recipe_test2"); - ItemStack result = new ItemStack(Material.GOLD_BLOCK); + ItemStack result = ItemStack.of(Material.GOLD_BLOCK); MaterialChoice materials = new MaterialChoice(Material.DIRT, Material.COBBLESTONE); FurnaceRecipe recipe = new FurnaceRecipe(key, result, materials, 1, 2); server.addRecipe(recipe); // The Snapshot has not been taken, so it should fallback to an empty Optional - Assertions.assertFalse(service.getFurnaceOutput(new ItemStack(Material.DIRT)).isPresent()); + Assertions.assertFalse(service.getFurnaceOutput(ItemStack.of(Material.DIRT)).isPresent()); service.refresh(); Assertions.assertFalse(service.getFurnaceOutput(null).isPresent()); - Assertions.assertFalse(service.getFurnaceOutput(new ItemStack(Material.BEDROCK)).isPresent()); + Assertions.assertFalse(service.getFurnaceOutput(ItemStack.of(Material.BEDROCK)).isPresent()); - Optional optional = service.getFurnaceOutput(new ItemStack(Material.DIRT)); + Optional optional = service.getFurnaceOutput(ItemStack.of(Material.DIRT)); Assertions.assertTrue(optional.isPresent()); Assertions.assertEquals(result, optional.get()); - Optional optional2 = service.getFurnaceOutput(new ItemStack(Material.COBBLESTONE)); + Optional optional2 = service.getFurnaceOutput(ItemStack.of(Material.COBBLESTONE)); Assertions.assertTrue(optional2.isPresent()); Assertions.assertEquals(result, optional2.get()); // Cobblestone should be smeltable - Assertions.assertTrue(service.isSmeltable(new ItemStack(Material.COBBLESTONE))); + Assertions.assertTrue(service.isSmeltable(ItemStack.of(Material.COBBLESTONE))); } @Test @@ -107,7 +107,7 @@ void testBigShapedRecipe() { MinecraftRecipeService service = new MinecraftRecipeService(plugin); NamespacedKey key = new NamespacedKey(plugin, "shaped_recipe_9"); - ShapedRecipe recipe = new ShapedRecipe(key, new ItemStack(Material.ENCHANTED_GOLDEN_APPLE)); + ShapedRecipe recipe = new ShapedRecipe(key, ItemStack.of(Material.ENCHANTED_GOLDEN_APPLE)); MaterialChoice choice = new MaterialChoice(Material.TNT, Material.TNT_MINECART); recipe.shape("t t", " t ", "t t"); @@ -125,7 +125,7 @@ void testSmallShapedRecipe() { MinecraftRecipeService service = new MinecraftRecipeService(plugin); NamespacedKey key = new NamespacedKey(plugin, "shaped_recipe_4"); - ShapedRecipe recipe = new ShapedRecipe(key, new ItemStack(Material.ENCHANTED_GOLDEN_APPLE)); + ShapedRecipe recipe = new ShapedRecipe(key, ItemStack.of(Material.ENCHANTED_GOLDEN_APPLE)); MaterialChoice choice = new MaterialChoice(Material.TNT, Material.TNT_MINECART); recipe.shape("tt", "tt"); @@ -145,7 +145,7 @@ void testShapelessRecipeShape() { Assertions.assertThrows(IllegalArgumentException.class, () -> service.getRecipeShape(null)); NamespacedKey key = new NamespacedKey(plugin, "shapeless_test"); - ShapelessRecipe recipe = new ShapelessRecipe(key, new ItemStack(Material.TNT_MINECART)); + ShapelessRecipe recipe = new ShapelessRecipe(key, ItemStack.of(Material.TNT_MINECART)); MaterialChoice choice = new MaterialChoice(Material.TNT); recipe.addIngredient(choice); diff --git a/src/test/java/io/github/thebusybiscuit/slimefun4/implementation/items/TestSlimefunItem.java b/src/test/java/io/github/thebusybiscuit/slimefun4/implementation/items/TestSlimefunItem.java index 1bd21a0d3f..8030370d94 100644 --- a/src/test/java/io/github/thebusybiscuit/slimefun4/implementation/items/TestSlimefunItem.java +++ b/src/test/java/io/github/thebusybiscuit/slimefun4/implementation/items/TestSlimefunItem.java @@ -61,7 +61,7 @@ void testWikiPages() { void testRecipe() { SlimefunItem item = TestUtilities.mockSlimefunItem(plugin, "RECIPE_TEST", new CustomItemStack(Material.DIAMOND, "&dAnother one bites the test")); - ItemStack[] recipe = { null, new ItemStack(Material.DIAMOND), null, null, new ItemStack(Material.DIAMOND), null, null, new ItemStack(Material.DIAMOND), null }; + ItemStack[] recipe = { null, ItemStack.of(Material.DIAMOND), null, null, ItemStack.of(Material.DIAMOND), null, null, ItemStack.of(Material.DIAMOND), null }; item.setRecipe(recipe); item.register(plugin); @@ -80,7 +80,7 @@ void testRecipeOutput() { Assertions.assertEquals(item.getItem(), item.getRecipeOutput()); - ItemStack output = new ItemStack(Material.EMERALD, 64); + ItemStack output = ItemStack.of(Material.EMERALD, 64); item.setRecipeOutput(output); Assertions.assertEquals(output, item.getRecipeOutput()); @@ -116,7 +116,7 @@ void testIsItem() { Assertions.assertTrue(sfItem.isItem(sfItem.getItem())); Assertions.assertFalse(sfItem.isItem(null)); - Assertions.assertFalse(sfItem.isItem(new ItemStack(Material.BEACON))); + Assertions.assertFalse(sfItem.isItem(ItemStack.of(Material.BEACON))); Assertions.assertFalse(sfItem.isItem(new CustomItemStack(Material.REDSTONE, "&cTest"))); Assertions.assertFalse(sfItem.isItem(item)); Assertions.assertFalse(sfItem.isItem(new CustomItemStack(Material.BEACON, "&cItem Test"))); diff --git a/src/test/java/io/github/thebusybiscuit/slimefun4/implementation/items/autocrafters/TestAutoCrafter.java b/src/test/java/io/github/thebusybiscuit/slimefun4/implementation/items/autocrafters/TestAutoCrafter.java index ac40d14416..761630492e 100644 --- a/src/test/java/io/github/thebusybiscuit/slimefun4/implementation/items/autocrafters/TestAutoCrafter.java +++ b/src/test/java/io/github/thebusybiscuit/slimefun4/implementation/items/autocrafters/TestAutoCrafter.java @@ -53,7 +53,7 @@ void testValidShapelessRecipe() { InventoryMock inv = new ChestInventoryMock(null, 9); // Test first choice - inv.addItem(new ItemStack(Material.IRON_NUGGET)); + inv.addItem(ItemStack.of(Material.IRON_NUGGET)); Assertions.assertTrue(crafter.craft(inv, abstractRecipe)); Assertions.assertFalse(inv.contains(Material.IRON_NUGGET, 1)); Assertions.assertTrue(inv.containsAtLeast(result, 1)); @@ -61,7 +61,7 @@ void testValidShapelessRecipe() { inv.clear(); // Test other choice - inv.addItem(new ItemStack(Material.GOLD_NUGGET)); + inv.addItem(ItemStack.of(Material.GOLD_NUGGET)); Assertions.assertTrue(crafter.craft(inv, abstractRecipe)); Assertions.assertFalse(inv.contains(Material.GOLD_NUGGET, 1)); Assertions.assertTrue(inv.containsAtLeast(result, 1)); @@ -81,7 +81,7 @@ void testDisabledRecipe() { // Test enabled Recipe abstractRecipe.setEnabled(true); - inv.addItem(new ItemStack(Material.GOLD_NUGGET)); + inv.addItem(ItemStack.of(Material.GOLD_NUGGET)); Assertions.assertTrue(crafter.craft(inv, abstractRecipe)); Assertions.assertFalse(inv.contains(Material.GOLD_NUGGET, 1)); Assertions.assertTrue(inv.containsAtLeast(result, 1)); @@ -90,7 +90,7 @@ void testDisabledRecipe() { // Test disabled Recipe abstractRecipe.setEnabled(false); - inv.addItem(new ItemStack(Material.GOLD_NUGGET)); + inv.addItem(ItemStack.of(Material.GOLD_NUGGET)); Assertions.assertFalse(crafter.craft(inv, abstractRecipe)); Assertions.assertTrue(inv.contains(Material.GOLD_NUGGET, 1)); Assertions.assertFalse(inv.containsAtLeast(result, 1)); @@ -109,7 +109,7 @@ void testResourceLeftovers() { AbstractAutoCrafter crafter = getVanillaAutoCrafter(); InventoryMock inv = new ChestInventoryMock(null, 9); - inv.addItem(new ItemStack(Material.HONEY_BOTTLE, 2)); + inv.addItem(ItemStack.of(Material.HONEY_BOTTLE, 2)); Assertions.assertTrue(crafter.craft(inv, abstractRecipe)); Assertions.assertFalse(inv.contains(Material.HONEY_BOTTLE, 2)); @@ -132,7 +132,7 @@ void testInvalidShapelessRecipe() { InventoryMock inv = new ChestInventoryMock(null, 9); // Test non-compatible Item - inv.addItem(new ItemStack(Material.BAMBOO)); + inv.addItem(ItemStack.of(Material.BAMBOO)); Assertions.assertFalse(crafter.craft(inv, abstractRecipe)); Assertions.assertTrue(inv.contains(Material.BAMBOO, 1)); Assertions.assertFalse(inv.containsAtLeast(result, 1)); @@ -183,11 +183,11 @@ void testFullInventory() { InventoryMock inv = new ChestInventoryMock(null, 9); for (int i = 0; i < 9; i++) { - inv.setItem(i, new ItemStack(Material.OAK_SAPLING)); + inv.setItem(i, ItemStack.of(Material.OAK_SAPLING)); } // Test valid item but inventory is full. - inv.addItem(new ItemStack(Material.IRON_NUGGET)); + inv.addItem(ItemStack.of(Material.IRON_NUGGET)); Assertions.assertFalse(crafter.craft(inv, abstractRecipe)); Assertions.assertTrue(inv.contains(Material.OAK_SAPLING, 9)); Assertions.assertFalse(inv.containsAtLeast(result, 1)); diff --git a/src/test/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/TestAnvilListener.java b/src/test/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/TestAnvilListener.java index cf57add8ac..a712edb86d 100644 --- a/src/test/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/TestAnvilListener.java +++ b/src/test/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/TestAnvilListener.java @@ -46,7 +46,7 @@ public static void unload() { private InventoryClickEvent mockAnvilEvent(ItemStack item) { Player player = server.addPlayer(); - Inventory inv = TestUtilities.mockInventory(InventoryType.ANVIL, item, null, new ItemStack(Material.IRON_CHESTPLATE)); + Inventory inv = TestUtilities.mockInventory(InventoryType.ANVIL, item, null, ItemStack.of(Material.IRON_CHESTPLATE)); InventoryView view = player.openInventory(inv); InventoryClickEvent event = new InventoryClickEvent(view, SlotType.CONTAINER, 2, ClickType.LEFT, InventoryAction.PICKUP_ONE); @@ -56,7 +56,7 @@ private InventoryClickEvent mockAnvilEvent(ItemStack item) { @Test void testAnvilWithoutSlimefunItems() { - InventoryClickEvent event = mockAnvilEvent(new ItemStack(Material.IRON_SWORD)); + InventoryClickEvent event = mockAnvilEvent(ItemStack.of(Material.IRON_SWORD)); Assertions.assertEquals(Result.DEFAULT, event.getResult()); } diff --git a/src/test/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/TestBackpackListener.java b/src/test/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/TestBackpackListener.java index 443d47c3c7..590ceda72f 100644 --- a/src/test/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/TestBackpackListener.java +++ b/src/test/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/TestBackpackListener.java @@ -100,7 +100,7 @@ void testIllegalSetId() { Assertions.assertThrows(IllegalArgumentException.class, () -> listener.setBackpackId(null, null, 1, 1)); Assertions.assertThrows(IllegalArgumentException.class, () -> listener.setBackpackId(player, null, 1, 1)); - Assertions.assertThrows(IllegalArgumentException.class, () -> listener.setBackpackId(player, new ItemStack(Material.REDSTONE), 1, 1)); + Assertions.assertThrows(IllegalArgumentException.class, () -> listener.setBackpackId(player, ItemStack.of(Material.REDSTONE), 1, 1)); Assertions.assertThrows(IllegalArgumentException.class, () -> listener.setBackpackId(player, new CustomItemStack(Material.REDSTONE, "Hi", "lore"), 1, 1)); Assertions.assertThrows(IllegalArgumentException.class, () -> listener.setBackpackId(player, new CustomItemStack(Material.REDSTONE, "Hi", "lore", "no id"), 1, 1)); } @@ -137,7 +137,7 @@ void testBackpackDropNormalItem() throws InterruptedException { Player player = server.addPlayer(); openMockBackpack(player, "DROP_NORMAL_ITEM_BACKPACK_TEST", 27); - Item item = new ItemEntityMock(server, UUID.randomUUID(), new ItemStack(Material.SUGAR_CANE)); + Item item = new ItemEntityMock(server, UUID.randomUUID(), ItemStack.of(Material.SUGAR_CANE)); PlayerDropItemEvent event = new PlayerDropItemEvent(player, item); listener.onItemDrop(event); @@ -159,14 +159,14 @@ private boolean isAllowed(String id, ItemStack item) throws InterruptedException @DisplayName("Test backpacks allowing normal materials") @EnumSource(value = Material.class, names = { "AIR", "DIAMOND", "STONE" }) void areItemsAllowed(Material type) throws InterruptedException { - Assertions.assertTrue(isAllowed("BACKPACK_ALLOWANCE_" + type.name(), new ItemStack(type))); + Assertions.assertTrue(isAllowed("BACKPACK_ALLOWANCE_" + type.name(), ItemStack.of(type))); } @ParameterizedTest @DisplayName("Test backpacks rejecting certain materials") @EnumSource(value = Material.class, names = { "SHULKER_BOX", "RED_SHULKER_BOX", "BLUE_SHULKER_BOX", "BLACK_SHULKER_BOX" }) void areShulkerBoxesAllowed(Material type) throws InterruptedException { - Assertions.assertFalse(isAllowed("BACKPACK_ALLOWANCE_" + type.name(), new ItemStack(type))); + Assertions.assertFalse(isAllowed("BACKPACK_ALLOWANCE_" + type.name(), ItemStack.of(type))); } @ParameterizedTest @@ -177,7 +177,7 @@ void testHotbarKey(Material type) throws InterruptedException { openMockBackpack(player, "BACKPACK_HOTBAR_" + type.name(), 9); int slot = 7; - player.getInventory().setItem(slot, new ItemStack(type)); + player.getInventory().setItem(slot, ItemStack.of(type)); InventoryClickEvent event = new InventoryClickEvent(player.getOpenInventory(), SlotType.CONTAINER, slot, ClickType.NUMBER_KEY, InventoryAction.PICKUP_ONE, slot); listener.onClick(event); diff --git a/src/test/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/TestBrewingStandListener.java b/src/test/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/TestBrewingStandListener.java index 7a78612680..7a94810fa6 100644 --- a/src/test/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/TestBrewingStandListener.java +++ b/src/test/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/TestBrewingStandListener.java @@ -61,7 +61,7 @@ private InventoryClickEvent mockBrewingEvent(ItemStack item) { @Test void testBrewingWithoutSlimefunItems() { - InventoryClickEvent event = mockBrewingEvent(new ItemStack(Material.BLAZE_POWDER)); + InventoryClickEvent event = mockBrewingEvent(ItemStack.of(Material.BLAZE_POWDER)); Assertions.assertEquals(Result.ALLOW, event.getResult()); } diff --git a/src/test/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/TestCargoNodeListener.java b/src/test/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/TestCargoNodeListener.java index 0951dce2ca..47f2dc1cb1 100644 --- a/src/test/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/TestCargoNodeListener.java +++ b/src/test/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/TestCargoNodeListener.java @@ -105,7 +105,7 @@ void testNonCargoNode() { Block b = l.getBlock(); Block against = b.getRelative(BlockFace.DOWN); - ItemStack item = new ItemStack(Material.PLAYER_HEAD); + ItemStack item = ItemStack.of(Material.PLAYER_HEAD); BlockPlaceEvent event = new BlockPlaceEvent(b, b.getState(), against, item, player, true, EquipmentSlot.HAND); listener.onCargoNodePlace(event); diff --git a/src/test/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/TestCartographyTableListener.java b/src/test/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/TestCartographyTableListener.java index 892fd5b4ad..5c36261063 100644 --- a/src/test/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/TestCartographyTableListener.java +++ b/src/test/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/TestCartographyTableListener.java @@ -46,7 +46,7 @@ public static void unload() { private InventoryClickEvent mockCartographyTableEvent(ItemStack item) { Player player = server.addPlayer(); - Inventory inv = TestUtilities.mockInventory(InventoryType.CARTOGRAPHY, new ItemStack(Material.FILLED_MAP), item, new ItemStack(Material.FILLED_MAP)); + Inventory inv = TestUtilities.mockInventory(InventoryType.CARTOGRAPHY, ItemStack.of(Material.FILLED_MAP), item, ItemStack.of(Material.FILLED_MAP)); InventoryView view = player.openInventory(inv); InventoryClickEvent event = new InventoryClickEvent(view, SlotType.CONTAINER, 2, ClickType.LEFT, InventoryAction.PICKUP_ONE); diff --git a/src/test/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/TestCauldronListener.java b/src/test/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/TestCauldronListener.java index fd39063195..def6f67d18 100644 --- a/src/test/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/TestCauldronListener.java +++ b/src/test/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/TestCauldronListener.java @@ -63,14 +63,14 @@ void testCauldronWithNull() { @Test @DisplayName("Test Cauldron working as normal with unrelated items") void testCauldronWithNormalItem() { - PlayerInteractEvent event = mockCauldronEvent(new ItemStack(Material.GOLD_BLOCK)); + PlayerInteractEvent event = mockCauldronEvent(ItemStack.of(Material.GOLD_BLOCK)); Assertions.assertEquals(Result.DEFAULT, event.useItemInHand()); } @Test @DisplayName("Test Cauldron working as normal with normal leather armor") void testCauldronWithNormalLeatherArmor() { - PlayerInteractEvent event = mockCauldronEvent(new ItemStack(Material.LEATHER_BOOTS)); + PlayerInteractEvent event = mockCauldronEvent(ItemStack.of(Material.LEATHER_BOOTS)); Assertions.assertEquals(Result.DEFAULT, event.useItemInHand()); } diff --git a/src/test/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/TestCoolerListener.java b/src/test/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/TestCoolerListener.java index e606840cbc..1c892d116b 100644 --- a/src/test/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/TestCoolerListener.java +++ b/src/test/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/TestCoolerListener.java @@ -61,7 +61,7 @@ public static void unload() { @Test @DisplayName("Test if Coolers only allow juices") void testOnlyJuiceAllowance() { - Assertions.assertFalse(cooler.isItemAllowed(new ItemStack(Material.DIAMOND), null)); + Assertions.assertFalse(cooler.isItemAllowed(ItemStack.of(Material.DIAMOND), null)); Assertions.assertFalse(cooler.isItemAllowed(cooler.getItem(), cooler)); Assertions.assertTrue(cooler.isItemAllowed(juice.getItem(), juice)); } diff --git a/src/test/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/TestCraftingTableListener.java b/src/test/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/TestCraftingTableListener.java index 5819ad3a32..03809827a5 100644 --- a/src/test/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/TestCraftingTableListener.java +++ b/src/test/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/TestCraftingTableListener.java @@ -50,7 +50,7 @@ public static void unload() { } private CraftItemEvent mockCraftingEvent(ItemStack item) { - Recipe recipe = new ShapedRecipe(new NamespacedKey(plugin, "test_recipe"), new ItemStack(Material.EMERALD)); + Recipe recipe = new ShapedRecipe(new NamespacedKey(plugin, "test_recipe"), ItemStack.of(Material.EMERALD)); Player player = server.addPlayer(); CraftingInventory inv = Mockito.mock(CraftingInventory.class); @@ -67,7 +67,7 @@ private PrepareItemCraftEvent mockPreCraftingEvent(ItemStack item) { Player player = server.addPlayer(); CraftingInventory inv = Mockito.mock(CraftingInventory.class); - MutableObject result = new MutableObject(new ItemStack(Material.EMERALD)); + MutableObject result = new MutableObject(ItemStack.of(Material.EMERALD)); Mockito.doAnswer(invocation -> { ItemStack argument = invocation.getArgument(0); @@ -87,7 +87,7 @@ private PrepareItemCraftEvent mockPreCraftingEvent(ItemStack item) { @Test void testCraftEventWithoutSlimefunItems() { - CraftItemEvent event = mockCraftingEvent(new ItemStack(Material.DIAMOND)); + CraftItemEvent event = mockCraftingEvent(ItemStack.of(Material.DIAMOND)); Assertions.assertEquals(Result.DEFAULT, event.getResult()); } @@ -125,7 +125,7 @@ void testCraftEventWithVanillaItem() { @Test void testPreCraftEventWithoutSlimefunItems() { - PrepareItemCraftEvent event = mockPreCraftingEvent(new ItemStack(Material.DIAMOND)); + PrepareItemCraftEvent event = mockPreCraftingEvent(ItemStack.of(Material.DIAMOND)); Assertions.assertNotNull(event.getInventory().getResult()); } diff --git a/src/test/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/TestGrindstoneListener.java b/src/test/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/TestGrindstoneListener.java index ff604beb04..4e081a5beb 100644 --- a/src/test/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/TestGrindstoneListener.java +++ b/src/test/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/TestGrindstoneListener.java @@ -60,7 +60,7 @@ private InventoryClickEvent mockGrindStoneEvent(ItemStack item) { @Test void testGrindStoneWithoutSlimefunItems() { - InventoryClickEvent event = mockGrindStoneEvent(new ItemStack(Material.ENCHANTED_BOOK)); + InventoryClickEvent event = mockGrindStoneEvent(ItemStack.of(Material.ENCHANTED_BOOK)); Assertions.assertEquals(Result.DEFAULT, event.getResult()); } diff --git a/src/test/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/TestIronGolemListener.java b/src/test/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/TestIronGolemListener.java index b536f6b00a..f3669157ee 100644 --- a/src/test/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/TestIronGolemListener.java +++ b/src/test/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/TestIronGolemListener.java @@ -66,7 +66,7 @@ private PlayerInteractEntityEvent callIronGolemEvent(EquipmentSlot hand, ItemSta @DisplayName("Test Iron Golem Healing not being disturbed") void testWithIron() { // This should heal the Iron Golem - ItemStack item = new ItemStack(Material.IRON_INGOT); + ItemStack item = ItemStack.of(Material.IRON_INGOT); PlayerInteractEntityEvent event = callIronGolemEvent(EquipmentSlot.HAND, item); Assertions.assertFalse(event.isCancelled()); diff --git a/src/test/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/TestItemPickupListener.java b/src/test/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/TestItemPickupListener.java index 8af24cd9b0..cff8c6695d 100644 --- a/src/test/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/TestItemPickupListener.java +++ b/src/test/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/TestItemPickupListener.java @@ -48,7 +48,7 @@ public static void unload() { @ValueSource(booleans = { true, false }) void testNoPickupFlagForEntities(boolean flag) { Player player = server.addPlayer(); - Item item = new ItemEntityMock(server, UUID.randomUUID(), new ItemStack(Material.COMPASS)); + Item item = new ItemEntityMock(server, UUID.randomUUID(), ItemStack.of(Material.COMPASS)); if (flag) { SlimefunUtils.markAsNoPickup(item, "Unit Test"); @@ -64,7 +64,7 @@ void testNoPickupFlagForEntities(boolean flag) { @ValueSource(booleans = { true, false }) void testNoPickupFlagForInventories(boolean flag) { Inventory inventory = new HopperInventoryMock(null); - Item item = new ItemEntityMock(server, UUID.randomUUID(), new ItemStack(Material.COMPASS)); + Item item = new ItemEntityMock(server, UUID.randomUUID(), ItemStack.of(Material.COMPASS)); if (flag) { SlimefunUtils.markAsNoPickup(item, "Unit Test"); diff --git a/src/test/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/TestMultiblockListener.java b/src/test/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/TestMultiblockListener.java index 55f9a5e5b6..16649bf4ae 100644 --- a/src/test/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/TestMultiblockListener.java +++ b/src/test/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/TestMultiblockListener.java @@ -55,7 +55,7 @@ void testNoMultiblock() { Block b = world.getBlockAt(3456, 90, -100); b.setType(Material.STONE); - PlayerInteractEvent event = new PlayerInteractEvent(player, Action.RIGHT_CLICK_BLOCK, new ItemStack(Material.AIR), b, BlockFace.NORTH); + PlayerInteractEvent event = new PlayerInteractEvent(player, Action.RIGHT_CLICK_BLOCK, ItemStack.of(Material.AIR), b, BlockFace.NORTH); listener.onRightClick(event); // No Multiblock, so nothing should happen @@ -76,7 +76,7 @@ void testMultiblock() { Block bottom = world.getBlockAt(1234, 90, -60); bottom.setType(multiblock.getStructure()[7]); - PlayerInteractEvent event = new PlayerInteractEvent(player, Action.RIGHT_CLICK_BLOCK, new ItemStack(Material.AIR), self, BlockFace.NORTH); + PlayerInteractEvent event = new PlayerInteractEvent(player, Action.RIGHT_CLICK_BLOCK, ItemStack.of(Material.AIR), self, BlockFace.NORTH); listener.onRightClick(event); Assertions.assertEquals(Result.DENY, event.useInteractedBlock()); diff --git a/src/test/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/TestNetworkListener.java b/src/test/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/TestNetworkListener.java index b6ef3148d6..5aa5cd1ba4 100644 --- a/src/test/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/TestNetworkListener.java +++ b/src/test/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/TestNetworkListener.java @@ -66,7 +66,7 @@ void testBlockPlace() { manager.registerNetwork(network); BlockState state = Mockito.mock(BlockState.class); - listener.onBlockPlace(new BlockPlaceEvent(l.getBlock(), state, l2.getBlock(), new ItemStack(Material.AIR), server.addPlayer(), true, EquipmentSlot.HAND)); + listener.onBlockPlace(new BlockPlaceEvent(l.getBlock(), state, l2.getBlock(), ItemStack.of(Material.AIR), server.addPlayer(), true, EquipmentSlot.HAND)); Mockito.verify(network).markDirty(l); } diff --git a/src/test/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/TestPiglinListener.java b/src/test/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/TestPiglinListener.java index d9e2b1fb87..fb7753f1fb 100644 --- a/src/test/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/TestPiglinListener.java +++ b/src/test/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/TestPiglinListener.java @@ -74,7 +74,7 @@ private PlayerInteractEntityEvent createInteractEvent(EquipmentSlot hand, ItemSt @Test void testPiglinPickup() { - EntityPickupItemEvent event = createPickupEvent(new ItemStack(Material.GOLD_INGOT)); + EntityPickupItemEvent event = createPickupEvent(ItemStack.of(Material.GOLD_INGOT)); listener.onPickup(event); Assertions.assertFalse(event.isCancelled()); } @@ -92,7 +92,7 @@ void testPiglinPickupWithSlimefunItem() { @ParameterizedTest @EnumSource(value = EquipmentSlot.class, names = { "HAND", "OFF_HAND" }) void testPiglinInteract(EquipmentSlot hand) { - PlayerInteractEntityEvent event = createInteractEvent(hand, new ItemStack(Material.GOLD_INGOT)); + PlayerInteractEntityEvent event = createInteractEvent(hand, ItemStack.of(Material.GOLD_INGOT)); listener.onInteract(event); Assertions.assertFalse(event.isCancelled()); } diff --git a/src/test/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/TestSmithingTableListener.java b/src/test/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/TestSmithingTableListener.java index 3c57ed5060..437b1daf64 100644 --- a/src/test/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/TestSmithingTableListener.java +++ b/src/test/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/TestSmithingTableListener.java @@ -71,7 +71,7 @@ private SmithItemEvent mockSmithingEvent(ItemStack tool, ItemStack material) { SmithingInventory inv = Mockito.mock(SmithingInventory.class); // MinecraftVersion#isAtLeast always returns true during unit test, so we use the 1.20 layout here. - Mockito.when(inv.getContents()).thenReturn(new ItemStack[] { new ItemStack(Material.NETHERITE_UPGRADE_SMITHING_TEMPLATE), tool, material, null }); + Mockito.when(inv.getContents()).thenReturn(new ItemStack[] { ItemStack.of(Material.NETHERITE_UPGRADE_SMITHING_TEMPLATE), tool, material, null }); InventoryView view = player.openInventory(inv); SmithItemEvent event = new SmithItemEvent(view, SlotType.RESULT, 3, ClickType.LEFT, InventoryAction.PICKUP_ONE); @@ -84,7 +84,7 @@ private PrepareSmithingEvent mockPrepareSmithingEvent(ItemStack tool, ItemStack Player player = server.addPlayer(); SmithingInventory inv = Mockito.mock(SmithingInventory.class); - MutableObject result = new MutableObject<>(new ItemStack(Material.NETHERITE_PICKAXE)); + MutableObject result = new MutableObject<>(ItemStack.of(Material.NETHERITE_PICKAXE)); Mockito.doAnswer(invocation -> { ItemStack argument = invocation.getArgument(0); @@ -94,7 +94,7 @@ private PrepareSmithingEvent mockPrepareSmithingEvent(ItemStack tool, ItemStack Mockito.when(inv.getResult()).thenAnswer(invocation -> result.getValue()); // MinecraftVersion#isAtLeast always returns true during unit test, so we use the 1.20 layout here. - Mockito.when(inv.getContents()).thenReturn(new ItemStack[] { new ItemStack(Material.NETHERITE_UPGRADE_SMITHING_TEMPLATE), tool, material, null }); + Mockito.when(inv.getContents()).thenReturn(new ItemStack[] { ItemStack.of(Material.NETHERITE_UPGRADE_SMITHING_TEMPLATE), tool, material, null }); InventoryView view = player.openInventory(inv); PrepareSmithingEvent event = new PrepareSmithingEvent(view, result.getValue()); @@ -106,28 +106,28 @@ private PrepareSmithingEvent mockPrepareSmithingEvent(ItemStack tool, ItemStack @Test @DisplayName("Test that vanilla is unchanged (ItemStack tool x ItemStack material)") void testSmithingTableWithItemStacks() { - SmithItemEvent event = mockSmithingEvent(new ItemStack(Material.DIAMOND_SWORD), new ItemStack(Material.NETHERITE_INGOT)); + SmithItemEvent event = mockSmithingEvent(ItemStack.of(Material.DIAMOND_SWORD), ItemStack.of(Material.NETHERITE_INGOT)); Assertions.assertEquals(Result.DEFAULT, event.getResult()); } @Test @DisplayName("Test that SlimefunItem material doesn't work (ItemStack tool x SlimefunItem material)") void testSmithingTableWithItemStackAndSlimefunItem() { - SmithItemEvent event = mockSmithingEvent(new ItemStack(Material.DIAMOND_SWORD), slimefunIngot.getItem()); + SmithItemEvent event = mockSmithingEvent(ItemStack.of(Material.DIAMOND_SWORD), slimefunIngot.getItem()); Assertions.assertEquals(Result.DENY, event.getResult()); } @Test @DisplayName("Test that VanillaItem material works (ItemStack tool x VanillaItem material)") void testSmithingTableWithItemStackAndVanillaItem() { - SmithItemEvent event = mockSmithingEvent(new ItemStack(Material.DIAMOND_SWORD), vanillaIngot.getItem()); + SmithItemEvent event = mockSmithingEvent(ItemStack.of(Material.DIAMOND_SWORD), vanillaIngot.getItem()); Assertions.assertEquals(Result.DEFAULT, event.getResult()); } @Test @DisplayName("Test that SlimefunItems can upgrade with vanilla (SlimefunItem tool x ItemStack material)") void testSmithingTableWithSlimefunItemAndItemStack() { - SmithItemEvent event = mockSmithingEvent(slimefunTool.getItem(), new ItemStack(Material.NETHERITE_INGOT)); + SmithItemEvent event = mockSmithingEvent(slimefunTool.getItem(), ItemStack.of(Material.NETHERITE_INGOT)); Assertions.assertEquals(Result.DEFAULT, event.getResult()); } @@ -148,7 +148,7 @@ void testSmithingTableWithSlimefunItemAndVanillaItem() { @Test @DisplayName("Test that VanillaItems can upgrade with vanilla (VanillaItem tool x ItemStack material)") void testSmithingTableWithVanillaItemAndItemStack() { - SmithItemEvent event = mockSmithingEvent(vanillaTool.getItem(), new ItemStack(Material.NETHERITE_INGOT)); + SmithItemEvent event = mockSmithingEvent(vanillaTool.getItem(), ItemStack.of(Material.NETHERITE_INGOT)); Assertions.assertEquals(Result.DEFAULT, event.getResult()); } @@ -170,35 +170,35 @@ void testSmithingTableWithVanillaItemAndVanillaItem() { @DisplayName("Test that ItemStacks can be upgraded with SlimefunItem can-be-used-in-workbenches: true") void testCanBeUsedInWorkbenchTrue() { Assertions.assertTrue(usableSlimefunIngot.isUseableInWorkbench()); - SmithItemEvent event = mockSmithingEvent(new ItemStack(Material.DIAMOND_SWORD), usableSlimefunIngot.getItem()); + SmithItemEvent event = mockSmithingEvent(ItemStack.of(Material.DIAMOND_SWORD), usableSlimefunIngot.getItem()); Assertions.assertEquals(Result.DEFAULT, event.getResult()); } @Test @DisplayName("Test that vanilla is unchanged (ItemStack tool x ItemStack material)") void testPrepareSmithingTableWithItemStacks() { - PrepareSmithingEvent event = mockPrepareSmithingEvent(new ItemStack(Material.DIAMOND_SWORD), new ItemStack(Material.NETHERITE_INGOT)); + PrepareSmithingEvent event = mockPrepareSmithingEvent(ItemStack.of(Material.DIAMOND_SWORD), ItemStack.of(Material.NETHERITE_INGOT)); Assertions.assertNotNull(event.getResult()); } @Test @DisplayName("Test that SlimefunItem material doesn't work (ItemStack tool x SlimefunItem material)") void testPrepareSmithingTableWithItemStackAndSlimefunItem() { - PrepareSmithingEvent event = mockPrepareSmithingEvent(new ItemStack(Material.DIAMOND_SWORD), slimefunIngot.getItem()); + PrepareSmithingEvent event = mockPrepareSmithingEvent(ItemStack.of(Material.DIAMOND_SWORD), slimefunIngot.getItem()); Assertions.assertNull(event.getResult()); } @Test @DisplayName("Test that VanillaItem material works (ItemStack tool x VanillaItem material)") void testPrepareSmithingTableWithItemStackAndVanillaItem() { - PrepareSmithingEvent event = mockPrepareSmithingEvent(new ItemStack(Material.DIAMOND_SWORD), vanillaIngot.getItem()); + PrepareSmithingEvent event = mockPrepareSmithingEvent(ItemStack.of(Material.DIAMOND_SWORD), vanillaIngot.getItem()); Assertions.assertNotNull(event.getResult()); } @Test @DisplayName("Test that SlimefunItems can upgrade with vanilla (SlimefunItem tool x ItemStack material)") void testPrepareSmithingTableWithSlimefunItemAndItemStack() { - PrepareSmithingEvent event = mockPrepareSmithingEvent(slimefunTool.getItem(), new ItemStack(Material.NETHERITE_INGOT)); + PrepareSmithingEvent event = mockPrepareSmithingEvent(slimefunTool.getItem(), ItemStack.of(Material.NETHERITE_INGOT)); Assertions.assertNotNull(event.getResult()); } @@ -219,7 +219,7 @@ void testPrepareSmithingTableWithSlimefunItemAndVanillaItem() { @Test @DisplayName("Test that VanillaItems can upgrade with vanilla (VanillaItem tool x ItemStack material)") void testPrepareSmithingTableWithVanillaItemAndItemStack() { - PrepareSmithingEvent event = mockPrepareSmithingEvent(vanillaTool.getItem(), new ItemStack(Material.NETHERITE_INGOT)); + PrepareSmithingEvent event = mockPrepareSmithingEvent(vanillaTool.getItem(), ItemStack.of(Material.NETHERITE_INGOT)); Assertions.assertNotNull(event.getResult()); } @@ -240,7 +240,7 @@ void testPrepareSmithingTableWithVanillaItemAndVanillaItem() { @Test @DisplayName("Test that ItemStacks can be upgraded with SlimefunItem can-be-used-in-workbenches: true") void testPrepareCanBeUsedInWorkbenchTrue() { - PrepareSmithingEvent event = mockPrepareSmithingEvent(new ItemStack(Material.DIAMOND_SWORD), usableSlimefunIngot.getItem()); + PrepareSmithingEvent event = mockPrepareSmithingEvent(ItemStack.of(Material.DIAMOND_SWORD), usableSlimefunIngot.getItem()); Assertions.assertNotNull(event.getResult()); } diff --git a/src/test/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/TestVillagerTradingListener.java b/src/test/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/TestVillagerTradingListener.java index da15c02de0..e28ad6fd39 100644 --- a/src/test/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/TestVillagerTradingListener.java +++ b/src/test/java/io/github/thebusybiscuit/slimefun4/implementation/listeners/TestVillagerTradingListener.java @@ -62,7 +62,7 @@ private InventoryClickEvent mockClickEvent(ItemStack item) { @Test void testTradingWithoutSlimefunItems() { - InventoryClickEvent event = mockClickEvent(new ItemStack(Material.EMERALD)); + InventoryClickEvent event = mockClickEvent(ItemStack.of(Material.EMERALD)); Assertions.assertEquals(Result.ALLOW, event.getResult()); } diff --git a/src/test/java/io/github/thebusybiscuit/slimefun4/implementation/registration/TestItemGroups.java b/src/test/java/io/github/thebusybiscuit/slimefun4/implementation/registration/TestItemGroups.java index d290992ff9..153ca76188 100644 --- a/src/test/java/io/github/thebusybiscuit/slimefun4/implementation/registration/TestItemGroups.java +++ b/src/test/java/io/github/thebusybiscuit/slimefun4/implementation/registration/TestItemGroups.java @@ -83,7 +83,7 @@ void testAddItem() { @Test @DisplayName("Test hidden Item Groups") void testHidden() { - ItemGroup group = new ItemGroup(new NamespacedKey(plugin, "hiddenItemGroup"), new ItemStack(Material.BEACON)); + ItemGroup group = new ItemGroup(new NamespacedKey(plugin, "hiddenItemGroup"), ItemStack.of(Material.BEACON)); Player player = server.addPlayer(); // Empty Item Groups are also hidden @@ -124,7 +124,7 @@ void testContains() { Assertions.assertFalse(group.contains(null)); // Unregistered Item - Assertions.assertFalse(group.contains(TestUtilities.mockSlimefunItem(plugin, "NULL", new ItemStack(Material.BEDROCK)))); + Assertions.assertFalse(group.contains(TestUtilities.mockSlimefunItem(plugin, "NULL", ItemStack.of(Material.BEDROCK)))); } @Test diff --git a/src/test/java/io/github/thebusybiscuit/slimefun4/implementation/registration/TestRechargeableItems.java b/src/test/java/io/github/thebusybiscuit/slimefun4/implementation/registration/TestRechargeableItems.java index 59938126f5..5ba611d827 100644 --- a/src/test/java/io/github/thebusybiscuit/slimefun4/implementation/registration/TestRechargeableItems.java +++ b/src/test/java/io/github/thebusybiscuit/slimefun4/implementation/registration/TestRechargeableItems.java @@ -40,16 +40,16 @@ void testInvalidItems() { Rechargeable rechargeable = mock("INVALID_CHARGING_TEST", 1); Assertions.assertThrows(IllegalArgumentException.class, () -> rechargeable.getItemCharge(null)); - Assertions.assertThrows(IllegalArgumentException.class, () -> rechargeable.getItemCharge(new ItemStack(Material.AIR))); + Assertions.assertThrows(IllegalArgumentException.class, () -> rechargeable.getItemCharge(ItemStack.of(Material.AIR))); Assertions.assertThrows(IllegalArgumentException.class, () -> rechargeable.setItemCharge(null, 1)); - Assertions.assertThrows(IllegalArgumentException.class, () -> rechargeable.setItemCharge(new ItemStack(Material.AIR), 1)); + Assertions.assertThrows(IllegalArgumentException.class, () -> rechargeable.setItemCharge(ItemStack.of(Material.AIR), 1)); Assertions.assertThrows(IllegalArgumentException.class, () -> rechargeable.addItemCharge(null, 1)); - Assertions.assertThrows(IllegalArgumentException.class, () -> rechargeable.addItemCharge(new ItemStack(Material.AIR), 1)); + Assertions.assertThrows(IllegalArgumentException.class, () -> rechargeable.addItemCharge(ItemStack.of(Material.AIR), 1)); Assertions.assertThrows(IllegalArgumentException.class, () -> rechargeable.removeItemCharge(null, 1)); - Assertions.assertThrows(IllegalArgumentException.class, () -> rechargeable.removeItemCharge(new ItemStack(Material.AIR), 1)); + Assertions.assertThrows(IllegalArgumentException.class, () -> rechargeable.removeItemCharge(ItemStack.of(Material.AIR), 1)); } @Test diff --git a/src/test/java/io/github/thebusybiscuit/slimefun4/implementation/tasks/TestArmorTask.java b/src/test/java/io/github/thebusybiscuit/slimefun4/implementation/tasks/TestArmorTask.java index 87995a039d..d6c15dd4e3 100644 --- a/src/test/java/io/github/thebusybiscuit/slimefun4/implementation/tasks/TestArmorTask.java +++ b/src/test/java/io/github/thebusybiscuit/slimefun4/implementation/tasks/TestArmorTask.java @@ -63,7 +63,7 @@ void testSlimefunArmor() throws InterruptedException { armor.register(plugin); player.getInventory().setHelmet(helmet.clone()); - player.getInventory().setChestplate(new ItemStack(Material.DIAMOND_CHESTPLATE)); + player.getInventory().setChestplate(ItemStack.of(Material.DIAMOND_CHESTPLATE)); new ArmorTask(false).run(); // Check if all Potion Effects were applied @@ -85,7 +85,7 @@ void testRadiactivity(boolean hazmat, boolean radioactiveFire) throws Interrupte new RadioactiveItem(itemGroup, Radioactivity.VERY_DEADLY, item, RecipeType.NULL, new ItemStack[9]).register(plugin); player.getInventory().setItemInMainHand(item.clone()); - player.getInventory().setItemInOffHand(new ItemStack(Material.EMERALD_ORE)); + player.getInventory().setItemInOffHand(ItemStack.of(Material.EMERALD_ORE)); if (hazmat) { SlimefunItemStack chestplate = new SlimefunItemStack("MOCK_HAZMAT_SUIT_" + String.valueOf(radioactiveFire).toUpperCase(Locale.ROOT), Material.LEATHER_CHESTPLATE, "&4Hazmat Prototype"); diff --git a/src/test/java/io/github/thebusybiscuit/slimefun4/test/TestUtilities.java b/src/test/java/io/github/thebusybiscuit/slimefun4/test/TestUtilities.java index edd6a458af..f2631574d6 100644 --- a/src/test/java/io/github/thebusybiscuit/slimefun4/test/TestUtilities.java +++ b/src/test/java/io/github/thebusybiscuit/slimefun4/test/TestUtilities.java @@ -70,7 +70,7 @@ private TestUtilities() {} @ParametersAreNonnullByDefault public static @Nonnull VanillaItem mockVanillaItem(Plugin plugin, Material type, boolean enabled) { ItemGroup itemGroup = new ItemGroup(new NamespacedKey(plugin, "test"), new CustomItemStack(Material.EMERALD, "&4Test ItemGroup")); - VanillaItem item = new VanillaItem(itemGroup, new ItemStack(type), type.name(), RecipeType.NULL, new ItemStack[9]); + VanillaItem item = new VanillaItem(itemGroup, ItemStack.of(type), type.name(), RecipeType.NULL, new ItemStack[9]); Slimefun.getItemCfg().setValue(type.name() + ".enabled", enabled); return item; } diff --git a/src/test/java/io/github/thebusybiscuit/slimefun4/utils/TestChargeUtils.java b/src/test/java/io/github/thebusybiscuit/slimefun4/utils/TestChargeUtils.java index 1f91b38415..151471e302 100644 --- a/src/test/java/io/github/thebusybiscuit/slimefun4/utils/TestChargeUtils.java +++ b/src/test/java/io/github/thebusybiscuit/slimefun4/utils/TestChargeUtils.java @@ -33,7 +33,7 @@ public static void unload() { @Test @DisplayName("Test setting charge") void testSetCharge() { - ItemStack item = new ItemStack(Material.DIAMOND_SWORD); + ItemStack item = ItemStack.of(Material.DIAMOND_SWORD); ItemMeta meta = item.getItemMeta(); // Make sure the lore is set @@ -59,14 +59,14 @@ void testSetCharge() { @DisplayName("Test getting charge") void testGetCharge() { // Test with persistent data - ItemStack itemWithData = new ItemStack(Material.DIAMOND_SWORD); + ItemStack itemWithData = ItemStack.of(Material.DIAMOND_SWORD); ItemMeta metaWithData = itemWithData.getItemMeta(); PersistentDataAPI.setFloat(metaWithData, Slimefun.getRegistry().getItemChargeDataKey(), 10.5f); Assertions.assertEquals(10.5f, ChargeUtils.getCharge(metaWithData), 0.001); // Test with lore - ItemStack itemWithLore = new ItemStack(Material.DIAMOND_SWORD); + ItemStack itemWithLore = ItemStack.of(Material.DIAMOND_SWORD); ItemMeta metaWithLore = itemWithLore.getItemMeta(); metaWithLore.setLore(Collections.singletonList("&8\u21E8 &e\u26A1 &710.5 / 100.5 J".replace('&', ChatColor.COLOR_CHAR))); @@ -74,14 +74,14 @@ void testGetCharge() { Assertions.assertTrue(PersistentDataAPI.hasFloat(metaWithLore, Slimefun.getRegistry().getItemChargeDataKey())); // Test no data and empty lore - ItemStack itemWithEmptyLore = new ItemStack(Material.DIAMOND_SWORD); + ItemStack itemWithEmptyLore = ItemStack.of(Material.DIAMOND_SWORD); ItemMeta metaWithEmptyLore = itemWithEmptyLore.getItemMeta(); metaWithEmptyLore.setLore(Collections.emptyList()); Assertions.assertEquals(0, ChargeUtils.getCharge(metaWithEmptyLore)); // Test no data and no lore - ItemStack itemWithNoDataOrLore = new ItemStack(Material.DIAMOND_SWORD); + ItemStack itemWithNoDataOrLore = ItemStack.of(Material.DIAMOND_SWORD); Assertions.assertEquals(0, ChargeUtils.getCharge(itemWithNoDataOrLore.getItemMeta())); diff --git a/src/test/java/io/github/thebusybiscuit/slimefun4/utils/TestItemStackWrapper.java b/src/test/java/io/github/thebusybiscuit/slimefun4/utils/TestItemStackWrapper.java index 510584bbfc..8e246e8d05 100644 --- a/src/test/java/io/github/thebusybiscuit/slimefun4/utils/TestItemStackWrapper.java +++ b/src/test/java/io/github/thebusybiscuit/slimefun4/utils/TestItemStackWrapper.java @@ -47,7 +47,7 @@ void testEqualityWithItemMeta() { @Test @DisplayName("Test if an ItemStackWrappers can be compared properly (No ItemMeta)") void testEqualityWithoutItemMeta() { - ItemStack item = new ItemStack(Material.DIAMOND_AXE); + ItemStack item = ItemStack.of(Material.DIAMOND_AXE); ItemStackWrapper wrapper = ItemStackWrapper.wrap(item); Assertions.assertEquals(item.getType(), wrapper.getType()); @@ -90,7 +90,7 @@ void testWrapperChecking() { @Test @DisplayName("Test wrapping an ItemStack Array") void testWrapArray() { - ItemStack[] items = { new ItemStack(Material.DIAMOND), null, new ItemStack(Material.EMERALD), new CustomItemStack(Material.REDSTONE, "&4Firey thing", "with lore :o") }; + ItemStack[] items = { ItemStack.of(Material.DIAMOND), null, ItemStack.of(Material.EMERALD), new CustomItemStack(Material.REDSTONE, "&4Firey thing", "with lore :o") }; ItemStackWrapper[] wrappers = ItemStackWrapper.wrapArray(items); Assertions.assertEquals(items.length, wrappers.length); @@ -111,7 +111,7 @@ void testWrapArray() { @Test @DisplayName("Test wrapping an ItemStack List") void testWrapList() { - List items = Arrays.asList(new ItemStack(Material.DIAMOND), null, new ItemStack(Material.EMERALD), new CustomItemStack(Material.REDSTONE, "&4Firey thing", "with lore :o")); + List items = Arrays.asList(ItemStack.of(Material.DIAMOND), null, ItemStack.of(Material.EMERALD), new CustomItemStack(Material.REDSTONE, "&4Firey thing", "with lore :o")); List wrappers = ItemStackWrapper.wrapList(items); Assertions.assertEquals(items.size(), wrappers.size()); diff --git a/src/test/java/io/github/thebusybiscuit/slimefun4/utils/TestSoulboundItem.java b/src/test/java/io/github/thebusybiscuit/slimefun4/utils/TestSoulboundItem.java index 9720494842..58eb98a739 100644 --- a/src/test/java/io/github/thebusybiscuit/slimefun4/utils/TestSoulboundItem.java +++ b/src/test/java/io/github/thebusybiscuit/slimefun4/utils/TestSoulboundItem.java @@ -39,7 +39,7 @@ public static void unload() { void testNullAndAir() { Assertions.assertThrows(IllegalArgumentException.class, () -> SlimefunUtils.setSoulbound(null, true)); - ItemStack item = new ItemStack(Material.AIR); + ItemStack item = ItemStack.of(Material.AIR); Assertions.assertThrows(IllegalArgumentException.class, () -> SlimefunUtils.setSoulbound(item, true)); Assertions.assertFalse(SlimefunUtils.isSoulbound(null));