mirror of
https://github.com/StarWishsama/Slimefun4.git
synced 2024-09-20 03:35:51 +00:00
commit
5730907da3
@ -77,7 +77,7 @@ public class ExplosivePickaxe extends SimpleSlimefunItem<BlockBreakHandler> impl
|
|||||||
b.breakNaturally();
|
b.breakNaturally();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
for (ItemStack drop: b.getDrops()) {
|
for (ItemStack drop : b.getDrops(getItem())) {
|
||||||
b.getWorld().dropItemNaturally(b.getLocation(), (b.getType().toString().endsWith("_ORE") && b.getType() != Material.IRON_ORE && b.getType() != Material.GOLD_ORE) ? new CustomItem(drop, fortune): drop);
|
b.getWorld().dropItemNaturally(b.getLocation(), (b.getType().toString().endsWith("_ORE") && b.getType() != Material.IRON_ORE && b.getType() != Material.GOLD_ORE) ? new CustomItem(drop, fortune): drop);
|
||||||
}
|
}
|
||||||
b.setType(Material.AIR);
|
b.setType(Material.AIR);
|
||||||
|
@ -52,7 +52,7 @@ public class ExplosiveShovel extends SimpleSlimefunItem<BlockBreakHandler> imple
|
|||||||
|
|
||||||
b.getWorld().playEffect(b.getLocation(), Effect.STEP_SOUND, b.getType());
|
b.getWorld().playEffect(b.getLocation(), Effect.STEP_SOUND, b.getType());
|
||||||
|
|
||||||
for (ItemStack drop: b.getDrops()) {
|
for (ItemStack drop : b.getDrops(getItem())) {
|
||||||
if (drop != null) {
|
if (drop != null) {
|
||||||
b.getWorld().dropItemNaturally(b.getLocation(), drop);
|
b.getWorld().dropItemNaturally(b.getLocation(), drop);
|
||||||
}
|
}
|
||||||
|
@ -33,7 +33,7 @@ public class HerculesPickaxe extends SimpleSlimefunItem<BlockBreakHandler> {
|
|||||||
drops.add(new CustomItem(SlimefunItems.GOLD_DUST, 2));
|
drops.add(new CustomItem(SlimefunItems.GOLD_DUST, 2));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
for (ItemStack drop: e.getBlock().getDrops()) {
|
for (ItemStack drop : e.getBlock().getDrops(getItem())) {
|
||||||
drops.add(new CustomItem(drop, drop.getAmount() * 2));
|
drops.add(new CustomItem(drop, drop.getAmount() * 2));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -44,7 +44,7 @@ public class LumberAxe extends SimpleSlimefunItem<BlockBreakHandler> implements
|
|||||||
if (SlimefunPlugin.getProtectionManager().hasPermission(e.getPlayer(), b, ProtectableAction.BREAK_BLOCK)) {
|
if (SlimefunPlugin.getProtectionManager().hasPermission(e.getPlayer(), b, ProtectableAction.BREAK_BLOCK)) {
|
||||||
b.getWorld().playEffect(b.getLocation(), Effect.STEP_SOUND, b.getType());
|
b.getWorld().playEffect(b.getLocation(), Effect.STEP_SOUND, b.getType());
|
||||||
|
|
||||||
for (ItemStack drop: b.getDrops()) {
|
for (ItemStack drop : b.getDrops(getItem())) {
|
||||||
b.getWorld().dropItemNaturally(b.getLocation(), drop);
|
b.getWorld().dropItemNaturally(b.getLocation(), drop);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -40,7 +40,7 @@ public class PickaxeOfVeinMining extends SimpleSlimefunItem<BlockBreakHandler> {
|
|||||||
if (SlimefunPlugin.getProtectionManager().hasPermission(e.getPlayer(), b.getLocation(), ProtectableAction.BREAK_BLOCK)) {
|
if (SlimefunPlugin.getProtectionManager().hasPermission(e.getPlayer(), b.getLocation(), ProtectableAction.BREAK_BLOCK)) {
|
||||||
b.getWorld().playEffect(b.getLocation(), Effect.STEP_SOUND, b.getType());
|
b.getWorld().playEffect(b.getLocation(), Effect.STEP_SOUND, b.getType());
|
||||||
|
|
||||||
for (ItemStack drop: b.getDrops()) {
|
for (ItemStack drop : b.getDrops(getItem())) {
|
||||||
b.getWorld().dropItemNaturally(b.getLocation(), drop.getType().isBlock() ? drop: new CustomItem(drop, fortune));
|
b.getWorld().dropItemNaturally(b.getLocation(), drop.getType().isBlock() ? drop: new CustomItem(drop, fortune));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -35,7 +35,7 @@ public class SmeltersPickaxe extends SimpleSlimefunItem<BlockBreakHandler> {
|
|||||||
if (BlockStorage.hasBlockInfo(e.getBlock())) return true;
|
if (BlockStorage.hasBlockInfo(e.getBlock())) return true;
|
||||||
if (e.getBlock().getType() == Material.PLAYER_HEAD) return true;
|
if (e.getBlock().getType() == Material.PLAYER_HEAD) return true;
|
||||||
|
|
||||||
Collection<ItemStack> blockDrops = e.getBlock().getDrops();
|
Collection<ItemStack> blockDrops = e.getBlock().getDrops(getItem());
|
||||||
for (ItemStack drop : blockDrops) {
|
for (ItemStack drop : blockDrops) {
|
||||||
if (drop != null) {
|
if (drop != null) {
|
||||||
ItemStack output = drop;
|
ItemStack output = drop;
|
||||||
|
@ -1092,7 +1092,8 @@ public final class SlimefunSetup {
|
|||||||
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},
|
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},
|
||||||
new ItemStack[0], BlockFace.SELF)
|
new ItemStack[0], BlockFace.SELF)
|
||||||
.register(true, new MultiBlockInteractionHandler() {
|
.register(true, new MultiBlockInteractionHandler() {
|
||||||
|
// Determines the drops an Advanced Digital Miner will get
|
||||||
|
private final ItemStack EFFECTIVE_PICKAXE = new ItemStack(Material.DIAMOND_PICKAXE);
|
||||||
@Override
|
@Override
|
||||||
public boolean onInteract(final Player p, MultiBlock mb, final Block b) {
|
public boolean onInteract(final Player p, MultiBlock mb, final Block b) {
|
||||||
if (mb.isMultiBlock(SlimefunItem.getByID("ADVANCED_DIGITAL_MINER"))) {
|
if (mb.isMultiBlock(SlimefunItem.getByID("ADVANCED_DIGITAL_MINER"))) {
|
||||||
@ -1128,7 +1129,7 @@ public final class SlimefunSetup {
|
|||||||
else if (ore == Material.NETHER_QUARTZ_ORE) drop = new ItemStack(Material.QUARTZ, 4);
|
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 if (ore == Material.LAPIS_ORE) drop = new ItemStack(Material.LAPIS_LAZULI, 12);
|
||||||
else {
|
else {
|
||||||
for (ItemStack drops: ores.get(0).getBlock().getDrops()) {
|
for (ItemStack drops: ores.get(0).getBlock().getDrops(EFFECTIVE_PICKAXE)) {
|
||||||
if (!drops.getType().isBlock()) drop = new CustomItem(drops, 2);
|
if (!drops.getType().isBlock()) drop = new CustomItem(drops, 2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -74,6 +74,9 @@ import me.mrCookieSlime.Slimefun.api.item_transport.ItemTransportFlow;
|
|||||||
|
|
||||||
public abstract class ProgrammableAndroid extends SlimefunItem implements InventoryBlock {
|
public abstract class ProgrammableAndroid extends SlimefunItem implements InventoryBlock {
|
||||||
|
|
||||||
|
// Determines the drops a miner android will get
|
||||||
|
private static final ItemStack EFFECTIVE_PICKAXE = new ItemStack(Material.DIAMOND_PICKAXE);
|
||||||
|
|
||||||
private static final int[] border = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 18, 24, 25, 26, 27, 33, 35, 36, 42, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53};
|
private static final int[] border = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 18, 24, 25, 26, 27, 33, 35, 36, 42, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53};
|
||||||
private static final int[] border_out = {10, 11, 12, 13, 14, 19, 23, 28, 32, 37, 38, 39, 40, 41};
|
private static final int[] border_out = {10, 11, 12, 13, 14, 19, 23, 28, 32, 37, 38, 39, 40, 41};
|
||||||
|
|
||||||
@ -497,7 +500,7 @@ public abstract class ProgrammableAndroid extends SlimefunItem implements Invent
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void mine(Block b, BlockMenu menu, Block block) {
|
private void mine(Block b, BlockMenu menu, Block block) {
|
||||||
Collection<ItemStack> drops = block.getDrops();
|
Collection<ItemStack> drops = block.getDrops(EFFECTIVE_PICKAXE);
|
||||||
if (!MaterialCollections.getAllUnbreakableBlocks().contains(block.getType()) && !drops.isEmpty() && SlimefunPlugin.getProtectionManager().hasPermission(Bukkit.getOfflinePlayer(UUID.fromString(BlockStorage.getLocationInfo(b.getLocation(), "owner"))), block.getLocation(), ProtectableAction.BREAK_BLOCK)) {
|
if (!MaterialCollections.getAllUnbreakableBlocks().contains(block.getType()) && !drops.isEmpty() && SlimefunPlugin.getProtectionManager().hasPermission(Bukkit.getOfflinePlayer(UUID.fromString(BlockStorage.getLocationInfo(b.getLocation(), "owner"))), block.getLocation(), ProtectableAction.BREAK_BLOCK)) {
|
||||||
String item = BlockStorage.checkID(block);
|
String item = BlockStorage.checkID(block);
|
||||||
|
|
||||||
@ -532,7 +535,7 @@ public abstract class ProgrammableAndroid extends SlimefunItem implements Invent
|
|||||||
|
|
||||||
|
|
||||||
private void movedig(Block b, BlockMenu menu, BlockFace face, Block block) {
|
private void movedig(Block b, BlockMenu menu, BlockFace face, Block block) {
|
||||||
Collection<ItemStack> drops = block.getDrops();
|
Collection<ItemStack> drops = block.getDrops(EFFECTIVE_PICKAXE);
|
||||||
if (!MaterialCollections.getAllUnbreakableBlocks().contains(block.getType()) && !drops.isEmpty() && SlimefunPlugin.getProtectionManager().hasPermission(Bukkit.getOfflinePlayer(UUID.fromString(BlockStorage.getLocationInfo(b.getLocation(), "owner"))), block.getLocation(), ProtectableAction.BREAK_BLOCK)) {
|
if (!MaterialCollections.getAllUnbreakableBlocks().contains(block.getType()) && !drops.isEmpty() && SlimefunPlugin.getProtectionManager().hasPermission(Bukkit.getOfflinePlayer(UUID.fromString(BlockStorage.getLocationInfo(b.getLocation(), "owner"))), block.getLocation(), ProtectableAction.BREAK_BLOCK)) {
|
||||||
SlimefunItem item = BlockStorage.check(block);
|
SlimefunItem item = BlockStorage.check(block);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user