mirror of
https://github.com/StarWishsama/Slimefun4.git
synced 2024-09-19 19:25:48 +00:00
[CI skip] Refactoring and deprecation
This commit is contained in:
parent
76b8204bd0
commit
f5022ca790
23
.github/workflows/closed_issues.yml
vendored
23
.github/workflows/closed_issues.yml
vendored
@ -22,6 +22,7 @@ jobs:
|
||||
issue_number: ${{ github.event.issue.number }}
|
||||
labels: 'Resolved'
|
||||
- uses: maxkomarychev/octions/octions/issues/create-comment@master
|
||||
id: comment
|
||||
if: contains(steps.resolved.outputs.issues, github.event.issue.number) == false
|
||||
with:
|
||||
token: ${{ secrets.ACCESS_TOKEN }}
|
||||
@ -29,24 +30,24 @@ jobs:
|
||||
body: |-
|
||||
Your issue was closed, it may fall under one or more of the following categories.
|
||||
**Please wait for an admin to tick off the points that apply.**
|
||||
Do not post your Issue again until an Admin has reviewed this message and you fixed the points that were ticked.
|
||||
This message can be deleted if your issue was resolved.
|
||||
|
||||
Please respond below, if you have any questions.
|
||||
Do **not** open a new Issue unless explicitly told otherwise, comment below or edit your post instead.
|
||||
|
||||
* [ ] You did not follow our template. Please follow the Issue template to help us identify your issue more quickly.
|
||||
* [ ] You did not provide any information about your versions (We absolutely need your exact versions, \"latest\" is not helpful)
|
||||
* [ ] You did not provide a proper description to the problem.
|
||||
* [ ] You did not follow our template. Please follow the Issue template to help us identify your issue more effectively.
|
||||
* [ ] You did not provide any information about your versions (We absolutely need the exact version numbers that are installed on your Server, \"latest\" is not helpful)
|
||||
* [ ] You did not provide a proper description to the problem. Try to write at least 4-6 sentences on how to reproduce this.
|
||||
* [ ] We were unable to reproduce issue, if you think your issue still persists then please comment down below and give a better description on how to reproduce it.
|
||||
* [ ] Your issue was posted in a foreign language, we only accept english issues on here.
|
||||
* [ ] Your issue is not a bug, it is either intended or something we cannot change.
|
||||
* [ ] Your issue is not a bug, please only use this issue tracker to report bugs. Any other kind of communication should happen on discord or elsewhere.
|
||||
* [ ] Your issue was already reported, it is a duplicate. Check the other open issues first before posting!
|
||||
* [ ] You posted an error without using pastebin. Please always post errors via pastebin.
|
||||
* [ ] You have posted multiple issues at once. Please post a seperate issue for each bug you encountered.
|
||||
* [ ] Your issue is not a bug, please only use this issue tracker to report bugs. Any other kind of communication should happen on discord.
|
||||
* [ ] Your issue was already reported, it is a duplicate. Check the other issues first before posting!
|
||||
* [ ] You posted an error without using pastebin. Please always post errors via pastebin otherwise they become nearly unreadable.
|
||||
* [ ] You seem to be reporting multiple bugs at once. Please make a seperate issue for each bug you encountered, so we can properly handle them individually.
|
||||
* [ ] Your issue has already been fixed in a later version of Slimefun or CS-CoreLib, you should update.
|
||||
* [ ] You are using an outdated version of Slimefun / CS-CoreLib, again, you should update.
|
||||
* [ ] You are using an unsupported version of Minecraft. We only provide support for the latest version of Minecraft, old versions are not supported anymore.
|
||||
* [ ] You are using an outdated and unsupported version of Slimefun / CS-CoreLib, again, you should update.
|
||||
* [ ] You are using an unofficially modified build of Slimefun. We only support official versions of Slimefun - for obvious reasons.
|
||||
* [ ] You are using an unsupported version of Minecraft. We only provide support for the Minecraft versions Slimefun was developed for, older versions are not supported anymore.
|
||||
* [ ] You are using a \"stable\" version of Slimefun (prefixed with \"RC - \"), your issue may have been fixed in a development build, so we only accept bug reports from those.
|
||||
* [ ] You are on the wrong issue tracker. We would like to remind you that this Issue Tracker is **only for Slimefun**. To report bugs on any addons, head to the corresponding issue tracker of that addon.
|
||||
|
||||
|
@ -68,6 +68,8 @@
|
||||
* Lots of API improvements
|
||||
* Faulty addons are now identified more easily and will no longer break Slimefun's main content this quickly
|
||||
* You can no longer /sf give yourself a Multiblock
|
||||
* Addons have no longer access to Slimefuns default categories
|
||||
* Updated seasonal Categories to have better icons
|
||||
|
||||
#### Fixes
|
||||
* Fixed error message when clicking empty slots in the Slimefun Guide
|
||||
@ -82,6 +84,7 @@
|
||||
* Fixed #1803
|
||||
* Fixed #1806
|
||||
* Fixed #1807
|
||||
* Fixed Coolers accepting non-Juice items
|
||||
|
||||
## Release Candidate 10 (28 Mar 2020)
|
||||
|
||||
|
@ -52,6 +52,10 @@ public class MultiBlock {
|
||||
public MultiBlock(SlimefunItem item, Material[] build, BlockFace trigger) {
|
||||
this.item = item;
|
||||
|
||||
if (trigger != BlockFace.SELF && trigger != BlockFace.UP && trigger != BlockFace.DOWN) {
|
||||
throw new IllegalArgumentException("Multiblock Blockface must be either UP, DOWN or SELF");
|
||||
}
|
||||
|
||||
this.blocks = build;
|
||||
this.trigger = trigger;
|
||||
this.isSymmetric = isSymmetric(build);
|
||||
|
@ -4,27 +4,19 @@ import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.logging.Level;
|
||||
|
||||
import com.google.gson.JsonArray;
|
||||
import com.google.gson.JsonElement;
|
||||
import com.google.gson.JsonObject;
|
||||
|
||||
import me.mrCookieSlime.Slimefun.api.Slimefun;
|
||||
|
||||
class ContributionsConnector extends GitHubConnector {
|
||||
|
||||
// GitHub Bots that do not count as Contributors
|
||||
// (includes "invalid-email-address" because it is an invalid contributor)
|
||||
private static final List<String> blacklist = Arrays.asList(
|
||||
"invalid-email-address",
|
||||
"renovate-bot",
|
||||
"TheBusyBot",
|
||||
"ImgBotApp",
|
||||
"imgbot",
|
||||
"imgbot[bot]",
|
||||
"github-actions[bot]",
|
||||
"gitlocalize-app",
|
||||
"gitlocalize-app[bot]",
|
||||
"mt-gitlocalize"
|
||||
);
|
||||
private static final List<String> blacklist = Arrays.asList("invalid-email-address", "renovate-bot", "TheBusyBot", "ImgBotApp", "imgbot", "imgbot[bot]", "github-actions[bot]", "gitlocalize-app", "gitlocalize-app[bot]", "mt-gitlocalize");
|
||||
|
||||
// Matches a GitHub name with a Minecraft name.
|
||||
private static final Map<String, String> aliases = new HashMap<>();
|
||||
@ -42,27 +34,25 @@ class ContributionsConnector extends GitHubConnector {
|
||||
}
|
||||
|
||||
private final String prefix;
|
||||
private final String repository;
|
||||
private final String role;
|
||||
private final int page;
|
||||
|
||||
ContributionsConnector(GitHubService github, String prefix, int page, String repository, String role) {
|
||||
super(github);
|
||||
super(github, repository);
|
||||
|
||||
this.prefix = prefix;
|
||||
this.page = page;
|
||||
this.repository = repository;
|
||||
this.role = role;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess(JsonElement element) {
|
||||
if (element.isJsonArray()) {
|
||||
computeContributors(element.getAsJsonArray());
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRepository() {
|
||||
return repository;
|
||||
else {
|
||||
Slimefun.getLogger().log(Level.WARNING, "Received an unusual answer from GitHub, possibly a timeout? ({0})", element);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -20,16 +20,16 @@ import me.mrCookieSlime.Slimefun.api.Slimefun;
|
||||
abstract class GitHubConnector {
|
||||
|
||||
protected File file;
|
||||
protected String repository;
|
||||
protected final GitHubService github;
|
||||
|
||||
public GitHubConnector(GitHubService github) {
|
||||
public GitHubConnector(GitHubService github, String repository) {
|
||||
this.github = github;
|
||||
this.repository = repository;
|
||||
}
|
||||
|
||||
public abstract String getFileName();
|
||||
|
||||
public abstract String getRepository();
|
||||
|
||||
public abstract String getURLSuffix();
|
||||
|
||||
public abstract void onSuccess(JsonElement element);
|
||||
@ -42,11 +42,11 @@ abstract class GitHubConnector {
|
||||
file = new File("plugins/Slimefun/cache/github/" + getFileName() + ".json");
|
||||
|
||||
if (github.isLoggingEnabled()) {
|
||||
Slimefun.getLogger().log(Level.INFO, "Retrieving {0}.json from GitHub...", this.getFileName());
|
||||
Slimefun.getLogger().log(Level.INFO, "Retrieving {0}.json from GitHub...", getFileName());
|
||||
}
|
||||
|
||||
try {
|
||||
URL website = new URL("https://api.github.com/repos/" + this.getRepository() + this.getURLSuffix());
|
||||
URL website = new URL("https://api.github.com/repos/" + repository + getURLSuffix());
|
||||
|
||||
URLConnection connection = website.openConnection();
|
||||
connection.setConnectTimeout(8000);
|
||||
|
@ -0,0 +1,59 @@
|
||||
package io.github.thebusybiscuit.slimefun4.core.services.github;
|
||||
|
||||
import java.util.logging.Level;
|
||||
|
||||
import com.google.gson.JsonArray;
|
||||
import com.google.gson.JsonElement;
|
||||
import com.google.gson.JsonObject;
|
||||
|
||||
import me.mrCookieSlime.Slimefun.api.Slimefun;
|
||||
|
||||
class GitHubIssuesTracker extends GitHubConnector {
|
||||
|
||||
@FunctionalInterface
|
||||
interface IssuesCallback {
|
||||
|
||||
void update(int issues, int pullRequests);
|
||||
|
||||
}
|
||||
|
||||
private final IssuesCallback callback;
|
||||
|
||||
GitHubIssuesTracker(GitHubService github, String repository, IssuesCallback callback) {
|
||||
super(github, repository);
|
||||
this.callback = callback;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess(JsonElement element) {
|
||||
if (element.isJsonArray()) {
|
||||
JsonArray array = element.getAsJsonArray();
|
||||
|
||||
int issues = 0;
|
||||
int pullRequests = 0;
|
||||
|
||||
for (JsonElement elem : array) {
|
||||
JsonObject obj = elem.getAsJsonObject();
|
||||
|
||||
if (obj.has("pull_request")) pullRequests++;
|
||||
else issues++;
|
||||
}
|
||||
|
||||
callback.update(issues, pullRequests);
|
||||
}
|
||||
else {
|
||||
Slimefun.getLogger().log(Level.WARNING, "Received an unusual answer from GitHub, possibly a timeout? ({0})", element);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getFileName() {
|
||||
return "issues";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getURLSuffix() {
|
||||
return "/issues?per_page=100";
|
||||
}
|
||||
|
||||
}
|
@ -6,7 +6,6 @@ import java.util.Set;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.ConcurrentMap;
|
||||
|
||||
import com.google.gson.JsonArray;
|
||||
import com.google.gson.JsonElement;
|
||||
import com.google.gson.JsonObject;
|
||||
|
||||
@ -49,13 +48,18 @@ public class GitHubService {
|
||||
}
|
||||
|
||||
private void addDefaultContributors() {
|
||||
Contributor fuffles = new Contributor("Fuffles_");
|
||||
fuffles.setContribution("&dSkull Texture Artist", 0);
|
||||
contributors.put(fuffles.getName(), fuffles);
|
||||
addContributor("Fuffles_", "&dArtist");
|
||||
addContributor("IMS_Art", "&dArtist");
|
||||
|
||||
new Translators(contributors);
|
||||
}
|
||||
|
||||
private void addContributor(String name, String role) {
|
||||
Contributor contributor = new Contributor(name);
|
||||
contributor.setContribution(role, 0);
|
||||
contributors.put(name, contributor);
|
||||
}
|
||||
|
||||
private void loadConnectors(boolean logging) {
|
||||
this.logging = logging;
|
||||
addDefaultContributors();
|
||||
@ -70,7 +74,13 @@ public class GitHubService {
|
||||
// TheBusyBiscuit/Slimefun4-Resourcepack
|
||||
connectors.add(new ContributionsConnector(this, "resourcepack", 1, "TheBusyBiscuit/Slimefun4-Resourcepack", "resourcepack"));
|
||||
|
||||
connectors.add(new GitHubConnector(this) {
|
||||
// Issues and Pull Requests
|
||||
connectors.add(new GitHubIssuesTracker(this, repository, (issues, pullRequests) -> {
|
||||
this.issues = issues;
|
||||
this.pullRequests = pullRequests;
|
||||
}));
|
||||
|
||||
connectors.add(new GitHubConnector(this, repository) {
|
||||
|
||||
@Override
|
||||
public void onSuccess(JsonElement element) {
|
||||
@ -80,11 +90,6 @@ public class GitHubService {
|
||||
lastUpdate = NumberUtils.parseGitHubDate(object.get("pushed_at").getAsString());
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRepository() {
|
||||
return repository;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getFileName() {
|
||||
return "repo";
|
||||
@ -95,42 +100,6 @@ public class GitHubService {
|
||||
return "";
|
||||
}
|
||||
});
|
||||
|
||||
connectors.add(new GitHubConnector(this) {
|
||||
|
||||
@Override
|
||||
public void onSuccess(JsonElement element) {
|
||||
JsonArray array = element.getAsJsonArray();
|
||||
|
||||
int issueCount = 0;
|
||||
int prCount = 0;
|
||||
|
||||
for (JsonElement elem : array) {
|
||||
JsonObject obj = elem.getAsJsonObject();
|
||||
|
||||
if (obj.has("pull_request")) prCount++;
|
||||
else issueCount++;
|
||||
}
|
||||
|
||||
issues = issueCount;
|
||||
pullRequests = prCount;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRepository() {
|
||||
return repository;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getFileName() {
|
||||
return "issues";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getURLSuffix() {
|
||||
return "/issues";
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public Set<GitHubConnector> getConnectors() {
|
||||
|
@ -101,7 +101,7 @@ public class Translators {
|
||||
addTranslator("mio9", EmbeddedLanguage.CHINESE_TAIWAN, true);
|
||||
|
||||
// Translators - Arabic
|
||||
addTranslator("mohkamfer", "citBabY", EmbeddedLanguage.ARABIC, false);
|
||||
addTranslator("mohkamfer", "AgentBabbie", EmbeddedLanguage.ARABIC, false);
|
||||
|
||||
// Translators - Japanese
|
||||
addTranslator("bito-blosh", "Bloshop", EmbeddedLanguage.JAPANESE, true);
|
||||
|
@ -8,8 +8,8 @@ import org.bukkit.block.Furnace;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import me.mrCookieSlime.CSCoreLibPlugin.Configuration.Config;
|
||||
import me.mrCookieSlime.Slimefun.Lists.Categories;
|
||||
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.handlers.BlockTicker;
|
||||
@ -32,8 +32,8 @@ public class EnhancedFurnace extends SimpleSlimefunItem<BlockTicker> {
|
||||
private final int efficiency;
|
||||
private final int fortune;
|
||||
|
||||
public EnhancedFurnace(int speed, int efficiency, int fortune, SlimefunItemStack item, ItemStack[] recipe) {
|
||||
super(Categories.BASIC_MACHINES, item, RecipeType.ENHANCED_CRAFTING_TABLE, recipe);
|
||||
public EnhancedFurnace(Category category, int speed, int efficiency, int fortune, SlimefunItemStack item, ItemStack[] recipe) {
|
||||
super(category, item, RecipeType.ENHANCED_CRAFTING_TABLE, recipe);
|
||||
|
||||
this.speed = speed - 1;
|
||||
this.efficiency = efficiency - 1;
|
||||
|
@ -24,6 +24,7 @@ public class RepairedSpawner extends SimpleSlimefunItem<BlockPlaceHandler> {
|
||||
@Override
|
||||
public BlockPlaceHandler getItemHandler() {
|
||||
return (e, item) -> {
|
||||
// We need to explicitly ignore the lore here
|
||||
if (SlimefunUtils.isItemSimilar(item, SlimefunItems.REPAIRED_SPAWNER, false)) {
|
||||
EntityType type = null;
|
||||
|
||||
|
@ -2,13 +2,15 @@ package io.github.thebusybiscuit.slimefun4.implementation.items.electric;
|
||||
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import io.github.thebusybiscuit.slimefun4.api.events.PlayerRightClickEvent;
|
||||
import io.github.thebusybiscuit.slimefun4.api.items.ItemSetting;
|
||||
import me.mrCookieSlime.Slimefun.Lists.RecipeType;
|
||||
import me.mrCookieSlime.Slimefun.Objects.Category;
|
||||
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.SlimefunItem;
|
||||
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.SimpleSlimefunItem;
|
||||
import me.mrCookieSlime.Slimefun.Objects.handlers.ItemUseHandler;
|
||||
import me.mrCookieSlime.Slimefun.api.SlimefunItemStack;
|
||||
|
||||
public class BasicCircuitBoard extends SlimefunItem {
|
||||
public class BasicCircuitBoard extends SimpleSlimefunItem<ItemUseHandler> {
|
||||
|
||||
private final ItemSetting<Boolean> dropSetting = new ItemSetting<>("drop-from-golems", true);
|
||||
|
||||
@ -22,4 +24,9 @@ public class BasicCircuitBoard extends SlimefunItem {
|
||||
return dropSetting.getValue();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemUseHandler getItemHandler() {
|
||||
return PlayerRightClickEvent::cancel;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -5,8 +5,8 @@ import org.bukkit.inventory.ItemStack;
|
||||
import io.github.thebusybiscuit.slimefun4.core.attributes.EnergyNetComponent;
|
||||
import io.github.thebusybiscuit.slimefun4.core.networks.energy.EnergyNet;
|
||||
import io.github.thebusybiscuit.slimefun4.core.networks.energy.EnergyNetComponentType;
|
||||
import me.mrCookieSlime.Slimefun.Lists.Categories;
|
||||
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;
|
||||
|
||||
@ -26,8 +26,8 @@ public class Capacitor extends SlimefunItem implements EnergyNetComponent {
|
||||
|
||||
private final int capacity;
|
||||
|
||||
public Capacitor(int capacity, SlimefunItemStack item, RecipeType recipeType, ItemStack[] recipe) {
|
||||
super(Categories.ELECTRICITY, item, recipeType, recipe);
|
||||
public Capacitor(Category category, int capacity, SlimefunItemStack item, RecipeType recipeType, ItemStack[] recipe) {
|
||||
super(category, item, recipeType, recipe);
|
||||
|
||||
this.capacity = capacity;
|
||||
}
|
||||
|
@ -2,8 +2,8 @@ package io.github.thebusybiscuit.slimefun4.implementation.items.electric.gadgets
|
||||
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import me.mrCookieSlime.Slimefun.Lists.Categories;
|
||||
import me.mrCookieSlime.Slimefun.Lists.RecipeType;
|
||||
import me.mrCookieSlime.Slimefun.Objects.Category;
|
||||
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.ChargableItem;
|
||||
import me.mrCookieSlime.Slimefun.api.SlimefunItemStack;
|
||||
|
||||
@ -11,8 +11,8 @@ public class JetBoots extends ChargableItem {
|
||||
|
||||
private final double speed;
|
||||
|
||||
public JetBoots(SlimefunItemStack item, ItemStack[] recipe, double speed) {
|
||||
super(Categories.TECH, item, RecipeType.ENHANCED_CRAFTING_TABLE, recipe);
|
||||
public JetBoots(Category category, SlimefunItemStack item, ItemStack[] recipe, double speed) {
|
||||
super(category, item, RecipeType.ENHANCED_CRAFTING_TABLE, recipe);
|
||||
this.speed = speed;
|
||||
}
|
||||
|
||||
|
@ -2,8 +2,8 @@ package io.github.thebusybiscuit.slimefun4.implementation.items.electric.gadgets
|
||||
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import me.mrCookieSlime.Slimefun.Lists.Categories;
|
||||
import me.mrCookieSlime.Slimefun.Lists.RecipeType;
|
||||
import me.mrCookieSlime.Slimefun.Objects.Category;
|
||||
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.ChargableItem;
|
||||
import me.mrCookieSlime.Slimefun.api.SlimefunItemStack;
|
||||
|
||||
@ -11,8 +11,8 @@ public class Jetpack extends ChargableItem {
|
||||
|
||||
private final double thrust;
|
||||
|
||||
public Jetpack(SlimefunItemStack item, ItemStack[] recipe, double thrust) {
|
||||
super(Categories.TECH, item, RecipeType.ENHANCED_CRAFTING_TABLE, recipe);
|
||||
public Jetpack(Category category, SlimefunItemStack item, ItemStack[] recipe, double thrust) {
|
||||
super(category, item, RecipeType.ENHANCED_CRAFTING_TABLE, recipe);
|
||||
this.thrust = thrust;
|
||||
}
|
||||
|
||||
|
@ -11,8 +11,8 @@ import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import me.mrCookieSlime.Slimefun.SlimefunPlugin;
|
||||
import me.mrCookieSlime.Slimefun.Lists.Categories;
|
||||
import me.mrCookieSlime.Slimefun.Lists.RecipeType;
|
||||
import me.mrCookieSlime.Slimefun.Objects.Category;
|
||||
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.ChargableItem;
|
||||
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.SlimefunItem;
|
||||
import me.mrCookieSlime.Slimefun.Objects.handlers.BlockBreakHandler;
|
||||
@ -27,8 +27,8 @@ public class MultiTool extends ChargableItem {
|
||||
private final Map<UUID, Integer> selectedMode = new HashMap<>();
|
||||
private final List<MultiToolMode> modes = new ArrayList<>();
|
||||
|
||||
public MultiTool(SlimefunItemStack item, RecipeType recipeType, ItemStack[] recipe, String... items) {
|
||||
super(Categories.TECH, item, recipeType, recipe);
|
||||
public MultiTool(Category category, SlimefunItemStack item, RecipeType recipeType, ItemStack[] recipe, String... items) {
|
||||
super(category, item, recipeType, recipe);
|
||||
|
||||
for (int i = 0; i < items.length; i++) {
|
||||
modes.add(new MultiToolMode(this, i, items[i]));
|
||||
|
@ -1,10 +1,13 @@
|
||||
package io.github.thebusybiscuit.slimefun4.implementation.items.magical;
|
||||
|
||||
import org.bukkit.NamespacedKey;
|
||||
import org.bukkit.block.EnderChest;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import me.mrCookieSlime.Slimefun.Lists.Categories;
|
||||
import io.github.thebusybiscuit.cscorelib2.item.CustomItem;
|
||||
import me.mrCookieSlime.Slimefun.SlimefunPlugin;
|
||||
import me.mrCookieSlime.Slimefun.Lists.SlimefunItems;
|
||||
import me.mrCookieSlime.Slimefun.Objects.LockedCategory;
|
||||
import me.mrCookieSlime.Slimefun.api.SlimefunItemStack;
|
||||
|
||||
/**
|
||||
@ -16,8 +19,10 @@ import me.mrCookieSlime.Slimefun.api.SlimefunItemStack;
|
||||
*/
|
||||
class EnderTalisman extends Talisman {
|
||||
|
||||
private static final LockedCategory ENDER_TALISMANS_CATEGORY = new LockedCategory(new NamespacedKey(SlimefunPlugin.instance, "ender_talismans"), new CustomItem(SlimefunItems.ENDER_TALISMAN, "&7Talismans - &aTier II"), 3, Talisman.TALISMANS_CATEGORY.getKey());
|
||||
|
||||
public EnderTalisman(Talisman parent) {
|
||||
super(Categories.ENDER_TALISMANS, parent.upgrade(), new ItemStack[] { SlimefunItems.ENDER_LUMP_3, null, SlimefunItems.ENDER_LUMP_3, null, parent.getItem(), null, SlimefunItems.ENDER_LUMP_3, null, SlimefunItems.ENDER_LUMP_3 }, parent.isConsumable(), parent.isEventCancelled(), parent.getSuffix(), parent.getChance(), parent.getEffects());
|
||||
super(ENDER_TALISMANS_CATEGORY, parent.upgrade(), new ItemStack[] { SlimefunItems.ENDER_LUMP_3, null, SlimefunItems.ENDER_LUMP_3, null, parent.getItem(), null, SlimefunItems.ENDER_LUMP_3, null, SlimefunItems.ENDER_LUMP_3 }, parent.isConsumable(), parent.isEventCancelled(), parent.getSuffix(), parent.getChance(), parent.getEffects());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -5,6 +5,7 @@ import java.util.List;
|
||||
import java.util.concurrent.ThreadLocalRandom;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.NamespacedKey;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.Cancellable;
|
||||
import org.bukkit.event.Event;
|
||||
@ -19,8 +20,8 @@ import org.bukkit.potion.PotionEffect;
|
||||
|
||||
import io.github.thebusybiscuit.cscorelib2.item.CustomItem;
|
||||
import me.mrCookieSlime.Slimefun.SlimefunPlugin;
|
||||
import me.mrCookieSlime.Slimefun.Lists.Categories;
|
||||
import me.mrCookieSlime.Slimefun.Lists.RecipeType;
|
||||
import me.mrCookieSlime.Slimefun.Lists.SlimefunItems;
|
||||
import me.mrCookieSlime.Slimefun.Objects.Category;
|
||||
import me.mrCookieSlime.Slimefun.Objects.Research;
|
||||
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.SlimefunItem;
|
||||
@ -29,6 +30,8 @@ import me.mrCookieSlime.Slimefun.api.SlimefunItemStack;
|
||||
|
||||
public class Talisman extends SlimefunItem {
|
||||
|
||||
protected static final Category TALISMANS_CATEGORY = new Category(new NamespacedKey(SlimefunPlugin.instance, "talismans"), new CustomItem(SlimefunItems.TALISMAN, "&7Talismans - &aTier I"), 2);
|
||||
|
||||
protected final String suffix;
|
||||
protected final boolean consumable;
|
||||
protected final boolean cancel;
|
||||
@ -44,7 +47,7 @@ public class Talisman extends SlimefunItem {
|
||||
}
|
||||
|
||||
public Talisman(SlimefunItemStack item, ItemStack[] recipe, boolean consumable, boolean cancelEvent, String messageSuffix, int chance, PotionEffect... effects) {
|
||||
this(Categories.TALISMANS, item, recipe, consumable, cancelEvent, messageSuffix, chance, effects);
|
||||
this(TALISMANS_CATEGORY, item, recipe, consumable, cancelEvent, messageSuffix, chance, effects);
|
||||
}
|
||||
|
||||
protected Talisman(Category category, SlimefunItemStack item, ItemStack[] recipe, boolean consumable, boolean cancelEvent, String messageSuffix, int chance, PotionEffect... effects) {
|
||||
@ -58,23 +61,23 @@ public class Talisman extends SlimefunItem {
|
||||
}
|
||||
|
||||
public String getSuffix() {
|
||||
return this.suffix;
|
||||
return suffix;
|
||||
}
|
||||
|
||||
public boolean isConsumable() {
|
||||
return this.consumable;
|
||||
return consumable;
|
||||
}
|
||||
|
||||
public boolean isEventCancelled() {
|
||||
return this.cancel;
|
||||
return cancel;
|
||||
}
|
||||
|
||||
public PotionEffect[] getEffects() {
|
||||
return this.effects;
|
||||
return effects;
|
||||
}
|
||||
|
||||
public int getChance() {
|
||||
return this.chance;
|
||||
return chance;
|
||||
}
|
||||
|
||||
public SlimefunItemStack upgrade() {
|
||||
@ -194,7 +197,9 @@ public class Talisman extends SlimefunItem {
|
||||
|
||||
private static boolean pass(Player p, SlimefunItem talisman) {
|
||||
for (PotionEffect effect : ((Talisman) talisman).getEffects()) {
|
||||
if (effect != null && p.hasPotionEffect(effect.getType())) return false;
|
||||
if (effect != null && p.hasPotionEffect(effect.getType())) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
|
@ -16,16 +16,16 @@ import io.github.thebusybiscuit.cscorelib2.inventory.ItemUtils;
|
||||
import io.github.thebusybiscuit.cscorelib2.item.CustomItem;
|
||||
import io.github.thebusybiscuit.slimefun4.utils.SlimefunUtils;
|
||||
import me.mrCookieSlime.Slimefun.SlimefunPlugin;
|
||||
import me.mrCookieSlime.Slimefun.Lists.Categories;
|
||||
import me.mrCookieSlime.Slimefun.Lists.RecipeType;
|
||||
import me.mrCookieSlime.Slimefun.Lists.SlimefunItems;
|
||||
import me.mrCookieSlime.Slimefun.Objects.Category;
|
||||
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.multiblocks.MultiBlockMachine;
|
||||
import me.mrCookieSlime.Slimefun.api.Slimefun;
|
||||
|
||||
public class ArmorForge extends MultiBlockMachine {
|
||||
|
||||
public ArmorForge() {
|
||||
super(Categories.BASIC_MACHINES, SlimefunItems.ARMOR_FORGE, new ItemStack[] {
|
||||
public ArmorForge(Category category) {
|
||||
super(category, SlimefunItems.ARMOR_FORGE, new ItemStack[] {
|
||||
null, null, null,
|
||||
null, new ItemStack(Material.ANVIL), null,
|
||||
null, new CustomItem(Material.DISPENSER, "Dispenser (Facing up)"), null
|
||||
|
@ -18,8 +18,8 @@ import io.github.thebusybiscuit.cscorelib2.scheduling.TaskQueue;
|
||||
import io.github.thebusybiscuit.slimefun4.implementation.items.tools.GoldPan;
|
||||
import io.github.thebusybiscuit.slimefun4.utils.SlimefunUtils;
|
||||
import me.mrCookieSlime.Slimefun.SlimefunPlugin;
|
||||
import me.mrCookieSlime.Slimefun.Lists.Categories;
|
||||
import me.mrCookieSlime.Slimefun.Lists.SlimefunItems;
|
||||
import me.mrCookieSlime.Slimefun.Objects.Category;
|
||||
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.multiblocks.MultiBlockMachine;
|
||||
|
||||
public class AutomatedPanningMachine extends MultiBlockMachine {
|
||||
@ -27,8 +27,8 @@ public class AutomatedPanningMachine extends MultiBlockMachine {
|
||||
private final GoldPan goldPan = (GoldPan) SlimefunItems.GOLD_PAN.getItem();
|
||||
private final GoldPan netherGoldPan = (GoldPan) SlimefunItems.NETHER_GOLD_PAN.getItem();
|
||||
|
||||
public AutomatedPanningMachine() {
|
||||
super(Categories.BASIC_MACHINES, SlimefunItems.AUTOMATED_PANNING_MACHINE, new ItemStack[] { null, null, null, null, new ItemStack(Material.OAK_TRAPDOOR), null, null, new ItemStack(Material.CAULDRON), null }, new ItemStack[0], BlockFace.SELF);
|
||||
public AutomatedPanningMachine(Category category) {
|
||||
super(category, SlimefunItems.AUTOMATED_PANNING_MACHINE, new ItemStack[] { null, null, null, null, new ItemStack(Material.OAK_TRAPDOOR), null, null, new ItemStack(Material.CAULDRON), null }, new ItemStack[0], BlockFace.SELF);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -16,17 +16,15 @@ import org.bukkit.inventory.ItemStack;
|
||||
import io.github.thebusybiscuit.cscorelib2.item.CustomItem;
|
||||
import io.github.thebusybiscuit.slimefun4.utils.SlimefunUtils;
|
||||
import me.mrCookieSlime.Slimefun.SlimefunPlugin;
|
||||
import me.mrCookieSlime.Slimefun.Lists.Categories;
|
||||
import me.mrCookieSlime.Slimefun.Lists.RecipeType;
|
||||
import me.mrCookieSlime.Slimefun.Lists.SlimefunItems;
|
||||
import me.mrCookieSlime.Slimefun.Objects.Category;
|
||||
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.multiblocks.MultiBlockMachine;
|
||||
|
||||
public class Compressor extends MultiBlockMachine {
|
||||
|
||||
public Compressor() {
|
||||
super(
|
||||
Categories.BASIC_MACHINES,
|
||||
SlimefunItems.COMPRESSOR,
|
||||
public Compressor(Category category) {
|
||||
super(category, SlimefunItems.COMPRESSOR,
|
||||
new ItemStack[] {null, null, null, null, new ItemStack(Material.NETHER_BRICK_FENCE), null, new ItemStack(Material.PISTON), new CustomItem(Material.DISPENSER, "Dispenser (Facing up)"), new ItemStack(Material.PISTON)},
|
||||
new ItemStack[] {
|
||||
new CustomItem(SlimefunItems.STONE_CHUNK, 4), new ItemStack(Material.COBBLESTONE),
|
||||
|
@ -15,16 +15,16 @@ import io.github.thebusybiscuit.cscorelib2.inventory.ItemUtils;
|
||||
import io.github.thebusybiscuit.slimefun4.implementation.items.tools.SlimefunBackpack;
|
||||
import io.github.thebusybiscuit.slimefun4.utils.SlimefunUtils;
|
||||
import me.mrCookieSlime.Slimefun.SlimefunPlugin;
|
||||
import me.mrCookieSlime.Slimefun.Lists.Categories;
|
||||
import me.mrCookieSlime.Slimefun.Lists.RecipeType;
|
||||
import me.mrCookieSlime.Slimefun.Lists.SlimefunItems;
|
||||
import me.mrCookieSlime.Slimefun.Objects.Category;
|
||||
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.SlimefunItem;
|
||||
import me.mrCookieSlime.Slimefun.api.Slimefun;
|
||||
|
||||
public class EnhancedCraftingTable extends BackpackCrafter {
|
||||
|
||||
public EnhancedCraftingTable() {
|
||||
super(Categories.BASIC_MACHINES, SlimefunItems.ENHANCED_CRAFTING_TABLE, new ItemStack[] { null, null, null, null, new ItemStack(Material.CRAFTING_TABLE), null, null, new ItemStack(Material.DISPENSER), null }, new ItemStack[0], BlockFace.SELF);
|
||||
public EnhancedCraftingTable(Category category) {
|
||||
super(category, SlimefunItems.ENHANCED_CRAFTING_TABLE, new ItemStack[] { null, null, null, null, new ItemStack(Material.CRAFTING_TABLE), null, null, new ItemStack(Material.DISPENSER), null }, new ItemStack[0], BlockFace.SELF);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -15,17 +15,15 @@ import org.bukkit.inventory.ItemStack;
|
||||
import io.github.thebusybiscuit.cscorelib2.item.CustomItem;
|
||||
import io.github.thebusybiscuit.slimefun4.utils.SlimefunUtils;
|
||||
import me.mrCookieSlime.Slimefun.SlimefunPlugin;
|
||||
import me.mrCookieSlime.Slimefun.Lists.Categories;
|
||||
import me.mrCookieSlime.Slimefun.Lists.RecipeType;
|
||||
import me.mrCookieSlime.Slimefun.Lists.SlimefunItems;
|
||||
import me.mrCookieSlime.Slimefun.Objects.Category;
|
||||
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.multiblocks.MultiBlockMachine;
|
||||
|
||||
public class GrindStone extends MultiBlockMachine {
|
||||
|
||||
public GrindStone() {
|
||||
super(
|
||||
Categories.BASIC_MACHINES,
|
||||
SlimefunItems.GRIND_STONE,
|
||||
public GrindStone(Category category) {
|
||||
super(category, SlimefunItems.GRIND_STONE,
|
||||
new ItemStack[] {null, null, null, null, new ItemStack(Material.OAK_FENCE), null, null, new CustomItem(Material.DISPENSER, "Dispenser (Facing up)"), null},
|
||||
new ItemStack[] {
|
||||
new ItemStack(Material.BLAZE_ROD), new ItemStack(Material.BLAZE_POWDER, 4),
|
||||
|
@ -16,17 +16,15 @@ import org.bukkit.inventory.ItemStack;
|
||||
import io.github.thebusybiscuit.cscorelib2.item.CustomItem;
|
||||
import io.github.thebusybiscuit.slimefun4.utils.SlimefunUtils;
|
||||
import me.mrCookieSlime.Slimefun.SlimefunPlugin;
|
||||
import me.mrCookieSlime.Slimefun.Lists.Categories;
|
||||
import me.mrCookieSlime.Slimefun.Lists.RecipeType;
|
||||
import me.mrCookieSlime.Slimefun.Lists.SlimefunItems;
|
||||
import me.mrCookieSlime.Slimefun.Objects.Category;
|
||||
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.multiblocks.MultiBlockMachine;
|
||||
|
||||
public class Juicer extends MultiBlockMachine {
|
||||
|
||||
public Juicer() {
|
||||
super(
|
||||
Categories.BASIC_MACHINES,
|
||||
SlimefunItems.JUICER,
|
||||
public Juicer(Category category) {
|
||||
super(category, SlimefunItems.JUICER,
|
||||
new ItemStack[] {null, new ItemStack(Material.GLASS), null, null, new ItemStack(Material.NETHER_BRICK_FENCE), null, null, new CustomItem(Material.DISPENSER, "Dispenser (Facing up)"), null},
|
||||
new ItemStack[0],
|
||||
BlockFace.SELF
|
||||
|
@ -17,16 +17,16 @@ import io.github.thebusybiscuit.cscorelib2.item.CustomItem;
|
||||
import io.github.thebusybiscuit.slimefun4.implementation.items.tools.SlimefunBackpack;
|
||||
import io.github.thebusybiscuit.slimefun4.utils.SlimefunUtils;
|
||||
import me.mrCookieSlime.Slimefun.SlimefunPlugin;
|
||||
import me.mrCookieSlime.Slimefun.Lists.Categories;
|
||||
import me.mrCookieSlime.Slimefun.Lists.RecipeType;
|
||||
import me.mrCookieSlime.Slimefun.Lists.SlimefunItems;
|
||||
import me.mrCookieSlime.Slimefun.Objects.Category;
|
||||
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.SlimefunItem;
|
||||
import me.mrCookieSlime.Slimefun.api.Slimefun;
|
||||
|
||||
public class MagicWorkbench extends BackpackCrafter {
|
||||
|
||||
public MagicWorkbench() {
|
||||
super(Categories.BASIC_MACHINES, SlimefunItems.MAGIC_WORKBENCH, new ItemStack[] { null, null, null, null, null, null, new ItemStack(Material.BOOKSHELF), new ItemStack(Material.CRAFTING_TABLE), new ItemStack(Material.DISPENSER) }, new ItemStack[0], BlockFace.UP);
|
||||
public MagicWorkbench(Category category) {
|
||||
super(category, SlimefunItems.MAGIC_WORKBENCH, new ItemStack[] { null, null, null, null, null, null, new ItemStack(Material.BOOKSHELF), new ItemStack(Material.CRAFTING_TABLE), new ItemStack(Material.DISPENSER) }, new ItemStack[0], BlockFace.UP);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -17,16 +17,16 @@ import io.github.thebusybiscuit.cscorelib2.inventory.InvUtils;
|
||||
import io.github.thebusybiscuit.cscorelib2.item.CustomItem;
|
||||
import io.github.thebusybiscuit.slimefun4.utils.SlimefunUtils;
|
||||
import me.mrCookieSlime.Slimefun.SlimefunPlugin;
|
||||
import me.mrCookieSlime.Slimefun.Lists.Categories;
|
||||
import me.mrCookieSlime.Slimefun.Lists.RecipeType;
|
||||
import me.mrCookieSlime.Slimefun.Lists.SlimefunItems;
|
||||
import me.mrCookieSlime.Slimefun.Objects.Category;
|
||||
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.multiblocks.MultiBlockMachine;
|
||||
import me.mrCookieSlime.Slimefun.api.Slimefun;
|
||||
|
||||
public class MakeshiftSmeltery extends MultiBlockMachine {
|
||||
|
||||
public MakeshiftSmeltery() {
|
||||
super(Categories.BASIC_MACHINES, SlimefunItems.MAKESHIFT_SMELTERY, new ItemStack[] {
|
||||
public MakeshiftSmeltery(Category category) {
|
||||
super(category, SlimefunItems.MAKESHIFT_SMELTERY, new ItemStack[] {
|
||||
null, new ItemStack(Material.OAK_FENCE), null,
|
||||
new ItemStack(Material.BRICKS), new CustomItem(Material.DISPENSER, "Dispenser (Facing up)"), new ItemStack(Material.BRICKS),
|
||||
null, new ItemStack(Material.FLINT_AND_STEEL), null
|
||||
|
@ -17,9 +17,9 @@ import io.github.thebusybiscuit.cscorelib2.item.CustomItem;
|
||||
import io.github.thebusybiscuit.slimefun4.api.items.ItemSetting;
|
||||
import io.github.thebusybiscuit.slimefun4.utils.SlimefunUtils;
|
||||
import me.mrCookieSlime.Slimefun.SlimefunPlugin;
|
||||
import me.mrCookieSlime.Slimefun.Lists.Categories;
|
||||
import me.mrCookieSlime.Slimefun.Lists.RecipeType;
|
||||
import me.mrCookieSlime.Slimefun.Lists.SlimefunItems;
|
||||
import me.mrCookieSlime.Slimefun.Objects.Category;
|
||||
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.SlimefunItem;
|
||||
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.multiblocks.MultiBlockMachine;
|
||||
|
||||
@ -27,8 +27,8 @@ public class OreCrusher extends MultiBlockMachine {
|
||||
|
||||
private final DoubleOreSetting doubleOres = new DoubleOreSetting();
|
||||
|
||||
public OreCrusher() {
|
||||
super(Categories.BASIC_MACHINES, SlimefunItems.ORE_CRUSHER, new ItemStack[] { null, null, null, null, new ItemStack(Material.NETHER_BRICK_FENCE), null, new ItemStack(Material.IRON_BARS), new CustomItem(Material.DISPENSER, "Dispenser (Facing up)"), new ItemStack(Material.IRON_BARS) }, new ItemStack[] { new ItemStack(Material.COBBLESTONE, 8), new ItemStack(Material.SAND, 1), SlimefunItems.GOLD_4K, SlimefunItems.GOLD_DUST, new ItemStack(Material.GRAVEL), new ItemStack(Material.SAND), new ItemStack(Material.MAGMA_BLOCK, 4), SlimefunItems.SULFATE }, BlockFace.SELF);
|
||||
public OreCrusher(Category category) {
|
||||
super(category, SlimefunItems.ORE_CRUSHER, new ItemStack[] { null, null, null, null, new ItemStack(Material.NETHER_BRICK_FENCE), null, new ItemStack(Material.IRON_BARS), new CustomItem(Material.DISPENSER, "Dispenser (Facing up)"), new ItemStack(Material.IRON_BARS) }, new ItemStack[] { new ItemStack(Material.COBBLESTONE, 8), new ItemStack(Material.SAND, 1), SlimefunItems.GOLD_4K, SlimefunItems.GOLD_DUST, new ItemStack(Material.GRAVEL), new ItemStack(Material.SAND), new ItemStack(Material.MAGMA_BLOCK, 4), SlimefunItems.SULFATE }, BlockFace.SELF);
|
||||
|
||||
addItemSetting(doubleOres);
|
||||
}
|
||||
|
@ -17,18 +17,16 @@ import org.bukkit.inventory.ItemStack;
|
||||
import io.github.thebusybiscuit.cscorelib2.inventory.InvUtils;
|
||||
import io.github.thebusybiscuit.slimefun4.utils.SlimefunUtils;
|
||||
import me.mrCookieSlime.Slimefun.SlimefunPlugin;
|
||||
import me.mrCookieSlime.Slimefun.Lists.Categories;
|
||||
import me.mrCookieSlime.Slimefun.Lists.SlimefunItems;
|
||||
import me.mrCookieSlime.Slimefun.Objects.Category;
|
||||
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.multiblocks.MultiBlockMachine;
|
||||
|
||||
public class OreWasher extends MultiBlockMachine {
|
||||
|
||||
private final boolean legacyMode;
|
||||
|
||||
public OreWasher() {
|
||||
super(
|
||||
Categories.BASIC_MACHINES,
|
||||
SlimefunItems.ORE_WASHER,
|
||||
public OreWasher(Category category) {
|
||||
super(category, SlimefunItems.ORE_WASHER,
|
||||
new ItemStack[] {null, new ItemStack(Material.DISPENSER), null, null, new ItemStack(Material.OAK_FENCE), null, null, new ItemStack(Material.CAULDRON), null},
|
||||
new ItemStack[] {
|
||||
SlimefunItems.SIFTED_ORE, SlimefunItems.IRON_DUST,
|
||||
|
@ -18,15 +18,15 @@ import io.github.thebusybiscuit.cscorelib2.item.CustomItem;
|
||||
import io.github.thebusybiscuit.slimefun4.api.MinecraftVersion;
|
||||
import io.github.thebusybiscuit.slimefun4.utils.SlimefunUtils;
|
||||
import me.mrCookieSlime.Slimefun.SlimefunPlugin;
|
||||
import me.mrCookieSlime.Slimefun.Lists.Categories;
|
||||
import me.mrCookieSlime.Slimefun.Lists.RecipeType;
|
||||
import me.mrCookieSlime.Slimefun.Lists.SlimefunItems;
|
||||
import me.mrCookieSlime.Slimefun.Objects.Category;
|
||||
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.multiblocks.MultiBlockMachine;
|
||||
|
||||
public class PressureChamber extends MultiBlockMachine {
|
||||
|
||||
public PressureChamber() {
|
||||
super(Categories.BASIC_MACHINES, SlimefunItems.PRESSURE_CHAMBER, new ItemStack[] {
|
||||
public PressureChamber(Category category) {
|
||||
super(category, SlimefunItems.PRESSURE_CHAMBER, new ItemStack[] {
|
||||
SlimefunPlugin.getMinecraftVersion().isAtLeast(MinecraftVersion.MINECRAFT_1_14) ? new ItemStack(Material.SMOOTH_STONE_SLAB) : new ItemStack(Material.STONE_SLAB), new CustomItem(Material.DISPENSER, "Dispenser (Facing down)"), SlimefunPlugin.getMinecraftVersion().isAtLeast(MinecraftVersion.MINECRAFT_1_14) ? new ItemStack(Material.SMOOTH_STONE_SLAB) : new ItemStack(Material.STONE_SLAB),
|
||||
new ItemStack(Material.PISTON), new ItemStack(Material.GLASS), new ItemStack(Material.PISTON),
|
||||
new ItemStack(Material.PISTON), new ItemStack(Material.CAULDRON), new ItemStack(Material.PISTON)
|
||||
|
@ -24,9 +24,9 @@ import io.github.thebusybiscuit.cscorelib2.item.CustomItem;
|
||||
import io.github.thebusybiscuit.slimefun4.api.items.ItemSetting;
|
||||
import io.github.thebusybiscuit.slimefun4.utils.SlimefunUtils;
|
||||
import me.mrCookieSlime.Slimefun.SlimefunPlugin;
|
||||
import me.mrCookieSlime.Slimefun.Lists.Categories;
|
||||
import me.mrCookieSlime.Slimefun.Lists.RecipeType;
|
||||
import me.mrCookieSlime.Slimefun.Lists.SlimefunItems;
|
||||
import me.mrCookieSlime.Slimefun.Objects.Category;
|
||||
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.multiblocks.MultiBlockMachine;
|
||||
import me.mrCookieSlime.Slimefun.api.BlockStorage;
|
||||
import me.mrCookieSlime.Slimefun.api.Slimefun;
|
||||
@ -36,8 +36,8 @@ public class Smeltery extends MultiBlockMachine {
|
||||
private final BlockFace[] faces = { BlockFace.NORTH, BlockFace.EAST, BlockFace.SOUTH, BlockFace.WEST };
|
||||
private final ItemSetting<Integer> fireBreakingChance = new ItemSetting<>("fire-breaking-chance", 34);
|
||||
|
||||
public Smeltery() {
|
||||
super(Categories.BASIC_MACHINES, SlimefunItems.SMELTERY, new ItemStack[] { null, new ItemStack(Material.NETHER_BRICK_FENCE), null, new ItemStack(Material.NETHER_BRICKS), new CustomItem(Material.DISPENSER, "Dispenser (Facing up)"), new ItemStack(Material.NETHER_BRICKS), null, new ItemStack(Material.FLINT_AND_STEEL), null }, new ItemStack[] { SlimefunItems.IRON_DUST, new ItemStack(Material.IRON_INGOT) }, BlockFace.DOWN);
|
||||
public Smeltery(Category category) {
|
||||
super(category, SlimefunItems.SMELTERY, new ItemStack[] { null, new ItemStack(Material.NETHER_BRICK_FENCE), null, new ItemStack(Material.NETHER_BRICKS), new CustomItem(Material.DISPENSER, "Dispenser (Facing up)"), new ItemStack(Material.NETHER_BRICKS), null, new ItemStack(Material.FLINT_AND_STEEL), null }, new ItemStack[] { SlimefunItems.IRON_DUST, new ItemStack(Material.IRON_INGOT) }, BlockFace.DOWN);
|
||||
|
||||
addItemSetting(fireBreakingChance);
|
||||
}
|
||||
|
@ -16,8 +16,8 @@ import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import io.github.thebusybiscuit.cscorelib2.inventory.ItemUtils;
|
||||
import io.github.thebusybiscuit.cscorelib2.materials.MaterialConverter;
|
||||
import me.mrCookieSlime.Slimefun.Lists.Categories;
|
||||
import me.mrCookieSlime.Slimefun.Lists.SlimefunItems;
|
||||
import me.mrCookieSlime.Slimefun.Objects.Category;
|
||||
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.multiblocks.MultiBlockMachine;
|
||||
|
||||
/**
|
||||
@ -35,8 +35,8 @@ public class TableSaw extends MultiBlockMachine {
|
||||
|
||||
private final List<ItemStack> displayRecipes = new ArrayList<>();
|
||||
|
||||
public TableSaw() {
|
||||
super(Categories.BASIC_MACHINES, SlimefunItems.TABLE_SAW, new ItemStack[] {
|
||||
public TableSaw(Category category) {
|
||||
super(category, SlimefunItems.TABLE_SAW, new ItemStack[] {
|
||||
null, null, null,
|
||||
new ItemStack(Material.SMOOTH_STONE_SLAB), new ItemStack(Material.STONECUTTER), new ItemStack(Material.SMOOTH_STONE_SLAB),
|
||||
null, new ItemStack(Material.IRON_BLOCK), null
|
||||
|
@ -0,0 +1,48 @@
|
||||
package io.github.thebusybiscuit.slimefun4.implementation.items.seasonal;
|
||||
|
||||
import java.util.concurrent.ThreadLocalRandom;
|
||||
|
||||
import org.bukkit.GameMode;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import io.github.thebusybiscuit.cscorelib2.inventory.ItemUtils;
|
||||
import io.github.thebusybiscuit.slimefun4.utils.FireworkUtils;
|
||||
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.interfaces.NotPlaceable;
|
||||
import me.mrCookieSlime.Slimefun.Objects.handlers.BlockPlaceHandler;
|
||||
import me.mrCookieSlime.Slimefun.api.SlimefunItemStack;
|
||||
|
||||
public class ChristmasPresent extends SimpleSlimefunItem<BlockPlaceHandler> implements NotPlaceable {
|
||||
|
||||
private final ItemStack[] gifts;
|
||||
|
||||
public ChristmasPresent(Category category, SlimefunItemStack item, RecipeType recipeType, ItemStack[] recipe, ItemStack... gifts) {
|
||||
super(category, item, recipeType, recipe);
|
||||
|
||||
this.gifts = gifts;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockPlaceHandler getItemHandler() {
|
||||
return (e, item) -> {
|
||||
if (isItem(item)) {
|
||||
e.setCancelled(true);
|
||||
|
||||
if (e.getPlayer().getGameMode() != GameMode.CREATIVE) {
|
||||
ItemUtils.consumeItem(item, false);
|
||||
}
|
||||
|
||||
FireworkUtils.launchRandom(e.getPlayer(), 3);
|
||||
|
||||
ItemStack gift = gifts[ThreadLocalRandom.current().nextInt(gifts.length)].clone();
|
||||
e.getBlockPlaced().getWorld().dropItemNaturally(e.getBlockPlaced().getLocation(), gift);
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
};
|
||||
}
|
||||
|
||||
}
|
@ -1,4 +1,4 @@
|
||||
package io.github.thebusybiscuit.slimefun4.implementation.items;
|
||||
package io.github.thebusybiscuit.slimefun4.implementation.items.seasonal;
|
||||
|
||||
import java.util.concurrent.ThreadLocalRandom;
|
||||
|
@ -4,13 +4,14 @@ import org.bukkit.Sound;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
import me.mrCookieSlime.Slimefun.Objects.Category;
|
||||
import me.mrCookieSlime.Slimefun.Objects.handlers.BowShootHandler;
|
||||
import me.mrCookieSlime.Slimefun.api.SlimefunItemStack;
|
||||
|
||||
public class ExplosiveBow extends SlimefunBow {
|
||||
|
||||
public ExplosiveBow(SlimefunItemStack item, ItemStack[] recipe) {
|
||||
super(item, recipe);
|
||||
public ExplosiveBow(Category category, SlimefunItemStack item, ItemStack[] recipe) {
|
||||
super(category, item, recipe);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -6,13 +6,14 @@ import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.potion.PotionEffect;
|
||||
import org.bukkit.potion.PotionEffectType;
|
||||
|
||||
import me.mrCookieSlime.Slimefun.Objects.Category;
|
||||
import me.mrCookieSlime.Slimefun.Objects.handlers.BowShootHandler;
|
||||
import me.mrCookieSlime.Slimefun.api.SlimefunItemStack;
|
||||
|
||||
public class IcyBow extends SlimefunBow {
|
||||
|
||||
public IcyBow(SlimefunItemStack item, ItemStack[] recipe) {
|
||||
super(item, recipe);
|
||||
public IcyBow(Category category, SlimefunItemStack item, ItemStack[] recipe) {
|
||||
super(category, item, recipe);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -3,8 +3,8 @@ package io.github.thebusybiscuit.slimefun4.implementation.items.weapons;
|
||||
import org.bukkit.entity.Arrow;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import me.mrCookieSlime.Slimefun.Lists.Categories;
|
||||
import me.mrCookieSlime.Slimefun.Lists.RecipeType;
|
||||
import me.mrCookieSlime.Slimefun.Objects.Category;
|
||||
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.SlimefunItem;
|
||||
import me.mrCookieSlime.Slimefun.Objects.handlers.BowShootHandler;
|
||||
import me.mrCookieSlime.Slimefun.api.SlimefunItemStack;
|
||||
@ -19,8 +19,8 @@ import me.mrCookieSlime.Slimefun.api.SlimefunItemStack;
|
||||
*/
|
||||
public abstract class SlimefunBow extends SlimefunItem {
|
||||
|
||||
public SlimefunBow(SlimefunItemStack item, ItemStack[] recipe) {
|
||||
super(Categories.WEAPONS, item, RecipeType.MAGIC_WORKBENCH, recipe);
|
||||
public SlimefunBow(Category category, SlimefunItemStack item, ItemStack[] recipe) {
|
||||
super(category, item, RecipeType.MAGIC_WORKBENCH, recipe);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -72,44 +72,45 @@ public class BackpackListener implements Listener {
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
@EventHandler(ignoreCancelled = true)
|
||||
public void onClick(InventoryClickEvent e) {
|
||||
ItemStack item = backpacks.get(e.getWhoClicked().getUniqueId());
|
||||
|
||||
if (item != null) {
|
||||
SlimefunItem backpack = SlimefunItem.getByItem(item);
|
||||
|
||||
if (e.getClick() == ClickType.NUMBER_KEY) {
|
||||
if (e.getClickedInventory().getType() != InventoryType.PLAYER) {
|
||||
ItemStack hotbarItem = e.getWhoClicked().getInventory().getItem(e.getHotbarButton());
|
||||
|
||||
if (hotbarItem != null && (hotbarItem.getType().toString().contains("SHULKER_BOX") || SlimefunItem.getByItem(hotbarItem) instanceof SlimefunBackpack)) {
|
||||
if (!isItemAllowed(hotbarItem, backpack)) {
|
||||
e.setCancelled(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (!isItemAllowed(e.getCurrentItem())) {
|
||||
else if (!isItemAllowed(e.getCurrentItem(), backpack)) {
|
||||
e.setCancelled(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private boolean isItemAllowed(ItemStack item) {
|
||||
private boolean isItemAllowed(ItemStack item, SlimefunItem backpack) {
|
||||
if (item == null || item.getType() == Material.AIR) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (item.getType().toString().contains("SHULKER_BOX")) {
|
||||
if (item.getType() == Material.SHULKER_BOX || item.getType().toString().endsWith("_SHULKER_BOX")) {
|
||||
return false;
|
||||
}
|
||||
|
||||
SlimefunItem sfItem = SlimefunItem.getByItem(item);
|
||||
SlimefunItem slimefunItem = SlimefunItem.getByItem(item);
|
||||
|
||||
if (sfItem instanceof SlimefunBackpack) {
|
||||
if (sfItem instanceof Cooler) {
|
||||
return sfItem instanceof Juice;
|
||||
}
|
||||
else {
|
||||
if (slimefunItem instanceof SlimefunBackpack) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (backpack instanceof Cooler) {
|
||||
return slimefunItem instanceof Juice;
|
||||
}
|
||||
|
||||
return true;
|
||||
|
@ -8,7 +8,6 @@ import java.util.Random;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.ThreadLocalRandom;
|
||||
|
||||
import org.bukkit.GameMode;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.Tag;
|
||||
import org.bukkit.block.Block;
|
||||
@ -21,9 +20,6 @@ import org.bukkit.event.block.BlockBreakEvent;
|
||||
import org.bukkit.event.block.BlockPlaceEvent;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import io.github.thebusybiscuit.cscorelib2.inventory.ItemUtils;
|
||||
import io.github.thebusybiscuit.cscorelib2.item.CustomItem;
|
||||
import io.github.thebusybiscuit.slimefun4.utils.FireworkUtils;
|
||||
import io.github.thebusybiscuit.slimefun4.utils.SlimefunUtils;
|
||||
import me.mrCookieSlime.Slimefun.SlimefunPlugin;
|
||||
import me.mrCookieSlime.Slimefun.Lists.SlimefunItems;
|
||||
@ -86,41 +82,27 @@ public class BlockListener implements Listener {
|
||||
}
|
||||
else {
|
||||
for (ItemHandler handler : SlimefunItem.getPublicItemHandlers(BlockPlaceHandler.class)) {
|
||||
if (((BlockPlaceHandler) handler).onBlockPlace(e, item)) break;
|
||||
if (((BlockPlaceHandler) handler).onBlockPlace(e, item)) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||
public void onBlockUnregister(BlockBreakEvent e) {
|
||||
boolean allow = true;
|
||||
List<ItemStack> drops = new ArrayList<>();
|
||||
ItemStack item = e.getPlayer().getInventory().getItemInMainHand();
|
||||
int fortune = getFortuneLevel(item, e.getBlock());
|
||||
Block blockAbove = e.getBlock().getRelative(BlockFace.UP);
|
||||
|
||||
Block block2 = e.getBlock().getRelative(BlockFace.UP);
|
||||
|
||||
if (sensitiveMaterials.contains(block2.getType())) {
|
||||
SlimefunItem sfItem = BlockStorage.check(e.getBlock().getRelative(BlockFace.UP));
|
||||
|
||||
if (sfItem == null && SlimefunPlugin.getBlockDataService().isTileEntity(block2.getType())) {
|
||||
Optional<String> blockData = SlimefunPlugin.getBlockDataService().getBlockData(block2);
|
||||
|
||||
if (blockData.isPresent()) {
|
||||
sfItem = SlimefunItem.getByID(blockData.get());
|
||||
}
|
||||
}
|
||||
if (sensitiveMaterials.contains(blockAbove.getType())) {
|
||||
SlimefunItem sfItem = BlockStorage.check(blockAbove);
|
||||
|
||||
if (sfItem != null && !(sfItem instanceof HandledBlock)) {
|
||||
SlimefunBlockHandler blockHandler = SlimefunPlugin.getRegistry().getBlockHandlers().get(sfItem.getID());
|
||||
|
||||
if (blockHandler != null) {
|
||||
allow = blockHandler.onBreak(e.getPlayer(), block2, sfItem, UnregisterReason.PLAYER_BREAK);
|
||||
}
|
||||
|
||||
if (allow) {
|
||||
block2.getWorld().dropItemNaturally(block2.getLocation(), BlockStorage.retrieve(block2));
|
||||
block2.setType(Material.AIR);
|
||||
if (blockHandler.onBreak(e.getPlayer(), blockAbove, sfItem, UnregisterReason.PLAYER_BREAK)) {
|
||||
blockAbove.getWorld().dropItemNaturally(blockAbove.getLocation(), BlockStorage.retrieve(blockAbove));
|
||||
blockAbove.setType(Material.AIR);
|
||||
}
|
||||
else {
|
||||
e.setCancelled(true);
|
||||
@ -128,8 +110,12 @@ public class BlockListener implements Listener {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
SlimefunItem sfItem = BlockStorage.check(e.getBlock());
|
||||
ItemStack item = e.getPlayer().getInventory().getItemInMainHand();
|
||||
int fortune = getBonusDropsWithFortune(item, e.getBlock());
|
||||
List<ItemStack> drops = new ArrayList<>();
|
||||
|
||||
if (sfItem == null && SlimefunPlugin.getBlockDataService().isTileEntity(e.getBlock().getType())) {
|
||||
Optional<String> blockData = SlimefunPlugin.getBlockDataService().getBlockData(e.getBlock());
|
||||
@ -143,13 +129,7 @@ public class BlockListener implements Listener {
|
||||
SlimefunBlockHandler blockHandler = SlimefunPlugin.getRegistry().getBlockHandlers().get(sfItem.getID());
|
||||
|
||||
if (blockHandler != null) {
|
||||
allow = blockHandler.onBreak(e.getPlayer(), e.getBlock(), sfItem, UnregisterReason.PLAYER_BREAK);
|
||||
}
|
||||
else {
|
||||
sfItem.callItemHandler(BlockBreakHandler.class, handler -> handler.onBlockBreak(e, item, fortune, drops));
|
||||
}
|
||||
|
||||
if (allow) {
|
||||
if (blockHandler.onBreak(e.getPlayer(), e.getBlock(), sfItem, UnregisterReason.PLAYER_BREAK)) {
|
||||
drops.addAll(sfItem.getDrops());
|
||||
BlockStorage.clearBlockInfo(e.getBlock());
|
||||
}
|
||||
@ -158,6 +138,11 @@ public class BlockListener implements Listener {
|
||||
return;
|
||||
}
|
||||
}
|
||||
else {
|
||||
sfItem.callItemHandler(BlockBreakHandler.class, handler -> handler.onBlockBreak(e, item, fortune, drops));
|
||||
}
|
||||
}
|
||||
|
||||
if (item.getType() != Material.AIR) {
|
||||
for (ItemHandler handler : SlimefunItem.getPublicItemHandlers(BlockBreakHandler.class)) {
|
||||
if (((BlockBreakHandler) handler).onBlockBreak(e, item, fortune, drops)) {
|
||||
@ -179,63 +164,33 @@ public class BlockListener implements Listener {
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
@EventHandler(ignoreCancelled = true)
|
||||
public void onBlockPlace(BlockPlaceEvent e) {
|
||||
ItemStack item = e.getItemInHand();
|
||||
|
||||
if (SlimefunUtils.isItemSimilar(item, SlimefunItems.BASIC_CIRCUIT_BOARD, true)) e.setCancelled(true);
|
||||
else if (SlimefunUtils.isItemSimilar(item, SlimefunItems.ADVANCED_CIRCUIT_BOARD, true)) e.setCancelled(true);
|
||||
|
||||
else if (SlimefunUtils.isItemSimilar(item, SlimefunItems.CARBON, false)) e.setCancelled(true);
|
||||
else if (SlimefunUtils.isItemSimilar(item, SlimefunItems.COMPRESSED_CARBON, false)) e.setCancelled(true);
|
||||
else if (SlimefunUtils.isItemSimilar(item, SlimefunItems.CARBON_CHUNK, false)) e.setCancelled(true);
|
||||
|
||||
else if (SlimefunUtils.isItemSimilar(item, SlimefunItems.ANDROID_MEMORY_CORE, false)) e.setCancelled(true);
|
||||
else if (SlimefunUtils.isItemSimilar(item, SlimefunItems.LAVA_CRYSTAL, false)) e.setCancelled(true);
|
||||
|
||||
else if (SlimefunUtils.isItemSimilar(item, SlimefunItems.TINY_URANIUM, false)) e.setCancelled(true);
|
||||
else if (SlimefunUtils.isItemSimilar(item, SlimefunItems.SMALL_URANIUM, false)) e.setCancelled(true);
|
||||
|
||||
if (SlimefunUtils.isItemSimilar(item, SlimefunItems.ADVANCED_CIRCUIT_BOARD, true)) e.setCancelled(true);
|
||||
else if (SlimefunUtils.isItemSimilar(item, SlimefunItems.CARBON, true)) e.setCancelled(true);
|
||||
else if (SlimefunUtils.isItemSimilar(item, SlimefunItems.COMPRESSED_CARBON, true)) e.setCancelled(true);
|
||||
else if (SlimefunUtils.isItemSimilar(item, SlimefunItems.CARBON_CHUNK, true)) e.setCancelled(true);
|
||||
else if (SlimefunUtils.isItemSimilar(item, SlimefunItems.ANDROID_MEMORY_CORE, true)) e.setCancelled(true);
|
||||
else if (SlimefunUtils.isItemSimilar(item, SlimefunItems.LAVA_CRYSTAL, true)) e.setCancelled(true);
|
||||
else if (SlimefunUtils.isItemSimilar(item, SlimefunItems.TINY_URANIUM, true)) e.setCancelled(true);
|
||||
else if (SlimefunUtils.isItemSimilar(item, SlimefunItems.SMALL_URANIUM, true)) e.setCancelled(true);
|
||||
else if (SlimefunUtils.isItemSimilar(item, SlimefunItems.BROKEN_SPAWNER, false)) e.setCancelled(true);
|
||||
else if (SlimefunUtils.isItemSimilar(item, SlimefunItems.CHRISTMAS_PRESENT, false)) {
|
||||
e.setCancelled(true);
|
||||
|
||||
if (e.getPlayer().getGameMode() != GameMode.CREATIVE) {
|
||||
ItemUtils.consumeItem(item, false);
|
||||
}
|
||||
|
||||
FireworkUtils.launchRandom(e.getPlayer(), 3);
|
||||
List<ItemStack> gifts = new ArrayList<>();
|
||||
|
||||
gifts.add(new CustomItem(SlimefunItems.CHRISTMAS_HOT_CHOCOLATE, 1));
|
||||
gifts.add(new CustomItem(SlimefunItems.CHRISTMAS_CHOCOLATE_APPLE, 4));
|
||||
gifts.add(new CustomItem(SlimefunItems.CHRISTMAS_CARAMEL_APPLE, 4));
|
||||
gifts.add(new CustomItem(SlimefunItems.CHRISTMAS_CAKE, 4));
|
||||
gifts.add(new CustomItem(SlimefunItems.CHRISTMAS_COOKIE, 8));
|
||||
gifts.add(new CustomItem(SlimefunItems.CHRISTMAS_PRESENT, 1));
|
||||
gifts.add(new CustomItem(SlimefunItems.CHRISTMAS_EGG_NOG, 1));
|
||||
gifts.add(new CustomItem(SlimefunItems.CHRISTMAS_MILK, 1));
|
||||
gifts.add(new CustomItem(SlimefunItems.CHRISTMAS_APPLE_CIDER, 1));
|
||||
gifts.add(new CustomItem(SlimefunItems.CHRISTMAS_FRUIT_CAKE, 4));
|
||||
gifts.add(new CustomItem(SlimefunItems.CHRISTMAS_APPLE_PIE, 4));
|
||||
gifts.add(new ItemStack(Material.EMERALD));
|
||||
|
||||
e.getBlockPlaced().getWorld().dropItemNaturally(e.getBlockPlaced().getLocation(), gifts.get(ThreadLocalRandom.current().nextInt(gifts.size())));
|
||||
}
|
||||
else if (e.getBlock().getY() != e.getBlockAgainst().getY() && (SlimefunUtils.isItemSimilar(item, SlimefunItems.CARGO_INPUT, false) || SlimefunUtils.isItemSimilar(item, SlimefunItems.CARGO_OUTPUT, false) || SlimefunUtils.isItemSimilar(item, SlimefunItems.CARGO_OUTPUT_ADVANCED, false))) {
|
||||
SlimefunPlugin.getLocal().sendMessage(e.getPlayer(), "machines.CARGO_NODES.must-be-placed", true);
|
||||
e.setCancelled(true);
|
||||
}
|
||||
}
|
||||
|
||||
private int getFortuneLevel(ItemStack item, Block b) {
|
||||
private int getBonusDropsWithFortune(ItemStack item, Block b) {
|
||||
int fortune = 1;
|
||||
|
||||
if (item != null && item.getEnchantments().containsKey(Enchantment.LOOT_BONUS_BLOCKS) && !item.getEnchantments().containsKey(Enchantment.SILK_TOUCH)) {
|
||||
Random random = ThreadLocalRandom.current();
|
||||
int fortuneLevel = item.getEnchantmentLevel(Enchantment.LOOT_BONUS_BLOCKS);
|
||||
|
||||
fortune = random.nextInt(item.getEnchantmentLevel(Enchantment.LOOT_BONUS_BLOCKS) + 2) - 1;
|
||||
if (fortune <= 0) fortune = 1;
|
||||
fortune = Math.max(1, random.nextInt(fortuneLevel + 2) - 1);
|
||||
fortune = (b.getType() == Material.LAPIS_ORE ? 4 + random.nextInt(5) : 1) * (fortune + 1);
|
||||
}
|
||||
|
||||
|
@ -2,6 +2,7 @@ package io.github.thebusybiscuit.slimefun4.implementation.listeners;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.Tag;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.data.type.Piston;
|
||||
import org.bukkit.entity.EntityType;
|
||||
@ -75,7 +76,7 @@ public class BlockPhysicsListener implements Listener {
|
||||
public void onLiquidFlow(BlockFromToEvent e) {
|
||||
Block block = e.getToBlock();
|
||||
|
||||
if (block.getType() == Material.PLAYER_HEAD || block.getType() == Material.PLAYER_WALL_HEAD) {
|
||||
if (block.getType() == Material.PLAYER_HEAD || block.getType() == Material.PLAYER_WALL_HEAD || Tag.SAPLINGS.isTagged(block.getType())) {
|
||||
String item = BlockStorage.checkID(block);
|
||||
|
||||
if (item != null) {
|
||||
|
@ -0,0 +1,60 @@
|
||||
package io.github.thebusybiscuit.slimefun4.implementation.setup;
|
||||
|
||||
import java.time.Month;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.NamespacedKey;
|
||||
|
||||
import io.github.thebusybiscuit.cscorelib2.item.CustomItem;
|
||||
import io.github.thebusybiscuit.cscorelib2.skull.SkullItem;
|
||||
import io.github.thebusybiscuit.slimefun4.core.categories.SeasonalCategory;
|
||||
import io.github.thebusybiscuit.slimefun4.utils.ChatUtils;
|
||||
import me.mrCookieSlime.CSCoreLibPlugin.general.World.CustomSkull;
|
||||
import me.mrCookieSlime.Slimefun.SlimefunPlugin;
|
||||
import me.mrCookieSlime.Slimefun.Objects.Category;
|
||||
import me.mrCookieSlime.Slimefun.Objects.LockedCategory;
|
||||
|
||||
/**
|
||||
* This class holds a reference to every {@link Category}
|
||||
* found in Slimefun itself.
|
||||
*
|
||||
* Addons should use their own {@link Category} hence why the visible of this class was now
|
||||
* changed to package-private.
|
||||
*
|
||||
* @author TheBusyBiscuit
|
||||
*
|
||||
* @see Category
|
||||
* @see LockedCategory
|
||||
* @see SeasonalCategory
|
||||
*
|
||||
*/
|
||||
final class DefaultCategories {
|
||||
|
||||
// Standard Categories
|
||||
final Category weapons = me.mrCookieSlime.Slimefun.Lists.Categories.WEAPONS;
|
||||
final Category tools = me.mrCookieSlime.Slimefun.Lists.Categories.TOOLS;
|
||||
final Category usefulItems = me.mrCookieSlime.Slimefun.Lists.Categories.PORTABLE;
|
||||
final Category food = me.mrCookieSlime.Slimefun.Lists.Categories.FOOD;
|
||||
final Category basicMachines = me.mrCookieSlime.Slimefun.Lists.Categories.BASIC_MACHINES;
|
||||
final Category armor = me.mrCookieSlime.Slimefun.Lists.Categories.ARMOR;
|
||||
final Category magicalResources = me.mrCookieSlime.Slimefun.Lists.Categories.LUMPS_AND_MAGIC;
|
||||
final Category magicalGadgets = me.mrCookieSlime.Slimefun.Lists.Categories.MAGIC;
|
||||
final Category misc = me.mrCookieSlime.Slimefun.Lists.Categories.MISC;
|
||||
final Category technicalGadgets = me.mrCookieSlime.Slimefun.Lists.Categories.TECH;
|
||||
final Category resources = me.mrCookieSlime.Slimefun.Lists.Categories.RESOURCES;
|
||||
final Category cargo = me.mrCookieSlime.Slimefun.Lists.Categories.CARGO;
|
||||
final Category technicalComponents = me.mrCookieSlime.Slimefun.Lists.Categories.TECH_MISC;
|
||||
final Category magicalArmor = me.mrCookieSlime.Slimefun.Lists.Categories.MAGIC_ARMOR;
|
||||
|
||||
// Locked Categories
|
||||
final LockedCategory electricity = me.mrCookieSlime.Slimefun.Lists.Categories.ELECTRICITY;
|
||||
final LockedCategory gps = me.mrCookieSlime.Slimefun.Lists.Categories.GPS;
|
||||
|
||||
// Seasonal Categories
|
||||
final SeasonalCategory christmas = new SeasonalCategory(new NamespacedKey(SlimefunPlugin.instance, "christmas"), Month.DECEMBER, 1, new CustomItem(SkullItem.fromHash("215ba31cde2671b8f176de6a9ffd008035f0590d63ee240be6e8921cd2037a45"), ChatUtils.christmas("Christmas") + " &7(December only)"));
|
||||
final SeasonalCategory valentinesDay = new SeasonalCategory(new NamespacedKey(SlimefunPlugin.instance, "valentines_day"), Month.FEBRUARY, 2, new CustomItem(SkullItem.fromHash("55d89431d14bfef2060461b4a3565614dc51115c001fae2508e8684bc0ae6a80"), "&dValentine's Day" + " &7(14th February)"));
|
||||
final SeasonalCategory easter = new SeasonalCategory(new NamespacedKey(SlimefunPlugin.instance, "easter"), Month.APRIL, 2, new CustomItem(SkullItem.fromHash("b2cd5df9d7f1fa8341fcce2f3c118e2f517e4d2d99df2c51d61d93ed7f83e13"), "&6Easter" + " &7(April)"));
|
||||
final SeasonalCategory birthday = new SeasonalCategory(new NamespacedKey(SlimefunPlugin.instance, "birthday"), Month.OCTOBER, 1, new CustomItem(Material.FIREWORK_ROCKET, "&a&lTheBusyBiscuit's Birthday &7(26th October)"));
|
||||
final SeasonalCategory halloween = new SeasonalCategory(new NamespacedKey(SlimefunPlugin.instance, "halloween"), Month.OCTOBER, 1, new CustomItem(Material.JACK_O_LANTERN, "&6&lHalloween &7(31st October)"));
|
||||
|
||||
}
|
File diff suppressed because it is too large
Load Diff
@ -1,13 +1,10 @@
|
||||
package me.mrCookieSlime.Slimefun.Lists;
|
||||
|
||||
import java.time.Month;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.NamespacedKey;
|
||||
|
||||
import io.github.thebusybiscuit.cscorelib2.item.CustomItem;
|
||||
import io.github.thebusybiscuit.slimefun4.core.categories.SeasonalCategory;
|
||||
import io.github.thebusybiscuit.slimefun4.utils.ChatUtils;
|
||||
import me.mrCookieSlime.Slimefun.SlimefunPlugin;
|
||||
import me.mrCookieSlime.Slimefun.Objects.Category;
|
||||
import me.mrCookieSlime.Slimefun.Objects.LockedCategory;
|
||||
@ -16,6 +13,8 @@ import me.mrCookieSlime.Slimefun.Objects.LockedCategory;
|
||||
* This class holds a static references to every {@link Category}
|
||||
* found in Slimefun.
|
||||
*
|
||||
* @deprecated This class is no longer available to addons. Please use your own {@link Category} instead.
|
||||
*
|
||||
* @author TheBusyBiscuit
|
||||
*
|
||||
* @see Category
|
||||
@ -23,6 +22,7 @@ import me.mrCookieSlime.Slimefun.Objects.LockedCategory;
|
||||
* @see SeasonalCategory
|
||||
*
|
||||
*/
|
||||
@Deprecated
|
||||
public final class Categories {
|
||||
|
||||
private Categories() {}
|
||||
@ -39,21 +39,11 @@ public final class Categories {
|
||||
public static final Category MISC = new Category(new NamespacedKey(SlimefunPlugin.instance, "misc"), new CustomItem(SlimefunItems.CAN, "&7Miscellaneous"), 2);
|
||||
public static final Category TECH = new Category(new NamespacedKey(SlimefunPlugin.instance, "technical_gadgets"), new CustomItem(SlimefunItems.STEEL_JETPACK, "&7Technical Gadgets"), 3);
|
||||
public static final Category RESOURCES = new Category(new NamespacedKey(SlimefunPlugin.instance, "resources"), new CustomItem(SlimefunItems.SYNTHETIC_SAPPHIRE, "&7Resources"), 1);
|
||||
public static final Category CARGO = new LockedCategory(new NamespacedKey(SlimefunPlugin.instance, "cargo"), new CustomItem(SlimefunItems.CARGO_MANAGER, "&cCargo Management"), 4, BASIC_MACHINES);
|
||||
public static final Category CARGO = new LockedCategory(new NamespacedKey(SlimefunPlugin.instance, "cargo"), new CustomItem(SlimefunItems.CARGO_MANAGER, "&cCargo Management"), 4, BASIC_MACHINES.getKey());
|
||||
public static final Category TECH_MISC = new Category(new NamespacedKey(SlimefunPlugin.instance, "tech_misc"), new CustomItem(SlimefunItems.HEATING_COIL, "&7Technical Components"), 2);
|
||||
public static final Category MAGIC_ARMOR = new Category(new NamespacedKey(SlimefunPlugin.instance, "magical_armor"), new CustomItem(SlimefunItems.ENDER_HELMET, "&7Magical Armor"), 2);
|
||||
public static final Category TALISMANS = new Category(new NamespacedKey(SlimefunPlugin.instance, "talismans"), new CustomItem(SlimefunItems.TALISMAN, "&7Talismans - &aTier I"), 2);
|
||||
|
||||
// Locked Categories
|
||||
public static final LockedCategory ELECTRICITY = new LockedCategory(new NamespacedKey(SlimefunPlugin.instance, "electricity"), new CustomItem(SlimefunItems.NUCLEAR_REACTOR, "&bEnergy and Electricity"), 4, BASIC_MACHINES);
|
||||
public static final LockedCategory GPS = new LockedCategory(new NamespacedKey(SlimefunPlugin.instance, "gps"), new CustomItem(SlimefunItems.GPS_TRANSMITTER, "&bGPS-based Machines"), 4, BASIC_MACHINES);
|
||||
public static final LockedCategory ENDER_TALISMANS = new LockedCategory(new NamespacedKey(SlimefunPlugin.instance, "ender_talismans"), new CustomItem(SlimefunItems.ENDER_TALISMAN, "&7Talismans - &aTier II"), 3, TALISMANS);
|
||||
|
||||
// Seasonal Categories
|
||||
public static final SeasonalCategory CHRISTMAS = new SeasonalCategory(new NamespacedKey(SlimefunPlugin.instance, "christmas"), Month.DECEMBER, 1, new CustomItem(Material.NETHER_STAR, ChatUtils.christmas("Christmas") + " &7(December only)"));
|
||||
public static final SeasonalCategory VALENTINES_DAY = new SeasonalCategory(new NamespacedKey(SlimefunPlugin.instance, "valentines_day"), Month.FEBRUARY, 2, new CustomItem(Material.POPPY, "&dValentine's Day" + " &7(14th February)"));
|
||||
public static final SeasonalCategory EASTER = new SeasonalCategory(new NamespacedKey(SlimefunPlugin.instance, "easter"), Month.APRIL, 2, new CustomItem(Material.EGG, "&6Easter" + " &7(April)"));
|
||||
public static final SeasonalCategory BIRTHDAY = new SeasonalCategory(new NamespacedKey(SlimefunPlugin.instance, "birthday"), Month.OCTOBER, 1, new CustomItem(Material.FIREWORK_ROCKET, "&a&lTheBusyBiscuit's Birthday &7(26th October)"));
|
||||
public static final SeasonalCategory HALLOWEEN = new SeasonalCategory(new NamespacedKey(SlimefunPlugin.instance, "halloween"), Month.OCTOBER, 1, new CustomItem(Material.JACK_O_LANTERN, "&6&lHalloween &7(31st October)"));
|
||||
|
||||
public static final LockedCategory ELECTRICITY = new LockedCategory(new NamespacedKey(SlimefunPlugin.instance, "electricity"), new CustomItem(SlimefunItems.NUCLEAR_REACTOR, "&bEnergy and Electricity"), 4, BASIC_MACHINES.getKey());
|
||||
public static final LockedCategory GPS = new LockedCategory(new NamespacedKey(SlimefunPlugin.instance, "gps"), new CustomItem(SlimefunItems.GPS_TRANSMITTER, "&bGPS-based Machines"), 4, BASIC_MACHINES.getKey());
|
||||
}
|
||||
|
@ -70,16 +70,6 @@ public class RecipeType implements Keyed {
|
||||
this.key = new NamespacedKey(SlimefunPlugin.instance, "null");
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated Use the constructor with {@link NamespacedKey} instead
|
||||
* @param item
|
||||
* The {@link ItemStack} to use for this {@link RecipeType}
|
||||
*/
|
||||
@Deprecated
|
||||
public RecipeType(ItemStack item) {
|
||||
this(item, "");
|
||||
}
|
||||
|
||||
public RecipeType(ItemStack item, String machine) {
|
||||
this.item = item;
|
||||
this.machine = machine;
|
||||
|
@ -134,16 +134,16 @@ public final class SlimefunItems {
|
||||
}
|
||||
|
||||
/* Food */
|
||||
public static final ItemStack FORTUNE_COOKIE = new SlimefunItemStack("FORTUNE_COOKIE", Material.COOKIE, "&6Fortune Cookie", "", "&a&oTells you stuff about your Future :o");
|
||||
public static final ItemStack DIET_COOKIE = new SlimefunItemStack("DIET_COOKIE", Material.COOKIE, "&6Diet Cookie", "", "&aA very &olightweight &r&acookie.");
|
||||
public static final ItemStack MAGIC_SUGAR = new SlimefunItemStack("MAGIC_SUGAR", Material.SUGAR, "&6Magic Sugar", "", "&a&oFeel the Power of Hermes!");
|
||||
public static final ItemStack MONSTER_JERKY = new SlimefunItemStack("MONSTER_JERKY", Material.ROTTEN_FLESH, "&6Monster Jerky", "", "&a&oNo longer hungry");
|
||||
public static final ItemStack APPLE_JUICE = new SlimefunItemStack("APPLE_JUICE", Color.RED, new PotionEffect(PotionEffectType.SATURATION, 6, 0), "&cApple Juice", "", "&7&oRestores &b&o" + "3.0" + " &7&oHunger");
|
||||
public static final ItemStack MELON_JUICE = new SlimefunItemStack("MELON_JUICE", Color.RED, new PotionEffect(PotionEffectType.SATURATION, 6, 0), "&cMelon Juice", "", "&7&oRestores &b&o" + "3.0" + " &7&oHunger");
|
||||
public static final ItemStack CARROT_JUICE = new SlimefunItemStack("CARROT_JUICE", Color.ORANGE, new PotionEffect(PotionEffectType.SATURATION, 6, 0), "&6Carrot Juice", "", "&7&oRestores &b&o" + "3.0" + " &7&oHunger");
|
||||
public static final ItemStack PUMPKIN_JUICE = new SlimefunItemStack("PUMPKIN_JUICE", Color.ORANGE, new PotionEffect(PotionEffectType.SATURATION, 6, 0), "&6Pumpkin Juice", "", "&7&oRestores &b&o" + "3.0" + " &7&oHunger");
|
||||
public static final ItemStack SWEET_BERRY_JUICE = new SlimefunItemStack("SWEET_BERRY_JUICE", Color.RED, new PotionEffect(PotionEffectType.SATURATION, 6, 0), "&cSweet Berry Juice", "", "&7&oRestores &b&o" + "3.0" + " &7&oHunger");
|
||||
public static final ItemStack GOLDEN_APPLE_JUICE = new SlimefunItemStack("GOLDEN_APPLE_JUICE", Color.YELLOW, new PotionEffect(PotionEffectType.ABSORPTION, 20 * 20, 0), "&bGolden Apple Juice");
|
||||
public static final SlimefunItemStack FORTUNE_COOKIE = new SlimefunItemStack("FORTUNE_COOKIE", Material.COOKIE, "&6Fortune Cookie", "", "&a&oTells you stuff about your Future :o");
|
||||
public static final SlimefunItemStack DIET_COOKIE = new SlimefunItemStack("DIET_COOKIE", Material.COOKIE, "&6Diet Cookie", "", "&aA very &olightweight &r&acookie.");
|
||||
public static final SlimefunItemStack MAGIC_SUGAR = new SlimefunItemStack("MAGIC_SUGAR", Material.SUGAR, "&6Magic Sugar", "", "&a&oFeel the Power of Hermes!");
|
||||
public static final SlimefunItemStack MONSTER_JERKY = new SlimefunItemStack("MONSTER_JERKY", Material.ROTTEN_FLESH, "&6Monster Jerky", "", "&a&oNo longer hungry");
|
||||
public static final SlimefunItemStack APPLE_JUICE = new SlimefunItemStack("APPLE_JUICE", Color.RED, new PotionEffect(PotionEffectType.SATURATION, 6, 0), "&cApple Juice", "", "&7&oRestores &b&o" + "3.0" + " &7&oHunger");
|
||||
public static final SlimefunItemStack MELON_JUICE = new SlimefunItemStack("MELON_JUICE", Color.RED, new PotionEffect(PotionEffectType.SATURATION, 6, 0), "&cMelon Juice", "", "&7&oRestores &b&o" + "3.0" + " &7&oHunger");
|
||||
public static final SlimefunItemStack CARROT_JUICE = new SlimefunItemStack("CARROT_JUICE", Color.ORANGE, new PotionEffect(PotionEffectType.SATURATION, 6, 0), "&6Carrot Juice", "", "&7&oRestores &b&o" + "3.0" + " &7&oHunger");
|
||||
public static final SlimefunItemStack PUMPKIN_JUICE = new SlimefunItemStack("PUMPKIN_JUICE", Color.ORANGE, new PotionEffect(PotionEffectType.SATURATION, 6, 0), "&6Pumpkin Juice", "", "&7&oRestores &b&o" + "3.0" + " &7&oHunger");
|
||||
public static final SlimefunItemStack SWEET_BERRY_JUICE = new SlimefunItemStack("SWEET_BERRY_JUICE", Color.RED, new PotionEffect(PotionEffectType.SATURATION, 6, 0), "&cSweet Berry Juice", "", "&7&oRestores &b&o" + "3.0" + " &7&oHunger");
|
||||
public static final SlimefunItemStack GOLDEN_APPLE_JUICE = new SlimefunItemStack("GOLDEN_APPLE_JUICE", Color.YELLOW, new PotionEffect(PotionEffectType.ABSORPTION, 20 * 20, 0), "&bGolden Apple Juice");
|
||||
|
||||
public static final SlimefunItemStack BEEF_JERKY = new SlimefunItemStack("BEEF_JERKY", Material.COOKED_BEEF, "&6Beef Jerky", "", "&rExtra saturating!");
|
||||
public static final SlimefunItemStack PORK_JERKY = new SlimefunItemStack("PORK_JERKY", Material.COOKED_PORKCHOP, "&6Pork Jerky", "", "&rExtra saturating!");
|
||||
@ -344,7 +344,7 @@ public final class SlimefunItems {
|
||||
public static final ItemStack SALT = new SlimefunItemStack("SALT", Material.SUGAR, "&rSalt");
|
||||
public static final ItemStack CHEESE = new SlimefunItemStack("CHEESE", "34febbc15d1d4cc62bedc5d7a2b6f0f46cd5b0696a884de75e289e35cbb53a0", "&rCheese");
|
||||
public static final ItemStack BUTTER = new SlimefunItemStack("BUTTER", "b66b19f7d635d03473891df33017c549363209a8f6328a8542c213d08525e", "&rButter");
|
||||
public static final ItemStack DUCT_TAPE = new SlimefunItemStack("DUCT_TAPE", "b2faaceab6384fff5ed24bb44a4af2f584eb1382729ecd93a5369acfd6654", "&8Duct Tape", "", "&rYou can repair Items using this", "&rin an Auto-Anvil");
|
||||
public static final SlimefunItemStack DUCT_TAPE = new SlimefunItemStack("DUCT_TAPE", "b2faaceab6384fff5ed24bb44a4af2f584eb1382729ecd93a5369acfd6654", "&8Duct Tape", "", "&rYou can repair Items using this", "&rin an Auto-Anvil");
|
||||
public static final ItemStack HEAVY_CREAM = new SlimefunItemStack("HEAVY_CREAM", Material.SNOWBALL, "&rHeavy Cream");
|
||||
public static final ItemStack CRUSHED_ORE = new SlimefunItemStack("CRUSHED_ORE", Material.GUNPOWDER, "&6Crushed Ore");
|
||||
public static final ItemStack PULVERIZED_ORE = new SlimefunItemStack("PULVERIZED_ORE", Material.GUNPOWDER, "&6Pulverized Ore");
|
||||
@ -368,7 +368,7 @@ public final class SlimefunItems {
|
||||
public static final ItemStack REINFORCED_PLATE = new SlimefunItemStack("REINFORCED_PLATE", Material.PAPER, "&7Reinforced Plate");
|
||||
public static final SlimefunItemStack ANCIENT_PEDESTAL = new SlimefunItemStack("ANCIENT_PEDESTAL", Material.DISPENSER, "&dAncient Pedestal", "", "&5Part of the Ancient Altar");
|
||||
public static final SlimefunItemStack ANCIENT_ALTAR = new SlimefunItemStack("ANCIENT_ALTAR", Material.ENCHANTING_TABLE, "&dAncient Altar", "", "&5Multi-Block Altar for", "&5magical Crafting Processes");
|
||||
public static final ItemStack COPPER_WIRE = new SlimefunItemStack("COPPER_WIRE", Material.STRING, "&6Copper Wire", "", "&6Crucial component in electric modules");
|
||||
public static final SlimefunItemStack COPPER_WIRE = new SlimefunItemStack("COPPER_WIRE", Material.STRING, "&6Copper Wire", "", "&6Crucial component in electric modules");
|
||||
|
||||
public static final SlimefunItemStack RAINBOW_WOOL = new SlimefunItemStack("RAINBOW_WOOL", Material.WHITE_WOOL, "&5Rainbow Wool", "", "&dCycles through all Colors of the Rainbow!");
|
||||
public static final SlimefunItemStack RAINBOW_GLASS = new SlimefunItemStack("RAINBOW_GLASS", Material.WHITE_STAINED_GLASS, "&5Rainbow Glass", "", "&dCycles through all Colors of the Rainbow!");
|
||||
@ -575,7 +575,7 @@ public final class SlimefunItems {
|
||||
public static final SlimefunItemStack SOULBOUND_BOOTS = new SlimefunItemStack("SOULBOUND_BOOTS", Material.DIAMOND_BOOTS, "&cSoulbound Boots");
|
||||
|
||||
/* Runes */
|
||||
public static final ItemStack BLANK_RUNE = new SlimefunItemStack("BLANK_RUNE", new ColoredFireworkStar(Color.BLACK, "&8Blank Rune"));
|
||||
public static final SlimefunItemStack BLANK_RUNE = new SlimefunItemStack("BLANK_RUNE", new ColoredFireworkStar(Color.BLACK, "&8Blank Rune"));
|
||||
|
||||
public static final ItemStack RUNE_AIR = new SlimefunItemStack("ANCIENT_RUNE_AIR", new ColoredFireworkStar(Color.AQUA, "&7Ancient Rune &8&l[&b&lAir&8&l]"));
|
||||
public static final ItemStack RUNE_WATER = new SlimefunItemStack("ANCIENT_RUNE_WATER", new ColoredFireworkStar(Color.BLUE, "&7Ancient Rune &8&l[&1&lWater&8&l]"));
|
||||
@ -634,9 +634,9 @@ public final class SlimefunItems {
|
||||
public static final ItemStack PROGRAMMABLE_ANDROID_2_FARMER = new SlimefunItemStack("PROGRAMMABLE_ANDROID_2_FARMER", "f9d33357e8418823bf783de92de80291b4ebd392aec8706698e06896d498f6", "&cAdvanced Programmable Android &7(Farmer)", "", "&8\u21E8 &7Function: Farming", "&8\u21E8 &7Fuel Efficiency: 1.5x", "&8\u21E8 &7Can also harvest Plants from ExoticGarden");
|
||||
public static final ItemStack PROGRAMMABLE_ANDROID_2_BUTCHER = new SlimefunItemStack("PROGRAMMABLE_ANDROID_2_BUTCHER", "3b472df0ad9a3be88f2e5d5d422d02b116d64d8df1475ed32e546afc84b31", "&cAdvanced Programmable Android &7(Butcher)", "", "&8\u21E8 &7Function: Slaughtering", "&8\u21E8 &7Damage: 8", "&8\u21E8 &7Fuel Efficiency: 1.5x");
|
||||
|
||||
public static final ItemStack PROGRAMMABLE_ANDROID_3 = new SlimefunItemStack("PROGRAMMABLE_ANDROID_3", "3503cb7ed845e7a507f569afc647c47ac483771465c9a679a54594c76afba", "&eEmpowered Programmable Android &7(Normal)", "", "&8\u21E8 &7Function: None", "&8\u21E8 &7Fuel Efficiency: 3.0x");
|
||||
public static final ItemStack PROGRAMMABLE_ANDROID_3_FISHERMAN = new SlimefunItemStack("PROGRAMMABLE_ANDROID_3_FISHERMAN", "345e8733a73114333b98b3601751241722f4713e1a1a5d36fbb132493f1c7", "&eEmpowered Programmable Android &7(Fisherman)", "", "&8\u21E8 &7Function: Fishing", "&8\u21E8 &7Success Rate: 30%", "&8\u21E8 &7Fuel Efficiency: 8.0x");
|
||||
public static final ItemStack PROGRAMMABLE_ANDROID_3_BUTCHER = new SlimefunItemStack("PROGRAMMABLE_ANDROID_3_BUTCHER", "3b472df0ad9a3be88f2e5d5d422d02b116d64d8df1475ed32e546afc84b31", "&eEmpowered Programmable Android &7(Butcher)", "", "&8\u21E8 &7Function: Slaughtering", "&8\u21E8 &7Damage: 20", "&8\u21E8 &7Fuel Efficiency: 8.0x");
|
||||
public static final SlimefunItemStack PROGRAMMABLE_ANDROID_3 = new SlimefunItemStack("PROGRAMMABLE_ANDROID_3", "3503cb7ed845e7a507f569afc647c47ac483771465c9a679a54594c76afba", "&eEmpowered Programmable Android &7(Normal)", "", "&8\u21E8 &7Function: None", "&8\u21E8 &7Fuel Efficiency: 3.0x");
|
||||
public static final SlimefunItemStack PROGRAMMABLE_ANDROID_3_FISHERMAN = new SlimefunItemStack("PROGRAMMABLE_ANDROID_3_FISHERMAN", "345e8733a73114333b98b3601751241722f4713e1a1a5d36fbb132493f1c7", "&eEmpowered Programmable Android &7(Fisherman)", "", "&8\u21E8 &7Function: Fishing", "&8\u21E8 &7Success Rate: 30%", "&8\u21E8 &7Fuel Efficiency: 8.0x");
|
||||
public static final SlimefunItemStack PROGRAMMABLE_ANDROID_3_BUTCHER = new SlimefunItemStack("PROGRAMMABLE_ANDROID_3_BUTCHER", "3b472df0ad9a3be88f2e5d5d422d02b116d64d8df1475ed32e546afc84b31", "&eEmpowered Programmable Android &7(Butcher)", "", "&8\u21E8 &7Function: Slaughtering", "&8\u21E8 &7Damage: 20", "&8\u21E8 &7Fuel Efficiency: 8.0x");
|
||||
|
||||
/* GPS */
|
||||
public static final ItemStack GPS_TRANSMITTER = new SlimefunItemStack("GPS_TRANSMITTER", "b0c9c1a022f40b73f14b4cba37c718c6a533f3a2864b6536d5f456934cc1f", "&bGPS Transmitter", "", LoreBuilder.powerBuffer(16), LoreBuilder.powerPerSecond(2));
|
||||
@ -648,8 +648,8 @@ public final class SlimefunItems {
|
||||
public static final ItemStack GPS_CONTROL_PANEL = new SlimefunItemStack("GPS_CONTROL_PANEL", "ddcfba58faf1f64847884111822b64afa21d7fc62d4481f14f3f3bcb6330", "&bGPS Control Panel", "", "&rAllows you to track your Satellites", "&rand manage your Waypoints");
|
||||
public static final ItemStack GPS_EMERGENCY_TRANSMITTER = new SlimefunItemStack("GPS_EMERGENCY_TRANSMITTER", "b0c9c1a022f40b73f14b4cba37c718c6a533f3a2864b6536d5f456934cc1f", "&cGPS Emergency Transmitter", "", "&rCarrying this in your Inventory", "&rautomatically sets a Waypoint", "&rat your Location when you die.");
|
||||
|
||||
public static final ItemStack ANDROID_INTERFACE_FUEL = new SlimefunItemStack("ANDROID_INTERFACE_FUEL", Material.DISPENSER, "&7Android Interface &c(Fuel)", "", "&rItems stored in this Interface", "&rwill be inserted into an Android's Fuel Slot", "&rwhen its Script tells them to do so");
|
||||
public static final ItemStack ANDROID_INTERFACE_ITEMS = new SlimefunItemStack("ANDROID_INTERFACE_ITEMS", Material.DISPENSER, "&7Android Interface &9(Items)", "", "&rItems stored in an Android's Inventory", "&rwill be inserted into this Interface", "&rwhen its Script tells them to do so");
|
||||
public static final SlimefunItemStack ANDROID_INTERFACE_FUEL = new SlimefunItemStack("ANDROID_INTERFACE_FUEL", Material.DISPENSER, "&7Android Interface &c(Fuel)", "", "&rItems stored in this Interface", "&rwill be inserted into an Android's Fuel Slot", "&rwhen its Script tells them to do so");
|
||||
public static final SlimefunItemStack ANDROID_INTERFACE_ITEMS = new SlimefunItemStack("ANDROID_INTERFACE_ITEMS", Material.DISPENSER, "&7Android Interface &9(Items)", "", "&rItems stored in an Android's Inventory", "&rwill be inserted into this Interface", "&rwhen its Script tells them to do so");
|
||||
|
||||
public static final ItemStack GPS_GEO_SCANNER = new SlimefunItemStack("GPS_GEO_SCANNER", "2ad8cfeb387a56e3e5bcf85345d6a417b242293887db3ce3ba91fa409b254b86", "&bGPS Geo-Scanner", "", "&rScans a Chunk for natural Resources", "&rsuch as &8Oil");
|
||||
public static final ItemStack PORTABLE_GEO_SCANNER = new SlimefunItemStack("PORTABLE_GEO_SCANNER", Material.CLOCK, "&bPortable Geo-Scanner", "", "&rScans a Chunk for natural Resources", "", "&eRight Click&7 to scan");
|
||||
@ -662,12 +662,12 @@ public final class SlimefunItems {
|
||||
public static final ItemStack COMBUSTION_REACTOR = new SlimefunItemStack("COMBUSTION_REACTOR", "9343ce58da54c79924a2c9331cfc417fe8ccbbea9be45a7ac85860a6c730", "&cCombustion Reactor", "", LoreBuilder.machine(MachineTier.ADVANCED, MachineType.GENERATOR), LoreBuilder.powerBuffer(256), LoreBuilder.powerPerSecond(24));
|
||||
public static final ItemStack ANDROID_MEMORY_CORE = new SlimefunItemStack("ANDROID_MEMORY_CORE", "d78f2b7e5e75639ea7fb796c35d364c4df28b4243e66b76277aadcd6261337", "&bAndroid Memory Core");
|
||||
|
||||
public static final ItemStack GPS_TELEPORTER_PYLON = new SlimefunItemStack("GPS_TELEPORTER_PYLON", Material.PURPLE_STAINED_GLASS, "&5GPS Teleporter Pylon", "", "&7Teleporter Component");
|
||||
public static final ItemStack GPS_TELEPORTATION_MATRIX = new SlimefunItemStack("GPS_TELEPORTATION_MATRIX", Material.IRON_BLOCK, "&bGPS Teleporter Matrix", "", "&rThis is your Teleporter's Main Component", "&rThis Matrix allows Players to choose from all", "&rWaypoints made by the Player who has placed", "&rthis Device.");
|
||||
public static final ItemStack GPS_ACTIVATION_DEVICE_SHARED = new SlimefunItemStack("GPS_ACTIVATION_DEVICE_SHARED", Material.STONE_PRESSURE_PLATE, "&rGPS Activation Device &3(Shared)", "", "&rPlace this onto a Teleportation Matrix", "&rand step onto this Plate to activate", "&rthe Teleportation Process");
|
||||
public static final ItemStack GPS_ACTIVATION_DEVICE_PERSONAL = new SlimefunItemStack("GPS_ACTIVATION_DEVICE_PERSONAL", Material.STONE_PRESSURE_PLATE, "&rGPS Activation Device &a(Personal)", "", "&rPlace this onto a Teleportation Matrix", "&rand step onto this Plate to activate", "&rthe Teleportation Process", "", "&rThis Version only allows the Person who", "&rplaced this Device to use it");
|
||||
public static final SlimefunItemStack GPS_TELEPORTER_PYLON = new SlimefunItemStack("GPS_TELEPORTER_PYLON", Material.PURPLE_STAINED_GLASS, "&5GPS Teleporter Pylon", "", "&7Teleporter Component");
|
||||
public static final SlimefunItemStack GPS_TELEPORTATION_MATRIX = new SlimefunItemStack("GPS_TELEPORTATION_MATRIX", Material.IRON_BLOCK, "&bGPS Teleporter Matrix", "", "&rThis is your Teleporter's Main Component", "&rThis Matrix allows Players to choose from all", "&rWaypoints made by the Player who has placed", "&rthis Device.");
|
||||
public static final SlimefunItemStack GPS_ACTIVATION_DEVICE_SHARED = new SlimefunItemStack("GPS_ACTIVATION_DEVICE_SHARED", Material.STONE_PRESSURE_PLATE, "&rGPS Activation Device &3(Shared)", "", "&rPlace this onto a Teleportation Matrix", "&rand step onto this Plate to activate", "&rthe Teleportation Process");
|
||||
public static final SlimefunItemStack GPS_ACTIVATION_DEVICE_PERSONAL = new SlimefunItemStack("GPS_ACTIVATION_DEVICE_PERSONAL", Material.STONE_PRESSURE_PLATE, "&rGPS Activation Device &a(Personal)", "", "&rPlace this onto a Teleportation Matrix", "&rand step onto this Plate to activate", "&rthe Teleportation Process", "", "&rThis Version only allows the Person who", "&rplaced this Device to use it");
|
||||
|
||||
public static final ItemStack ELEVATOR = new SlimefunItemStack("ELEVATOR_PLATE", Material.STONE_PRESSURE_PLATE, "&bElevator Plate", "", "&rPlace an Elevator Plate on every floor", "&rand you will be able to teleport between them.", "", "&eRight Click this Block &7to name it");
|
||||
public static final SlimefunItemStack ELEVATOR = new SlimefunItemStack("ELEVATOR_PLATE", Material.STONE_PRESSURE_PLATE, "&bElevator Plate", "", "&rPlace an Elevator Plate on every floor", "&rand you will be able to teleport between them.", "", "&eRight Click this Block &7to name it");
|
||||
|
||||
public static final ItemStack INFUSED_HOPPER = new SlimefunItemStack("INFUSED_HOPPER", Material.HOPPER, "&5Infused Hopper", "", "&rAutomatically picks up nearby Items in a 7x7x7", "&rRadius when placed.");
|
||||
|
||||
@ -708,7 +708,7 @@ public final class SlimefunItems {
|
||||
public static final ItemStack CARGO_OUTPUT = new SlimefunItemStack("CARGO_NODE_OUTPUT", "55b21fd480c1c43bf3b9f842c869bdc3bc5acc2599bf2eb6b8a1c95dce978f", "&7Cargo Node &c(Output)", "", "&rCargo Output Pipe");
|
||||
public static final ItemStack CARGO_OUTPUT_ADVANCED = new SlimefunItemStack("CARGO_NODE_OUTPUT_ADVANCED", "55b21fd480c1c43bf3b9f842c869bdc3bc5acc2599bf2eb6b8a1c95dce978f", "&6Advanced Cargo Node &c(Output)", "", "&rCargo Output Pipe");
|
||||
|
||||
public static final ItemStack AUTO_BREEDER = new SlimefunItemStack("AUTO_BREEDER", Material.HAY_BLOCK, "&eAuto-Breeder", "", "&rRuns on &aOrganic Food", "", LoreBuilder.machine(MachineTier.END_GAME, MachineType.MACHINE), LoreBuilder.powerBuffer(1024), "&8\u21E8 &e\u26A1 &760 J/Animal");
|
||||
public static final SlimefunItemStack AUTO_BREEDER = new SlimefunItemStack("AUTO_BREEDER", Material.HAY_BLOCK, "&eAuto-Breeder", "", "&rRuns on &aOrganic Food", "", LoreBuilder.machine(MachineTier.END_GAME, MachineType.MACHINE), LoreBuilder.powerBuffer(1024), "&8\u21E8 &e\u26A1 &760 J/Animal");
|
||||
|
||||
public static final ItemStack ORGANIC_FOOD = new CustomItem(SkullItem.fromBase64("b439e3f5acbee9be4c4259289d6d9f35c635ffa661114687b3ea6dda8c79"), "&aOrganic Food", "&7Content: &9X");
|
||||
public static final SlimefunItemStack WHEAT_ORGANIC_FOOD = new SlimefunItemStack("ORGANIC_FOOD_WHEAT", "b439e3f5acbee9be4c4259289d6d9f35c635ffa661114687b3ea6dda8c79", "&aOrganic Food", "&7Content: &9Wheat");
|
||||
@ -773,16 +773,17 @@ public final class SlimefunItems {
|
||||
|
||||
public static final SlimefunItemStack TRASH_CAN = new SlimefunItemStack("TRASH_CAN_BLOCK", "32d41042ce99147cc38cac9e46741576e7ee791283e6fac8d3292cae2935f1f", "&3Trash Can", "", "&rWill destroy all Items put into it");
|
||||
|
||||
public static final ItemStack ELYTRA = new ItemStack(Material.ELYTRA);
|
||||
public static final SlimefunItemStack ELYTRA_SCALE = new SlimefunItemStack("ELYTRA_SCALE", Material.FEATHER, "&bElytra Scale");
|
||||
public static final SlimefunItemStack INFUSED_ELYTRA = new SlimefunItemStack("INFUSED_ELYTRA", Material.ELYTRA, "&5Infused Elytra");
|
||||
public static final SlimefunItemStack SOULBOUND_ELYTRA = new SlimefunItemStack("SOULBOUND_ELYTRA", Material.ELYTRA, "&cSoulbound Elytra");
|
||||
|
||||
public static final ItemStack TOTEM_OF_UNDYING = new ItemStack(Material.TOTEM_OF_UNDYING);
|
||||
|
||||
public static final SlimefunItemStack MAGNESIUM_SALT = new SlimefunItemStack("MAGNESIUM_SALT", Material.SUGAR, "&cMagnesium Salt", "", "&7A special type of fuel that can be", "&7used in a Magnesium-powered Generator");
|
||||
public static final SlimefunItemStack MAGNESIUM_GENERATOR = new SlimefunItemStack("MAGNESIUM_GENERATOR", "9343ce58da54c79924a2c9331cfc417fe8ccbbea9be45a7ac85860a6c730", "&cMagnesium-powered Generator", "", LoreBuilder.machine(MachineTier.MEDIUM, MachineType.GENERATOR), LoreBuilder.powerBuffer(128), LoreBuilder.powerPerSecond(36));
|
||||
|
||||
// Vanilla Items
|
||||
public static final ItemStack ELYTRA = new ItemStack(Material.ELYTRA);
|
||||
public static final ItemStack TOTEM_OF_UNDYING = new ItemStack(Material.TOTEM_OF_UNDYING);
|
||||
|
||||
static {
|
||||
INFUSED_ELYTRA.addUnsafeEnchantment(Enchantment.MENDING, 1);
|
||||
|
||||
|
@ -18,13 +18,11 @@ import io.github.thebusybiscuit.cscorelib2.item.CustomItem;
|
||||
import io.github.thebusybiscuit.slimefun4.core.categories.SeasonalCategory;
|
||||
import io.github.thebusybiscuit.slimefun4.core.guide.SlimefunGuide;
|
||||
import me.mrCookieSlime.Slimefun.SlimefunPlugin;
|
||||
import me.mrCookieSlime.Slimefun.Lists.Categories;
|
||||
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.SlimefunItem;
|
||||
import me.mrCookieSlime.Slimefun.api.Slimefun;
|
||||
|
||||
/**
|
||||
* Represents a category, which structure multiple {@link SlimefunItem} in the {@link SlimefunGuide}.
|
||||
* See {@link Categories} for all built-in categories.
|
||||
*
|
||||
* @author TheBusyBiscuit
|
||||
*
|
||||
|
@ -1,14 +1,19 @@
|
||||
package me.mrCookieSlime.Slimefun.Objects;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.logging.Level;
|
||||
|
||||
import org.apache.commons.lang.Validate;
|
||||
import org.bukkit.NamespacedKey;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import io.github.thebusybiscuit.slimefun4.api.player.PlayerProfile;
|
||||
import io.github.thebusybiscuit.slimefun4.core.categories.SeasonalCategory;
|
||||
import me.mrCookieSlime.Slimefun.SlimefunPlugin;
|
||||
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.SlimefunItem;
|
||||
import me.mrCookieSlime.Slimefun.api.Slimefun;
|
||||
|
||||
@ -26,7 +31,8 @@ import me.mrCookieSlime.Slimefun.api.Slimefun;
|
||||
*/
|
||||
public class LockedCategory extends Category {
|
||||
|
||||
private final List<Category> parents;
|
||||
private final NamespacedKey[] keys;
|
||||
private final Set<Category> parents = new HashSet<>();
|
||||
|
||||
/**
|
||||
* The basic constructor for a LockedCategory.
|
||||
@ -40,7 +46,7 @@ public class LockedCategory extends Category {
|
||||
* The parent categories for this category
|
||||
*
|
||||
*/
|
||||
public LockedCategory(NamespacedKey key, ItemStack item, Category... parents) {
|
||||
public LockedCategory(NamespacedKey key, ItemStack item, NamespacedKey... parents) {
|
||||
this(key, item, 3, parents);
|
||||
}
|
||||
|
||||
@ -57,9 +63,33 @@ public class LockedCategory extends Category {
|
||||
* The parent categories for this category
|
||||
*
|
||||
*/
|
||||
public LockedCategory(NamespacedKey key, ItemStack item, int tier, Category... parents) {
|
||||
public LockedCategory(NamespacedKey key, ItemStack item, int tier, NamespacedKey... parents) {
|
||||
super(key, item, tier);
|
||||
this.parents = Arrays.asList(parents);
|
||||
Validate.noNullElements(parents, "A LockedCategory must not have any 'null' parents!");
|
||||
this.keys = parents;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void register() {
|
||||
super.register();
|
||||
|
||||
List<NamespacedKey> namespacedKeys = new ArrayList<>();
|
||||
|
||||
for (NamespacedKey key : keys) {
|
||||
if (key != null) {
|
||||
namespacedKeys.add(key);
|
||||
}
|
||||
}
|
||||
|
||||
for (Category category : SlimefunPlugin.getRegistry().getCategories()) {
|
||||
if (namespacedKeys.remove(category.getKey())) {
|
||||
addParent(category);
|
||||
}
|
||||
}
|
||||
|
||||
for (NamespacedKey key : namespacedKeys) {
|
||||
Slimefun.getLogger().log(Level.INFO, "Parent \"{0}\" for Category \"{1}\" was not found, probably just disabled.", new Object[] { key, getKey() });
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -70,7 +100,7 @@ public class LockedCategory extends Category {
|
||||
* @see #addParent(Category)
|
||||
* @see #removeParent(Category)
|
||||
*/
|
||||
public List<Category> getParents() {
|
||||
public Set<Category> getParents() {
|
||||
return parents;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user