1
mirror of https://github.com/StarWishsama/Slimefun4.git synced 2024-09-19 19:25:48 +00:00

Removed Digital Miners

This commit is contained in:
TheBusyBiscuit 2020-06-01 14:10:22 +02:00
parent f65ac6b68c
commit 0faaef9b25
5 changed files with 4 additions and 164 deletions

View File

@ -27,6 +27,8 @@
#### Changes
* Fixed a few memory leaks
* Removed Digital Miner
* Removed Advanced Digital Miner
#### Fixes
* Fixed Ore Washer recipes showing up twice

View File

@ -117,10 +117,8 @@ public final class ResearchSetup {
register("table_saw", 92, "Table Saw", 4, SlimefunItems.TABLE_SAW);
register("slime_steel_armor", 93, "Slimy Steel Armor", 27, SlimefunItems.SLIME_HELMET_STEEL, SlimefunItems.SLIME_CHESTPLATE_STEEL, SlimefunItems.SLIME_LEGGINGS_STEEL, SlimefunItems.SLIME_BOOTS_STEEL);
register("blade_of_vampires", 94, "Blade of Vampires", 26, SlimefunItems.BLADE_OF_VAMPIRES);
register("digital_miner", 95, "Lazy Mining", 40, SlimefunItems.DIGITAL_MINER);
register("water_staff", 96, "Water Staff", 8, SlimefunItems.STAFF_WATER);
register("24k_gold_block", 97, "Golden City", 19, SlimefunItems.GOLD_24K_BLOCK);
register("advanced_digital_miner", 98, "Advanced Mining 101", 42, SlimefunItems.ADVANCED_DIGITAL_MINER);
register("composter", 99, "Composting Dirt", 3, SlimefunItems.COMPOSTER);
register("farmer_shoes", 100, "Farmer Shoes", 4, SlimefunItems.FARMER_SHOES);
register("explosive_tools", 101, "Explosive Tools", 30, SlimefunItems.EXPLOSIVE_PICKAXE, SlimefunItems.EXPLOSIVE_SHOVEL);

View File

@ -3,28 +3,16 @@ package io.github.thebusybiscuit.slimefun4.implementation.setup;
import java.util.ArrayList;
import java.util.List;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.Effect;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.NamespacedKey;
import org.bukkit.Sound;
import org.bukkit.block.Block;
import org.bukkit.block.BlockFace;
import org.bukkit.block.Chest;
import org.bukkit.entity.Player;
import org.bukkit.inventory.Inventory;
import org.bukkit.inventory.ItemStack;
import org.bukkit.potion.PotionEffect;
import org.bukkit.potion.PotionEffectType;
import io.github.thebusybiscuit.cscorelib2.inventory.InvUtils;
import io.github.thebusybiscuit.cscorelib2.item.CustomItem;
import io.github.thebusybiscuit.cscorelib2.materials.MaterialCollections;
import io.github.thebusybiscuit.slimefun4.api.MinecraftVersion;
import io.github.thebusybiscuit.slimefun4.api.SlimefunAddon;
import io.github.thebusybiscuit.slimefun4.core.MultiBlock;
import io.github.thebusybiscuit.slimefun4.core.attributes.Radioactivity;
import io.github.thebusybiscuit.slimefun4.implementation.items.RadioactiveItem;
import io.github.thebusybiscuit.slimefun4.implementation.items.VanillaItem;
@ -176,17 +164,12 @@ import io.github.thebusybiscuit.slimefun4.implementation.items.weapons.SeismicAx
import io.github.thebusybiscuit.slimefun4.implementation.items.weapons.SwordOfBeheading;
import io.github.thebusybiscuit.slimefun4.implementation.items.weapons.VampireBlade;
import io.github.thebusybiscuit.slimefun4.utils.SlimefunUtils;
import me.mrCookieSlime.CSCoreLibPlugin.CSCoreLib;
import me.mrCookieSlime.Slimefun.SlimefunPlugin;
import me.mrCookieSlime.Slimefun.Lists.RecipeType;
import me.mrCookieSlime.Slimefun.Lists.SlimefunItems;
import me.mrCookieSlime.Slimefun.Objects.Category;
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.SlimefunItem;
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.SlimefunMachine;
import me.mrCookieSlime.Slimefun.Objects.handlers.MultiBlockInteractionHandler;
import me.mrCookieSlime.Slimefun.Objects.handlers.RainbowTicker;
import me.mrCookieSlime.Slimefun.api.BlockStorage;
import me.mrCookieSlime.Slimefun.api.Slimefun;
import me.mrCookieSlime.Slimefun.api.SlimefunItemStack;
/**
@ -1017,142 +1000,6 @@ public final class SlimefunItemSetup {
new ItemStack[] {null, new ItemStack(Material.WITHER_SKELETON_SKULL), null, null, new ItemStack(Material.WITHER_SKELETON_SKULL), null, null, new ItemStack(Material.BLAZE_ROD), null})
.register(plugin);
SlimefunMachine miner = new SlimefunMachine(categories.basicMachines, SlimefunItems.DIGITAL_MINER, "DIGITAL_MINER",
new ItemStack[] {SlimefunItems.SOLAR_PANEL, new ItemStack(Material.CHEST), SlimefunItems.SOLAR_PANEL, new ItemStack(Material.IRON_BLOCK), new ItemStack(Material.DISPENSER), new ItemStack(Material.IRON_BLOCK), new ItemStack(Material.IRON_BLOCK), new ItemStack(Material.HOPPER), new ItemStack(Material.IRON_BLOCK)},
BlockFace.SELF);
miner.addItemHandler(new MultiBlockInteractionHandler() {
@Override
public boolean onInteract(Player p, MultiBlock mb, Block b) {
if (mb.equals(((SlimefunMachine) SlimefunItem.getByID("DIGITAL_MINER")).getMultiBlock())) {
p.sendMessage(ChatColor.DARK_RED + "THIS MACHINE WILL SOON BE REMOVED!");
if (CSCoreLib.getLib().getProtectionManager().canAccessChest(p.getUniqueId(), b, true) && Slimefun.hasUnlocked(p, SlimefunItems.DIGITAL_MINER, true)) {
Block chestBlock = b.getRelative(BlockFace.UP);
if(!(BlockStorage.check(chestBlock.getRelative(BlockFace.WEST), "SOLAR_PANEL") && BlockStorage.check(chestBlock.getRelative(BlockFace.EAST), "SOLAR_PANEL")) &&
!(BlockStorage.check(chestBlock.getRelative(BlockFace.NORTH), "SOLAR_PANEL") && BlockStorage.check(chestBlock.getRelative(BlockFace.SOUTH), "SOLAR_PANEL"))) {
return false;
}
Chest chest = (Chest) chestBlock.getState();
Inventory inv = chest.getInventory();
List<Location> ores = new ArrayList<>();
for (int x = b.getX() - 4; x <= b.getX() + 4; x++) {
for (int z = b.getZ() - 4; z <= b.getZ() + 4; z++) {
for (int y = b.getY(); y > 0; y--) {
if (b.getWorld().getBlockAt(x, y, z).getType().toString().endsWith("_ORE")) {
ores.add(b.getWorld().getBlockAt(x, y, z).getLocation());
}
}
}
}
if (!ores.isEmpty()) {
Material ore = ores.get(0).getBlock().getType();
ItemStack adding = new ItemStack(ore);
ores.get(0).getBlock().setType(Material.AIR);
ores.clear();
if (InvUtils.fits(inv, adding)) {
for (int i = 0; i < 4; i++) {
int j = i;
Bukkit.getScheduler().runTaskLater(SlimefunPlugin.instance, () -> {
if (j < 3) {
b.getWorld().playEffect(b.getLocation(), Effect.STEP_SOUND, ore);
}
else {
p.getWorld().playSound(p.getLocation(), Sound.ENTITY_ARROW_HIT_PLAYER, 1F, 1F);
inv.addItem(adding);
}
}, i*20L);
}
}
else SlimefunPlugin.getLocal().sendMessage(p, "machines.full-inventory", true);
}
else SlimefunPlugin.getLocal().sendMessage(p, "miner.no-ores", true);
}
return true;
}
else return false;
}
});
miner.register(plugin);
SlimefunMachine advancedMiner = new SlimefunMachine(categories.basicMachines, SlimefunItems.ADVANCED_DIGITAL_MINER, "ADVANCED_DIGITAL_MINER",
new ItemStack[] {SlimefunItems.SOLAR_PANEL, new ItemStack(Material.CHEST), SlimefunItems.SOLAR_PANEL, SlimefunItems.GOLD_24K_BLOCK, new ItemStack(Material.DISPENSER), SlimefunItems.GOLD_24K_BLOCK, SlimefunItems.GOLD_24K_BLOCK, new ItemStack(Material.HOPPER), SlimefunItems.GOLD_24K_BLOCK},
BlockFace.SELF);
advancedMiner.addItemHandler(new MultiBlockInteractionHandler() {
// Determines the drops an Advanced Digital Miner will get
private final ItemStack effectivePickaxe = new ItemStack(Material.DIAMOND_PICKAXE);
@Override
public boolean onInteract(Player p, MultiBlock mb, Block b) {
if (mb.equals(((SlimefunMachine) SlimefunItem.getByID("ADVANCED_DIGITAL_MINER")).getMultiBlock())) {
p.sendMessage(ChatColor.DARK_RED + "THIS MACHINE WILL SOON BE REMOVED!");
if (CSCoreLib.getLib().getProtectionManager().canAccessChest(p.getUniqueId(), b, true) && Slimefun.hasUnlocked(p, SlimefunItems.ADVANCED_DIGITAL_MINER, true)) {
Block chestBlock = b.getRelative(BlockFace.UP);
if(!(BlockStorage.check(chestBlock.getRelative(BlockFace.WEST), "SOLAR_PANEL") && BlockStorage.check(chestBlock.getRelative(BlockFace.EAST), "SOLAR_PANEL")) &&
!(BlockStorage.check(chestBlock.getRelative(BlockFace.NORTH), "SOLAR_PANEL") && BlockStorage.check(chestBlock.getRelative(BlockFace.SOUTH), "SOLAR_PANEL"))) {
return false;
}
Chest chest = (Chest) chestBlock.getState();
Inventory inv = chest.getInventory();
List<Location> ores = new ArrayList<>();
for (int x = b.getX() - 6; x <= b.getX() + 6; x++) {
for (int z = b.getZ() - 6; z <= b.getZ() + 6; z++) {
for (int y = b.getY(); y > 0; y--) {
if (b.getWorld().getBlockAt(x, y, z).getType().toString().endsWith("_ORE")) {
ores.add(b.getWorld().getBlockAt(x, y, z).getLocation());
}
}
}
}
if (!ores.isEmpty()) {
Material ore = ores.get(0).getBlock().getType();
ItemStack drop = new ItemStack(ore);
if (ore == Material.COAL_ORE) drop = new ItemStack(Material.COAL, 4);
else if (ore == Material.IRON_ORE) drop = new CustomItem(SlimefunItems.IRON_DUST, 2);
else if (ore == Material.GOLD_ORE) drop = new CustomItem(SlimefunItems.GOLD_DUST, 2);
else if (ore == Material.REDSTONE_ORE) drop = new ItemStack(Material.REDSTONE, 8);
else if (ore == Material.NETHER_QUARTZ_ORE) drop = new ItemStack(Material.QUARTZ, 4);
else if (ore == Material.LAPIS_ORE) drop = new ItemStack(Material.LAPIS_LAZULI, 12);
else {
for (ItemStack drops : ores.get(0).getBlock().getDrops(effectivePickaxe)) {
if (!drops.getType().isBlock()) drop = new CustomItem(drops, 2);
}
}
final ItemStack adding = drop;
ores.get(0).getBlock().setType(Material.AIR);
ores.clear();
if (InvUtils.fits(inv, adding)) {
for (int i = 0; i < 4; i++) {
int j = i;
Bukkit.getScheduler().runTaskLater(SlimefunPlugin.instance, () -> {
if (j < 3) {
b.getWorld().playEffect(b.getLocation(), Effect.STEP_SOUND, ore);
}
else {
p.getWorld().playSound(p.getLocation(), Sound.ENTITY_ARROW_HIT_PLAYER, 1F, 1F);
inv.addItem(adding);
}
}, i*20L);
}
}
else SlimefunPlugin.getLocal().sendMessage(p, "machines.full-inventory", true);
}
else SlimefunPlugin.getLocal().sendMessage(p, "miner.no-ores", true);
}
return true;
}
else return false;
}
});
advancedMiner.register(plugin);
new SlimefunItem(categories.misc, (SlimefunItemStack) SlimefunItems.GOLD_24K_BLOCK, RecipeType.ENHANCED_CRAFTING_TABLE,
new ItemStack[] {SlimefunItems.GOLD_24K, SlimefunItems.GOLD_24K, SlimefunItems.GOLD_24K, SlimefunItems.GOLD_24K, SlimefunItems.GOLD_24K, SlimefunItems.GOLD_24K, SlimefunItems.GOLD_24K, SlimefunItems.GOLD_24K, SlimefunItems.GOLD_24K})
.register(plugin);

View File

@ -11,7 +11,6 @@ import org.bukkit.inventory.meta.ItemMeta;
import org.bukkit.potion.PotionEffect;
import org.bukkit.potion.PotionEffectType;
import io.github.thebusybiscuit.cscorelib2.item.CustomItem;
import io.github.thebusybiscuit.slimefun4.api.MinecraftVersion;
import io.github.thebusybiscuit.slimefun4.core.attributes.MachineTier;
import io.github.thebusybiscuit.slimefun4.core.attributes.MachineType;
@ -531,13 +530,7 @@ public final class SlimefunItems {
public static final SlimefunItemStack CRUCIBLE = new SlimefunItemStack("CRUCIBLE", Material.CAULDRON, "&cCrucible", "", "&a&oUsed to smelt Items into Liquids");
public static final SlimefunItemStack JUICER = new SlimefunItemStack("JUICER", Material.GLASS_BOTTLE, "&aJuicer", "", "&aAllows you to create delicious Juice");
public static final ItemStack SOLAR_PANEL = new SlimefunItemStack("SOLAR_PANEL", Material.DAYLIGHT_DETECTOR, "&bSolar Panel", "", "&a&oTransforms Sunlight to Energy");
@Deprecated
public static final ItemStack DIGITAL_MINER = new CustomItem(Material.IRON_PICKAXE, "&bDigital Miner", "", "&4DEPRECATED", "&cThis machine will be removed at some point!", "&cWe don't know when.");
@Deprecated
public static final ItemStack ADVANCED_DIGITAL_MINER = new CustomItem(Material.DIAMOND_PICKAXE, "&6Advanced Digital Miner", "", "&4DEPRECATED", "&cThis machine will be removed at some point!", "&cWe don't know when.");
public static final SlimefunItemStack SOLAR_PANEL = new SlimefunItemStack("SOLAR_PANEL", Material.DAYLIGHT_DETECTOR, "&bSolar Panel", "", "&a&oTransforms Sunlight to Energy");
public static final SlimefunItemStack AUTOMATED_PANNING_MACHINE = new SlimefunItemStack("AUTOMATED_PANNING_MACHINE", Material.BOWL, "&eAutomated Panning Machine", "", "&rA MultiBlock Version of the Gold Pan", "&rand Nether Gold Pan combined in one machine.");
public static final SlimefunItemStack OUTPUT_CHEST = new SlimefunItemStack("OUTPUT_CHEST", Material.CHEST, "&4Output Chest", "", "&c&oA basic machine will try to put", "&c&oitems in this chest if it's placed", "&c&oadjacent to the dispenser.");

View File

@ -200,7 +200,7 @@ public class SlimefunItemStack extends CustomItem {
@Override
public String toString() {
return "SlimefunItemStack (" + id + ')';
return "SlimefunItemStack (" + id + (getAmount() > 1 ? (" x " + getAmount()) : "") + ')';
}
public Optional<String> getSkullTexture() {