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

[CI skip] Updated dependencies

This commit is contained in:
TheBusyBiscuit 2019-12-29 22:13:00 +01:00
parent b8a94e22e5
commit a817903a04
61 changed files with 434 additions and 407 deletions

View File

@ -104,13 +104,13 @@
<dependency>
<groupId>com.github.TheBusyBiscuit</groupId>
<artifactId>CS-CoreLib</artifactId>
<version>ec5b4c24e3</version>
<version>e3242c600b</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.github.thebusybiscuit</groupId>
<artifactId>CS-CoreLib2</artifactId>
<version>0.7.7</version>
<version>0.8</version>
<scope>compile</scope>
</dependency>
<dependency>

View File

@ -2,7 +2,6 @@ package io.github.thebusybiscuit.slimefun4.core.commands;
import java.util.LinkedList;
import java.util.List;
import java.util.logging.Level;
import java.util.stream.Collectors;
import org.bukkit.ChatColor;
@ -26,8 +25,6 @@ import io.github.thebusybiscuit.slimefun4.core.commands.subcommands.StatsCommand
import io.github.thebusybiscuit.slimefun4.core.commands.subcommands.TeleporterCommand;
import io.github.thebusybiscuit.slimefun4.core.commands.subcommands.TimingsCommand;
import io.github.thebusybiscuit.slimefun4.core.commands.subcommands.VersionsCommand;
import me.mrCookieSlime.CSCoreLibPlugin.general.World.TitleBuilder;
import me.mrCookieSlime.CSCoreLibPlugin.general.World.TitleBuilder.TitleType;
import me.mrCookieSlime.Slimefun.SlimefunPlugin;
import me.mrCookieSlime.Slimefun.Lists.SlimefunItems;
import me.mrCookieSlime.Slimefun.api.BlockStorage;
@ -68,25 +65,21 @@ public class SlimefunCommand implements CommandExecutor, Listener {
}
else if (args[0].equalsIgnoreCase("elevator")) {
if (sender instanceof Player && args.length == 4) {
double x = Integer.parseInt(args[1]) + 0.5D;
double y = Integer.parseInt(args[2]) + 0.4D;
double z = Integer.parseInt(args[3]) + 0.5D;
Player p = (Player) sender;
if (BlockStorage.getLocationInfo(((Player) sender).getWorld().getBlockAt(Integer.parseInt(args[1]), Integer.parseInt(args[2]), Integer.parseInt(args[3])).getLocation(), "floor") != null) {
SlimefunPlugin.getUtilities().elevatorUsers.add(((Player) sender).getUniqueId());
float yaw = ((Player) sender).getEyeLocation().getYaw() + 180;
int x = Integer.parseInt(args[1]);
int y = Integer.parseInt(args[2]);
int z = Integer.parseInt(args[3]);
if (BlockStorage.getLocationInfo(p.getWorld().getBlockAt(x, y, z).getLocation(), "floor") != null) {
SlimefunPlugin.getUtilities().elevatorUsers.add(p.getUniqueId());
float yaw = p.getEyeLocation().getYaw() + 180;
if (yaw > 180) yaw = -180 + (yaw - 180);
((Player) sender).teleport(new Location(((Player) sender).getWorld(), x, y, z, yaw, ((Player) sender).getEyeLocation().getPitch()));
try {
TitleBuilder title = (TitleBuilder) new TitleBuilder(20, 60, 20).addText("&r" + ChatColor.translateAlternateColorCodes('&', BlockStorage.getLocationInfo(((Player) sender).getWorld().getBlockAt(Integer.parseInt(args[1]), Integer.parseInt(args[2]), Integer.parseInt(args[3])).getLocation(), "floor")));
TitleBuilder subtitle = (TitleBuilder) new TitleBuilder(20, 60, 20).addText(" ");
title.send(TitleType.TITLE, ((Player) sender));
subtitle.send(TitleType.SUBTITLE, ((Player) sender));
} catch (Exception e) {
Slimefun.getLogger().log(Level.SEVERE, "An Error occured while a Player used an Elevator in Slimefun " + Slimefun.getVersion(), e);
}
p.teleport(new Location(p.getWorld(), x + 0.5, y + 0.4, z + 0.5, yaw, p.getEyeLocation().getPitch()));
String title = "&r" + ChatColor.translateAlternateColorCodes('&', BlockStorage.getLocationInfo(p.getWorld().getBlockAt(x, y, z).getLocation(), "floor"));
p.sendTitle(title, " ", 20, 60, 20);
}
}
return true;

View File

@ -5,10 +5,10 @@ import java.util.Optional;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import io.github.thebusybiscuit.cscorelib2.item.CustomItem;
import io.github.thebusybiscuit.cscorelib2.players.PlayerList;
import io.github.thebusybiscuit.slimefun4.core.commands.SlimefunCommand;
import io.github.thebusybiscuit.slimefun4.core.commands.SubCommand;
import me.mrCookieSlime.CSCoreLibPlugin.general.Inventory.Item.CustomItem;
import me.mrCookieSlime.Slimefun.SlimefunPlugin;
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.SlimefunItem;
import me.mrCookieSlime.Slimefun.api.Slimefun;

View File

@ -55,10 +55,10 @@ public class BookSlimefunGuide implements ISlimefunGuide {
int tier = 0;
for (final Category category: Category.list()) {
for (Category category : Category.list()) {
boolean locked = true;
for (SlimefunItem item: category.getItems()) {
for (SlimefunItem item : category.getItems()) {
if (Slimefun.isEnabled(p, item, false)) {
locked = false;
break;

View File

@ -0,0 +1,65 @@
package io.github.thebusybiscuit.slimefun4.core.utils;
import java.util.Random;
import java.util.concurrent.ThreadLocalRandom;
import org.bukkit.Color;
import org.bukkit.FireworkEffect;
import org.bukkit.FireworkEffect.Type;
import org.bukkit.Location;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Firework;
import org.bukkit.entity.Player;
import org.bukkit.inventory.meta.FireworkMeta;
public final class FireworkUtils {
private static final Color[] colors = {Color.AQUA, Color.BLACK, Color.BLUE, Color.FUCHSIA, Color.GRAY, Color.GREEN, Color.LIME, Color.MAROON, Color.NAVY, Color.OLIVE, Color.ORANGE, Color.PURPLE, Color.RED, Color.SILVER, Color.TEAL, Color.WHITE, Color.YELLOW};
private FireworkUtils() {}
public static void launchFirework(Location l, Color color) {
Firework fw = (Firework)l.getWorld().spawnEntity(l, EntityType.FIREWORK);
FireworkMeta meta = fw.getFireworkMeta();
FireworkEffect effect = getRandomEffect(ThreadLocalRandom.current(), color);
meta.addEffect(effect);
meta.setPower(ThreadLocalRandom.current().nextInt(2) + 1);
fw.setFireworkMeta(meta);
}
public static Firework createFirework(Location l, Color color) {
Firework fw = (Firework)l.getWorld().spawnEntity(l, EntityType.FIREWORK);
FireworkMeta meta = fw.getFireworkMeta();
FireworkEffect effect = FireworkEffect.builder().flicker(ThreadLocalRandom.current().nextBoolean()).withColor(color).with(ThreadLocalRandom.current().nextInt(3) + 1 == 1 ? Type.BALL: Type.BALL_LARGE).trail(ThreadLocalRandom.current().nextBoolean()).build();
meta.addEffect(effect);
meta.setPower(ThreadLocalRandom.current().nextInt(2) + 1);
fw.setFireworkMeta(meta);
return fw;
}
public static void launchRandom(Player p, int amount) {
for (int i = 0; i < amount; i++) {
Location l = p.getLocation().clone();
l.setX(l.getX() + ThreadLocalRandom.current().nextInt(amount));
l.setX(l.getX() - ThreadLocalRandom.current().nextInt(amount));
l.setZ(l.getZ() + ThreadLocalRandom.current().nextInt(amount));
l.setZ(l.getZ() - ThreadLocalRandom.current().nextInt(amount));
launchFirework(l, getRandomColor());
}
}
public static FireworkEffect getRandomEffect(Random random, Color color) {
return FireworkEffect.builder()
.flicker(random.nextBoolean())
.withColor(color)
.with(random.nextBoolean() ? Type.BALL: Type.BALL_LARGE)
.trail(random.nextBoolean())
.build();
}
private static Color getRandomColor() {
return colors[ThreadLocalRandom.current().nextInt(colors.length)];
}
}

View File

@ -10,8 +10,8 @@ import org.bukkit.event.inventory.FurnaceBurnEvent;
import org.bukkit.event.inventory.FurnaceSmeltEvent;
import org.bukkit.inventory.ItemStack;
import io.github.thebusybiscuit.cscorelib2.item.CustomItem;
import io.github.thebusybiscuit.cscorelib2.recipes.MinecraftRecipe;
import me.mrCookieSlime.CSCoreLibPlugin.general.Inventory.Item.CustomItem;
import me.mrCookieSlime.Slimefun.SlimefunPlugin;
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.SlimefunItem;
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.machines.EnhancedFurnace;

View File

@ -32,7 +32,7 @@ import org.bukkit.potion.PotionEffect;
import org.bukkit.potion.PotionEffectType;
import org.bukkit.util.Vector;
import me.mrCookieSlime.CSCoreLibPlugin.general.Inventory.Item.CustomItem;
import io.github.thebusybiscuit.cscorelib2.item.CustomItem;
import me.mrCookieSlime.Slimefun.SlimefunPlugin;
import me.mrCookieSlime.Slimefun.Lists.SlimefunItems;
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.Talisman;

View File

@ -1,7 +1,6 @@
package me.mrCookieSlime.Slimefun.GPS;
import java.util.UUID;
import java.util.logging.Level;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
@ -12,10 +11,8 @@ import org.bukkit.entity.Player;
import org.bukkit.potion.PotionEffect;
import org.bukkit.potion.PotionEffectType;
import me.mrCookieSlime.CSCoreLibPlugin.general.World.TitleBuilder;
import me.mrCookieSlime.CSCoreLibPlugin.general.World.TitleBuilder.TitleType;
import io.github.thebusybiscuit.cscorelib2.chat.ChatColors;
import me.mrCookieSlime.Slimefun.SlimefunPlugin;
import me.mrCookieSlime.Slimefun.api.Slimefun;
public final class TeleportationSequence {
@ -51,54 +48,36 @@ public final class TeleportationSequence {
SlimefunPlugin.getUtilities().teleporterUsers.remove(uuid);
if (p != null) {
try {
TitleBuilder title = (TitleBuilder) new TitleBuilder(20, 60, 20).addText(ChatColor.translateAlternateColorCodes('&', "&4Teleportation cancelled"));
TitleBuilder subtitle = (TitleBuilder) new TitleBuilder(20, 60, 20).addText(ChatColor.translateAlternateColorCodes('&', "&40%"));
title.send(TitleType.TITLE, p);
subtitle.send(TitleType.SUBTITLE, p);
} catch(Exception x) {
Slimefun.getLogger().log(Level.SEVERE, "An Error occured while cancelling a Teleportation Sequence for Slimefun " + Slimefun.getVersion(), x);
}
p.sendTitle(ChatColors.color("&4Teleportation cancelled!"), ChatColors.color("&c&k40&r&c%"), 20, 60, 20);
}
}
private static void updateProgress(final UUID uuid, final int speed, final int progress, final Location source, final Location destination, final boolean resistance) {
private static void updateProgress(UUID uuid, int speed, int progress, Location source, Location destination, boolean resistance) {
Player p = Bukkit.getPlayer(uuid);
if (isValid(p, source)) {
try {
if (progress > 99) {
TitleBuilder title = (TitleBuilder) new TitleBuilder(20, 60, 20).addText(ChatColor.translateAlternateColorCodes('&', "&3Teleported!"));
TitleBuilder subtitle = (TitleBuilder) new TitleBuilder(20, 60, 20).addText(ChatColor.translateAlternateColorCodes('&', "&b100%"));
title.send(TitleType.TITLE, p);
subtitle.send(TitleType.SUBTITLE, p);
p.teleport(destination);
if (resistance) {
p.addPotionEffect(new PotionEffect(PotionEffectType.DAMAGE_RESISTANCE, 600, 20));
p.sendMessage(ChatColor.translateAlternateColorCodes('&', "&b&lYou have been given 30 Seconds of Invulnerability!"));
}
destination.getWorld().spawnParticle(Particle.PORTAL,new Location(destination.getWorld(), destination.getX(), destination.getY() + 1, destination.getZ()),progress * 2, 0.2F, 0.8F, 0.2F );
destination.getWorld().playSound(destination, Sound.BLOCK_BEACON_ACTIVATE, 1F, 1F);
SlimefunPlugin.getUtilities().teleporterUsers.remove(uuid);
if (progress > 99) {
p.sendTitle(ChatColors.color("&3Teleported!"), ChatColors.color("&b100%"), 20, 60, 20);
p.teleport(destination);
if (resistance) {
p.addPotionEffect(new PotionEffect(PotionEffectType.DAMAGE_RESISTANCE, 600, 20));
p.sendMessage(ChatColor.translateAlternateColorCodes('&', "&b&lYou have been given 30 Seconds of Invulnerability!"));
}
else {
TitleBuilder title = (TitleBuilder) new TitleBuilder(0, 60, 0).addText(ChatColor.translateAlternateColorCodes('&', "&3Teleporting..."));
TitleBuilder subtitle = (TitleBuilder) new TitleBuilder(0, 60, 0).addText(ChatColor.translateAlternateColorCodes('&', "&b" + progress + "%"));
title.send(TitleType.TITLE, p);
subtitle.send(TitleType.SUBTITLE, p);
source.getWorld().spawnParticle(Particle.PORTAL, source, progress * 2, 0.2F, 0.8F, 0.2F);
source.getWorld().playSound(source, Sound.BLOCK_BEACON_AMBIENT, 1F, 0.6F);
Bukkit.getScheduler().scheduleSyncDelayedTask(SlimefunPlugin.instance, () -> updateProgress(uuid, speed, progress + speed, source, destination, resistance), 10L);
}
} catch (Exception x) {
Slimefun.getLogger().log(Level.SEVERE, "An Error occured during a Teleportation Sequence for Slimefun " + Slimefun.getVersion(), x);
destination.getWorld().spawnParticle(Particle.PORTAL,new Location(destination.getWorld(), destination.getX(), destination.getY() + 1, destination.getZ()),progress * 2, 0.2F, 0.8F, 0.2F );
destination.getWorld().playSound(destination, Sound.BLOCK_BEACON_ACTIVATE, 1F, 1F);
SlimefunPlugin.getUtilities().teleporterUsers.remove(uuid);
}
else {
p.sendTitle(ChatColors.color("&3Teleporting..."), ChatColors.color("&b" + progress + "%"), 0, 60, 0);
source.getWorld().spawnParticle(Particle.PORTAL, source, progress * 2, 0.2F, 0.8F, 0.2F);
source.getWorld().playSound(source, Sound.BLOCK_BEACON_AMBIENT, 1F, 0.6F);
Bukkit.getScheduler().scheduleSyncDelayedTask(SlimefunPlugin.instance, () -> updateProgress(uuid, speed, progress + speed, source, destination, resistance), 10L);
}
}
else cancel(uuid, p);

View File

@ -16,7 +16,7 @@ import org.bukkit.entity.Player;
import io.github.thebusybiscuit.cscorelib2.data.PersistentDataAPI;
import io.github.thebusybiscuit.slimefun4.api.events.ResearchUnlockEvent;
import io.github.thebusybiscuit.slimefun4.core.guide.GuideSettings;
import me.mrCookieSlime.CSCoreLibPlugin.general.Particles.FireworkShow;
import io.github.thebusybiscuit.slimefun4.core.utils.FireworkUtils;
import me.mrCookieSlime.Slimefun.SlimefunPlugin;
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.SlimefunItem;
import me.mrCookieSlime.Slimefun.Setup.ResearchSetup;
@ -218,7 +218,7 @@ public class Research {
SlimefunPlugin.getLocal().sendMessage(p, "messages.unlocked", true, msg -> msg.replace("%research%", getName()));
if (SlimefunPlugin.getSettings().researchFireworksEnabled && (!PersistentDataAPI.hasByte(p, GuideSettings.FIREWORKS_KEY) || PersistentDataAPI.getByte(p, GuideSettings.FIREWORKS_KEY) == (byte) 1)) {
FireworkShow.launchRandom(p, 1);
FireworkUtils.launchRandom(p, 1);
}
};

View File

@ -1,17 +0,0 @@
package me.mrCookieSlime.Slimefun.Objects.SlimefunItem;
import org.bukkit.inventory.ItemStack;
import me.mrCookieSlime.Slimefun.Lists.RecipeType;
import me.mrCookieSlime.Slimefun.Objects.Category;
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.interfaces.NotPlaceable;
public class ExcludedBlock extends SlimefunItem implements NotPlaceable {
public ExcludedBlock(Category category, ItemStack item, String id, RecipeType recipeType, ItemStack[] recipe) {
super(category, item, id, recipeType, recipe);
}
}

View File

@ -1,18 +0,0 @@
package me.mrCookieSlime.Slimefun.Objects.SlimefunItem;
import org.bukkit.inventory.ItemStack;
import me.mrCookieSlime.Slimefun.Lists.RecipeType;
import me.mrCookieSlime.Slimefun.Objects.Category;
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.interfaces.NotPlaceable;
public class ExcludedGadget extends SlimefunGadget implements NotPlaceable {
public ExcludedGadget(Category category, ItemStack item, String id, RecipeType recipeType, ItemStack[] recipe, ItemStack[] machineRecipes) {
super(category, item, id, recipeType, recipe, machineRecipes);
}
public ExcludedGadget(Category category, ItemStack item, String id, RecipeType recipeType, ItemStack[] recipe, ItemStack[] machineRecipes, String[] keys, Object[] values) {
super(category, item, id, recipeType, recipe, machineRecipes, keys, values);
}
}

View File

@ -1,16 +0,0 @@
package me.mrCookieSlime.Slimefun.Objects.SlimefunItem;
import org.bukkit.inventory.ItemStack;
import me.mrCookieSlime.Slimefun.Lists.RecipeType;
import me.mrCookieSlime.Slimefun.Objects.Category;
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.interfaces.NotPlaceable;
@Deprecated
public class ExcludedTool extends SlimefunItem implements NotPlaceable {
public ExcludedTool(Category category, ItemStack item, String id,RecipeType recipeType, ItemStack[] recipe) {
super(category, item, id, recipeType, recipe);
}
}

View File

@ -7,13 +7,13 @@ import me.mrCookieSlime.Slimefun.Objects.Category;
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.interfaces.NotPlaceable;
import me.mrCookieSlime.Slimefun.api.SlimefunItemStack;
public class ExcludedSoulboundTool extends SoulboundItem implements NotPlaceable {
public class SoulboundTool extends SoulboundItem implements NotPlaceable {
public ExcludedSoulboundTool(Category category, ItemStack item, String id, RecipeType type, ItemStack[] recipe) {
public SoulboundTool(Category category, ItemStack item, String id, RecipeType type, ItemStack[] recipe) {
super(category, item, id, type, recipe);
}
public ExcludedSoulboundTool(Category category, SlimefunItemStack item, ItemStack[] recipe) {
public SoulboundTool(Category category, SlimefunItemStack item, ItemStack[] recipe) {
super(category, item, recipe);
}

View File

@ -16,7 +16,7 @@ import org.bukkit.event.player.PlayerEvent;
import org.bukkit.inventory.ItemStack;
import org.bukkit.potion.PotionEffect;
import me.mrCookieSlime.CSCoreLibPlugin.general.Inventory.Item.CustomItem;
import io.github.thebusybiscuit.cscorelib2.item.CustomItem;
import me.mrCookieSlime.Slimefun.SlimefunPlugin;
import me.mrCookieSlime.Slimefun.Lists.Categories;
import me.mrCookieSlime.Slimefun.Lists.RecipeType;

View File

@ -11,11 +11,11 @@ import org.bukkit.entity.Player;
import org.bukkit.event.inventory.InventoryClickEvent;
import org.bukkit.inventory.ItemStack;
import io.github.thebusybiscuit.cscorelib2.item.CustomItem;
import io.github.thebusybiscuit.slimefun4.core.utils.ChestMenuUtils;
import me.mrCookieSlime.CSCoreLibPlugin.Configuration.Config;
import me.mrCookieSlime.CSCoreLibPlugin.general.Inventory.ChestMenu.AdvancedMenuClickHandler;
import me.mrCookieSlime.CSCoreLibPlugin.general.Inventory.ClickAction;
import me.mrCookieSlime.CSCoreLibPlugin.general.Inventory.InvUtils;
import me.mrCookieSlime.CSCoreLibPlugin.general.Inventory.Item.CustomItem;
import me.mrCookieSlime.Slimefun.Lists.RecipeType;
import me.mrCookieSlime.Slimefun.Objects.Category;
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.SlimefunItem;
@ -82,18 +82,18 @@ public abstract class AContainer extends SlimefunItem implements InventoryBlock
protected void constructMenu(BlockMenuPreset preset) {
for (int i : BORDER) {
preset.addItem(i, new CustomItem(new ItemStack(Material.GRAY_STAINED_GLASS_PANE), " "), (p, slot, item, action) -> false);
preset.addItem(i, ChestMenuUtils.getBackground(), ChestMenuUtils.getEmptyClickHandler());
}
for (int i : BORDER_IN) {
preset.addItem(i, new CustomItem(new ItemStack(Material.CYAN_STAINED_GLASS_PANE), " "), (p, slot, item, action) -> false);
preset.addItem(i, new CustomItem(new ItemStack(Material.CYAN_STAINED_GLASS_PANE), " "), ChestMenuUtils.getEmptyClickHandler());
}
for (int i : BORDER_OUT) {
preset.addItem(i, new CustomItem(new ItemStack(Material.ORANGE_STAINED_GLASS_PANE), " "), (p, slot, item, action) -> false);
preset.addItem(i, new CustomItem(new ItemStack(Material.ORANGE_STAINED_GLASS_PANE), " "), ChestMenuUtils.getEmptyClickHandler());
}
preset.addItem(22, new CustomItem(new ItemStack(Material.BLACK_STAINED_GLASS_PANE), " "), (p, slot, item, action) -> false);
preset.addItem(22, new CustomItem(new ItemStack(Material.BLACK_STAINED_GLASS_PANE), " "), ChestMenuUtils.getEmptyClickHandler());
for (int i : getOutputSlots()) {
preset.addMenuClickHandler(i, new AdvancedMenuClickHandler() {
@ -227,7 +227,7 @@ public abstract class AContainer extends SlimefunItem implements InventoryBlock
if (!fits(b, r.getOutput())) return;
for (Map.Entry<Integer, Integer> entry : found.entrySet()) {
inv.replaceExistingItem(entry.getKey(), InvUtils.decreaseItem(inv.getItemInSlot(entry.getKey()), entry.getValue()));
inv.consumeItem(entry.getKey(), entry.getValue());
}
processing.put(b, r);

View File

@ -7,6 +7,7 @@ import org.bukkit.event.inventory.InventoryClickEvent;
import org.bukkit.inventory.ItemStack;
import io.github.thebusybiscuit.cscorelib2.protection.ProtectableAction;
import io.github.thebusybiscuit.slimefun4.core.utils.ChestMenuUtils;
import me.mrCookieSlime.CSCoreLibPlugin.general.Inventory.ClickAction;
import me.mrCookieSlime.CSCoreLibPlugin.general.Inventory.Item.CustomItem;
import me.mrCookieSlime.Slimefun.SlimefunPlugin;
@ -45,17 +46,17 @@ public abstract class ADrill extends AContainer {
private void constructMenu(BlockMenuPreset preset) {
for (int i : border) {
preset.addItem(i, new CustomItem(new ItemStack(Material.GRAY_STAINED_GLASS_PANE), " "),
(p, slot, item, action) -> false
ChestMenuUtils.getEmptyClickHandler()
);
}
for (int i : border_out) {
preset.addItem(i, new CustomItem(new ItemStack(Material.ORANGE_STAINED_GLASS_PANE), " "),
(p, slot, item, action) -> false
ChestMenuUtils.getEmptyClickHandler()
);
}
preset.addItem(22, new CustomItem(new ItemStack(Material.BLACK_STAINED_GLASS_PANE), " "),
(p, slot, item, action) -> false
ChestMenuUtils.getEmptyClickHandler()
);
for (int i: getOutputSlots()) {

View File

@ -7,11 +7,12 @@ import org.bukkit.entity.Player;
import org.bukkit.event.inventory.InventoryClickEvent;
import org.bukkit.inventory.ItemStack;
import io.github.thebusybiscuit.cscorelib2.item.CustomItem;
import io.github.thebusybiscuit.cscorelib2.protection.ProtectableAction;
import io.github.thebusybiscuit.slimefun4.core.utils.ChestMenuUtils;
import me.mrCookieSlime.CSCoreLibPlugin.Configuration.Config;
import me.mrCookieSlime.CSCoreLibPlugin.general.Inventory.ChestMenu.AdvancedMenuClickHandler;
import me.mrCookieSlime.CSCoreLibPlugin.general.Inventory.ClickAction;
import me.mrCookieSlime.CSCoreLibPlugin.general.Inventory.Item.CustomItem;
import me.mrCookieSlime.Slimefun.SlimefunPlugin;
import me.mrCookieSlime.Slimefun.Lists.RecipeType;
import me.mrCookieSlime.Slimefun.Objects.Category;
@ -66,14 +67,14 @@ public abstract class AFarm extends SlimefunItem {
private void constructMenu(BlockMenuPreset preset) {
for (int i : border) {
preset.addItem(i, new CustomItem(new ItemStack(Material.GRAY_STAINED_GLASS_PANE), " "), (p, slot, item, action) -> false);
preset.addItem(i, ChestMenuUtils.getBackground(), ChestMenuUtils.getEmptyClickHandler());
}
for (int i : border_out) {
preset.addItem(i, new CustomItem(new ItemStack(Material.ORANGE_STAINED_GLASS_PANE), " "), (p, slot, item, action) -> false);
preset.addItem(i, new CustomItem(new ItemStack(Material.ORANGE_STAINED_GLASS_PANE), " "), ChestMenuUtils.getEmptyClickHandler());
}
preset.addItem(22, new CustomItem(new ItemStack(Material.BLACK_STAINED_GLASS_PANE), " "), (p, slot, item, action) -> false);
preset.addItem(22, new CustomItem(new ItemStack(Material.BLACK_STAINED_GLASS_PANE), " "), ChestMenuUtils.getEmptyClickHandler());
for (int i : getOutputSlots()) {
preset.addMenuClickHandler(i, new AdvancedMenuClickHandler() {

View File

@ -16,13 +16,13 @@ import org.bukkit.event.inventory.InventoryClickEvent;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.ItemMeta;
import io.github.thebusybiscuit.cscorelib2.item.CustomItem;
import io.github.thebusybiscuit.cscorelib2.math.DoubleHandler;
import io.github.thebusybiscuit.cscorelib2.protection.ProtectableAction;
import io.github.thebusybiscuit.slimefun4.core.utils.ChestMenuUtils;
import me.mrCookieSlime.CSCoreLibPlugin.Configuration.Config;
import me.mrCookieSlime.CSCoreLibPlugin.general.Inventory.ChestMenu.AdvancedMenuClickHandler;
import me.mrCookieSlime.CSCoreLibPlugin.general.Inventory.ClickAction;
import me.mrCookieSlime.CSCoreLibPlugin.general.Inventory.InvUtils;
import me.mrCookieSlime.CSCoreLibPlugin.general.Inventory.Item.CustomItem;
import me.mrCookieSlime.Slimefun.SlimefunPlugin;
import me.mrCookieSlime.Slimefun.Lists.RecipeType;
import me.mrCookieSlime.Slimefun.Lists.SlimefunItems;
@ -107,15 +107,15 @@ public abstract class AGenerator extends SlimefunItem implements RecipeDisplayIt
private void constructMenu(BlockMenuPreset preset) {
for (int i : border) {
preset.addItem(i, new CustomItem(new ItemStack(Material.GRAY_STAINED_GLASS_PANE), " "), (p, slot, item, action) -> false);
preset.addItem(i, ChestMenuUtils.getBackground(), ChestMenuUtils.getEmptyClickHandler());
}
for (int i : border_in) {
preset.addItem(i, new CustomItem(new ItemStack(Material.CYAN_STAINED_GLASS_PANE), " "),(p, slot, item, action) -> false);
preset.addItem(i, new CustomItem(new ItemStack(Material.CYAN_STAINED_GLASS_PANE), " "),ChestMenuUtils.getEmptyClickHandler());
}
for (int i: border_out) {
preset.addItem(i, new CustomItem(new ItemStack(Material.ORANGE_STAINED_GLASS_PANE), " "), (p, slot, item, action) -> false);
preset.addItem(i, new CustomItem(new ItemStack(Material.ORANGE_STAINED_GLASS_PANE), " "), ChestMenuUtils.getEmptyClickHandler());
}
for (int i: getOutputSlots()) {
@ -133,7 +133,7 @@ public abstract class AGenerator extends SlimefunItem implements RecipeDisplayIt
});
}
preset.addItem(22, new CustomItem(new ItemStack(Material.BLACK_STAINED_GLASS_PANE), " "), (p, slot, item, action) -> false);
preset.addItem(22, new CustomItem(new ItemStack(Material.BLACK_STAINED_GLASS_PANE), " "), ChestMenuUtils.getEmptyClickHandler());
}
public abstract String getInventoryTitle();
@ -205,8 +205,8 @@ public abstract class AGenerator extends SlimefunItem implements RecipeDisplayIt
MachineFuel fuel = findRecipe(inv, found);
if (fuel != null) {
for (Map.Entry<Integer, Integer> entry: found.entrySet()) {
inv.replaceExistingItem(entry.getKey(), InvUtils.decreaseItem(inv.getItemInSlot(entry.getKey()), entry.getValue()));
for (Map.Entry<Integer, Integer> entry : found.entrySet()) {
inv.consumeItem(entry.getKey(), entry.getValue());
}
processing.put(l, fuel);

View File

@ -17,13 +17,12 @@ import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.ItemMeta;
import io.github.thebusybiscuit.cscorelib2.item.CustomItem;
import io.github.thebusybiscuit.cscorelib2.math.DoubleHandler;
import io.github.thebusybiscuit.cscorelib2.protection.ProtectableAction;
import io.github.thebusybiscuit.cscorelib2.skull.SkullItem;
import io.github.thebusybiscuit.slimefun4.core.utils.ChestMenuUtils;
import me.mrCookieSlime.CSCoreLibPlugin.Configuration.Config;
import me.mrCookieSlime.CSCoreLibPlugin.general.Inventory.InvUtils;
import me.mrCookieSlime.CSCoreLibPlugin.general.Inventory.Item.CustomItem;
import me.mrCookieSlime.Slimefun.SlimefunPlugin;
import me.mrCookieSlime.Slimefun.Lists.RecipeType;
import me.mrCookieSlime.Slimefun.Lists.SlimefunItems;
@ -289,7 +288,7 @@ public abstract class AReactor extends SlimefunItem implements RecipeDisplayItem
for (int slot : getCoolantSlots()) {
if (SlimefunManager.isItemSimilar(menu.getItemInSlot(slot), getCoolant(), true)) {
menu.replaceExistingItem(slot, InvUtils.decreaseItem(menu.getItemInSlot(slot), 1));
menu.consumeItem(slot);
ReactorHologram.update(l, "&b\u2744 &7100%");
explosion = false;
break;
@ -339,7 +338,7 @@ public abstract class AReactor extends SlimefunItem implements RecipeDisplayItem
if (fuel != null) {
for (Map.Entry<Integer, Integer> entry : found.entrySet()) {
menu.replaceExistingItem(entry.getKey(), InvUtils.decreaseItem(menu.getItemInSlot(entry.getKey()), entry.getValue()));
menu.consumeItem(entry.getKey(), entry.getValue());
}
processing.put(l, fuel);

View File

@ -9,8 +9,8 @@ import org.bukkit.entity.Player;
import org.bukkit.inventory.Inventory;
import org.bukkit.inventory.ItemStack;
import io.github.thebusybiscuit.cscorelib2.item.CustomItem;
import io.github.thebusybiscuit.cscorelib2.protection.ProtectableAction;
import me.mrCookieSlime.CSCoreLibPlugin.general.Inventory.Item.CustomItem;
import me.mrCookieSlime.Slimefun.SlimefunPlugin;
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.SlimefunItem;
import me.mrCookieSlime.Slimefun.api.BlockStorage;

View File

@ -3,7 +3,7 @@ package me.mrCookieSlime.Slimefun.Objects.SlimefunItem.items;
import org.bukkit.Material;
import org.bukkit.inventory.ItemStack;
import me.mrCookieSlime.CSCoreLibPlugin.general.Inventory.Item.CustomItem;
import io.github.thebusybiscuit.cscorelib2.item.CustomItem;
import me.mrCookieSlime.Slimefun.Lists.RecipeType;
import me.mrCookieSlime.Slimefun.Lists.SlimefunItems;
import me.mrCookieSlime.Slimefun.Objects.Category;

View File

@ -5,7 +5,7 @@ import org.bukkit.Sound;
import org.bukkit.block.Container;
import org.bukkit.inventory.ItemStack;
import me.mrCookieSlime.CSCoreLibPlugin.general.Inventory.Item.CustomItem;
import io.github.thebusybiscuit.cscorelib2.item.CustomItem;
import me.mrCookieSlime.Slimefun.Lists.RecipeType;
import me.mrCookieSlime.Slimefun.Objects.Category;
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.SimpleSlimefunItem;

View File

@ -8,9 +8,9 @@ import org.bukkit.block.Block;
import org.bukkit.inventory.ItemStack;
import io.github.thebusybiscuit.cscorelib2.blocks.Vein;
import io.github.thebusybiscuit.cscorelib2.item.CustomItem;
import io.github.thebusybiscuit.cscorelib2.materials.MaterialCollections;
import io.github.thebusybiscuit.cscorelib2.protection.ProtectableAction;
import me.mrCookieSlime.CSCoreLibPlugin.general.Inventory.Item.CustomItem;
import me.mrCookieSlime.Slimefun.SlimefunPlugin;
import me.mrCookieSlime.Slimefun.Lists.RecipeType;
import me.mrCookieSlime.Slimefun.Objects.Category;

View File

@ -1,9 +1,10 @@
package me.mrCookieSlime.Slimefun.Objects.SlimefunItem;
package me.mrCookieSlime.Slimefun.Objects.SlimefunItem.items;
import org.bukkit.inventory.ItemStack;
import me.mrCookieSlime.Slimefun.Lists.RecipeType;
import me.mrCookieSlime.Slimefun.Objects.Category;
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.SlimefunItem;
import me.mrCookieSlime.Slimefun.api.SlimefunItemStack;
public class SolarHelmet extends SlimefunItem {

View File

@ -81,7 +81,8 @@ public class StormStaff extends SimpleSlimefunItem<ItemInteractionHandler> {
if (currentUses == 1) {
p.playSound(p.getLocation(), Sound.ENTITY_ITEM_BREAK, 1, 1);
item.setAmount(0);
} else {
}
else {
itemMeta.getPersistentDataContainer().set(
usageKey, PersistentDataType.INTEGER, --currentUses
);

View File

@ -6,8 +6,8 @@ import org.bukkit.block.Block;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import io.github.thebusybiscuit.cscorelib2.item.CustomItem;
import io.github.thebusybiscuit.cscorelib2.protection.ProtectableAction;
import me.mrCookieSlime.CSCoreLibPlugin.general.Inventory.Item.CustomItem;
import me.mrCookieSlime.Slimefun.SlimefunPlugin;
import me.mrCookieSlime.Slimefun.Lists.RecipeType;
import me.mrCookieSlime.Slimefun.Lists.SlimefunItems;

View File

@ -4,8 +4,9 @@ import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.inventory.ItemStack;
import io.github.thebusybiscuit.cscorelib2.item.CustomItem;
import io.github.thebusybiscuit.slimefun4.core.utils.ChestMenuUtils;
import me.mrCookieSlime.CSCoreLibPlugin.Configuration.Config;
import me.mrCookieSlime.CSCoreLibPlugin.general.Inventory.Item.CustomItem;
import me.mrCookieSlime.Slimefun.Lists.RecipeType;
import me.mrCookieSlime.Slimefun.Objects.Category;
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.SlimefunItem;
@ -18,16 +19,17 @@ import me.mrCookieSlime.Slimefun.api.inventory.BlockMenuPreset;
public class TrashCan extends SlimefunItem implements InventoryBlock {
private static final int[] border = {0, 1, 2, 3, 5, 4, 6, 7, 8, 9, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26};
private static final int[] BORDER = {0, 1, 2, 3, 5, 4, 6, 7, 8, 9, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26};
private static final ItemStack BACKGROUND = new CustomItem(new ItemStack(Material.RED_STAINED_GLASS_PANE), " ");
public TrashCan(Category category, SlimefunItemStack item, RecipeType recipeType, ItemStack[] recipe) {
super(category, item, recipeType, recipe);
createPreset(this, "&4Trash Can", this::constructMenu);
}
private void constructMenu(BlockMenuPreset preset) {
for (int i : border) {
preset.addItem(i, new CustomItem(new ItemStack(Material.RED_STAINED_GLASS_PANE), " "), (p, slot, item, action) -> false);
for (int i : BORDER) {
preset.addItem(i, BACKGROUND, ChestMenuUtils.getEmptyClickHandler());
}
}

View File

@ -8,8 +8,7 @@ import org.bukkit.Tag;
import org.bukkit.block.Block;
import org.bukkit.inventory.ItemStack;
import me.mrCookieSlime.CSCoreLibPlugin.general.Inventory.InvUtils;
import me.mrCookieSlime.CSCoreLibPlugin.general.Inventory.Item.CustomItem;
import io.github.thebusybiscuit.cscorelib2.item.CustomItem;
import me.mrCookieSlime.Slimefun.Lists.RecipeType;
import me.mrCookieSlime.Slimefun.Lists.SlimefunItems;
import me.mrCookieSlime.Slimefun.Objects.Category;
@ -146,7 +145,8 @@ public class AutoDrier extends AContainer implements RecipeDisplayItem {
if (r != null) {
if (inputSlot == -1) return;
if (!menu.fits(r.getOutput()[0], getOutputSlots())) return;
menu.replaceExistingItem(inputSlot, InvUtils.decreaseItem(menu.getItemInSlot(inputSlot), 1));
menu.consumeItem(inputSlot);
processing.put(b, r);
progress.put(b, r.getTicks());
}

View File

@ -11,8 +11,7 @@ import org.bukkit.enchantments.Enchantment;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.EnchantmentStorageMeta;
import me.mrCookieSlime.CSCoreLibPlugin.general.Inventory.InvUtils;
import me.mrCookieSlime.CSCoreLibPlugin.general.Inventory.Item.CustomItem;
import io.github.thebusybiscuit.cscorelib2.item.CustomItem;
import me.mrCookieSlime.EmeraldEnchants.EmeraldEnchants;
import me.mrCookieSlime.EmeraldEnchants.ItemEnchantment;
import me.mrCookieSlime.Slimefun.SlimefunPlugin;
@ -128,8 +127,8 @@ public class AutoEnchanter extends AContainer {
if (recipe != null) {
if (!fits(b, recipe.getOutput())) return;
for (int slot: getInputSlots()) {
menu.replaceExistingItem(slot, InvUtils.decreaseItem(menu.getItemInSlot(slot), 1));
for (int slot : getInputSlots()) {
menu.consumeItem(slot);
}
processing.put(b, recipe);

View File

@ -3,7 +3,7 @@ package me.mrCookieSlime.Slimefun.Objects.SlimefunItem.machines.electric;
import org.bukkit.Material;
import org.bukkit.inventory.ItemStack;
import me.mrCookieSlime.CSCoreLibPlugin.general.Inventory.Item.CustomItem;
import io.github.thebusybiscuit.cscorelib2.item.CustomItem;
import me.mrCookieSlime.Slimefun.Lists.RecipeType;
import me.mrCookieSlime.Slimefun.Lists.SlimefunItems;
import me.mrCookieSlime.Slimefun.Objects.Category;

View File

@ -9,10 +9,10 @@ import org.bukkit.block.Block;
import org.bukkit.block.data.Ageable;
import org.bukkit.inventory.ItemStack;
import io.github.thebusybiscuit.cscorelib2.item.CustomItem;
import io.github.thebusybiscuit.slimefun4.core.utils.ChestMenuUtils;
import me.mrCookieSlime.CSCoreLibPlugin.Configuration.Config;
import me.mrCookieSlime.CSCoreLibPlugin.general.Inventory.InvUtils;
import me.mrCookieSlime.CSCoreLibPlugin.general.Inventory.Item.CustomItem;
import me.mrCookieSlime.Slimefun.Lists.RecipeType;
import me.mrCookieSlime.Slimefun.Lists.SlimefunItems;
import me.mrCookieSlime.Slimefun.Objects.Category;

View File

@ -6,8 +6,7 @@ import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.inventory.ItemStack;
import me.mrCookieSlime.CSCoreLibPlugin.general.Inventory.InvUtils;
import me.mrCookieSlime.CSCoreLibPlugin.general.Inventory.Item.CustomItem;
import io.github.thebusybiscuit.cscorelib2.item.CustomItem;
import me.mrCookieSlime.Slimefun.SlimefunPlugin;
import me.mrCookieSlime.Slimefun.Lists.RecipeType;
import me.mrCookieSlime.Slimefun.Lists.SlimefunItems;
@ -85,7 +84,7 @@ public abstract class ElectricDustWasher extends AContainer {
ItemStack adding = items[new Random().nextInt(items.length)];
MachineRecipe r = new MachineRecipe(4 / getSpeed(), new ItemStack[0], new ItemStack[] {adding});
if (SlimefunPlugin.getSettings().legacyDustWasher && !menu.fits(r.getOutput()[0], getOutputSlots())) return;
menu.replaceExistingItem(slot, InvUtils.decreaseItem(menu.getItemInSlot(slot), 1));
menu.consumeItem(slot);
processing.put(b, r);
progress.put(b, r.getTicks());
break;
@ -93,7 +92,7 @@ public abstract class ElectricDustWasher extends AContainer {
else if (SlimefunManager.isItemSimilar(menu.getItemInSlot(slot), SlimefunItems.PULVERIZED_ORE, true)) {
MachineRecipe r = new MachineRecipe(4 / getSpeed(), new ItemStack[0], new ItemStack[] {SlimefunItems.PURE_ORE_CLUSTER});
if (!menu.fits(r.getOutput()[0], getOutputSlots())) return;
menu.replaceExistingItem(slot, InvUtils.decreaseItem(menu.getItemInSlot(slot), 1));
menu.consumeItem(slot);
processing.put(b, r);
progress.put(b, r.getTicks());
break;

View File

@ -8,8 +8,7 @@ import org.bukkit.block.Block;
import org.bukkit.inventory.ItemStack;
import io.github.thebusybiscuit.cscorelib2.collections.RandomizedSet;
import me.mrCookieSlime.CSCoreLibPlugin.general.Inventory.InvUtils;
import me.mrCookieSlime.CSCoreLibPlugin.general.Inventory.Item.CustomItem;
import io.github.thebusybiscuit.cscorelib2.item.CustomItem;
import me.mrCookieSlime.Slimefun.Lists.RecipeType;
import me.mrCookieSlime.Slimefun.Lists.SlimefunItems;
import me.mrCookieSlime.Slimefun.Objects.Category;
@ -121,8 +120,8 @@ public abstract class ElectricGoldPan extends AContainer implements RecipeDispla
MachineRecipe r = new MachineRecipe(3 / getSpeed(), new ItemStack[0], new ItemStack[] {output});
if (!menu.fits(output, getOutputSlots())) return;
menu.replaceExistingItem(slot, InvUtils.decreaseItem(menu.getItemInSlot(slot), 1));
menu.consumeItem(slot);
processing.put(b, r);
progress.put(b, r.getTicks());
break;
@ -132,8 +131,8 @@ public abstract class ElectricGoldPan extends AContainer implements RecipeDispla
MachineRecipe r = new MachineRecipe(4 / getSpeed(), new ItemStack[0], new ItemStack[] {output});
if (!menu.fits(output, getOutputSlots())) return;
menu.replaceExistingItem(slot, InvUtils.decreaseItem(menu.getItemInSlot(slot), 1));
menu.consumeItem(slot);
processing.put(b, r);
progress.put(b, r.getTicks());
break;

View File

@ -11,10 +11,10 @@ import org.bukkit.entity.Player;
import org.bukkit.event.inventory.InventoryClickEvent;
import org.bukkit.inventory.ItemStack;
import io.github.thebusybiscuit.cscorelib2.item.CustomItem;
import io.github.thebusybiscuit.cscorelib2.protection.ProtectableAction;
import me.mrCookieSlime.CSCoreLibPlugin.general.Inventory.ChestMenu.AdvancedMenuClickHandler;
import me.mrCookieSlime.CSCoreLibPlugin.general.Inventory.ClickAction;
import me.mrCookieSlime.CSCoreLibPlugin.general.Inventory.Item.CustomItem;
import me.mrCookieSlime.Slimefun.SlimefunPlugin;
import me.mrCookieSlime.Slimefun.Lists.RecipeType;
import me.mrCookieSlime.Slimefun.Objects.Category;

View File

@ -10,13 +10,13 @@ import org.bukkit.event.inventory.InventoryClickEvent;
import org.bukkit.inventory.ItemStack;
import io.github.thebusybiscuit.cscorelib2.blocks.Vein;
import io.github.thebusybiscuit.cscorelib2.item.CustomItem;
import me.mrCookieSlime.CSCoreLibPlugin.Configuration.Config;
import me.mrCookieSlime.CSCoreLibPlugin.general.Inventory.ChestMenu.AdvancedMenuClickHandler;
import me.mrCookieSlime.CSCoreLibPlugin.general.Inventory.ClickAction;
import me.mrCookieSlime.CSCoreLibPlugin.general.Inventory.InvUtils;
import me.mrCookieSlime.CSCoreLibPlugin.general.Inventory.Item.CustomItem;
import me.mrCookieSlime.Slimefun.Lists.RecipeType;
import me.mrCookieSlime.Slimefun.Objects.Category;
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.SimpleSlimefunItem;
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.SlimefunItem;
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.interfaces.InventoryBlock;
import me.mrCookieSlime.Slimefun.Objects.handlers.BlockTicker;
@ -27,7 +27,7 @@ import me.mrCookieSlime.Slimefun.api.energy.ChargableBlock;
import me.mrCookieSlime.Slimefun.api.inventory.BlockMenu;
import me.mrCookieSlime.Slimefun.api.inventory.BlockMenuPreset;
public class FluidPump extends SlimefunItem implements InventoryBlock {
public class FluidPump extends SimpleSlimefunItem<BlockTicker> implements InventoryBlock {
private static final int[] border = {0, 1, 2, 3, 4, 5, 6, 7, 8, 13, 31, 36, 37, 38, 39, 40, 41, 42, 43, 44, 22};
private static final int[] border_in = {9, 10, 11, 12, 18, 21, 27, 28, 29, 30};
@ -98,7 +98,7 @@ public class FluidPump extends SlimefunItem implements InventoryBlock {
if (!menu.fits(output, getOutputSlots())) return;
ChargableBlock.addCharge(b, -energyConsumption);
menu.replaceExistingItem(slot, InvUtils.decreaseItem(menu.getItemInSlot(slot), 1));
menu.consumeItem(slot);
menu.pushItem(output, getOutputSlots());
if (fluid.getType() == Material.WATER) {
@ -116,8 +116,8 @@ public class FluidPump extends SlimefunItem implements InventoryBlock {
}
@Override
public void preRegister() {
addItemHandler(new BlockTicker() {
public BlockTicker getItemHandler() {
return new BlockTicker() {
@Override
public void tick(Block b, SlimefunItem sf, Config data) {
@ -128,7 +128,7 @@ public class FluidPump extends SlimefunItem implements InventoryBlock {
public boolean isSynchronized() {
return true;
}
});
};
}
}

View File

@ -12,10 +12,9 @@ import org.bukkit.block.Block;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import io.github.thebusybiscuit.cscorelib2.item.CustomItem;
import io.github.thebusybiscuit.cscorelib2.protection.ProtectableAction;
import me.mrCookieSlime.CSCoreLibPlugin.Configuration.Config;
import me.mrCookieSlime.CSCoreLibPlugin.general.Inventory.InvUtils;
import me.mrCookieSlime.CSCoreLibPlugin.general.Inventory.Item.CustomItem;
import me.mrCookieSlime.Slimefun.SlimefunPlugin;
import me.mrCookieSlime.Slimefun.Lists.RecipeType;
import me.mrCookieSlime.Slimefun.Lists.SlimefunItems;
@ -172,7 +171,7 @@ public abstract class HeatedPressureChamber extends AContainer {
if (!menu.fits(recipe.getOutput()[0], getOutputSlots())) return;
for (Map.Entry<Integer, Integer> entry : found.entrySet()) {
menu.replaceExistingItem(entry.getKey(), InvUtils.decreaseItem(menu.getItemInSlot(entry.getKey()), entry.getValue()));
menu.consumeItem(entry.getKey(), entry.getValue());
}
processing.put(b, recipe);

View File

@ -7,8 +7,8 @@ import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.inventory.ItemStack;
import me.mrCookieSlime.CSCoreLibPlugin.general.Inventory.InvUtils;
import me.mrCookieSlime.CSCoreLibPlugin.general.Inventory.Item.CustomItem;
import io.github.thebusybiscuit.cscorelib2.inventory.ItemUtils;
import io.github.thebusybiscuit.cscorelib2.item.CustomItem;
import me.mrCookieSlime.Slimefun.Lists.RecipeType;
import me.mrCookieSlime.Slimefun.Lists.SlimefunItems;
import me.mrCookieSlime.Slimefun.Objects.Category;
@ -81,7 +81,7 @@ public abstract class Refinery extends AContainer implements RecipeDisplayItem {
if (!menu.fits(SlimefunItems.BUCKET_OF_FUEL, getOutputSlots())) return;
menu.replaceExistingItem(slot, InvUtils.decreaseItem(menu.getItemInSlot(slot), 1));
ItemUtils.consumeItem(menu.getItemInSlot(slot), false);
processing.put(b, r);
progress.put(b, r.getTicks());
break;

View File

@ -11,7 +11,6 @@ import io.github.thebusybiscuit.cscorelib2.item.CustomItem;
import io.github.thebusybiscuit.cscorelib2.math.DoubleHandler;
import io.github.thebusybiscuit.cscorelib2.protection.ProtectableAction;
import me.mrCookieSlime.CSCoreLibPlugin.Configuration.Config;
import me.mrCookieSlime.CSCoreLibPlugin.general.Inventory.InvUtils;
import me.mrCookieSlime.Slimefun.SlimefunPlugin;
import me.mrCookieSlime.Slimefun.Lists.RecipeType;
import me.mrCookieSlime.Slimefun.Objects.Category;
@ -190,9 +189,11 @@ public class WitherAssembler extends SlimefunItem {
int soulsand = 0;
int skulls = 0;
BlockMenu menu = BlockStorage.getInventory(b);
for (int slot : getSoulSandSlots()) {
if (SlimefunManager.isItemSimilar(BlockStorage.getInventory(b).getItemInSlot(slot), new ItemStack(Material.SOUL_SAND), true)) {
soulsand = soulsand + BlockStorage.getInventory(b).getItemInSlot(slot).getAmount();
if (SlimefunManager.isItemSimilar(menu.getItemInSlot(slot), new ItemStack(Material.SOUL_SAND), true)) {
soulsand = soulsand + menu.getItemInSlot(slot).getAmount();
if (soulsand > 3) {
soulsand = 4;
break;
@ -201,8 +202,8 @@ public class WitherAssembler extends SlimefunItem {
}
for (int slot : getWitherSkullSlots()) {
if (SlimefunManager.isItemSimilar(BlockStorage.getInventory(b).getItemInSlot(slot), new ItemStack(Material.WITHER_SKELETON_SKULL), true)) {
skulls = skulls + BlockStorage.getInventory(b).getItemInSlot(slot).getAmount();
if (SlimefunManager.isItemSimilar(menu.getItemInSlot(slot), new ItemStack(Material.WITHER_SKELETON_SKULL), true)) {
skulls = skulls + menu.getItemInSlot(slot).getAmount();
if (skulls > 2) {
skulls = 3;
break;
@ -212,31 +213,31 @@ public class WitherAssembler extends SlimefunItem {
if (soulsand > 3 && skulls > 2) {
for (int slot : getSoulSandSlots()) {
if (SlimefunManager.isItemSimilar(BlockStorage.getInventory(b).getItemInSlot(slot), new ItemStack(Material.SOUL_SAND), true)) {
int amount = BlockStorage.getInventory(b).getItemInSlot(slot).getAmount();
if (SlimefunManager.isItemSimilar(menu.getItemInSlot(slot), new ItemStack(Material.SOUL_SAND), true)) {
int amount = menu.getItemInSlot(slot).getAmount();
if (amount >= soulsand) {
BlockStorage.getInventory(b).replaceExistingItem(slot, InvUtils.decreaseItem(BlockStorage.getInventory(b).getItemInSlot(slot), soulsand));
menu.consumeItem(slot, soulsand);
break;
}
else {
soulsand = soulsand - amount;
BlockStorage.getInventory(b).replaceExistingItem(slot, null);
menu.replaceExistingItem(slot, null);
}
}
}
for (int slot : getWitherSkullSlots()) {
if (SlimefunManager.isItemSimilar(BlockStorage.getInventory(b).getItemInSlot(slot), new ItemStack(Material.WITHER_SKELETON_SKULL), true)) {
int amount = BlockStorage.getInventory(b).getItemInSlot(slot).getAmount();
if (SlimefunManager.isItemSimilar(menu.getItemInSlot(slot), new ItemStack(Material.WITHER_SKELETON_SKULL), true)) {
int amount = menu.getItemInSlot(slot).getAmount();
if (amount >= skulls) {
BlockStorage.getInventory(b).replaceExistingItem(slot, InvUtils.decreaseItem(BlockStorage.getInventory(b).getItemInSlot(slot), skulls));
menu.consumeItem(slot, skulls);
break;
}
else {
skulls = skulls - amount;
BlockStorage.getInventory(b).replaceExistingItem(slot, null);
menu.replaceExistingItem(slot, null);
}
}
}

View File

@ -9,8 +9,8 @@ import org.bukkit.entity.ExperienceOrb;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import io.github.thebusybiscuit.cscorelib2.item.CustomItem;
import me.mrCookieSlime.CSCoreLibPlugin.Configuration.Config;
import me.mrCookieSlime.CSCoreLibPlugin.general.Inventory.Item.CustomItem;
import me.mrCookieSlime.Slimefun.Lists.RecipeType;
import me.mrCookieSlime.Slimefun.Objects.Category;
import me.mrCookieSlime.Slimefun.Objects.SlimefunBlockHandler;

View File

@ -0,0 +1,57 @@
package me.mrCookieSlime.Slimefun.Objects.SlimefunItem.machines.electric.reactors;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.entity.Entity;
import org.bukkit.entity.LivingEntity;
import org.bukkit.inventory.ItemStack;
import org.bukkit.potion.PotionEffect;
import org.bukkit.potion.PotionEffectType;
import me.mrCookieSlime.Slimefun.Lists.RecipeType;
import me.mrCookieSlime.Slimefun.Lists.SlimefunItems;
import me.mrCookieSlime.Slimefun.Objects.Category;
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.abstractItems.AReactor;
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.abstractItems.MachineFuel;
import me.mrCookieSlime.Slimefun.api.Slimefun;
import me.mrCookieSlime.Slimefun.api.SlimefunItemStack;
import me.mrCookieSlime.Slimefun.holograms.ReactorHologram;
public abstract class NetherStarReactor extends AReactor {
public NetherStarReactor(Category category, SlimefunItemStack item, RecipeType recipeType, ItemStack[] recipe) {
super(category, item, recipeType, recipe);
}
@Override
public String getInventoryTitle() {
return "&fNether Star Reactor";
}
@Override
public void registerDefaultRecipes() {
registerFuel(new MachineFuel(1800, new ItemStack(Material.NETHER_STAR)));
}
@Override
public void extraTick(final Location l) {
Slimefun.runSync(() -> {
for (Entity entity : ReactorHologram.getArmorStand(l, true).getNearbyEntities(5, 5, 5)) {
if (entity instanceof LivingEntity) {
((LivingEntity) entity).addPotionEffect(new PotionEffect(PotionEffectType.WITHER, 60, 1));
}
}
}, 0L);
}
@Override
public ItemStack getCoolant() {
return SlimefunItems.NETHER_ICE_COOLANT_CELL;
}
@Override
public ItemStack getProgressBar() {
return new ItemStack(Material.NETHER_STAR);
}
}

View File

@ -0,0 +1,48 @@
package me.mrCookieSlime.Slimefun.Objects.SlimefunItem.machines.electric.reactors;
import org.bukkit.Location;
import org.bukkit.inventory.ItemStack;
import io.github.thebusybiscuit.cscorelib2.skull.SkullItem;
import me.mrCookieSlime.Slimefun.Lists.RecipeType;
import me.mrCookieSlime.Slimefun.Lists.SlimefunItems;
import me.mrCookieSlime.Slimefun.Objects.Category;
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.abstractItems.AReactor;
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.abstractItems.MachineFuel;
import me.mrCookieSlime.Slimefun.api.SlimefunItemStack;
public abstract class NuclearReactor extends AReactor {
public NuclearReactor(Category category, SlimefunItemStack item, RecipeType recipeType, ItemStack[] recipe) {
super(category, item, recipeType, recipe);
}
@Override
public String getInventoryTitle() {
return "&2Nuclear Reactor";
}
@Override
public void registerDefaultRecipes() {
registerFuel(new MachineFuel(1200, SlimefunItems.URANIUM, SlimefunItems.NEPTUNIUM));
registerFuel(new MachineFuel(600, SlimefunItems.NEPTUNIUM, SlimefunItems.PLUTONIUM));
registerFuel(new MachineFuel(1500, SlimefunItems.BOOSTED_URANIUM, null));
}
@Override
public ItemStack getProgressBar() {
return SkullItem.fromBase64("eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvYTNhZDhlZTg0OWVkZjA0ZWQ5YTI2Y2EzMzQxZjYwMzNiZDc2ZGNjNDIzMWVkMWVhNjNiNzU2NTc1MWIyN2FjIn19fQ==");
}
@Override
public ItemStack getCoolant() {
return SlimefunItems.REACTOR_COOLANT_CELL;
}
@Override
public void extraTick(Location l) {
// This machine does not need to perform anything while ticking
// The Nether Star Reactor uses this method to generate the Wither Effect
}
}

View File

@ -13,7 +13,7 @@ import org.bukkit.inventory.Inventory;
import org.bukkit.inventory.ItemStack;
import io.github.thebusybiscuit.cscorelib2.inventory.ItemUtils;
import me.mrCookieSlime.CSCoreLibPlugin.general.Inventory.Item.CustomItem;
import io.github.thebusybiscuit.cscorelib2.item.CustomItem;
import me.mrCookieSlime.Slimefun.SlimefunPlugin;
import me.mrCookieSlime.Slimefun.Lists.Categories;
import me.mrCookieSlime.Slimefun.Lists.RecipeType;
@ -51,7 +51,7 @@ public class ArmorForge extends MultiBlockMachine {
}
if (craft) {
final ItemStack adding = RecipeType.getRecipeOutputList(this, inputs.get(i)).clone();
ItemStack adding = RecipeType.getRecipeOutputList(this, inputs.get(i)).clone();
if (Slimefun.hasUnlocked(p, adding, true)) {
Inventory outputInv = findOutputInventory(adding, dispBlock, inv);

View File

@ -13,7 +13,7 @@ import org.bukkit.entity.Player;
import org.bukkit.inventory.Inventory;
import org.bukkit.inventory.ItemStack;
import me.mrCookieSlime.CSCoreLibPlugin.general.Inventory.Item.CustomItem;
import io.github.thebusybiscuit.cscorelib2.item.CustomItem;
import me.mrCookieSlime.Slimefun.SlimefunPlugin;
import me.mrCookieSlime.Slimefun.Lists.Categories;
import me.mrCookieSlime.Slimefun.Lists.RecipeType;
@ -50,7 +50,7 @@ public class Compressor extends MultiBlockMachine {
for (ItemStack current : inv.getContents()) {
for (ItemStack convert : RecipeType.getRecipeInputs(this)) {
if (convert != null && SlimefunManager.isItemSimilar(current, convert, true)) {
final ItemStack adding = RecipeType.getRecipeOutput(this, convert);
ItemStack adding = RecipeType.getRecipeOutput(this, convert);
Inventory outputInv = findOutputInventory(adding, dispBlock, inv);
if (outputInv != null) {

View File

@ -16,8 +16,8 @@ import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.ItemMeta;
import io.github.thebusybiscuit.cscorelib2.inventory.ItemUtils;
import io.github.thebusybiscuit.cscorelib2.item.CustomItem;
import io.github.thebusybiscuit.slimefun4.implementation.listeners.BackpackListener;
import me.mrCookieSlime.CSCoreLibPlugin.general.Inventory.Item.CustomItem;
import me.mrCookieSlime.Slimefun.SlimefunPlugin;
import me.mrCookieSlime.Slimefun.Lists.Categories;
import me.mrCookieSlime.Slimefun.Lists.RecipeType;
@ -71,7 +71,7 @@ public class EnhancedCraftingTable extends MultiBlockMachine {
}
if (craft) {
final ItemStack adding = RecipeType.getRecipeOutputList(this, inputs.get(i)).clone();
ItemStack adding = RecipeType.getRecipeOutputList(this, inputs.get(i)).clone();
if (Slimefun.hasUnlocked(p, adding, true)) {
Inventory inv2 = Bukkit.createInventory(null, 9, "test");

View File

@ -12,7 +12,7 @@ import org.bukkit.entity.Player;
import org.bukkit.inventory.Inventory;
import org.bukkit.inventory.ItemStack;
import me.mrCookieSlime.CSCoreLibPlugin.general.Inventory.Item.CustomItem;
import io.github.thebusybiscuit.cscorelib2.item.CustomItem;
import me.mrCookieSlime.Slimefun.SlimefunPlugin;
import me.mrCookieSlime.Slimefun.Lists.Categories;
import me.mrCookieSlime.Slimefun.Lists.RecipeType;

View File

@ -13,7 +13,7 @@ import org.bukkit.entity.Player;
import org.bukkit.inventory.Inventory;
import org.bukkit.inventory.ItemStack;
import me.mrCookieSlime.CSCoreLibPlugin.general.Inventory.Item.CustomItem;
import io.github.thebusybiscuit.cscorelib2.item.CustomItem;
import me.mrCookieSlime.Slimefun.SlimefunPlugin;
import me.mrCookieSlime.Slimefun.Lists.Categories;
import me.mrCookieSlime.Slimefun.Lists.RecipeType;

View File

@ -16,8 +16,8 @@ import org.bukkit.inventory.Inventory;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.ItemMeta;
import io.github.thebusybiscuit.cscorelib2.item.CustomItem;
import io.github.thebusybiscuit.slimefun4.implementation.listeners.BackpackListener;
import me.mrCookieSlime.CSCoreLibPlugin.general.Inventory.Item.CustomItem;
import me.mrCookieSlime.Slimefun.SlimefunPlugin;
import me.mrCookieSlime.Slimefun.Lists.Categories;
import me.mrCookieSlime.Slimefun.Lists.RecipeType;

View File

@ -12,7 +12,7 @@ import org.bukkit.entity.Player;
import org.bukkit.inventory.Inventory;
import org.bukkit.inventory.ItemStack;
import me.mrCookieSlime.CSCoreLibPlugin.general.Inventory.Item.CustomItem;
import io.github.thebusybiscuit.cscorelib2.item.CustomItem;
import me.mrCookieSlime.Slimefun.SlimefunPlugin;
import me.mrCookieSlime.Slimefun.Lists.Categories;
import me.mrCookieSlime.Slimefun.Lists.RecipeType;

View File

@ -14,7 +14,7 @@ import org.bukkit.entity.Player;
import org.bukkit.inventory.Inventory;
import org.bukkit.inventory.ItemStack;
import me.mrCookieSlime.CSCoreLibPlugin.general.Inventory.InvUtils;
import io.github.thebusybiscuit.cscorelib2.inventory.InvUtils;
import me.mrCookieSlime.Slimefun.SlimefunPlugin;
import me.mrCookieSlime.Slimefun.Lists.Categories;
import me.mrCookieSlime.Slimefun.Lists.SlimefunItems;

View File

@ -14,7 +14,7 @@ import org.bukkit.entity.Player;
import org.bukkit.inventory.Inventory;
import org.bukkit.inventory.ItemStack;
import me.mrCookieSlime.CSCoreLibPlugin.general.Inventory.Item.CustomItem;
import io.github.thebusybiscuit.cscorelib2.item.CustomItem;
import me.mrCookieSlime.Slimefun.SlimefunPlugin;
import me.mrCookieSlime.Slimefun.Lists.Categories;
import me.mrCookieSlime.Slimefun.Lists.RecipeType;

View File

@ -20,7 +20,7 @@ import org.bukkit.inventory.meta.Damageable;
import org.bukkit.inventory.meta.ItemMeta;
import io.github.thebusybiscuit.cscorelib2.inventory.InvUtils;
import me.mrCookieSlime.CSCoreLibPlugin.general.Inventory.Item.CustomItem;
import io.github.thebusybiscuit.cscorelib2.item.CustomItem;
import me.mrCookieSlime.Slimefun.SlimefunPlugin;
import me.mrCookieSlime.Slimefun.Lists.Categories;
import me.mrCookieSlime.Slimefun.Lists.RecipeType;

View File

@ -9,17 +9,18 @@ import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.SlimefunItem;
import me.mrCookieSlime.Slimefun.Objects.handlers.BlockTicker;
public class RainbowTicker extends BlockTicker {
private final int[] sequence;
private int meta;
private int index;
private int[] queue;
public RainbowTicker() {
this(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15);
}
public RainbowTicker(int... data) {
this.queue = data;
this.sequence = data;
meta = data[0];
index = 0;
}
@ -49,8 +50,8 @@ public class RainbowTicker extends BlockTicker {
@Override
public void uniqueTick() {
index = ((index >= queue.length - 1) ? 0: index + 1);
meta = queue[index];
index = ((index >= sequence.length - 1) ? 0: index + 1);
meta = sequence[index];
}
@Override

View File

@ -4,7 +4,6 @@ import java.util.ArrayList;
import java.util.List;
import java.util.UUID;
import java.util.concurrent.ThreadLocalRandom;
import java.util.logging.Level;
import java.util.stream.Collectors;
import java.util.stream.Stream;
@ -19,7 +18,6 @@ import org.bukkit.block.Block;
import org.bukkit.block.BlockFace;
import org.bukkit.block.Chest;
import org.bukkit.block.CreatureSpawner;
import org.bukkit.entity.Entity;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
@ -32,14 +30,14 @@ import org.bukkit.potion.PotionEffectType;
import org.bukkit.util.Vector;
import io.github.thebusybiscuit.cscorelib2.chat.ChatColors;
import io.github.thebusybiscuit.cscorelib2.inventory.InvUtils;
import io.github.thebusybiscuit.cscorelib2.inventory.ItemUtils;
import io.github.thebusybiscuit.cscorelib2.item.CustomItem;
import io.github.thebusybiscuit.cscorelib2.materials.MaterialCollections;
import io.github.thebusybiscuit.cscorelib2.skull.SkullItem;
import io.github.thebusybiscuit.slimefun4.core.utils.FireworkUtils;
import me.mrCookieSlime.CSCoreLibPlugin.CSCoreLib;
import me.mrCookieSlime.CSCoreLibPlugin.events.ItemUseEvent;
import me.mrCookieSlime.CSCoreLibPlugin.general.Inventory.InvUtils;
import me.mrCookieSlime.CSCoreLibPlugin.general.Inventory.Item.CustomItem;
import me.mrCookieSlime.CSCoreLibPlugin.general.Particles.FireworkShow;
import me.mrCookieSlime.CSCoreLibPlugin.general.World.CustomSkull;
import me.mrCookieSlime.Slimefun.SlimefunPlugin;
import me.mrCookieSlime.Slimefun.Lists.Categories;
import me.mrCookieSlime.Slimefun.Lists.RecipeType;
@ -47,8 +45,7 @@ import me.mrCookieSlime.Slimefun.Lists.SlimefunItems;
import me.mrCookieSlime.Slimefun.Objects.MultiBlock;
import me.mrCookieSlime.Slimefun.Objects.SlimefunBlockHandler;
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.Alloy;
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.ExcludedBlock;
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.ExcludedSoulboundTool;
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.HandledBlock;
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.JetBoots;
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.Jetpack;
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.Juice;
@ -60,14 +57,12 @@ import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.SlimefunBackpack;
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.SlimefunBow;
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.SlimefunItem;
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.SlimefunMachine;
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.SolarHelmet;
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.SoulboundBackpack;
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.SoulboundItem;
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.SoulboundTool;
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.Talisman;
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.UnregisterReason;
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.VanillaItem;
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.abstractItems.AReactor;
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.abstractItems.MachineFuel;
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.abstractItems.Teleporter;
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.cargo.AdvancedCargoOutputNode;
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.cargo.CargoInputNode;
@ -100,6 +95,7 @@ import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.items.PortableDustbin;
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.items.PortableGEOScanner;
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.items.SeismicAxe;
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.items.SmeltersPickaxe;
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.items.SolarHelmet;
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.items.SoulboundRune;
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.items.StormStaff;
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.items.SwordOfBeheading;
@ -153,6 +149,8 @@ import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.machines.electric.geo.GEOS
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.machines.electric.geo.OilPump;
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.machines.electric.gps.ElevatorPlate;
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.machines.electric.gps.GPSTransmitter;
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.machines.electric.reactors.NetherStarReactor;
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.machines.electric.reactors.NuclearReactor;
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.multiblocks.ArmorForge;
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.multiblocks.AutomatedPanningMachine;
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.multiblocks.Compressor;
@ -177,7 +175,6 @@ import me.mrCookieSlime.Slimefun.api.BlockStorage;
import me.mrCookieSlime.Slimefun.api.Slimefun;
import me.mrCookieSlime.Slimefun.api.SlimefunItemStack;
import me.mrCookieSlime.Slimefun.api.item_transport.CargoNet;
import me.mrCookieSlime.Slimefun.holograms.ReactorHologram;
public final class SlimefunSetup {
@ -1315,15 +1312,15 @@ public final class SlimefunSetup {
new ItemStack[] {null, SlimefunItems.ESSENCE_OF_AFTERLIFE, null, null, new ItemStack(Material.DIAMOND_PICKAXE), null, null, SlimefunItems.ESSENCE_OF_AFTERLIFE, null})
.register(true);
new ExcludedSoulboundTool(Categories.TOOLS, (SlimefunItemStack) SlimefunItems.SOULBOUND_AXE,
new SoulboundTool(Categories.TOOLS, (SlimefunItemStack) SlimefunItems.SOULBOUND_AXE,
new ItemStack[] {null, SlimefunItems.ESSENCE_OF_AFTERLIFE, null, null, new ItemStack(Material.DIAMOND_AXE), null, null, SlimefunItems.ESSENCE_OF_AFTERLIFE, null})
.register(true);
new ExcludedSoulboundTool(Categories.TOOLS, (SlimefunItemStack) SlimefunItems.SOULBOUND_SHOVEL,
new SoulboundTool(Categories.TOOLS, (SlimefunItemStack) SlimefunItems.SOULBOUND_SHOVEL,
new ItemStack[] {null, SlimefunItems.ESSENCE_OF_AFTERLIFE, null, null, new ItemStack(Material.DIAMOND_SHOVEL), null, null, SlimefunItems.ESSENCE_OF_AFTERLIFE, null})
.register(true);
new ExcludedSoulboundTool(Categories.TOOLS, (SlimefunItemStack) SlimefunItems.SOULBOUND_HOE,
new SoulboundTool(Categories.TOOLS, (SlimefunItemStack) SlimefunItems.SOULBOUND_HOE,
new ItemStack[] {null, SlimefunItems.ESSENCE_OF_AFTERLIFE, null, null, new ItemStack(Material.DIAMOND_HOE), null, null, SlimefunItems.ESSENCE_OF_AFTERLIFE, null})
.register(true);
@ -1468,7 +1465,7 @@ public final class SlimefunSetup {
new BlockPlacer(Categories.MACHINES_1, (SlimefunItemStack) SlimefunItems.BLOCK_PLACER, RecipeType.ENHANCED_CRAFTING_TABLE,
new ItemStack[] {SlimefunItems.GOLD_4K, new ItemStack(Material.PISTON), SlimefunItems.GOLD_4K, new ItemStack(Material.IRON_INGOT), SlimefunItems.ELECTRIC_MOTOR, new ItemStack(Material.IRON_INGOT), SlimefunItems.GOLD_4K, new ItemStack(Material.PISTON), SlimefunItems.GOLD_4K},
new String[] {"unplaceable-blocks"}, new Object[] {Stream.of(Material.STRUCTURE_BLOCK, Material.COMMAND_BLOCK, Material.CHAIN_COMMAND_BLOCK, Material.REPEATING_COMMAND_BLOCK).map(Material::toString).collect(Collectors.toList())})
new String[] {"unplaceable-blocks"}, new Object[] {MaterialCollections.getAllUnbreakableBlocks().stream().map(Material::name).collect(Collectors.toList())})
.register(true);
new TelepositionScroll(Categories.MAGIC, (SlimefunItemStack) SlimefunItems.SCROLL_OF_DIMENSIONAL_TELEPOSITION, RecipeType.MAGIC_WORKBENCH,
@ -1518,7 +1515,7 @@ public final class SlimefunSetup {
new ItemStack[] {null, null, null, SlimefunItems.MAGIC_LUMP_2, new ItemStack(Material.GLASS_PANE), SlimefunItems.MAGIC_LUMP_2, null, SlimefunItems.MAGIC_LUMP_2, null}, new CustomItem(SlimefunItems.FLASK_OF_KNOWLEDGE, 8))
.register(true);
new ExcludedBlock(Categories.BIRTHDAY, new CustomItem(new ItemStack(Material.CAKE), "&bBirthday Cake"), "BIRTHDAY_CAKE", RecipeType.ENHANCED_CRAFTING_TABLE,
new HandledBlock(Categories.BIRTHDAY, new CustomItem(new ItemStack(Material.CAKE), "&bBirthday Cake"), "BIRTHDAY_CAKE", RecipeType.ENHANCED_CRAFTING_TABLE,
new ItemStack[] {null, new ItemStack(Material.TORCH), null, new ItemStack(Material.SUGAR), new ItemStack(Material.CAKE), new ItemStack(Material.SUGAR), null, null, null})
.register(true);
@ -1591,7 +1588,7 @@ public final class SlimefunSetup {
if (SlimefunManager.isItemSimilar(item, SlimefunItems.EASTER_EGG, true)) {
e.setCancelled(true);
if (p.getGameMode() != GameMode.CREATIVE) ItemUtils.consumeItem(item, false);
FireworkShow.launchRandom(e.getPlayer(), 2);
FireworkUtils.launchRandom(e.getPlayer(), 2);
List<ItemStack> gifts = new ArrayList<>();
gifts.add(new CustomItem(SlimefunItems.EASTER_CARROT_PIE, 4));
@ -3013,88 +3010,24 @@ public final class SlimefunSetup {
SlimefunItem.setRadioactive(SlimefunItems.BOOSTED_URANIUM);
new AReactor(Categories.ELECTRICITY, (SlimefunItemStack) SlimefunItems.NUCLEAR_REACTOR, RecipeType.ENHANCED_CRAFTING_TABLE,
new NuclearReactor(Categories.ELECTRICITY, (SlimefunItemStack) SlimefunItems.NUCLEAR_REACTOR, RecipeType.ENHANCED_CRAFTING_TABLE,
new ItemStack[] {SlimefunItems.BLISTERING_INGOT_3, SlimefunItems.CARBONADO_EDGED_CAPACITOR, SlimefunItems.BLISTERING_INGOT_3, SlimefunItems.REINFORCED_PLATE, SlimefunItems.COOLING_UNIT, SlimefunItems.REINFORCED_PLATE, SlimefunItems.LEAD_INGOT, SlimefunItems.REINFORCED_PLATE, SlimefunItems.LEAD_INGOT}){
@Override
public String getInventoryTitle() {
return "&2Nuclear Reactor";
}
@Override
public void registerDefaultRecipes() {
registerFuel(new MachineFuel(1200, SlimefunItems.URANIUM, SlimefunItems.NEPTUNIUM));
registerFuel(new MachineFuel(600, SlimefunItems.NEPTUNIUM, SlimefunItems.PLUTONIUM));
registerFuel(new MachineFuel(1500, SlimefunItems.BOOSTED_URANIUM, null));
}
@Override
public int getEnergyProduction() {
return 250;
}
}.registerChargeableBlock(true, 16384);
@Override
public ItemStack getProgressBar() {
try {
return CustomSkull.getItem("eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvYTNhZDhlZTg0OWVkZjA0ZWQ5YTI2Y2EzMzQxZjYwMzNiZDc2ZGNjNDIzMWVkMWVhNjNiNzU2NTc1MWIyN2FjIn19fQ==");
} catch (Exception e) {
Slimefun.getLogger().log(Level.SEVERE, "An Error occured while creating the Progressbar of a Reactor for Slimefun " + Slimefun.getVersion());
return new ItemStack(Material.BLAZE_POWDER);
}
}
@Override
public ItemStack getCoolant() {
return SlimefunItems.REACTOR_COOLANT_CELL;
}
@Override
public void extraTick(Location l) {
// This machine does not need to perform anything while ticking
// The Nether Star Reactor uses this method to generate the Wither Effect
}
}
.registerChargeableBlock(true, 16384);
new AReactor(Categories.ELECTRICITY, (SlimefunItemStack) SlimefunItems.NETHERSTAR_REACTOR, RecipeType.ENHANCED_CRAFTING_TABLE,
new NetherStarReactor(Categories.ELECTRICITY, (SlimefunItemStack) SlimefunItems.NETHERSTAR_REACTOR, RecipeType.ENHANCED_CRAFTING_TABLE,
new ItemStack[]{SlimefunItems.BOOSTED_URANIUM, SlimefunItems.CARBONADO_EDGED_CAPACITOR, SlimefunItems.BOOSTED_URANIUM, SlimefunItems.REINFORCED_PLATE, new ItemStack(Material.NETHER_STAR), SlimefunItems.REINFORCED_PLATE, SlimefunItems.CORINTHIAN_BRONZE_INGOT, SlimefunItems.REINFORCED_PLATE, SlimefunItems.CORINTHIAN_BRONZE_INGOT}){
@Override
public String getInventoryTitle() {
return "&fNether Star Reactor";
}
@Override
public void registerDefaultRecipes() {
registerFuel(new MachineFuel(1800, new ItemStack(Material.NETHER_STAR)));
}
@Override
public int getEnergyProduction() {
return 512;
}
@Override
public void extraTick(final Location l) {
Slimefun.runSync(() -> {
for (Entity entity : ReactorHologram.getArmorStand(l, true).getNearbyEntities(5, 5, 5)) {
if (entity instanceof LivingEntity) {
((LivingEntity) entity).addPotionEffect(new PotionEffect(PotionEffectType.WITHER, 60, 1));
}
}
}, 0L);
}
@Override
public ItemStack getCoolant() {
return SlimefunItems.NETHER_ICE_COOLANT_CELL;
}
@Override
public ItemStack getProgressBar() {
return new ItemStack(Material.NETHER_STAR);
}
}.registerChargeableBlock(true, 32768);
new SlimefunItem(Categories.CARGO, (SlimefunItemStack) SlimefunItems.CARGO_MOTOR, RecipeType.ENHANCED_CRAFTING_TABLE,
@ -3147,7 +3080,7 @@ public final class SlimefunSetup {
}.registerChargeableBlock(true, 256);
new ReactorAccessPort(Categories.ELECTRICITY, SlimefunItems.REACTOR_ACCESS_PORT, "REACTOR_ACCESS_PORT", RecipeType.ENHANCED_CRAFTING_TABLE,
new ReactorAccessPort(Categories.CARGO, SlimefunItems.REACTOR_ACCESS_PORT, "REACTOR_ACCESS_PORT", RecipeType.ENHANCED_CRAFTING_TABLE,
new ItemStack[] {null, SlimefunItems.BLISTERING_INGOT_3, null, SlimefunItems.LEAD_INGOT, SlimefunItems.CARGO_MOTOR, SlimefunItems.LEAD_INGOT, null, SlimefunItems.ELECTRIC_MOTOR, null})
.register(true);

View File

@ -12,11 +12,11 @@ import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.ItemMeta;
import io.github.thebusybiscuit.cscorelib2.chat.ChatColors;
import io.github.thebusybiscuit.cscorelib2.item.CustomItem;
import io.github.thebusybiscuit.slimefun4.core.guide.BookSlimefunGuide;
import io.github.thebusybiscuit.slimefun4.core.guide.ChestSlimefunGuide;
import io.github.thebusybiscuit.slimefun4.core.guide.ISlimefunGuide;
import io.github.thebusybiscuit.slimefun4.core.guide.SlimefunGuideLayout;
import me.mrCookieSlime.CSCoreLibPlugin.general.Inventory.Item.CustomItem;
import me.mrCookieSlime.Slimefun.Objects.Category;
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.SlimefunItem;
import me.mrCookieSlime.Slimefun.Setup.SlimefunManager;

View File

@ -8,6 +8,7 @@ import java.util.UUID;
import org.bukkit.ChatColor;
import org.bukkit.GameMode;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.block.Block;
@ -26,24 +27,25 @@ import org.bukkit.metadata.FixedMetadataValue;
import org.bukkit.util.Vector;
import io.github.thebusybiscuit.cscorelib2.inventory.ItemUtils;
import me.mrCookieSlime.CSCoreLibPlugin.general.Inventory.Item.CustomItem;
import io.github.thebusybiscuit.cscorelib2.item.CustomItem;
import me.mrCookieSlime.Slimefun.SlimefunPlugin;
import me.mrCookieSlime.Slimefun.Lists.SlimefunItems;
import me.mrCookieSlime.Slimefun.api.BlockStorage;
import me.mrCookieSlime.Slimefun.api.Slimefun;
import me.mrCookieSlime.Slimefun.utils.Utilities;
public class AncientAltarListener implements Listener {
private Utilities utilities;
private final Set<Location> altarsInUse = new HashSet<>();
private final List<Block> altars = new ArrayList<>();
private final Set<UUID> removedItems = new HashSet<>();
public AncientAltarListener(SlimefunPlugin plugin) {
plugin.getServer().getPluginManager().registerEvents(this, plugin);
utilities = SlimefunPlugin.getUtilities();
}
public Set<Location> getAltarsInUse() {
return altarsInUse;
}
@EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true)
@ -56,7 +58,7 @@ public class AncientAltarListener implements Listener {
if (item.equals("ANCIENT_PEDESTAL")) {
e.setCancelled(true);
if (utilities.altarinuse.contains(b.getLocation())) {
if (altarsInUse.contains(b.getLocation())) {
return;
}
@ -84,13 +86,13 @@ public class AncientAltarListener implements Listener {
}
}
else if (item.equals("ANCIENT_ALTAR")) {
if (!Slimefun.hasUnlocked(e.getPlayer(), SlimefunItems.ANCIENT_ALTAR, true) || utilities.altarinuse.contains(b.getLocation())) {
if (!Slimefun.hasUnlocked(e.getPlayer(), SlimefunItems.ANCIENT_ALTAR, true) || altarsInUse.contains(b.getLocation())) {
e.setCancelled(true);
return;
}
// Make altarinuse simply because that was the last block clicked.
utilities.altarinuse.add(b.getLocation());
altarsInUse.add(b.getLocation());
e.setCancelled(true);
ItemStack catalyst = new CustomItem(e.getPlayer().getInventory().getItemInMainHand(), 1);
@ -99,7 +101,7 @@ public class AncientAltarListener implements Listener {
if (!altars.contains(e.getClickedBlock())) {
altars.add(e.getClickedBlock());
if (pedestals.size() == 8) {
pedestals.forEach(block -> utilities.altarinuse.add(block.getLocation()));
pedestals.forEach(block -> altarsInUse.add(block.getLocation()));
if (catalyst.getType() != Material.AIR) {
List<ItemStack> input = new ArrayList<>();
@ -118,35 +120,35 @@ public class AncientAltarListener implements Listener {
ItemUtils.consumeItem(e.getPlayer().getInventory().getItemInMainHand(), false);
}
Slimefun.runSync(new RitualAnimation(altars, b, b.getLocation().add(0.5, 1.3, 0.5), result, pedestals, consumed), 10L);
Slimefun.runSync(new RitualAnimation(this, altars, b, b.getLocation().add(0.5, 1.3, 0.5), result, pedestals, consumed), 10L);
}
else {
altars.remove(e.getClickedBlock());
pedestals.forEach(block -> utilities.altarinuse.remove(block.getLocation()));
pedestals.forEach(block -> altarsInUse.remove(block.getLocation()));
// Item not unlocked, no longer in use.
utilities.altarinuse.remove(b.getLocation());
altarsInUse.remove(b.getLocation());
}
}
else {
altars.remove(e.getClickedBlock());
SlimefunPlugin.getLocal().sendMessage(e.getPlayer(), "machines.ANCIENT_ALTAR.unknown-recipe", true);
pedestals.forEach(block -> utilities.altarinuse.remove(block.getLocation()));
pedestals.forEach(block -> altarsInUse.remove(block.getLocation()));
// Bad recipe, no longer in use.
utilities.altarinuse.remove(b.getLocation());
altarsInUse.remove(b.getLocation());
}
}
else {
altars.remove(e.getClickedBlock());
SlimefunPlugin.getLocal().sendMessage(e.getPlayer(), "machines.ANCIENT_ALTAR.unknown-catalyst", true);
pedestals.forEach(block -> utilities.altarinuse.remove(block.getLocation()));
pedestals.forEach(block -> altarsInUse.remove(block.getLocation()));
// Unknown catalyst, no longer in use
utilities.altarinuse.remove(b.getLocation());
altarsInUse.remove(b.getLocation());
}
}
else {
@ -154,7 +156,7 @@ public class AncientAltarListener implements Listener {
SlimefunPlugin.getLocal().sendMessage(e.getPlayer(), "machines.ANCIENT_ALTAR.not-enough-pedestals", true, msg -> msg.replace("%pedestals%", String.valueOf(pedestals.size())));
// Not a valid altar so remove from inuse
utilities.altarinuse.remove(b.getLocation());
altarsInUse.remove(b.getLocation());
}
}
}

View File

@ -1,14 +1,10 @@
package me.mrCookieSlime.Slimefun.ancient_altar;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.logging.Level;
import me.mrCookieSlime.Slimefun.SlimefunPlugin;
import me.mrCookieSlime.Slimefun.api.Slimefun;
import me.mrCookieSlime.Slimefun.utils.Utilities;
import org.bukkit.Effect;
import org.bukkit.Location;
@ -19,32 +15,36 @@ import org.bukkit.block.Block;
import org.bukkit.entity.Item;
import org.bukkit.inventory.ItemStack;
import me.mrCookieSlime.Slimefun.SlimefunPlugin;
import me.mrCookieSlime.Slimefun.api.Slimefun;
public class RitualAnimation implements Runnable {
private final AncientAltarListener listener;
private List<Block> altars;
private final List<Block> altars;
private Block altar;
private Location l;
private ItemStack output;
private List<Block> pedestals;
private List<ItemStack> items;
private final Block altar;
private final Location dropLocation;
private final ItemStack output;
private final List<Block> pedestals;
private final List<ItemStack> items;
private List<Location> particles;
private Map<Item, Location> itemLock = new HashMap<>();
private final Collection<Location> particleLocations = new LinkedList<>();
private final Map<Item, Location> itemLock = new HashMap<>();
private boolean running;
private int stage;
private Utilities utilities = SlimefunPlugin.getUtilities();
public RitualAnimation(List<Block> altars, Block altar, Location drop, ItemStack output, List<Block> pedestals, List<ItemStack> items) {
this.l = drop;
public RitualAnimation(AncientAltarListener listener, List<Block> altars, Block altar, Location drop, ItemStack output, List<Block> pedestals, List<ItemStack> items) {
this.listener = listener;
this.dropLocation = drop;
this.altar = altar;
this.altars = altars;
this.output = output;
this.pedestals = pedestals;
this.items = items;
this.particles = new ArrayList<>();
this.running = true;
this.stage = 0;
@ -74,7 +74,7 @@ public class RitualAnimation implements Runnable {
}
this.stage += 1;
SlimefunPlugin.instance.getServer().getScheduler().scheduleSyncDelayedTask(SlimefunPlugin.instance, this, 8);
Slimefun.runSync(this, 8);
}
private boolean checkLockedItems() {
@ -88,16 +88,12 @@ public class RitualAnimation implements Runnable {
}
private void idle() {
try {
l.getWorld().spawnParticle(Particle.SPELL_WITCH, l,16, 1.2F, 0F, 1.2F);
l.getWorld().spawnParticle(Particle.FIREWORKS_SPARK,l,8, 0.2F, 0F, 0.2F);
for (Location l2 : particles) {
l.getWorld().spawnParticle(Particle.ENCHANTMENT_TABLE, l2,16, 0.3F, 0.2F, 0.3F);
l.getWorld().spawnParticle(Particle.CRIT_MAGIC,l2,8, 0.3F, 0.2F, 0.3F);
}
} catch (Exception x) {
Slimefun.getLogger().log(Level.SEVERE, "An Error occured while playing Ritual Animation for Slimefun " + Slimefun.getVersion(), x);
dropLocation.getWorld().spawnParticle(Particle.SPELL_WITCH, dropLocation,16, 1.2F, 0F, 1.2F);
dropLocation.getWorld().spawnParticle(Particle.FIREWORKS_SPARK,dropLocation,8, 0.2F, 0F, 0.2F);
for (Location loc : particleLocations) {
dropLocation.getWorld().spawnParticle(Particle.ENCHANTMENT_TABLE, loc,16, 0.3F, 0.2F, 0.3F);
dropLocation.getWorld().spawnParticle(Particle.CRIT_MAGIC,loc,8, 0.3F, 0.2F, 0.3F);
}
}
@ -108,16 +104,12 @@ public class RitualAnimation implements Runnable {
abort();
}
else {
particles.add(pedestal.getLocation().add(0.5, 1.5, 0.5));
particleLocations.add(pedestal.getLocation().add(0.5, 1.5, 0.5));
items.add(AncientAltarListener.fixItemStack(item.getItemStack(), item.getCustomName()));
pedestal.getWorld().playSound(pedestal.getLocation(), Sound.ENTITY_ENDERMAN_TELEPORT, 1F, 2F);
try {
l.getWorld().spawnParticle(Particle.ENCHANTMENT_TABLE,pedestal.getLocation().add(0.5, 1.5, 0.5),16, 0.3F, 0.2F, 0.3F);
l.getWorld().spawnParticle(Particle.CRIT_MAGIC,pedestal.getLocation().add(0.5, 1.5, 0.5), 8,0.3F, 0.2F, 0.3F);
} catch (Exception x) {
Slimefun.getLogger().log(Level.SEVERE, "An Error occured while playing Pedestal Animation for Slimefun " + Slimefun.getVersion(), x);
}
dropLocation.getWorld().spawnParticle(Particle.ENCHANTMENT_TABLE,pedestal.getLocation().add(0.5, 1.5, 0.5), 16, 0.3F, 0.2F, 0.3F);
dropLocation.getWorld().spawnParticle(Particle.CRIT_MAGIC,pedestal.getLocation().add(0.5, 1.5, 0.5), 8, 0.3F, 0.2F, 0.3F);
itemLock.remove(item);
item.remove();
@ -128,29 +120,29 @@ public class RitualAnimation implements Runnable {
private void abort() {
running = false;
pedestals.forEach(b -> utilities.altarinuse.remove(b.getLocation()));
pedestals.forEach(b -> listener.getAltarsInUse().remove(b.getLocation()));
// This should re-enable altar blocks on craft failure.
utilities.altarinuse.remove(altar.getLocation());
l.getWorld().playSound(l, Sound.ENTITY_ZOMBIE_ATTACK_IRON_DOOR, 1F, 1F);
listener.getAltarsInUse().remove(altar.getLocation());
dropLocation.getWorld().playSound(dropLocation, Sound.ENTITY_ZOMBIE_ATTACK_IRON_DOOR, 1F, 1F);
itemLock.clear();
altars.remove(altar);
}
private void finish() {
if (running) {
l.getWorld().playSound(l, Sound.ENTITY_ZOMBIE_VILLAGER_CURE, 1F, 1F);
l.getWorld().playEffect(l, Effect.STEP_SOUND, Material.EMERALD_BLOCK);
l.getWorld().dropItemNaturally(l.add(0, -0.5, 0), output);
dropLocation.getWorld().playSound(dropLocation, Sound.ENTITY_ZOMBIE_VILLAGER_CURE, 1F, 1F);
dropLocation.getWorld().playEffect(dropLocation, Effect.STEP_SOUND, Material.EMERALD_BLOCK);
dropLocation.getWorld().dropItemNaturally(dropLocation.add(0, -0.5, 0), output);
pedestals.forEach(b -> utilities.altarinuse.remove(b.getLocation()));
pedestals.forEach(b -> listener.getAltarsInUse().remove(b.getLocation()));
// This should re-enable altar blocks on craft completion.
utilities.altarinuse.remove(altar.getLocation());
listener.getAltarsInUse().remove(altar.getLocation());
altars.remove(altar);
}
else {
l.getWorld().playSound(l, Sound.ENTITY_ZOMBIE_BREAK_WOODEN_DOOR, 1F, 1F);
dropLocation.getWorld().playSound(dropLocation, Sound.ENTITY_ZOMBIE_BREAK_WOODEN_DOOR, 1F, 1F);
}
}
}

View File

@ -1,15 +1,12 @@
package me.mrCookieSlime.Slimefun.api.energy;
import java.util.logging.Level;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.block.Skull;
import io.github.thebusybiscuit.cscorelib2.math.DoubleHandler;
import io.github.thebusybiscuit.cscorelib2.skull.SkullBlock;
import me.mrCookieSlime.CSCoreLibPlugin.Configuration.Config;
import me.mrCookieSlime.CSCoreLibPlugin.general.World.CustomSkull;
import me.mrCookieSlime.Slimefun.SlimefunPlugin;
import me.mrCookieSlime.Slimefun.api.BlockStorage;
import me.mrCookieSlime.Slimefun.api.Slimefun;
@ -98,19 +95,16 @@ public final class ChargableBlock {
}
private static void updateTexture(final Location l) {
Bukkit.getScheduler().scheduleSyncDelayedTask(SlimefunPlugin.instance, () -> {
try {
Block b = l.getBlock();
int charge = getCharge(b);
int capacity = getMaxCharge(b);
if (b.getState() instanceof Skull) {
if (charge < (int) (capacity * 0.25D)) CustomSkull.setSkull(b, "eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvOTEzNjFlNTc2YjQ5M2NiZmRmYWUzMjg2NjFjZWRkMWFkZDU1ZmFiNGU1ZWI0MThiOTJjZWJmNjI3NWY4YmI0In19fQ==");
else if (charge < (int) (capacity * 0.5D)) CustomSkull.setSkull(b, "eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvMzA1MzIzMzk0YTdkOTFiZmIzM2RmMDZkOTJiNjNjYjQxNGVmODBmMDU0ZDA0NzM0ZWEwMTVhMjNjNTM5In19fQ==");
else if (charge < (int) (capacity * 0.75D)) CustomSkull.setSkull(b, "eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvNTU4NDQzMmFmNmYzODIxNjcxMjAyNThkMWVlZThjODdjNmU3NWQ5ZTQ3OWU3YjBkNGM3YjZhZDQ4Y2ZlZWYifX19");
else CustomSkull.setSkull(b, "eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvN2EyNTY5NDE1YzE0ZTMxYzk4ZWM5OTNhMmY5OWU2ZDY0ODQ2ZGIzNjdhMTNiMTk5OTY1YWQ5OWM0MzhjODZjIn19fQ==");
}
} catch (Exception x) {
Slimefun.getLogger().log(Level.SEVERE, "An Error occured while updating a Capacitor Texture for Slimefun " + Slimefun.getVersion(), x);
Slimefun.runSync(() -> {
Block b = l.getBlock();
int charge = getCharge(b);
int capacity = getMaxCharge(b);
if (b.getType() == Material.PLAYER_HEAD || b.getType() == Material.PLAYER_WALL_HEAD) {
if (charge < (int) (capacity * 0.25D)) SkullBlock.setFromBase64(b, "eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvOTEzNjFlNTc2YjQ5M2NiZmRmYWUzMjg2NjFjZWRkMWFkZDU1ZmFiNGU1ZWI0MThiOTJjZWJmNjI3NWY4YmI0In19fQ==");
else if (charge < (int) (capacity * 0.5D)) SkullBlock.setFromBase64(b, "eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvMzA1MzIzMzk0YTdkOTFiZmIzM2RmMDZkOTJiNjNjYjQxNGVmODBmMDU0ZDA0NzM0ZWEwMTVhMjNjNTM5In19fQ==");
else if (charge < (int) (capacity * 0.75D)) SkullBlock.setFromBase64(b, "eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvNTU4NDQzMmFmNmYzODIxNjcxMjAyNThkMWVlZThjODdjNmU3NWQ5ZTQ3OWU3YjBkNGM3YjZhZDQ4Y2ZlZWYifX19");
else SkullBlock.setFromBase64(b, "eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvN2EyNTY5NDE1YzE0ZTMxYzk4ZWM5OTNhMmY5OWU2ZDY0ODQ2ZGIzNjdhMTNiMTk5OTY1YWQ5OWM0MzhjODZjIn19fQ==");
}
});
}

View File

@ -9,8 +9,8 @@ import org.bukkit.inventory.ItemStack;
import io.github.thebusybiscuit.cscorelib2.inventory.InvUtils;
import io.github.thebusybiscuit.cscorelib2.inventory.ItemUtils;
import io.github.thebusybiscuit.cscorelib2.item.CustomItem;
import me.mrCookieSlime.CSCoreLibPlugin.general.Inventory.ChestMenu;
import me.mrCookieSlime.CSCoreLibPlugin.general.Inventory.Item.CustomItem;
public class DirtyChestMenu extends ChestMenu {
@ -92,6 +92,19 @@ public class DirtyChestMenu extends ChestMenu {
}
}
public void consumeItem(int slot) {
consumeItem(slot, 1);
}
public void consumeItem(int slot, int amount) {
consumeItem(slot, amount, false);
}
public void consumeItem(int slot, int amount, boolean replaceConsumables) {
ItemUtils.consumeItem(getItemInSlot(slot), amount, replaceConsumables);
markDirty();
}
@Override
public void replaceExistingItem(int slot, ItemStack item) {
this.replaceExistingItem(slot, item, true);

View File

@ -209,7 +209,7 @@ public class ItemListener implements Listener {
return;
}
final Player p = e.getPlayer();
Player p = e.getPlayer();
ItemStack item = e.getItem();
if (SlimefunManager.isItemSimilar(item, SlimefunGuide.getItem(SlimefunGuideLayout.BOOK), true)) {

View File

@ -27,8 +27,8 @@ import org.bukkit.event.entity.EntityExplodeEvent;
import org.bukkit.inventory.ItemStack;
import io.github.thebusybiscuit.cscorelib2.inventory.ItemUtils;
import io.github.thebusybiscuit.slimefun4.core.utils.FireworkUtils;
import me.mrCookieSlime.CSCoreLibPlugin.general.Inventory.Item.CustomItem;
import me.mrCookieSlime.CSCoreLibPlugin.general.Particles.FireworkShow;
import me.mrCookieSlime.Slimefun.SlimefunPlugin;
import me.mrCookieSlime.Slimefun.Lists.SlimefunItems;
import me.mrCookieSlime.Slimefun.Objects.SlimefunBlockHandler;
@ -148,7 +148,7 @@ public class ToolListener implements Listener {
ItemUtils.consumeItem(item, false);
}
FireworkShow.launchRandom(e.getPlayer(), 3);
FireworkUtils.launchRandom(e.getPlayer(), 3);
List<ItemStack> gifts = new ArrayList<>();
gifts.add(new CustomItem(SlimefunItems.CHRISTMAS_HOT_CHOCOLATE, 1));

View File

@ -110,7 +110,6 @@ public final class Utilities {
public final Map<UUID, Integer> enchanting = new HashMap<>();
public final Map<UUID, ItemStack> backpack = new HashMap<>();
public final Set<Location> altarinuse = new HashSet<>();
public final Set<AltarRecipe> altarRecipes = new HashSet<>();
public final Map<UUID, Map<Integer, ItemStack>> soulbound = new HashMap<>();