mirror of
https://github.com/StarWishsama/Slimefun4.git
synced 2024-09-20 03:35:51 +00:00
commit
37585d0584
13
CHANGELOG.md
13
CHANGELOG.md
@ -2,6 +2,7 @@
|
||||
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
|
||||
**Table of contents**
|
||||
|
||||
- [Release Candidate 18 (TBD)](#release-candidate-18-tbd)
|
||||
- [Release Candidate 17 (17 Oct 2020)](#release-candidate-17-17-oct-2020)
|
||||
- [Release Candidate 16 (07 Sep 2020)](#release-candidate-16-07-sep-2020)
|
||||
- [Release Candidate 15 (01 Aug 2020)](#release-candidate-15-01-aug-2020)
|
||||
@ -22,6 +23,18 @@
|
||||
|
||||
<!-- END doctoc generated TOC please keep comment here to allow auto update -->
|
||||
|
||||
## Release Candidate 18 (TBD)
|
||||
|
||||
#### Additions
|
||||
|
||||
#### Changes
|
||||
* Removed 1.13 support
|
||||
|
||||
#### Fixes
|
||||
* Fixed #2448
|
||||
* Fixed #2470
|
||||
* Fixed #2478
|
||||
|
||||
## Release Candidate 17 (17 Oct 2020)
|
||||
|
||||
#### Additions
|
||||
|
@ -32,7 +32,7 @@ Here is a full summary of the differences between the two different versions of
|
||||
|
||||
| | development (latest) | "stable" |
|
||||
| ------------------ | -------- | -------- |
|
||||
| **Minecraft version(s)** | :video_game: **1.13.\* - 1.16.\*** | :video_game: **1.13.\* - 1.16.\*** |
|
||||
| **Minecraft version(s)** | :video_game: **1.14.\* - 1.16.\*** | :video_game: **1.13.\* - 1.16.\*** |
|
||||
| **automatic updates** | :heavy_check_mark: | :heavy_check_mark: |
|
||||
| **frequent updates** | :heavy_check_mark: | :x: |
|
||||
| **latest content** | :heavy_check_mark: | :x: |
|
||||
|
2
pom.xml
2
pom.xml
@ -349,7 +349,7 @@
|
||||
<dependency>
|
||||
<groupId>com.konghq</groupId>
|
||||
<artifactId>unirest-java</artifactId>
|
||||
<version>3.11.01</version>
|
||||
<version>3.11.02</version>
|
||||
<scope>compile</scope>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
|
@ -14,12 +14,6 @@ import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin;
|
||||
*/
|
||||
public enum MinecraftVersion {
|
||||
|
||||
/**
|
||||
* This constant represents Minecraft (Java Edition) Version 1.14
|
||||
* (The Update Aquatic)
|
||||
*/
|
||||
MINECRAFT_1_13("1.13.x"),
|
||||
|
||||
/**
|
||||
* This constant represents Minecraft (Java Edition) Version 1.14
|
||||
* (The "Village & Pillage" Update)
|
||||
|
@ -22,14 +22,12 @@ import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import io.github.thebusybiscuit.cscorelib2.collections.KeyMap;
|
||||
import io.github.thebusybiscuit.cscorelib2.config.Config;
|
||||
import io.github.thebusybiscuit.slimefun4.api.MinecraftVersion;
|
||||
import io.github.thebusybiscuit.slimefun4.api.geo.GEOResource;
|
||||
import io.github.thebusybiscuit.slimefun4.api.player.PlayerProfile;
|
||||
import io.github.thebusybiscuit.slimefun4.core.guide.SlimefunGuideImplementation;
|
||||
import io.github.thebusybiscuit.slimefun4.core.guide.SlimefunGuideLayout;
|
||||
import io.github.thebusybiscuit.slimefun4.core.multiblocks.MultiBlock;
|
||||
import io.github.thebusybiscuit.slimefun4.core.researching.Research;
|
||||
import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin;
|
||||
import io.github.thebusybiscuit.slimefun4.implementation.guide.BookSlimefunGuide;
|
||||
import io.github.thebusybiscuit.slimefun4.implementation.guide.CheatSheetSlimefunGuide;
|
||||
import io.github.thebusybiscuit.slimefun4.implementation.guide.ChestSlimefunGuide;
|
||||
@ -100,7 +98,7 @@ public final class SlimefunRegistry {
|
||||
|
||||
researchRanks.addAll(cfg.getStringList("research-ranks"));
|
||||
|
||||
backwardsCompatibility = cfg.getBoolean("options.backwards-compatibility") || SlimefunPlugin.getMinecraftVersion().isBefore(MinecraftVersion.MINECRAFT_1_14);
|
||||
backwardsCompatibility = cfg.getBoolean("options.backwards-compatibility");
|
||||
freeCreativeResearches = cfg.getBoolean("researches.free-in-creative-mode");
|
||||
researchFireworks = cfg.getBoolean("researches.enable-fireworks");
|
||||
logDuplicateBlockEntries = cfg.getBoolean("options.log-duplicate-block-entries");
|
||||
|
@ -13,7 +13,6 @@ import org.bukkit.inventory.meta.ItemMeta;
|
||||
import org.bukkit.persistence.PersistentDataType;
|
||||
|
||||
import io.github.thebusybiscuit.cscorelib2.chat.ChatColors;
|
||||
import io.github.thebusybiscuit.slimefun4.api.MinecraftVersion;
|
||||
import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin;
|
||||
import io.github.thebusybiscuit.slimefun4.utils.PatternUtils;
|
||||
import net.md_5.bungee.api.ChatColor;
|
||||
@ -39,9 +38,7 @@ final class RechargeableHelper {
|
||||
BigDecimal decimal = BigDecimal.valueOf(charge).setScale(2, RoundingMode.HALF_UP);
|
||||
float value = decimal.floatValue();
|
||||
|
||||
if (SlimefunPlugin.getMinecraftVersion().isAtLeast(MinecraftVersion.MINECRAFT_1_14)) {
|
||||
meta.getPersistentDataContainer().set(CHARGE_KEY, PersistentDataType.FLOAT, value);
|
||||
}
|
||||
meta.getPersistentDataContainer().set(CHARGE_KEY, PersistentDataType.FLOAT, value);
|
||||
|
||||
List<String> lore = meta.hasLore() ? meta.getLore() : new ArrayList<>();
|
||||
for (int i = 0; i < lore.size(); i++) {
|
||||
@ -59,13 +56,11 @@ final class RechargeableHelper {
|
||||
}
|
||||
|
||||
static float getCharge(@Nonnull ItemMeta meta) {
|
||||
if (SlimefunPlugin.getMinecraftVersion().isAtLeast(MinecraftVersion.MINECRAFT_1_14)) {
|
||||
Float value = meta.getPersistentDataContainer().get(CHARGE_KEY, PersistentDataType.FLOAT);
|
||||
Float value = meta.getPersistentDataContainer().get(CHARGE_KEY, PersistentDataType.FLOAT);
|
||||
|
||||
// If persistent data is available, we just return this value
|
||||
if (value != null) {
|
||||
return value;
|
||||
}
|
||||
// If persistent data is available, we just return this value
|
||||
if (value != null) {
|
||||
return value;
|
||||
}
|
||||
|
||||
// If no persistent data exists, we will just fall back to the lore
|
||||
|
@ -12,7 +12,6 @@ import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import io.github.thebusybiscuit.cscorelib2.item.CustomItem;
|
||||
import io.github.thebusybiscuit.slimefun4.api.MinecraftVersion;
|
||||
import io.github.thebusybiscuit.slimefun4.core.guide.SlimefunGuide;
|
||||
import io.github.thebusybiscuit.slimefun4.core.guide.SlimefunGuideLayout;
|
||||
import io.github.thebusybiscuit.slimefun4.core.services.localization.Language;
|
||||
@ -41,11 +40,8 @@ public final class SlimefunGuideSettings {
|
||||
|
||||
static {
|
||||
options.add(new GuideLayoutOption());
|
||||
|
||||
if (SlimefunPlugin.getMinecraftVersion().isAtLeast(MinecraftVersion.MINECRAFT_1_14)) {
|
||||
options.add(new FireworksOption());
|
||||
options.add(new PlayerLanguageOption());
|
||||
}
|
||||
options.add(new FireworksOption());
|
||||
options.add(new PlayerLanguageOption());
|
||||
}
|
||||
|
||||
private SlimefunGuideSettings() {}
|
||||
|
@ -41,10 +41,8 @@ public class MultiBlock {
|
||||
SUPPORTED_TAGS.add(Tag.LOGS);
|
||||
SUPPORTED_TAGS.add(Tag.WOODEN_TRAPDOORS);
|
||||
SUPPORTED_TAGS.add(Tag.WOODEN_SLABS);
|
||||
SUPPORTED_TAGS.add(Tag.WOODEN_FENCES);
|
||||
|
||||
if (SlimefunPlugin.getMinecraftVersion().isAtLeast(MinecraftVersion.MINECRAFT_1_14)) {
|
||||
SUPPORTED_TAGS.add(Tag.WOODEN_FENCES);
|
||||
}
|
||||
if (SlimefunPlugin.getMinecraftVersion().isAtLeast(MinecraftVersion.MINECRAFT_1_16)) {
|
||||
SUPPORTED_TAGS.add(Tag.FIRE);
|
||||
}
|
||||
|
@ -18,10 +18,10 @@ import org.bukkit.inventory.InventoryHolder;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import io.github.thebusybiscuit.cscorelib2.blocks.BlockPosition;
|
||||
import io.github.thebusybiscuit.slimefun4.api.MinecraftVersion;
|
||||
import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin;
|
||||
import io.github.thebusybiscuit.slimefun4.utils.SlimefunUtils;
|
||||
import io.github.thebusybiscuit.slimefun4.utils.itemstack.ItemStackWrapper;
|
||||
import io.github.thebusybiscuit.slimefun4.utils.tags.SlimefunTag;
|
||||
import io.papermc.lib.PaperLib;
|
||||
import me.mrCookieSlime.CSCoreLibPlugin.Configuration.Config;
|
||||
import me.mrCookieSlime.Slimefun.api.BlockStorage;
|
||||
@ -54,6 +54,10 @@ final class CargoUtils {
|
||||
|
||||
Material type = block.getType();
|
||||
|
||||
if (SlimefunTag.SHULKER_BOXES.isTagged(type)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
switch (type) {
|
||||
case CHEST:
|
||||
case TRAPPED_CHEST:
|
||||
@ -62,28 +66,13 @@ final class CargoUtils {
|
||||
case DROPPER:
|
||||
case HOPPER:
|
||||
case BREWING_STAND:
|
||||
case SHULKER_BOX:
|
||||
case BARREL:
|
||||
case BLAST_FURNACE:
|
||||
case SMOKER:
|
||||
return true;
|
||||
default:
|
||||
break;
|
||||
return false;
|
||||
}
|
||||
|
||||
if (type.name().endsWith("_SHULKER_BOX")) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (SlimefunPlugin.getMinecraftVersion().isAtLeast(MinecraftVersion.MINECRAFT_1_14)) {
|
||||
switch (type) {
|
||||
case BARREL:
|
||||
case BLAST_FURNACE:
|
||||
case SMOKER:
|
||||
return true;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
static int[] getInputSlotRange(@Nonnull Inventory inv, @Nullable ItemStack item) {
|
||||
|
@ -11,9 +11,6 @@ import org.bukkit.block.TileState;
|
||||
import org.bukkit.persistence.PersistentDataHolder;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
|
||||
import io.github.thebusybiscuit.slimefun4.api.MinecraftVersion;
|
||||
import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin;
|
||||
|
||||
/**
|
||||
* The {@link BlockDataService} is similar to the {@link CustomItemDataService},
|
||||
* it is responsible for storing NBT data inside a {@link TileState}.
|
||||
@ -83,9 +80,8 @@ public class BlockDataService implements PersistentDataService, Keyed {
|
||||
* @return Whether the given {@link Material} is considered a Tile Entity
|
||||
*/
|
||||
public boolean isTileEntity(Material type) {
|
||||
if (type == null || !SlimefunPlugin.getMinecraftVersion().isAtLeast(MinecraftVersion.MINECRAFT_1_14)) {
|
||||
// We can only store data on Tile Entities in 1.14+
|
||||
// So we will just return false here in that case.
|
||||
if (type == null || type.isAir()) {
|
||||
// Cannot store data on air
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -10,8 +10,6 @@ import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.meta.ItemMeta;
|
||||
|
||||
import io.github.thebusybiscuit.cscorelib2.config.Config;
|
||||
import io.github.thebusybiscuit.slimefun4.api.MinecraftVersion;
|
||||
import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin;
|
||||
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.SlimefunItem;
|
||||
import me.mrCookieSlime.Slimefun.api.SlimefunItemStack;
|
||||
|
||||
@ -101,10 +99,7 @@ public class CustomTextureService {
|
||||
|
||||
public void setTexture(@Nonnull ItemMeta im, @Nonnull String id) {
|
||||
int data = getModelData(id);
|
||||
|
||||
if (SlimefunPlugin.getMinecraftVersion().isAtLeast(MinecraftVersion.MINECRAFT_1_14)) {
|
||||
im.setCustomModelData(data == 0 ? null : data);
|
||||
}
|
||||
im.setCustomModelData(data == 0 ? null : data);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -7,8 +7,8 @@ import org.bukkit.persistence.PersistentDataContainer;
|
||||
import org.bukkit.persistence.PersistentDataHolder;
|
||||
import org.bukkit.persistence.PersistentDataType;
|
||||
|
||||
import io.github.thebusybiscuit.cscorelib2.data.PersistentDataAPI;
|
||||
import io.github.thebusybiscuit.slimefun4.api.MinecraftVersion;
|
||||
import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin;
|
||||
|
||||
/**
|
||||
* This interface is used to defer calls to Persistent Data and make sure they are only called
|
||||
@ -16,23 +16,20 @@ import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin;
|
||||
*
|
||||
* @author TheBusyBiscuit
|
||||
*
|
||||
* @deprecated This is redundant, we can use {@link PersistentDataAPI} instead.
|
||||
*
|
||||
*/
|
||||
@Deprecated
|
||||
interface PersistentDataService {
|
||||
|
||||
default void setString(Object obj, NamespacedKey key, String value) {
|
||||
if (SlimefunPlugin.getMinecraftVersion().isAtLeast(MinecraftVersion.MINECRAFT_1_14) && obj instanceof PersistentDataHolder) {
|
||||
PersistentDataContainer container = ((PersistentDataHolder) obj).getPersistentDataContainer();
|
||||
container.set(key, PersistentDataType.STRING, value);
|
||||
}
|
||||
PersistentDataContainer container = ((PersistentDataHolder) obj).getPersistentDataContainer();
|
||||
container.set(key, PersistentDataType.STRING, value);
|
||||
}
|
||||
|
||||
default Optional<String> getString(Object obj, NamespacedKey key) {
|
||||
if (SlimefunPlugin.getMinecraftVersion().isAtLeast(MinecraftVersion.MINECRAFT_1_14) && obj instanceof PersistentDataHolder) {
|
||||
PersistentDataContainer container = ((PersistentDataHolder) obj).getPersistentDataContainer();
|
||||
return Optional.ofNullable(container.get(key, PersistentDataType.STRING));
|
||||
}
|
||||
|
||||
return Optional.empty();
|
||||
PersistentDataContainer container = ((PersistentDataHolder) obj).getPersistentDataContainer();
|
||||
return Optional.ofNullable(container.get(key, PersistentDataType.STRING));
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -394,7 +394,7 @@ public final class SlimefunItems {
|
||||
public static final SlimefunItemStack PLASTIC_SHEET = new SlimefunItemStack("PLASTIC_SHEET", Material.PAPER, "&fPlastic Sheet");
|
||||
|
||||
public static final SlimefunItemStack MAGNET = new SlimefunItemStack("MAGNET", HeadTexture.MAGNET, "&cMagnet");
|
||||
public static final SlimefunItemStack NECROTIC_SKULL = new SlimefunItemStack("NECROTIC_SKULL", Material.WITHER_SKELETON_SKULL, "&cNecrotic Skull");
|
||||
public static final SlimefunItemStack NECROTIC_SKULL = new SlimefunItemStack("NECROTIC_SKULL", HeadTexture.NECROTIC_SKULL, "&cNecrotic Skull");
|
||||
public static final SlimefunItemStack ESSENCE_OF_AFTERLIFE = new SlimefunItemStack("ESSENCE_OF_AFTERLIFE", Material.GUNPOWDER, "&4Essence of Afterlife");
|
||||
public static final SlimefunItemStack STRANGE_NETHER_GOO = new SlimefunItemStack("STRANGE_NETHER_GOO", Material.PURPLE_DYE, "&5Strange Nether Goo", "", "&fA strange bio matter that", "&fcan be acquired from", "&fbartering with Piglins");
|
||||
public static final SlimefunItemStack ELECTRO_MAGNET = new SlimefunItemStack("ELECTRO_MAGNET", HeadTexture.MAGNET, "&cElectromagnet");
|
||||
@ -567,14 +567,14 @@ public final class SlimefunItems {
|
||||
public static final SlimefunItemStack ENHANCED_CRAFTING_TABLE = new SlimefunItemStack("ENHANCED_CRAFTING_TABLE", Material.CRAFTING_TABLE, "&eEnhanced Crafting Table", "", "&aA regular Crafting Table cannot", "&ahold this massive Amount of Power...");
|
||||
public static final SlimefunItemStack GRIND_STONE = new SlimefunItemStack("GRIND_STONE", Material.DISPENSER, "&bGrind Stone", "", "&aGrinds items down into other items");
|
||||
public static final SlimefunItemStack ARMOR_FORGE = new SlimefunItemStack("ARMOR_FORGE", Material.ANVIL, "&6Armor Forge", "", "&aGives you the ability to create powerful armor");
|
||||
public static final SlimefunItemStack MAKESHIFT_SMELTERY;
|
||||
public static final SlimefunItemStack MAKESHIFT_SMELTERY = new SlimefunItemStack("MAKESHIFT_SMELTERY", Material.BLAST_FURNACE, "&eMakeshift Smeltery", "", "&fImprovised version of the Smeltery", "&fthat only allows you to", "&fsmelt dusts into ingots");
|
||||
public static final SlimefunItemStack SMELTERY = new SlimefunItemStack("SMELTERY", Material.FURNACE, "&6Smeltery", "", "&fA high-temperature furnace", "&fthat allows you to smelt dusts", "&finto ingots and create alloys.");
|
||||
public static final SlimefunItemStack ORE_CRUSHER = new SlimefunItemStack("ORE_CRUSHER", Material.DISPENSER, "&bOre Crusher", "", "&aCrushes ores to double them");
|
||||
public static final SlimefunItemStack COMPRESSOR = new SlimefunItemStack("COMPRESSOR", Material.PISTON, "&bCompressor", "", "&aCompresses Items");
|
||||
public static final SlimefunItemStack PRESSURE_CHAMBER = new SlimefunItemStack("PRESSURE_CHAMBER", Material.GLASS, "&bPressure Chamber", "", "&aCompresses Items even further");
|
||||
public static final SlimefunItemStack MAGIC_WORKBENCH = new SlimefunItemStack("MAGIC_WORKBENCH", Material.CRAFTING_TABLE, "&6Magic Workbench", "", "&dInfuses Items with magical Energy");
|
||||
public static final SlimefunItemStack ORE_WASHER = new SlimefunItemStack("ORE_WASHER", Material.CAULDRON, "&6Ore Washer", "", "&aWashes Sifted Ore to filter Ores", "&aand gives you small Stone Chunks");
|
||||
public static final SlimefunItemStack TABLE_SAW;
|
||||
public static final SlimefunItemStack TABLE_SAW = new SlimefunItemStack("TABLE_SAW", Material.STONECUTTER, "&6Table Saw", "", "&aAllows you to get 8 planks from 1 Log", "&a(Works with all log types)");
|
||||
public static final SlimefunItemStack JUICER = new SlimefunItemStack("JUICER", Material.GLASS_BOTTLE, "&aJuicer", "", "&aAllows you to create delicious Juice");
|
||||
public static final SlimefunItemStack AUTOMATED_PANNING_MACHINE = new SlimefunItemStack("AUTOMATED_PANNING_MACHINE", Material.BOWL, "&eAutomated Panning Machine", "", "&fA MultiBlock Version of the Gold Pan", "&fand Nether Gold Pan combined in one machine.");
|
||||
|
||||
@ -662,12 +662,12 @@ public final class SlimefunItems {
|
||||
public static final SlimefunItemStack ELECTRIC_ORE_GRINDER = new SlimefunItemStack("ELECTRIC_ORE_GRINDER", Material.FURNACE, "&cElectric Ore Grinder", "", "&fWorks as an Ore Crusher and Grind Stone", "", LoreBuilder.machine(MachineTier.ADVANCED, MachineType.MACHINE), LoreBuilder.speed(1), LoreBuilder.powerPerSecond(12));
|
||||
public static final SlimefunItemStack ELECTRIC_ORE_GRINDER_2 = new SlimefunItemStack("ELECTRIC_ORE_GRINDER_2", Material.FURNACE, "&cElectric Ore Grinder &7(&eII&7)", "", "&fWorks as an Ore Crusher and Grind Stone", "", LoreBuilder.machine(MachineTier.END_GAME, MachineType.MACHINE), LoreBuilder.speed(4), LoreBuilder.powerPerSecond(30));
|
||||
public static final SlimefunItemStack ELECTRIC_INGOT_PULVERIZER = new SlimefunItemStack("ELECTRIC_INGOT_PULVERIZER", Material.FURNACE, "&cElectric Ingot Pulverizer", "", "&fPulverizes Ingots into Dust", "", LoreBuilder.machine(MachineTier.MEDIUM, MachineType.MACHINE), LoreBuilder.speed(1), LoreBuilder.powerPerSecond(14));
|
||||
public static final SlimefunItemStack AUTO_DRIER;
|
||||
public static final SlimefunItemStack AUTO_DRIER = new SlimefunItemStack("AUTO_DRIER", Material.SMOKER, "&6Auto Drier", "", LoreBuilder.machine(MachineTier.MEDIUM, MachineType.MACHINE), LoreBuilder.speed(1), LoreBuilder.powerPerSecond(10));
|
||||
public static final SlimefunItemStack AUTO_ENCHANTER = new SlimefunItemStack("AUTO_ENCHANTER", Material.ENCHANTING_TABLE, "&5Auto Enchanter", "", LoreBuilder.machine(MachineTier.MEDIUM, MachineType.MACHINE), LoreBuilder.speed(1), LoreBuilder.powerPerSecond(18));
|
||||
public static final SlimefunItemStack AUTO_DISENCHANTER = new SlimefunItemStack("AUTO_DISENCHANTER", Material.ENCHANTING_TABLE, "&5Auto Disenchanter", "", LoreBuilder.machine(MachineTier.MEDIUM, MachineType.MACHINE), LoreBuilder.speed(1), LoreBuilder.powerPerSecond(18));
|
||||
public static final SlimefunItemStack AUTO_ANVIL = new SlimefunItemStack("AUTO_ANVIL", Material.IRON_BLOCK, "&7Auto Anvil", "", LoreBuilder.machine(MachineTier.ADVANCED, MachineType.MACHINE), "&8\u21E8 &7Repair Factor: 10%", LoreBuilder.powerPerSecond(24));
|
||||
public static final SlimefunItemStack AUTO_ANVIL_2 = new SlimefunItemStack("AUTO_ANVIL_2", Material.IRON_BLOCK, "&7Auto Anvil Mk.II", "", LoreBuilder.machine(MachineTier.END_GAME, MachineType.MACHINE), "&8\u21E8 &7Repair Factor: 25%", LoreBuilder.powerPerSecond(32));
|
||||
public static final SlimefunItemStack AUTO_BREWER;
|
||||
public static final SlimefunItemStack AUTO_BREWER = new SlimefunItemStack("AUTO_BREWER", Material.SMOKER, "&6Auto Brewer", "", LoreBuilder.machine(MachineTier.MEDIUM, MachineType.MACHINE), LoreBuilder.speed(1), LoreBuilder.powerPerSecond(12));
|
||||
|
||||
public static final SlimefunItemStack BIO_REACTOR = new SlimefunItemStack("BIO_REACTOR", Material.LIME_TERRACOTTA, "&2Bio Reactor", "", LoreBuilder.machine(MachineTier.AVERAGE, MachineType.GENERATOR), LoreBuilder.powerBuffer(128), LoreBuilder.powerPerSecond(8));
|
||||
public static final SlimefunItemStack MULTIMETER = new SlimefunItemStack("MULTIMETER", Material.CLOCK, "&eMultimeter", "", "&fMeasures the Amount of stored", "&fEnergy in a Block");
|
||||
@ -841,17 +841,5 @@ public final class SlimefunItems {
|
||||
|
||||
static {
|
||||
INFUSED_ELYTRA.addUnsafeEnchantment(Enchantment.MENDING, 1);
|
||||
|
||||
if (SlimefunPlugin.getMinecraftVersion().isAtLeast(MinecraftVersion.MINECRAFT_1_14)) {
|
||||
TABLE_SAW = new SlimefunItemStack("TABLE_SAW", Material.STONECUTTER, "&6Table Saw", "", "&aAllows you to get 8 planks from 1 Log", "&a(Works with all log types)");
|
||||
MAKESHIFT_SMELTERY = new SlimefunItemStack("MAKESHIFT_SMELTERY", Material.BLAST_FURNACE, "&eMakeshift Smeltery", "", "&fImprovised version of the Smeltery", "&fthat only allows you to", "&fsmelt dusts into ingots");
|
||||
AUTO_DRIER = new SlimefunItemStack("AUTO_DRIER", Material.SMOKER, "&6Auto Drier", "", LoreBuilder.machine(MachineTier.MEDIUM, MachineType.MACHINE), LoreBuilder.speed(1), LoreBuilder.powerPerSecond(10));
|
||||
AUTO_BREWER = new SlimefunItemStack("AUTO_BREWER", Material.SMOKER, "&6Auto Brewer", "", LoreBuilder.machine(MachineTier.MEDIUM, MachineType.MACHINE), LoreBuilder.speed(1), LoreBuilder.powerPerSecond(12));
|
||||
} else {
|
||||
TABLE_SAW = null;
|
||||
MAKESHIFT_SMELTERY = new SlimefunItemStack("MAKESHIFT_SMELTERY", Material.FURNACE, "&eMakeshift Smeltery", "", "&fImprovised version of the Smeltery", "&fthat only allows you to", "&fsmelt dusts into ingots");
|
||||
AUTO_DRIER = new SlimefunItemStack("AUTO_DRIER", Material.FURNACE, "&6Auto Drier", "", LoreBuilder.machine(MachineTier.MEDIUM, MachineType.MACHINE), LoreBuilder.speed(1), LoreBuilder.powerPerSecond(10));
|
||||
AUTO_BREWER = new SlimefunItemStack("AUTO_BREWER", Material.BREWING_STAND, "&6Auto Brewer", LoreBuilder.machine(MachineTier.MEDIUM, MachineType.MACHINE), LoreBuilder.speed(1), LoreBuilder.powerPerSecond(12));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -469,11 +469,8 @@ public final class SlimefunPlugin extends JavaPlugin implements SlimefunAddon {
|
||||
new AnvilListener(this);
|
||||
new BrewingStandListener(this);
|
||||
new CauldronListener(this);
|
||||
|
||||
if (minecraftVersion.isAtLeast(MinecraftVersion.MINECRAFT_1_14)) {
|
||||
new GrindstoneListener(this);
|
||||
new CartographyTableListener(this);
|
||||
}
|
||||
new GrindstoneListener(this);
|
||||
new CartographyTableListener(this);
|
||||
|
||||
if (minecraftVersion.isAtLeast(MinecraftVersion.MINECRAFT_1_15)) {
|
||||
new BeeListener(this);
|
||||
@ -490,6 +487,7 @@ public final class SlimefunPlugin extends JavaPlugin implements SlimefunAddon {
|
||||
new AncientAltarListener(this, (AncientAltar) SlimefunItems.ANCIENT_ALTAR.getItem(), (AncientPedestal) SlimefunItems.ANCIENT_PEDESTAL.getItem());
|
||||
grapplingHookListener.register(this, (GrapplingHook) SlimefunItems.GRAPPLING_HOOK.getItem());
|
||||
bowListener.register(this);
|
||||
backpackListener.register(this);
|
||||
|
||||
// Toggleable Listeners for performance reasons
|
||||
if (config.getBoolean("items.talismans")) {
|
||||
@ -500,10 +498,6 @@ public final class SlimefunPlugin extends JavaPlugin implements SlimefunAddon {
|
||||
new SoulboundListener(this);
|
||||
}
|
||||
|
||||
if (config.getBoolean("items.backpacks")) {
|
||||
backpackListener.register(this);
|
||||
}
|
||||
|
||||
// Handle Slimefun Guide being given on Join
|
||||
new SlimefunGuideListener(this, config.getBoolean("guide.receive-on-first-join"));
|
||||
|
||||
|
@ -1,7 +1,5 @@
|
||||
package io.github.thebusybiscuit.slimefun4.implementation.guide;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.LinkedList;
|
||||
@ -10,6 +8,9 @@ import java.util.Locale;
|
||||
import java.util.Optional;
|
||||
import java.util.logging.Level;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.ParametersAreNonnullByDefault;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.Sound;
|
||||
@ -26,7 +27,6 @@ import io.github.thebusybiscuit.cscorelib2.chat.ChatInput;
|
||||
import io.github.thebusybiscuit.cscorelib2.inventory.ItemUtils;
|
||||
import io.github.thebusybiscuit.cscorelib2.item.CustomItem;
|
||||
import io.github.thebusybiscuit.cscorelib2.recipes.MinecraftRecipe;
|
||||
import io.github.thebusybiscuit.slimefun4.api.MinecraftVersion;
|
||||
import io.github.thebusybiscuit.slimefun4.api.player.PlayerProfile;
|
||||
import io.github.thebusybiscuit.slimefun4.core.attributes.RecipeDisplayItem;
|
||||
import io.github.thebusybiscuit.slimefun4.core.categories.FlexCategory;
|
||||
@ -65,21 +65,15 @@ import me.mrCookieSlime.Slimefun.api.Slimefun;
|
||||
public class ChestSlimefunGuide implements SlimefunGuideImplementation {
|
||||
|
||||
private static final int CATEGORY_SIZE = 36;
|
||||
private static final Sound sound = Sound.ITEM_BOOK_PAGE_TURN;
|
||||
|
||||
private final ItemStack item;
|
||||
private final int[] recipeSlots = { 3, 4, 5, 12, 13, 14, 21, 22, 23 };
|
||||
private final Sound sound;
|
||||
private final ItemStack item;
|
||||
private final boolean showVanillaRecipes;
|
||||
|
||||
public ChestSlimefunGuide(boolean vanillaRecipes) {
|
||||
showVanillaRecipes = vanillaRecipes;
|
||||
public ChestSlimefunGuide(boolean showVanillaRecipes) {
|
||||
this.showVanillaRecipes = showVanillaRecipes;
|
||||
item = new SlimefunGuideItem(this, "&aSlimefun Guide &7(Chest GUI)");
|
||||
|
||||
if (SlimefunPlugin.getMinecraftVersion().isAtLeast(MinecraftVersion.MINECRAFT_1_14)) {
|
||||
sound = Sound.ITEM_BOOK_PAGE_TURN;
|
||||
} else {
|
||||
sound = Sound.ENTITY_BAT_TAKEOFF;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -132,7 +126,6 @@ public class ChestSlimefunGuide implements SlimefunGuideImplementation {
|
||||
}
|
||||
|
||||
ChestMenu menu = create(p);
|
||||
|
||||
List<Category> categories = getVisibleCategories(p, profile);
|
||||
|
||||
int index = 9;
|
||||
@ -341,26 +334,14 @@ public class ChestSlimefunGuide implements SlimefunGuideImplementation {
|
||||
int index = 9;
|
||||
// Find items and add them
|
||||
for (SlimefunItem slimefunItem : SlimefunPlugin.getRegistry().getEnabledSlimefunItems()) {
|
||||
String itemName = ChatColor.stripColor(slimefunItem.getItemName()).toLowerCase(Locale.ROOT);
|
||||
|
||||
if (index == 44) {
|
||||
break;
|
||||
}
|
||||
|
||||
if (!itemName.isEmpty() && (itemName.equals(searchTerm) || itemName.contains(searchTerm))) {
|
||||
if (isSearchFilterApplicable(slimefunItem, searchTerm)) {
|
||||
ItemStack itemstack = new CustomItem(slimefunItem.getItem(), meta -> {
|
||||
List<String> lore = null;
|
||||
Category category = slimefunItem.getCategory();
|
||||
|
||||
if (category != null) {
|
||||
ItemStack categoryItem = category.getItem(p);
|
||||
|
||||
if (categoryItem != null && categoryItem.hasItemMeta() && categoryItem.getItemMeta().hasDisplayName()) {
|
||||
lore = Arrays.asList("", ChatColor.DARK_GRAY + "\u21E8 " + ChatColor.WHITE + categoryItem.getItemMeta().getDisplayName());
|
||||
}
|
||||
}
|
||||
|
||||
meta.setLore(lore);
|
||||
meta.setLore(Arrays.asList("", ChatColor.DARK_GRAY + "\u21E8 " + ChatColor.WHITE + category.getDisplayName(p)));
|
||||
meta.addItemFlags(ItemFlag.HIDE_ATTRIBUTES, ItemFlag.HIDE_ENCHANTS, ItemFlag.HIDE_POTION_EFFECTS);
|
||||
});
|
||||
|
||||
@ -386,6 +367,12 @@ public class ChestSlimefunGuide implements SlimefunGuideImplementation {
|
||||
menu.open(p);
|
||||
}
|
||||
|
||||
@ParametersAreNonnullByDefault
|
||||
private boolean isSearchFilterApplicable(SlimefunItem slimefunItem, String searchTerm) {
|
||||
String itemName = ChatColor.stripColor(slimefunItem.getItemName()).toLowerCase(Locale.ROOT);
|
||||
return !itemName.isEmpty() && (itemName.equals(searchTerm) || itemName.contains(searchTerm));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void displayItem(PlayerProfile profile, ItemStack item, int index, boolean addToHistory) {
|
||||
Player p = profile.getPlayer();
|
||||
|
@ -10,8 +10,6 @@ import org.bukkit.block.data.Ageable;
|
||||
import org.bukkit.block.data.BlockData;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import io.github.thebusybiscuit.slimefun4.api.MinecraftVersion;
|
||||
import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin;
|
||||
import me.mrCookieSlime.Slimefun.Lists.RecipeType;
|
||||
import me.mrCookieSlime.Slimefun.Objects.Category;
|
||||
import me.mrCookieSlime.Slimefun.api.SlimefunItemStack;
|
||||
@ -57,10 +55,6 @@ public class FarmerAndroid extends ProgrammableAndroid {
|
||||
private ItemStack getDropFromCrop(Material crop) {
|
||||
Random random = ThreadLocalRandom.current();
|
||||
|
||||
if (SlimefunPlugin.getMinecraftVersion().isAtLeast(MinecraftVersion.MINECRAFT_1_14) && crop == Material.SWEET_BERRY_BUSH) {
|
||||
return new ItemStack(Material.SWEET_BERRIES, random.nextInt(3) + 1);
|
||||
}
|
||||
|
||||
switch (crop) {
|
||||
case WHEAT:
|
||||
return new ItemStack(Material.WHEAT, random.nextInt(2) + 1);
|
||||
@ -74,6 +68,8 @@ public class FarmerAndroid extends ProgrammableAndroid {
|
||||
return new ItemStack(Material.COCOA_BEANS, random.nextInt(3) + 1);
|
||||
case NETHER_WART:
|
||||
return new ItemStack(Material.NETHER_WART, random.nextInt(3) + 1);
|
||||
case SWEET_BERRY_BUSH:
|
||||
return new ItemStack(Material.SWEET_BERRIES, random.nextInt(3) + 1);
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
|
@ -10,8 +10,6 @@ import org.bukkit.block.BlockFace;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import io.github.thebusybiscuit.cscorelib2.collections.RandomizedSet;
|
||||
import io.github.thebusybiscuit.slimefun4.api.MinecraftVersion;
|
||||
import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin;
|
||||
import me.mrCookieSlime.Slimefun.Lists.RecipeType;
|
||||
import me.mrCookieSlime.Slimefun.Objects.Category;
|
||||
import me.mrCookieSlime.Slimefun.api.SlimefunItemStack;
|
||||
@ -37,10 +35,7 @@ public class FisherAndroid extends ProgrammableAndroid {
|
||||
fishingLoot.add(new ItemStack(Material.STICK), 5);
|
||||
fishingLoot.add(new ItemStack(Material.ROTTEN_FLESH), 3);
|
||||
fishingLoot.add(new ItemStack(Material.LEATHER), 2);
|
||||
|
||||
if (SlimefunPlugin.getMinecraftVersion().isAtLeast(MinecraftVersion.MINECRAFT_1_14)) {
|
||||
fishingLoot.add(new ItemStack(Material.BAMBOO), 3);
|
||||
}
|
||||
fishingLoot.add(new ItemStack(Material.BAMBOO), 3);
|
||||
|
||||
// "loot"
|
||||
fishingLoot.add(new ItemStack(Material.SADDLE), 1);
|
||||
|
@ -48,15 +48,12 @@ public abstract class BioGenerator extends AGenerator {
|
||||
registerFuel(new MachineFuel(20, new ItemStack(Material.DRIED_KELP_BLOCK)));
|
||||
registerFuel(new MachineFuel(1, new ItemStack(Material.SEAGRASS)));
|
||||
registerFuel(new MachineFuel(2, new ItemStack(Material.SEA_PICKLE)));
|
||||
registerFuel(new MachineFuel(1, new ItemStack(Material.BAMBOO)));
|
||||
registerFuel(new MachineFuel(2, new ItemStack(Material.SWEET_BERRIES)));
|
||||
|
||||
if (SlimefunPlugin.getMinecraftVersion().isAtLeast(MinecraftVersion.MINECRAFT_1_14)) {
|
||||
registerFuel(new MachineFuel(1, new ItemStack(Material.BAMBOO)));
|
||||
registerFuel(new MachineFuel(2, new ItemStack(Material.SWEET_BERRIES)));
|
||||
|
||||
// Small Flowers (formally just dandelions and poppies).
|
||||
for (Material m : Tag.SMALL_FLOWERS.getValues()) {
|
||||
registerFuel(new MachineFuel(1, new ItemStack(m)));
|
||||
}
|
||||
// Small Flowers (formally just dandelions and poppies).
|
||||
for (Material m : Tag.SMALL_FLOWERS.getValues()) {
|
||||
registerFuel(new MachineFuel(1, new ItemStack(m)));
|
||||
}
|
||||
|
||||
if (SlimefunPlugin.getMinecraftVersion().isAtLeast(MinecraftVersion.MINECRAFT_1_15)) {
|
||||
|
@ -3,10 +3,8 @@ package io.github.thebusybiscuit.slimefun4.implementation.items.electric.machine
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import io.github.thebusybiscuit.slimefun4.api.MinecraftVersion;
|
||||
import io.github.thebusybiscuit.slimefun4.core.attributes.RecipeDisplayItem;
|
||||
import io.github.thebusybiscuit.slimefun4.implementation.SlimefunItems;
|
||||
import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin;
|
||||
import io.github.thebusybiscuit.slimefun4.implementation.items.misc.OrganicFertilizer;
|
||||
import me.mrCookieSlime.Slimefun.Lists.RecipeType;
|
||||
import me.mrCookieSlime.Slimefun.Objects.Category;
|
||||
@ -30,10 +28,7 @@ public abstract class FoodComposter extends AContainer implements RecipeDisplayI
|
||||
registerRecipe(30, new ItemStack[] { SlimefunItems.APPLE_ORGANIC_FOOD }, new ItemStack[] { new SlimefunItemStack(SlimefunItems.APPLE_FERTILIZER, OrganicFertilizer.OUTPUT) });
|
||||
registerRecipe(30, new ItemStack[] { SlimefunItems.KELP_ORGANIC_FOOD }, new ItemStack[] { new SlimefunItemStack(SlimefunItems.KELP_FERTILIZER, OrganicFertilizer.OUTPUT) });
|
||||
registerRecipe(30, new ItemStack[] { SlimefunItems.COCOA_ORGANIC_FOOD }, new ItemStack[] { new SlimefunItemStack(SlimefunItems.COCOA_FERTILIZER, OrganicFertilizer.OUTPUT) });
|
||||
|
||||
if (SlimefunPlugin.getMinecraftVersion().isAtLeast(MinecraftVersion.MINECRAFT_1_14)) {
|
||||
registerRecipe(30, new ItemStack[] { SlimefunItems.SWEET_BERRIES_ORGANIC_FOOD }, new ItemStack[] { new SlimefunItemStack(SlimefunItems.SWEET_BERRIES_FERTILIZER, OrganicFertilizer.OUTPUT) });
|
||||
}
|
||||
registerRecipe(30, new ItemStack[] { SlimefunItems.SWEET_BERRIES_ORGANIC_FOOD }, new ItemStack[] { new SlimefunItemStack(SlimefunItems.SWEET_BERRIES_FERTILIZER, OrganicFertilizer.OUTPUT) });
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -3,9 +3,7 @@ package io.github.thebusybiscuit.slimefun4.implementation.items.electric.machine
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import io.github.thebusybiscuit.slimefun4.api.MinecraftVersion;
|
||||
import io.github.thebusybiscuit.slimefun4.implementation.SlimefunItems;
|
||||
import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin;
|
||||
import io.github.thebusybiscuit.slimefun4.implementation.items.misc.OrganicFood;
|
||||
import me.mrCookieSlime.Slimefun.Lists.RecipeType;
|
||||
import me.mrCookieSlime.Slimefun.Objects.Category;
|
||||
@ -29,10 +27,7 @@ public abstract class FoodFabricator extends AContainer {
|
||||
registerRecipe(12, new ItemStack[] { SlimefunItems.TIN_CAN, new ItemStack(Material.APPLE) }, new ItemStack[] { new SlimefunItemStack(SlimefunItems.APPLE_ORGANIC_FOOD, OrganicFood.OUTPUT) });
|
||||
registerRecipe(12, new ItemStack[] { SlimefunItems.TIN_CAN, new ItemStack(Material.DRIED_KELP) }, new ItemStack[] { new SlimefunItemStack(SlimefunItems.KELP_ORGANIC_FOOD, OrganicFood.OUTPUT) });
|
||||
registerRecipe(12, new ItemStack[] { SlimefunItems.TIN_CAN, new ItemStack(Material.COCOA_BEANS) }, new ItemStack[] { new SlimefunItemStack(SlimefunItems.COCOA_ORGANIC_FOOD, OrganicFood.OUTPUT) });
|
||||
|
||||
if (SlimefunPlugin.getMinecraftVersion().isAtLeast(MinecraftVersion.MINECRAFT_1_14)) {
|
||||
registerRecipe(12, new ItemStack[] { SlimefunItems.TIN_CAN, new ItemStack(Material.SWEET_BERRIES) }, new ItemStack[] { new SlimefunItemStack(SlimefunItems.SWEET_BERRIES_ORGANIC_FOOD, OrganicFood.OUTPUT) });
|
||||
}
|
||||
registerRecipe(12, new ItemStack[] { SlimefunItems.TIN_CAN, new ItemStack(Material.SWEET_BERRIES) }, new ItemStack[] { new SlimefunItemStack(SlimefunItems.SWEET_BERRIES_ORGANIC_FOOD, OrganicFood.OUTPUT) });
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -15,7 +15,6 @@ import org.bukkit.inventory.Inventory;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import io.github.thebusybiscuit.cscorelib2.item.CustomItem;
|
||||
import io.github.thebusybiscuit.slimefun4.api.MinecraftVersion;
|
||||
import io.github.thebusybiscuit.slimefun4.core.multiblocks.MultiBlockMachine;
|
||||
import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin;
|
||||
import io.github.thebusybiscuit.slimefun4.utils.SlimefunUtils;
|
||||
@ -27,8 +26,7 @@ import me.mrCookieSlime.Slimefun.api.SlimefunItemStack;
|
||||
public class PressureChamber extends MultiBlockMachine {
|
||||
|
||||
public PressureChamber(Category category, SlimefunItemStack item) {
|
||||
super(category, item, 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) }, BlockFace.UP);
|
||||
super(category, item, new ItemStack[] { new ItemStack(Material.SMOOTH_STONE_SLAB), new CustomItem(Material.DISPENSER, "Dispenser (Facing down)"), new ItemStack(Material.SMOOTH_STONE_SLAB), new ItemStack(Material.PISTON), new ItemStack(Material.GLASS), new ItemStack(Material.PISTON), new ItemStack(Material.PISTON), new ItemStack(Material.CAULDRON), new ItemStack(Material.PISTON) }, BlockFace.UP);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -52,7 +52,7 @@ public class IndustrialMiner extends MultiBlockMachine {
|
||||
private final ItemSetting<Boolean> canMineAncientDebris = new ItemSetting<>("can-mine-ancient-debris", false);
|
||||
|
||||
public IndustrialMiner(Category category, SlimefunItemStack item, Material baseMaterial, boolean silkTouch, int range) {
|
||||
super(category, item, new ItemStack[] { null, null, null, new CustomItem(Material.PISTON, "Piston (facing up)"), new ItemStack(Material.CHEST), new CustomItem(Material.PISTON, "Piston (facing up)"), new ItemStack(baseMaterial), new ItemStack(SlimefunPlugin.getMinecraftVersion().isAtLeast(MinecraftVersion.MINECRAFT_1_14) ? Material.BLAST_FURNACE : Material.FURNACE), new ItemStack(baseMaterial) }, BlockFace.UP);
|
||||
super(category, item, new ItemStack[] { null, null, null, new CustomItem(Material.PISTON, "Piston (facing up)"), new ItemStack(Material.CHEST), new CustomItem(Material.PISTON, "Piston (facing up)"), new ItemStack(baseMaterial), new ItemStack(Material.BLAST_FURNACE), new ItemStack(baseMaterial) }, BlockFace.UP);
|
||||
|
||||
this.range = range;
|
||||
this.silkTouch = silkTouch;
|
||||
|
@ -55,7 +55,7 @@ class ExplosiveTool extends SimpleSlimefunItem<ToolUseHandler> implements NotPla
|
||||
Player p = e.getPlayer();
|
||||
Block b = e.getBlock();
|
||||
|
||||
b.getWorld().createExplosion(b.getLocation(), 0.0F);
|
||||
b.getWorld().createExplosion(b.getLocation(), 0);
|
||||
b.getWorld().playSound(b.getLocation(), Sound.ENTITY_GENERIC_EXPLODE, 0.2F, 1F);
|
||||
|
||||
List<Block> blocks = findBlocks(b);
|
||||
@ -122,8 +122,9 @@ class ExplosiveTool extends SimpleSlimefunItem<ToolUseHandler> implements NotPla
|
||||
|
||||
private void breakBlock(Player p, ItemStack item, Block b, int fortune, List<ItemStack> drops) {
|
||||
SlimefunPlugin.getProtectionManager().logAction(p, b, ProtectableAction.BREAK_BLOCK);
|
||||
Material material = b.getType();
|
||||
|
||||
b.getWorld().playEffect(b.getLocation(), Effect.STEP_SOUND, b.getType());
|
||||
b.getWorld().playEffect(b.getLocation(), Effect.STEP_SOUND, material);
|
||||
SlimefunItem sfItem = BlockStorage.check(b);
|
||||
|
||||
if (sfItem != null && !sfItem.useVanillaBlockBreaking()) {
|
||||
@ -132,10 +133,10 @@ class ExplosiveTool extends SimpleSlimefunItem<ToolUseHandler> implements NotPla
|
||||
if (handler != null && !handler.onBreak(p, b, sfItem, UnregisterReason.PLAYER_BREAK)) {
|
||||
drops.add(BlockStorage.retrieve(b));
|
||||
}
|
||||
} else if (b.getType() == Material.PLAYER_HEAD || b.getType() == Material.SHULKER_BOX || b.getType().name().endsWith("_SHULKER_BOX")) {
|
||||
} else if (material == Material.PLAYER_HEAD || SlimefunTag.SHULKER_BOXES.isTagged(material)) {
|
||||
b.breakNaturally(item);
|
||||
} else {
|
||||
boolean applyFortune = b.getType().name().endsWith("_ORE") && b.getType() != Material.IRON_ORE && b.getType() != Material.GOLD_ORE;
|
||||
boolean applyFortune = SlimefunTag.FORTUNE_COMPATIBLE_ORES.isTagged(material);
|
||||
|
||||
for (ItemStack drop : b.getDrops(getItem())) {
|
||||
// For some reason this check is necessary with Paper
|
||||
|
@ -39,15 +39,19 @@ public class SlimefunBootsListener implements Listener {
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true)
|
||||
public void onDamage(EntityDamageEvent e) {
|
||||
if (e.getEntity() instanceof Player) {
|
||||
if (e.getCause() == DamageCause.FALL) {
|
||||
if (e.getEntity() instanceof Player && e.getCause() == DamageCause.FALL) {
|
||||
onFallDamage(e);
|
||||
} else if (e instanceof EntityDamageByEntityEvent) {
|
||||
EntityDamageByEntityEvent event = (EntityDamageByEntityEvent) e;
|
||||
}
|
||||
}
|
||||
|
||||
if (event.getDamager() instanceof EnderPearl) {
|
||||
onEnderPearlDamage(e);
|
||||
}
|
||||
@EventHandler
|
||||
public void onEnderPearlDamage(EntityDamageByEntityEvent e) {
|
||||
if (e.getDamager() instanceof EnderPearl && e.getEntity() instanceof Player) {
|
||||
Player p = (Player) e.getEntity();
|
||||
SlimefunItem boots = SlimefunItem.getByItem(p.getInventory().getBoots());
|
||||
|
||||
if (boots != null && boots.getId().equals("ENDER_BOOTS") && Slimefun.hasUnlocked(p, boots, true)) {
|
||||
e.setCancelled(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -71,15 +75,6 @@ public class SlimefunBootsListener implements Listener {
|
||||
}
|
||||
}
|
||||
|
||||
private void onEnderPearlDamage(@Nonnull EntityDamageEvent e) {
|
||||
Player p = (Player) e.getEntity();
|
||||
SlimefunItem boots = SlimefunItem.getByItem(p.getInventory().getBoots());
|
||||
|
||||
if (boots != null && boots.getId().equals("ENDER_BOOTS") && Slimefun.hasUnlocked(p, boots, true)) {
|
||||
e.setCancelled(true);
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onTrample(PlayerInteractEvent e) {
|
||||
if (e.getAction() == Action.PHYSICAL) {
|
||||
|
@ -207,27 +207,8 @@ import me.mrCookieSlime.Slimefun.api.SlimefunItemStack;
|
||||
*/
|
||||
public final class SlimefunItemSetup {
|
||||
|
||||
private static final Material RED_DYE;
|
||||
private static final Material YELLOW_DYE;
|
||||
private static final Material BLACK_DYE;
|
||||
private static final Material GREEN_DYE;
|
||||
|
||||
private static boolean registeredItems = false;
|
||||
|
||||
static {
|
||||
if (SlimefunPlugin.getMinecraftVersion().isAtLeast(MinecraftVersion.MINECRAFT_1_14)) {
|
||||
RED_DYE = Material.RED_DYE;
|
||||
YELLOW_DYE = Material.YELLOW_DYE;
|
||||
BLACK_DYE = Material.BLACK_DYE;
|
||||
GREEN_DYE = Material.GREEN_DYE;
|
||||
} else {
|
||||
RED_DYE = Material.valueOf("ROSE_RED");
|
||||
YELLOW_DYE = Material.valueOf("DANDELION_YELLOW");
|
||||
BLACK_DYE = Material.valueOf("INK_SAC");
|
||||
GREEN_DYE = Material.valueOf("CACTUS_GREEN");
|
||||
}
|
||||
}
|
||||
|
||||
private SlimefunItemSetup() {}
|
||||
|
||||
public static void setup(@Nonnull SlimefunPlugin plugin) {
|
||||
@ -796,21 +777,19 @@ public final class SlimefunItemSetup {
|
||||
new ItemStack[] {null, null, SlimefunItems.LAVA_CRYSTAL, null, SlimefunItems.STAFF_ELEMENTAL, null, SlimefunItems.STAFF_ELEMENTAL, null, null})
|
||||
.register(plugin);
|
||||
|
||||
if (SlimefunPlugin.getMinecraftVersion().isAtLeast(MinecraftVersion.MINECRAFT_1_14)) {
|
||||
new StormStaff(categories.magicalGadgets, SlimefunItems.STAFF_STORM, RecipeType.ANCIENT_ALTAR,
|
||||
new ItemStack[] {SlimefunItems.LIGHTNING_RUNE, SlimefunItems.ENDER_LUMP_3, SlimefunItems.LIGHTNING_RUNE, SlimefunItems.STAFF_WATER, SlimefunItems.MAGIC_SUGAR, SlimefunItems.STAFF_WIND, SlimefunItems.LIGHTNING_RUNE, SlimefunItems.ENDER_LUMP_3, SlimefunItems.LIGHTNING_RUNE})
|
||||
.register(plugin);
|
||||
new StormStaff(categories.magicalGadgets, SlimefunItems.STAFF_STORM, RecipeType.ANCIENT_ALTAR,
|
||||
new ItemStack[] {SlimefunItems.LIGHTNING_RUNE, SlimefunItems.ENDER_LUMP_3, SlimefunItems.LIGHTNING_RUNE, SlimefunItems.STAFF_WATER, SlimefunItems.MAGIC_SUGAR, SlimefunItems.STAFF_WIND, SlimefunItems.LIGHTNING_RUNE, SlimefunItems.ENDER_LUMP_3, SlimefunItems.LIGHTNING_RUNE})
|
||||
.register(plugin);
|
||||
|
||||
ItemStack weaknessPotion = new ItemStack(Material.POTION);
|
||||
PotionMeta meta = (PotionMeta) weaknessPotion.getItemMeta();
|
||||
meta.setBasePotionData(new PotionData(PotionType.WEAKNESS, false, false));
|
||||
weaknessPotion.setItemMeta(meta);
|
||||
ItemStack weaknessPotion = new ItemStack(Material.POTION);
|
||||
PotionMeta meta = (PotionMeta) weaknessPotion.getItemMeta();
|
||||
meta.setBasePotionData(new PotionData(PotionType.WEAKNESS, false, false));
|
||||
weaknessPotion.setItemMeta(meta);
|
||||
|
||||
new MagicalZombiePills(categories.magicalGadgets, SlimefunItems.MAGICAL_ZOMBIE_PILLS, RecipeType.MAGIC_WORKBENCH,
|
||||
new ItemStack[] {new ItemStack(Material.GOLD_INGOT), SlimefunItems.MAGIC_LUMP_2, new ItemStack(Material.GOLD_INGOT), new ItemStack(Material.APPLE), weaknessPotion, new ItemStack(Material.APPLE), new ItemStack(Material.GOLD_INGOT), SlimefunItems.MAGIC_LUMP_2, new ItemStack(Material.GOLD_INGOT)},
|
||||
new SlimefunItemStack(SlimefunItems.MAGICAL_ZOMBIE_PILLS, 2))
|
||||
.register(plugin);
|
||||
}
|
||||
new MagicalZombiePills(categories.magicalGadgets, SlimefunItems.MAGICAL_ZOMBIE_PILLS, RecipeType.MAGIC_WORKBENCH,
|
||||
new ItemStack[] {new ItemStack(Material.GOLD_INGOT), SlimefunItems.MAGIC_LUMP_2, new ItemStack(Material.GOLD_INGOT), new ItemStack(Material.APPLE), weaknessPotion, new ItemStack(Material.APPLE), new ItemStack(Material.GOLD_INGOT), SlimefunItems.MAGIC_LUMP_2, new ItemStack(Material.GOLD_INGOT)},
|
||||
new SlimefunItemStack(SlimefunItems.MAGICAL_ZOMBIE_PILLS, 2))
|
||||
.register(plugin);
|
||||
|
||||
new SmeltersPickaxe(categories.tools, SlimefunItems.SMELTERS_PICKAXE, RecipeType.ENHANCED_CRAFTING_TABLE,
|
||||
new ItemStack[] {SlimefunItems.LAVA_CRYSTAL, SlimefunItems.LAVA_CRYSTAL, SlimefunItems.LAVA_CRYSTAL, null, SlimefunItems.FERROSILICON, null, null, SlimefunItems.FERROSILICON, null})
|
||||
@ -1026,9 +1005,7 @@ public final class SlimefunItemSetup {
|
||||
new ItemStack[] {SlimefunItems.HARDENED_METAL_INGOT, SlimefunItems.HARDENED_METAL_INGOT, SlimefunItems.HARDENED_METAL_INGOT, null, SlimefunItems.FERROSILICON, null, null, SlimefunItems.FERROSILICON, null})
|
||||
.register(plugin);
|
||||
|
||||
if (SlimefunPlugin.getMinecraftVersion().isAtLeast(MinecraftVersion.MINECRAFT_1_14)) {
|
||||
new TableSaw(categories.basicMachines, SlimefunItems.TABLE_SAW).register(plugin);
|
||||
}
|
||||
new TableSaw(categories.basicMachines, SlimefunItems.TABLE_SAW).register(plugin);
|
||||
|
||||
new SlimefunArmorPiece(categories.magicalArmor, SlimefunItems.SLIME_HELMET_STEEL, RecipeType.ARMOR_FORGE,
|
||||
new ItemStack[] {new ItemStack(Material.SLIME_BALL), SlimefunItems.STEEL_PLATE, new ItemStack(Material.SLIME_BALL), new ItemStack(Material.SLIME_BALL), null, new ItemStack(Material.SLIME_BALL), null, null, null}, null)
|
||||
@ -1258,11 +1235,9 @@ public final class SlimefunItemSetup {
|
||||
new ItemStack[] {new ItemStack(Material.PUMPKIN), null, null, null, null, null, null, null, null})
|
||||
.register(plugin);
|
||||
|
||||
if (SlimefunPlugin.getMinecraftVersion().isAtLeast(MinecraftVersion.MINECRAFT_1_14)) {
|
||||
new Juice(categories.food, SlimefunItems.SWEET_BERRY_JUICE, RecipeType.JUICER,
|
||||
new ItemStack[] {new ItemStack(Material.SWEET_BERRIES), null, null, null, null, null, null, null, null})
|
||||
.register(plugin);
|
||||
}
|
||||
new Juice(categories.food, SlimefunItems.SWEET_BERRY_JUICE, RecipeType.JUICER,
|
||||
new ItemStack[] {new ItemStack(Material.SWEET_BERRIES), null, null, null, null, null, null, null, null})
|
||||
.register(plugin);
|
||||
|
||||
new Juice(categories.food, SlimefunItems.GOLDEN_APPLE_JUICE, RecipeType.JUICER,
|
||||
new ItemStack[] {new ItemStack(Material.GOLDEN_APPLE), null, null, null, null, null, null, null, null})
|
||||
@ -1989,11 +1964,9 @@ public final class SlimefunItemSetup {
|
||||
|
||||
}.register(plugin);
|
||||
|
||||
if (SlimefunPlugin.getMinecraftVersion().isAtLeast(MinecraftVersion.MINECRAFT_1_14)) {
|
||||
new AutoDrier(categories.electricity, SlimefunItems.AUTO_DRIER, RecipeType.ENHANCED_CRAFTING_TABLE,
|
||||
new ItemStack[]{null, null, null, SlimefunItems.HEATING_COIL, new ItemStack(Material.SMOKER), SlimefunItems.HEATING_COIL, null, new ItemStack(Material.CAMPFIRE), null})
|
||||
.register(plugin);
|
||||
}
|
||||
new AutoDrier(categories.electricity, SlimefunItems.AUTO_DRIER, RecipeType.ENHANCED_CRAFTING_TABLE,
|
||||
new ItemStack[]{null, null, null, SlimefunItems.HEATING_COIL, new ItemStack(Material.SMOKER), SlimefunItems.HEATING_COIL, null, new ItemStack(Material.CAMPFIRE), null})
|
||||
.register(plugin);
|
||||
|
||||
new AutoBrewer(categories.electricity, SlimefunItems.AUTO_BREWER, RecipeType.ENHANCED_CRAFTING_TABLE,
|
||||
new ItemStack[] {null, SlimefunItems.HEATING_COIL, null, SlimefunItems.REINFORCED_PLATE, new ItemStack(Material.BREWING_STAND), SlimefunItems.REINFORCED_PLATE, null, SlimefunItems.ELECTRIC_MOTOR, null}) {
|
||||
@ -2282,7 +2255,7 @@ public final class SlimefunItemSetup {
|
||||
.register(plugin);
|
||||
|
||||
new SlimefunItem(categories.magicalResources, SlimefunItems.RAINBOW_RUNE, RecipeType.ANCIENT_ALTAR,
|
||||
new ItemStack[] {new ItemStack(RED_DYE), SlimefunItems.MAGIC_LUMP_3, new ItemStack(Material.CYAN_DYE), new ItemStack(Material.WHITE_WOOL), SlimefunItems.ENDER_RUNE, new ItemStack(Material.WHITE_WOOL), new ItemStack(YELLOW_DYE), SlimefunItems.ENDER_LUMP_3, new ItemStack(Material.MAGENTA_DYE)})
|
||||
new ItemStack[] {new ItemStack(Material.RED_DYE), SlimefunItems.MAGIC_LUMP_3, new ItemStack(Material.CYAN_DYE), new ItemStack(Material.WHITE_WOOL), SlimefunItems.ENDER_RUNE, new ItemStack(Material.WHITE_WOOL), new ItemStack(Material.YELLOW_DYE), SlimefunItems.ENDER_LUMP_3, new ItemStack(Material.MAGENTA_DYE)})
|
||||
.register(plugin);
|
||||
|
||||
new SoulboundRune(categories.magicalResources, SlimefunItems.SOULBOUND_RUNE, RecipeType.ANCIENT_ALTAR,
|
||||
@ -2351,96 +2324,96 @@ public final class SlimefunItemSetup {
|
||||
// Christmas
|
||||
|
||||
new RainbowBlock(categories.christmas, SlimefunItems.RAINBOW_WOOL_XMAS, RecipeType.ANCIENT_ALTAR,
|
||||
new ItemStack[] {new ItemStack(RED_DYE), SlimefunItems.CHRISTMAS_COOKIE, new ItemStack(GREEN_DYE), new ItemStack(Material.WHITE_WOOL), SlimefunItems.RAINBOW_RUNE, new ItemStack(Material.WHITE_WOOL), new ItemStack(GREEN_DYE), SlimefunItems.CHRISTMAS_COOKIE, new ItemStack(RED_DYE)},
|
||||
new ItemStack[] {new ItemStack(Material.RED_DYE), SlimefunItems.CHRISTMAS_COOKIE, new ItemStack(Material.GREEN_DYE), new ItemStack(Material.WHITE_WOOL), SlimefunItems.RAINBOW_RUNE, new ItemStack(Material.WHITE_WOOL), new ItemStack(Material.GREEN_DYE), SlimefunItems.CHRISTMAS_COOKIE, new ItemStack(Material.RED_DYE)},
|
||||
new SlimefunItemStack(SlimefunItems.RAINBOW_WOOL_XMAS, 2), new RainbowTickHandler(Material.RED_WOOL, Material.GREEN_WOOL))
|
||||
.register(plugin);
|
||||
|
||||
new RainbowBlock(categories.christmas, SlimefunItems.RAINBOW_GLASS_XMAS, RecipeType.ANCIENT_ALTAR,
|
||||
new ItemStack[] {new ItemStack(RED_DYE), SlimefunItems.CHRISTMAS_COOKIE, new ItemStack(GREEN_DYE), new ItemStack(Material.WHITE_STAINED_GLASS), SlimefunItems.RAINBOW_RUNE, new ItemStack(Material.WHITE_STAINED_GLASS), new ItemStack(GREEN_DYE), SlimefunItems.CHRISTMAS_COOKIE, new ItemStack(RED_DYE)},
|
||||
new ItemStack[] {new ItemStack(Material.RED_DYE), SlimefunItems.CHRISTMAS_COOKIE, new ItemStack(Material.GREEN_DYE), new ItemStack(Material.WHITE_STAINED_GLASS), SlimefunItems.RAINBOW_RUNE, new ItemStack(Material.WHITE_STAINED_GLASS), new ItemStack(Material.GREEN_DYE), SlimefunItems.CHRISTMAS_COOKIE, new ItemStack(Material.RED_DYE)},
|
||||
new SlimefunItemStack(SlimefunItems.RAINBOW_GLASS_XMAS, 2), new RainbowTickHandler(Material.RED_STAINED_GLASS, Material.GREEN_STAINED_GLASS))
|
||||
.register(plugin);
|
||||
|
||||
new RainbowBlock(categories.christmas, SlimefunItems.RAINBOW_GLASS_PANE_XMAS, RecipeType.ANCIENT_ALTAR,
|
||||
new ItemStack[] {new ItemStack(RED_DYE), SlimefunItems.CHRISTMAS_COOKIE, new ItemStack(GREEN_DYE), new ItemStack(Material.WHITE_STAINED_GLASS_PANE), SlimefunItems.RAINBOW_RUNE, new ItemStack(Material.WHITE_STAINED_GLASS_PANE), new ItemStack(GREEN_DYE), SlimefunItems.CHRISTMAS_COOKIE, new ItemStack(RED_DYE)},
|
||||
new ItemStack[] {new ItemStack(Material.RED_DYE), SlimefunItems.CHRISTMAS_COOKIE, new ItemStack(Material.GREEN_DYE), new ItemStack(Material.WHITE_STAINED_GLASS_PANE), SlimefunItems.RAINBOW_RUNE, new ItemStack(Material.WHITE_STAINED_GLASS_PANE), new ItemStack(Material.GREEN_DYE), SlimefunItems.CHRISTMAS_COOKIE, new ItemStack(Material.RED_DYE)},
|
||||
new SlimefunItemStack(SlimefunItems.RAINBOW_GLASS_PANE_XMAS, 2), new RainbowTickHandler(Material.RED_STAINED_GLASS_PANE, Material.GREEN_STAINED_GLASS_PANE))
|
||||
.register(plugin);
|
||||
|
||||
new RainbowBlock(categories.christmas, SlimefunItems.RAINBOW_CLAY_XMAS, RecipeType.ANCIENT_ALTAR,
|
||||
new ItemStack[] {new ItemStack(RED_DYE), SlimefunItems.CHRISTMAS_COOKIE, new ItemStack(GREEN_DYE), new ItemStack(Material.WHITE_TERRACOTTA), SlimefunItems.RAINBOW_RUNE, new ItemStack(Material.WHITE_TERRACOTTA), new ItemStack(GREEN_DYE), SlimefunItems.CHRISTMAS_COOKIE, new ItemStack(RED_DYE)},
|
||||
new ItemStack[] {new ItemStack(Material.RED_DYE), SlimefunItems.CHRISTMAS_COOKIE, new ItemStack(Material.GREEN_DYE), new ItemStack(Material.WHITE_TERRACOTTA), SlimefunItems.RAINBOW_RUNE, new ItemStack(Material.WHITE_TERRACOTTA), new ItemStack(Material.GREEN_DYE), SlimefunItems.CHRISTMAS_COOKIE, new ItemStack(Material.RED_DYE)},
|
||||
new SlimefunItemStack(SlimefunItems.RAINBOW_CLAY_XMAS, 2), new RainbowTickHandler(Material.RED_TERRACOTTA, Material.GREEN_TERRACOTTA))
|
||||
.register(plugin);
|
||||
|
||||
new RainbowBlock(categories.christmas, SlimefunItems.RAINBOW_CONCRETE_XMAS, RecipeType.ANCIENT_ALTAR,
|
||||
new ItemStack[] {new ItemStack(RED_DYE), SlimefunItems.CHRISTMAS_COOKIE, new ItemStack(GREEN_DYE), new ItemStack(Material.WHITE_CONCRETE), SlimefunItems.RAINBOW_RUNE, new ItemStack(Material.WHITE_CONCRETE), new ItemStack(GREEN_DYE), SlimefunItems.CHRISTMAS_COOKIE, new ItemStack(RED_DYE)},
|
||||
new ItemStack[] {new ItemStack(Material.RED_DYE), SlimefunItems.CHRISTMAS_COOKIE, new ItemStack(Material.GREEN_DYE), new ItemStack(Material.WHITE_CONCRETE), SlimefunItems.RAINBOW_RUNE, new ItemStack(Material.WHITE_CONCRETE), new ItemStack(Material.GREEN_DYE), SlimefunItems.CHRISTMAS_COOKIE, new ItemStack(Material.RED_DYE)},
|
||||
new SlimefunItemStack(SlimefunItems.RAINBOW_CONCRETE_XMAS, 2), new RainbowTickHandler(Material.RED_CONCRETE, Material.GREEN_CONCRETE))
|
||||
.register(plugin);
|
||||
|
||||
new RainbowBlock(categories.christmas, SlimefunItems.RAINBOW_GLAZED_TERRACOTTA_XMAS, RecipeType.ANCIENT_ALTAR,
|
||||
new ItemStack[] {new ItemStack(RED_DYE), SlimefunItems.CHRISTMAS_COOKIE, new ItemStack(GREEN_DYE), new ItemStack(Material.WHITE_GLAZED_TERRACOTTA), SlimefunItems.RAINBOW_RUNE, new ItemStack(Material.WHITE_GLAZED_TERRACOTTA), new ItemStack(GREEN_DYE), SlimefunItems.CHRISTMAS_COOKIE, new ItemStack(RED_DYE)},
|
||||
new ItemStack[] {new ItemStack(Material.RED_DYE), SlimefunItems.CHRISTMAS_COOKIE, new ItemStack(Material.GREEN_DYE), new ItemStack(Material.WHITE_GLAZED_TERRACOTTA), SlimefunItems.RAINBOW_RUNE, new ItemStack(Material.WHITE_GLAZED_TERRACOTTA), new ItemStack(Material.GREEN_DYE), SlimefunItems.CHRISTMAS_COOKIE, new ItemStack(Material.RED_DYE)},
|
||||
new SlimefunItemStack(SlimefunItems.RAINBOW_GLAZED_TERRACOTTA_XMAS, 2), new RainbowTickHandler(Material.RED_GLAZED_TERRACOTTA, Material.GREEN_GLAZED_TERRACOTTA))
|
||||
.register(plugin);
|
||||
|
||||
// Valentines Day
|
||||
|
||||
new RainbowBlock(categories.valentinesDay, SlimefunItems.RAINBOW_WOOL_VALENTINE, RecipeType.ANCIENT_ALTAR,
|
||||
new ItemStack[] {new ItemStack(RED_DYE), new ItemStack(Material.POPPY), new ItemStack(Material.PINK_DYE), new ItemStack(Material.WHITE_WOOL), SlimefunItems.RAINBOW_RUNE, new ItemStack(Material.WHITE_WOOL), new ItemStack(Material.PINK_DYE), new ItemStack(Material.POPPY), new ItemStack(RED_DYE)},
|
||||
new ItemStack[] {new ItemStack(Material.RED_DYE), new ItemStack(Material.POPPY), new ItemStack(Material.PINK_DYE), new ItemStack(Material.WHITE_WOOL), SlimefunItems.RAINBOW_RUNE, new ItemStack(Material.WHITE_WOOL), new ItemStack(Material.PINK_DYE), new ItemStack(Material.POPPY), new ItemStack(Material.RED_DYE)},
|
||||
new SlimefunItemStack(SlimefunItems.RAINBOW_WOOL_VALENTINE, 2), new RainbowTickHandler(Material.MAGENTA_WOOL, Material.PINK_WOOL))
|
||||
.register(plugin);
|
||||
|
||||
new RainbowBlock(categories.valentinesDay, SlimefunItems.RAINBOW_GLASS_VALENTINE, RecipeType.ANCIENT_ALTAR,
|
||||
new ItemStack[] {new ItemStack(RED_DYE), new ItemStack(Material.POPPY), new ItemStack(Material.PINK_DYE), new ItemStack(Material.WHITE_STAINED_GLASS), SlimefunItems.RAINBOW_RUNE, new ItemStack(Material.WHITE_STAINED_GLASS), new ItemStack(Material.PINK_DYE), new ItemStack(Material.POPPY), new ItemStack(RED_DYE)},
|
||||
new ItemStack[] {new ItemStack(Material.RED_DYE), new ItemStack(Material.POPPY), new ItemStack(Material.PINK_DYE), new ItemStack(Material.WHITE_STAINED_GLASS), SlimefunItems.RAINBOW_RUNE, new ItemStack(Material.WHITE_STAINED_GLASS), new ItemStack(Material.PINK_DYE), new ItemStack(Material.POPPY), new ItemStack(Material.RED_DYE)},
|
||||
new SlimefunItemStack(SlimefunItems.RAINBOW_GLASS_VALENTINE, 2), new RainbowTickHandler(Material.MAGENTA_STAINED_GLASS, Material.PINK_STAINED_GLASS))
|
||||
.register(plugin);
|
||||
|
||||
new RainbowBlock(categories.valentinesDay, SlimefunItems.RAINBOW_GLASS_PANE_VALENTINE, RecipeType.ANCIENT_ALTAR,
|
||||
new ItemStack[] {new ItemStack(RED_DYE), new ItemStack(Material.POPPY), new ItemStack(Material.PINK_DYE), new ItemStack(Material.WHITE_STAINED_GLASS_PANE), SlimefunItems.RAINBOW_RUNE, new ItemStack(Material.WHITE_STAINED_GLASS_PANE), new ItemStack(Material.PINK_DYE), new ItemStack(Material.POPPY), new ItemStack(RED_DYE)},
|
||||
new ItemStack[] {new ItemStack(Material.RED_DYE), new ItemStack(Material.POPPY), new ItemStack(Material.PINK_DYE), new ItemStack(Material.WHITE_STAINED_GLASS_PANE), SlimefunItems.RAINBOW_RUNE, new ItemStack(Material.WHITE_STAINED_GLASS_PANE), new ItemStack(Material.PINK_DYE), new ItemStack(Material.POPPY), new ItemStack(Material.RED_DYE)},
|
||||
new SlimefunItemStack(SlimefunItems.RAINBOW_GLASS_PANE_VALENTINE, 2), new RainbowTickHandler(Material.MAGENTA_STAINED_GLASS_PANE, Material.PINK_STAINED_GLASS_PANE))
|
||||
.register(plugin);
|
||||
|
||||
new RainbowBlock(categories.valentinesDay, SlimefunItems.RAINBOW_CLAY_VALENTINE, RecipeType.ANCIENT_ALTAR,
|
||||
new ItemStack[] {new ItemStack(RED_DYE), new ItemStack(Material.POPPY), new ItemStack(Material.PINK_DYE), new ItemStack(Material.WHITE_TERRACOTTA), SlimefunItems.RAINBOW_RUNE, new ItemStack(Material.WHITE_TERRACOTTA), new ItemStack(Material.PINK_DYE), new ItemStack(Material.POPPY), new ItemStack(RED_DYE)},
|
||||
new ItemStack[] {new ItemStack(Material.RED_DYE), new ItemStack(Material.POPPY), new ItemStack(Material.PINK_DYE), new ItemStack(Material.WHITE_TERRACOTTA), SlimefunItems.RAINBOW_RUNE, new ItemStack(Material.WHITE_TERRACOTTA), new ItemStack(Material.PINK_DYE), new ItemStack(Material.POPPY), new ItemStack(Material.RED_DYE)},
|
||||
new SlimefunItemStack(SlimefunItems.RAINBOW_CLAY_VALENTINE, 2), new RainbowTickHandler(Material.MAGENTA_TERRACOTTA, Material.PINK_TERRACOTTA))
|
||||
.register(plugin);
|
||||
|
||||
new RainbowBlock(categories.valentinesDay, SlimefunItems.RAINBOW_CONCRETE_VALENTINE, RecipeType.ANCIENT_ALTAR,
|
||||
new ItemStack[] {new ItemStack(RED_DYE), new ItemStack(Material.POPPY), new ItemStack(Material.PINK_DYE), new ItemStack(Material.WHITE_CONCRETE), SlimefunItems.RAINBOW_RUNE, new ItemStack(Material.WHITE_CONCRETE), new ItemStack(Material.PINK_DYE), new ItemStack(Material.POPPY), new ItemStack(RED_DYE)},
|
||||
new ItemStack[] {new ItemStack(Material.RED_DYE), new ItemStack(Material.POPPY), new ItemStack(Material.PINK_DYE), new ItemStack(Material.WHITE_CONCRETE), SlimefunItems.RAINBOW_RUNE, new ItemStack(Material.WHITE_CONCRETE), new ItemStack(Material.PINK_DYE), new ItemStack(Material.POPPY), new ItemStack(Material.RED_DYE)},
|
||||
new SlimefunItemStack(SlimefunItems.RAINBOW_CONCRETE_VALENTINE, 2), new RainbowTickHandler(Material.MAGENTA_CONCRETE, Material.PINK_CONCRETE))
|
||||
.register(plugin);
|
||||
|
||||
new RainbowBlock(categories.valentinesDay, SlimefunItems.RAINBOW_GLAZED_TERRACOTTA_VALENTINE, RecipeType.ANCIENT_ALTAR,
|
||||
new ItemStack[] {new ItemStack(RED_DYE), new ItemStack(Material.POPPY), new ItemStack(Material.PINK_DYE), new ItemStack(Material.WHITE_GLAZED_TERRACOTTA), SlimefunItems.RAINBOW_RUNE, new ItemStack(Material.WHITE_GLAZED_TERRACOTTA), new ItemStack(Material.PINK_DYE), new ItemStack(Material.POPPY), new ItemStack(RED_DYE)},
|
||||
new ItemStack[] {new ItemStack(Material.RED_DYE), new ItemStack(Material.POPPY), new ItemStack(Material.PINK_DYE), new ItemStack(Material.WHITE_GLAZED_TERRACOTTA), SlimefunItems.RAINBOW_RUNE, new ItemStack(Material.WHITE_GLAZED_TERRACOTTA), new ItemStack(Material.PINK_DYE), new ItemStack(Material.POPPY), new ItemStack(Material.RED_DYE)},
|
||||
new SlimefunItemStack(SlimefunItems.RAINBOW_GLAZED_TERRACOTTA_VALENTINE, 2), new RainbowTickHandler(Material.MAGENTA_GLAZED_TERRACOTTA, Material.PINK_GLAZED_TERRACOTTA))
|
||||
.register(plugin);
|
||||
|
||||
// Halloween
|
||||
|
||||
new RainbowBlock(categories.halloween, SlimefunItems.RAINBOW_WOOL_HALLOWEEN, RecipeType.ANCIENT_ALTAR,
|
||||
new ItemStack[] {new ItemStack(Material.ORANGE_DYE), new ItemStack(Material.PUMPKIN), new ItemStack(BLACK_DYE), new ItemStack(Material.WHITE_WOOL), SlimefunItems.RAINBOW_RUNE, new ItemStack(Material.WHITE_WOOL), new ItemStack(BLACK_DYE), new ItemStack(Material.PUMPKIN), new ItemStack(Material.ORANGE_DYE)},
|
||||
new ItemStack[] {new ItemStack(Material.ORANGE_DYE), new ItemStack(Material.PUMPKIN), new ItemStack(Material.BLACK_DYE), new ItemStack(Material.WHITE_WOOL), SlimefunItems.RAINBOW_RUNE, new ItemStack(Material.WHITE_WOOL), new ItemStack(Material.BLACK_DYE), new ItemStack(Material.PUMPKIN), new ItemStack(Material.ORANGE_DYE)},
|
||||
new SlimefunItemStack(SlimefunItems.RAINBOW_WOOL_HALLOWEEN, 2), new RainbowTickHandler(Material.ORANGE_WOOL, Material.BLACK_WOOL))
|
||||
.register(plugin);
|
||||
|
||||
new RainbowBlock(categories.halloween, SlimefunItems.RAINBOW_GLASS_HALLOWEEN, RecipeType.ANCIENT_ALTAR,
|
||||
new ItemStack[] {new ItemStack(Material.ORANGE_DYE), new ItemStack(Material.PUMPKIN), new ItemStack(BLACK_DYE), new ItemStack(Material.WHITE_STAINED_GLASS), SlimefunItems.RAINBOW_RUNE, new ItemStack(Material.WHITE_STAINED_GLASS), new ItemStack(BLACK_DYE), new ItemStack(Material.PUMPKIN), new ItemStack(Material.ORANGE_DYE)},
|
||||
new ItemStack[] {new ItemStack(Material.ORANGE_DYE), new ItemStack(Material.PUMPKIN), new ItemStack(Material.BLACK_DYE), new ItemStack(Material.WHITE_STAINED_GLASS), SlimefunItems.RAINBOW_RUNE, new ItemStack(Material.WHITE_STAINED_GLASS), new ItemStack(Material.BLACK_DYE), new ItemStack(Material.PUMPKIN), new ItemStack(Material.ORANGE_DYE)},
|
||||
new SlimefunItemStack(SlimefunItems.RAINBOW_GLASS_HALLOWEEN, 2), new RainbowTickHandler(Material.ORANGE_STAINED_GLASS, Material.BLACK_STAINED_GLASS))
|
||||
.register(plugin);
|
||||
|
||||
new RainbowBlock(categories.halloween, SlimefunItems.RAINBOW_GLASS_PANE_HALLOWEEN, RecipeType.ANCIENT_ALTAR,
|
||||
new ItemStack[] {new ItemStack(Material.ORANGE_DYE), new ItemStack(Material.PUMPKIN), new ItemStack(BLACK_DYE), new ItemStack(Material.WHITE_STAINED_GLASS_PANE), SlimefunItems.RAINBOW_RUNE, new ItemStack(Material.WHITE_STAINED_GLASS_PANE), new ItemStack(BLACK_DYE), new ItemStack(Material.PUMPKIN), new ItemStack(Material.ORANGE_DYE)},
|
||||
new ItemStack[] {new ItemStack(Material.ORANGE_DYE), new ItemStack(Material.PUMPKIN), new ItemStack(Material.BLACK_DYE), new ItemStack(Material.WHITE_STAINED_GLASS_PANE), SlimefunItems.RAINBOW_RUNE, new ItemStack(Material.WHITE_STAINED_GLASS_PANE), new ItemStack(Material.BLACK_DYE), new ItemStack(Material.PUMPKIN), new ItemStack(Material.ORANGE_DYE)},
|
||||
new SlimefunItemStack(SlimefunItems.RAINBOW_GLASS_PANE_HALLOWEEN, 2), new RainbowTickHandler(Material.ORANGE_STAINED_GLASS_PANE, Material.BLACK_STAINED_GLASS_PANE))
|
||||
.register(plugin);
|
||||
|
||||
new RainbowBlock(categories.halloween, SlimefunItems.RAINBOW_CLAY_HALLOWEEN, RecipeType.ANCIENT_ALTAR,
|
||||
new ItemStack[] {new ItemStack(Material.ORANGE_DYE), new ItemStack(Material.PUMPKIN), new ItemStack(BLACK_DYE), new ItemStack(Material.WHITE_TERRACOTTA), SlimefunItems.RAINBOW_RUNE, new ItemStack(Material.WHITE_TERRACOTTA), new ItemStack(BLACK_DYE), new ItemStack(Material.PUMPKIN), new ItemStack(Material.ORANGE_DYE)},
|
||||
new ItemStack[] {new ItemStack(Material.ORANGE_DYE), new ItemStack(Material.PUMPKIN), new ItemStack(Material.BLACK_DYE), new ItemStack(Material.WHITE_TERRACOTTA), SlimefunItems.RAINBOW_RUNE, new ItemStack(Material.WHITE_TERRACOTTA), new ItemStack(Material.BLACK_DYE), new ItemStack(Material.PUMPKIN), new ItemStack(Material.ORANGE_DYE)},
|
||||
new SlimefunItemStack(SlimefunItems.RAINBOW_CLAY_HALLOWEEN, 2), new RainbowTickHandler(Material.ORANGE_TERRACOTTA, Material.BLACK_TERRACOTTA))
|
||||
.register(plugin);
|
||||
|
||||
new RainbowBlock(categories.halloween, SlimefunItems.RAINBOW_CONCRETE_HALLOWEEN, RecipeType.ANCIENT_ALTAR,
|
||||
new ItemStack[] {new ItemStack(Material.ORANGE_DYE), new ItemStack(Material.PUMPKIN), new ItemStack(BLACK_DYE), new ItemStack(Material.WHITE_CONCRETE), SlimefunItems.RAINBOW_RUNE, new ItemStack(Material.WHITE_CONCRETE), new ItemStack(BLACK_DYE), new ItemStack(Material.PUMPKIN), new ItemStack(Material.ORANGE_DYE)},
|
||||
new ItemStack[] {new ItemStack(Material.ORANGE_DYE), new ItemStack(Material.PUMPKIN), new ItemStack(Material.BLACK_DYE), new ItemStack(Material.WHITE_CONCRETE), SlimefunItems.RAINBOW_RUNE, new ItemStack(Material.WHITE_CONCRETE), new ItemStack(Material.BLACK_DYE), new ItemStack(Material.PUMPKIN), new ItemStack(Material.ORANGE_DYE)},
|
||||
new SlimefunItemStack(SlimefunItems.RAINBOW_CONCRETE_HALLOWEEN, 2), new RainbowTickHandler(Material.ORANGE_CONCRETE, Material.BLACK_CONCRETE))
|
||||
.register(plugin);
|
||||
|
||||
new RainbowBlock(categories.halloween, SlimefunItems.RAINBOW_GLAZED_TERRACOTTA_HALLOWEEN, RecipeType.ANCIENT_ALTAR,
|
||||
new ItemStack[] {new ItemStack(Material.ORANGE_DYE), new ItemStack(Material.PUMPKIN), new ItemStack(BLACK_DYE), new ItemStack(Material.WHITE_GLAZED_TERRACOTTA), SlimefunItems.RAINBOW_RUNE, new ItemStack(Material.WHITE_GLAZED_TERRACOTTA), new ItemStack(BLACK_DYE), new ItemStack(Material.PUMPKIN), new ItemStack(Material.ORANGE_DYE)},
|
||||
new ItemStack[] {new ItemStack(Material.ORANGE_DYE), new ItemStack(Material.PUMPKIN), new ItemStack(Material.BLACK_DYE), new ItemStack(Material.WHITE_GLAZED_TERRACOTTA), SlimefunItems.RAINBOW_RUNE, new ItemStack(Material.WHITE_GLAZED_TERRACOTTA), new ItemStack(Material.BLACK_DYE), new ItemStack(Material.PUMPKIN), new ItemStack(Material.ORANGE_DYE)},
|
||||
new SlimefunItemStack(SlimefunItems.RAINBOW_GLAZED_TERRACOTTA_HALLOWEEN, 2), new RainbowTickHandler(Material.ORANGE_GLAZED_TERRACOTTA, Material.BLACK_GLAZED_TERRACOTTA))
|
||||
.register(plugin);
|
||||
|
||||
@ -2678,10 +2651,8 @@ public final class SlimefunItemSetup {
|
||||
new OrganicFood(categories.misc, SlimefunItems.APPLE_ORGANIC_FOOD, Material.APPLE)
|
||||
.register(plugin);
|
||||
|
||||
if (SlimefunPlugin.getMinecraftVersion().isAtLeast(MinecraftVersion.MINECRAFT_1_14)) {
|
||||
new OrganicFood(categories.misc, SlimefunItems.SWEET_BERRIES_ORGANIC_FOOD, Material.SWEET_BERRIES)
|
||||
.register(plugin);
|
||||
}
|
||||
new OrganicFood(categories.misc, SlimefunItems.SWEET_BERRIES_ORGANIC_FOOD, Material.SWEET_BERRIES)
|
||||
.register(plugin);
|
||||
|
||||
new OrganicFood(categories.misc, SlimefunItems.KELP_ORGANIC_FOOD, Material.DRIED_KELP)
|
||||
.register(plugin);
|
||||
@ -3059,11 +3030,9 @@ public final class SlimefunItemSetup {
|
||||
new ItemStack[] {SlimefunItems.BLISTERING_INGOT_3, new ItemStack(Material.NETHER_STAR), SlimefunItems.BLISTERING_INGOT_3, SlimefunItems.WITHER_PROOF_OBSIDIAN, SlimefunItems.ANDROID_MEMORY_CORE, SlimefunItems.WITHER_PROOF_OBSIDIAN, SlimefunItems.ELECTRIC_MOTOR, SlimefunItems.REINFORCED_ALLOY_INGOT, SlimefunItems.CARBONADO_EDGED_CAPACITOR})
|
||||
.register(plugin);
|
||||
|
||||
if (SlimefunPlugin.getMinecraftVersion().isAtLeast(MinecraftVersion.MINECRAFT_1_14)) {
|
||||
new TapeMeasure(categories.usefulItems, SlimefunItems.TAPE_MEASURE, RecipeType.ENHANCED_CRAFTING_TABLE,
|
||||
new ItemStack[] {SlimefunItems.SILICON, new ItemStack(Material.YELLOW_DYE), SlimefunItems.SILICON, new ItemStack(Material.YELLOW_DYE), new ItemStack(Material.STRING), new ItemStack(Material.YELLOW_DYE), SlimefunItems.GILDED_IRON, new ItemStack(Material.YELLOW_DYE), SlimefunItems.SILICON})
|
||||
.register(plugin);
|
||||
}
|
||||
new TapeMeasure(categories.usefulItems, SlimefunItems.TAPE_MEASURE, RecipeType.ENHANCED_CRAFTING_TABLE,
|
||||
new ItemStack[] {SlimefunItems.SILICON, new ItemStack(Material.YELLOW_DYE), SlimefunItems.SILICON, new ItemStack(Material.YELLOW_DYE), new ItemStack(Material.STRING), new ItemStack(Material.YELLOW_DYE), SlimefunItems.GILDED_IRON, new ItemStack(Material.YELLOW_DYE), SlimefunItems.SILICON})
|
||||
.register(plugin);
|
||||
|
||||
if (SlimefunPlugin.getMinecraftVersion().isAtLeast(MinecraftVersion.MINECRAFT_1_16)) {
|
||||
new StrangeNetherGoo(categories.magicalResources, SlimefunItems.STRANGE_NETHER_GOO, RecipeType.BARTER_DROP,
|
||||
|
@ -108,7 +108,8 @@ public enum HeadTexture {
|
||||
CARGO_ARROW_RIGHT("c2f910c47da042e4aa28af6cc81cf48ac6caf37dab35f88db993accb9dfe516"),
|
||||
ADD_NEW_LANGUAGE("3edd20be93520949e6ce789dc4f43efaeb28c717ee6bfcbbe02780142f716"),
|
||||
IRON_GOLEM("89091d79ea0f59ef7ef94d7bba6e5f17f2f7d4572c44f90f76c4819a714"),
|
||||
PIGLIN_HEAD("2882af1294a74023e6919a31d1a027310f2e142afb4667d230d155e7f21dbb41");
|
||||
PIGLIN_HEAD("2882af1294a74023e6919a31d1a027310f2e142afb4667d230d155e7f21dbb41"),
|
||||
NECROTIC_SKULL("7953b6c68448e7e6b6bf8fb273d7203acd8e1be19e81481ead51f45de59a8");
|
||||
|
||||
public static final HeadTexture[] valuesCache = values();
|
||||
|
||||
|
@ -12,16 +12,51 @@ import javax.annotation.Nullable;
|
||||
import org.apache.commons.lang.Validate;
|
||||
import org.bukkit.ChatColor;
|
||||
|
||||
/**
|
||||
* This class contains various utilities related to numbers and number formatting.
|
||||
*
|
||||
* @author TheBusyBiscuit
|
||||
* @author Walshy
|
||||
*
|
||||
*/
|
||||
public final class NumberUtils {
|
||||
|
||||
/**
|
||||
* This is our {@link DecimalFormat} for decimal values.
|
||||
*/
|
||||
private static final DecimalFormat DECIMAL_FORMAT = new DecimalFormat("#.##");
|
||||
|
||||
/**
|
||||
* We do not want any instance of this to be created.
|
||||
*/
|
||||
private NumberUtils() {}
|
||||
|
||||
public static String formatBigNumber(int i) {
|
||||
return NumberFormat.getNumberInstance(Locale.US).format(i);
|
||||
/**
|
||||
* This method formats a given {@link Integer} to be displayed nicely with
|
||||
* decimal digit grouping.
|
||||
* {@code 1000000} for example will return {@code "1,000,000"} as a {@link String}.
|
||||
* It uses the american (US) {@link Locale} for this transformation.
|
||||
*
|
||||
* @param number
|
||||
* Your {@link Integer}
|
||||
*
|
||||
* @return The formatted String
|
||||
*/
|
||||
@Nonnull
|
||||
public static String formatBigNumber(int number) {
|
||||
return NumberFormat.getNumberInstance(Locale.US).format(number);
|
||||
}
|
||||
|
||||
/**
|
||||
* This method transforms a String representation of a {@link LocalDateTime}
|
||||
* from GitHub's API back into a {@link LocalDateTime} object
|
||||
*
|
||||
* @param date
|
||||
* The formatted String version of a date from GitHub
|
||||
*
|
||||
* @return The {@link LocalDateTime} for the given input
|
||||
*/
|
||||
@Nonnull
|
||||
public static LocalDateTime parseGitHubDate(@Nonnull String date) {
|
||||
Validate.notNull(date, "Provided date was null");
|
||||
return LocalDateTime.parse(date.substring(0, date.length() - 1));
|
||||
@ -37,6 +72,7 @@ public final class NumberUtils {
|
||||
*
|
||||
* @return A representative {@link ChatColor}
|
||||
*/
|
||||
@Nonnull
|
||||
public static ChatColor getColorFromPercentage(float percentage) {
|
||||
if (percentage < 16.0F) {
|
||||
return ChatColor.DARK_RED;
|
||||
@ -53,13 +89,28 @@ public final class NumberUtils {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* This returns the elapsed time since the given {@link LocalDateTime}.
|
||||
* The output will be nicely formatted based on the elapsed hours or days since the
|
||||
* given {@link LocalDateTime}.
|
||||
*
|
||||
* If a {@link LocalDateTime} from yesterday was passed it will return {@code "1d"}.
|
||||
* One hour later it will read {@code "1d 1h"}. For values smaller than an hour {@code "< 1h"}
|
||||
* will be returned instead.
|
||||
*
|
||||
* @param date
|
||||
* The {@link LocalDateTime}.
|
||||
*
|
||||
* @return The elapsed time as a {@link String}
|
||||
*/
|
||||
@Nonnull
|
||||
public static String getElapsedTime(@Nonnull LocalDateTime date) {
|
||||
Validate.notNull(date, "Provided date was null");
|
||||
long hours = Duration.between(date, LocalDateTime.now()).toHours();
|
||||
|
||||
if (hours == 0) {
|
||||
return "< 1h";
|
||||
} else if ((hours / 24) == 0) {
|
||||
} else if (hours / 24 == 0) {
|
||||
return (hours % 24) + "h";
|
||||
} else if (hours % 24 == 0) {
|
||||
return (hours / 24) + "d";
|
||||
@ -68,10 +119,12 @@ public final class NumberUtils {
|
||||
}
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
public static String getTimeLeft(int seconds) {
|
||||
String timeleft = "";
|
||||
|
||||
int minutes = (int) (seconds / 60L);
|
||||
|
||||
if (minutes > 0) {
|
||||
timeleft += minutes + "m ";
|
||||
}
|
||||
@ -80,7 +133,7 @@ public final class NumberUtils {
|
||||
return timeleft + seconds + "s";
|
||||
}
|
||||
|
||||
public static int getInt(String str, int defaultValue) {
|
||||
public static int getInt(@Nonnull String str, int defaultValue) {
|
||||
if (PatternUtils.NUMERIC.matcher(str).matches()) {
|
||||
return Integer.parseInt(str);
|
||||
}
|
||||
@ -88,6 +141,7 @@ public final class NumberUtils {
|
||||
return defaultValue;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
public static String getAsMillis(long nanoseconds) {
|
||||
if (nanoseconds == 0) {
|
||||
return "0ms";
|
||||
|
@ -121,7 +121,7 @@ public final class SlimefunUtils {
|
||||
}
|
||||
|
||||
private static boolean hasSoulboundFlag(@Nullable ItemMeta meta) {
|
||||
if (meta != null && SlimefunPlugin.getMinecraftVersion().isAtLeast(MinecraftVersion.MINECRAFT_1_14)) {
|
||||
if (meta != null) {
|
||||
PersistentDataContainer container = meta.getPersistentDataContainer();
|
||||
|
||||
if (container.has(SOULBOUND_KEY, PersistentDataType.BYTE)) {
|
||||
@ -154,16 +154,14 @@ public final class SlimefunUtils {
|
||||
boolean isSoulbound = isSoulbound(item);
|
||||
ItemMeta meta = item.getItemMeta();
|
||||
|
||||
if (SlimefunPlugin.getMinecraftVersion().isAtLeast(MinecraftVersion.MINECRAFT_1_14)) {
|
||||
PersistentDataContainer container = meta.getPersistentDataContainer();
|
||||
PersistentDataContainer container = meta.getPersistentDataContainer();
|
||||
|
||||
if (makeSoulbound && !isSoulbound) {
|
||||
container.set(SOULBOUND_KEY, PersistentDataType.BYTE, (byte) 1);
|
||||
}
|
||||
if (makeSoulbound && !isSoulbound) {
|
||||
container.set(SOULBOUND_KEY, PersistentDataType.BYTE, (byte) 1);
|
||||
}
|
||||
|
||||
if (!makeSoulbound && isSoulbound) {
|
||||
container.remove(SOULBOUND_KEY);
|
||||
}
|
||||
if (!makeSoulbound && isSoulbound) {
|
||||
container.remove(SOULBOUND_KEY);
|
||||
}
|
||||
|
||||
List<String> lore = meta.hasLore() ? meta.getLore() : new ArrayList<>();
|
||||
|
@ -48,6 +48,11 @@ public enum SlimefunTag implements Tag<Material> {
|
||||
*/
|
||||
ORES,
|
||||
|
||||
/**
|
||||
* All minecraft ores that can be affected by fortune.
|
||||
*/
|
||||
FORTUNE_COMPATIBLE_ORES,
|
||||
|
||||
/**
|
||||
* All Shulker boxes, normal and colored.
|
||||
*/
|
||||
@ -104,12 +109,28 @@ public enum SlimefunTag implements Tag<Material> {
|
||||
*/
|
||||
STONE_VARIANTS,
|
||||
|
||||
/**
|
||||
* All dirt variants. Dirt, coarse dirt, grass, mycelium.
|
||||
* This also includes farmland and grass paths.
|
||||
*/
|
||||
DIRT_VARIANTS,
|
||||
|
||||
/**
|
||||
* All variants of concrete powder.
|
||||
* Can you believe there is no tag for this already?
|
||||
*/
|
||||
CONCRETE_POWDERS,
|
||||
|
||||
/**
|
||||
* All the types of pressure plates.
|
||||
*/
|
||||
PRESSURE_PLATES,
|
||||
|
||||
/**
|
||||
* All tall flowers because minecraft doesn't have a tag for this
|
||||
*/
|
||||
TALL_FLOWERS,
|
||||
|
||||
/**
|
||||
* Materials which are sensitive to break.
|
||||
* Things like Saplings or Pressure plates which break as well when you break
|
||||
|
@ -134,6 +134,7 @@ public class Category implements Keyed {
|
||||
*
|
||||
* @param p
|
||||
* The Player to create this {@link ItemStack} for
|
||||
*
|
||||
* @return A localized display item for this {@link Category}
|
||||
*/
|
||||
@Nonnull
|
||||
@ -166,6 +167,26 @@ public class Category implements Keyed {
|
||||
return ChatColor.stripColor(item.getItemMeta().getDisplayName());
|
||||
}
|
||||
|
||||
/**
|
||||
* This returns the localized display name of this {@link Category} for the given {@link Player}.
|
||||
* The method will fall back to {@link #getUnlocalizedName()} if no translation was found.
|
||||
*
|
||||
* @param p
|
||||
* The {@link Player} who to translate the name for
|
||||
*
|
||||
* @return The localized name of this {@link Category}
|
||||
*/
|
||||
@Nonnull
|
||||
public String getDisplayName(@Nonnull Player p) {
|
||||
String localized = SlimefunPlugin.getLocalization().getCategoryName(p, getKey());
|
||||
|
||||
if (localized != null) {
|
||||
return localized;
|
||||
} else {
|
||||
return getUnlocalizedName();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns all instances of {@link SlimefunItem} bound to this {@link Category}.
|
||||
*
|
||||
|
@ -19,7 +19,7 @@ import me.mrCookieSlime.Slimefun.api.item_transport.ItemTransportFlow;
|
||||
* @deprecated This interface is not designed to be used by addons.
|
||||
*
|
||||
*/
|
||||
@Deprecated
|
||||
// @Deprecated - commented out because we are not ready to send out warnings yet
|
||||
public interface InventoryBlock {
|
||||
|
||||
/**
|
||||
|
@ -40,7 +40,6 @@ networks:
|
||||
|
||||
items:
|
||||
talismans: true
|
||||
backpacks: true
|
||||
soulbound: true
|
||||
|
||||
metrics:
|
||||
|
@ -23,3 +23,4 @@ slimefun:
|
||||
easter: חג הפסחא (אפריל)
|
||||
birthday: יום הולדתו של TheBusyBiscuit (26 באוקטובר)
|
||||
halloween: ליל כל הקדושים (31 באוקטובר)
|
||||
androids: רובוטים ניתנים לתכנות
|
||||
|
@ -20,6 +20,10 @@ commands:
|
||||
player-never-joined: "&4找不到叫这个名字的玩家!"
|
||||
backpack-does-not-exist: "&4你指定的背包不存在!"
|
||||
restored-backpack-given: "&a你的背包已被恢复并且已经放入了你的物品栏!"
|
||||
charge:
|
||||
description: 为你手持的物品充电
|
||||
charge-success: 充电完成!
|
||||
not-rechargeable: 这个物品不能充电!
|
||||
guide:
|
||||
search:
|
||||
message: "&b你想要搜索什么?"
|
||||
@ -127,6 +131,7 @@ messages:
|
||||
knight: "&a&o你的护身符给予了你 5 秒的生命恢复"
|
||||
whirlwind: "&a&o你的护身符反弹了所有的弹射物"
|
||||
wizard: "&a&o你的护身符使一个附魔的等级提高了, 同时其他附魔等级将会下降"
|
||||
caveman: "&a&o你的护身符给予了你急迫效果"
|
||||
soulbound-rune:
|
||||
fail: "&c一次只能灵魂绑定一个物品."
|
||||
success: "&a物品绑定成功! 在你死亡后此物品将不会掉落."
|
||||
@ -223,6 +228,7 @@ machines:
|
||||
finished: "&e你的工业矿机采矿已完成! 总共开采了 %ores% 个矿石!"
|
||||
anvil:
|
||||
not-working: "&4你不能在铁砧里使用 Slimefun 的物品"
|
||||
mcmmo-salvaging: "&4你不能分解 Slimefun 物品!"
|
||||
backpack:
|
||||
already-open: "&c抱歉, 这个背包已在别处打开了!"
|
||||
no-stack: "&c你不能同时手持两个背包"
|
||||
@ -331,5 +337,9 @@ brewing_stand:
|
||||
not-working: "&4你不能在酿造台中使用 Slimefun 物品!"
|
||||
villagers:
|
||||
no-trading: "&4你不能用 Slimefun 的物品和村民交易!"
|
||||
cartography_table:
|
||||
not-working: "&4你不能在制图台中使用 Slimefun 物品!"
|
||||
cauldron:
|
||||
no-discoloring: "&4你不能用炼药锅清洗 Slimefun 物品上的颜色"
|
||||
miner:
|
||||
no-ores: "&e抱歉, 周围找不到矿石了!"
|
||||
|
@ -243,3 +243,6 @@ slimefun:
|
||||
climbing_pick: 古块丽影
|
||||
shulker_shell: 人造潜影贝
|
||||
villager_rune: 防奸商神器
|
||||
caveman_talisman: 穴居人护身符
|
||||
even_higher_tier_capacitors: 三级电容器
|
||||
energy_connectors: 有线连接
|
||||
|
@ -7,7 +7,7 @@ website: https://github.com/Slimefun
|
||||
main: io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin
|
||||
softdepend: [CS-CoreLib, PlaceholderAPI, WorldEdit, EmeraldEnchants, mcMMO]
|
||||
|
||||
api-version: '1.13'
|
||||
api-version: '1.14'
|
||||
|
||||
commands:
|
||||
slimefun:
|
||||
|
@ -1,24 +1,50 @@
|
||||
{
|
||||
"values" : [
|
||||
"#slimefun:sensitive_materials",
|
||||
"#slimefun:tall_flowers",
|
||||
"#slimefun:mushrooms",
|
||||
{
|
||||
"id" : "#minecraft:tall_flowers",
|
||||
"required" : false
|
||||
},
|
||||
{
|
||||
"id" : "#minecraft:beds",
|
||||
"required" : false
|
||||
},
|
||||
{
|
||||
"id" : "#minecraft:doors",
|
||||
"required" : false
|
||||
},
|
||||
"#minecraft:beds",
|
||||
"#minecraft:buttons",
|
||||
"#minecraft:signs",
|
||||
"#minecraft:doors",
|
||||
"minecraft:bamboo",
|
||||
"#minecraft:rails",
|
||||
"#minecraft:small_flowers",
|
||||
"#minecraft:coral_blocks",
|
||||
"#minecraft:coral_plants",
|
||||
"#minecraft:banners",
|
||||
"minecraft:sugar_cane",
|
||||
"minecraft:ladder",
|
||||
"minecraft:snow",
|
||||
"minecraft:lever",
|
||||
"minecraft:repeater",
|
||||
"minecraft:tripwire_hook",
|
||||
"minecraft:lily_pad",
|
||||
"minecraft:dead_bush",
|
||||
"minecraft:fern",
|
||||
"minecraft:grass",
|
||||
"minecraft:seagrass",
|
||||
"minecraft:tall_seagrass",
|
||||
"minecraft:cactus",
|
||||
"minecraft:kelp",
|
||||
{
|
||||
"id" : "minecraft:bamboo",
|
||||
"id" : "minecraft:nether_sprouts",
|
||||
"required" : false
|
||||
},
|
||||
{
|
||||
"id" : "minecraft:crimson_roots",
|
||||
"required": false
|
||||
},
|
||||
{
|
||||
"id" : "minecraft:twisting_vines",
|
||||
"required" : false
|
||||
},
|
||||
{
|
||||
"id" : "minecraft:warped_roots",
|
||||
"required" : false
|
||||
},
|
||||
{
|
||||
"id" : "minecraft:weeping_vines",
|
||||
"required" : false
|
||||
}
|
||||
]
|
||||
|
@ -12,9 +12,6 @@
|
||||
"minecraft:pumpkin_stem",
|
||||
"minecraft:nether_wart",
|
||||
"minecraft:cocoa",
|
||||
{
|
||||
"id" : "minecraft:sweet_berry_bush",
|
||||
"required" : false
|
||||
}
|
||||
"minecraft:sweet_berry_bush"
|
||||
]
|
||||
}
|
||||
|
11
src/main/resources/tags/dirt_variants.json
Normal file
11
src/main/resources/tags/dirt_variants.json
Normal file
@ -0,0 +1,11 @@
|
||||
{
|
||||
"values" : [
|
||||
"minecraft:dirt",
|
||||
"minecraft:coarse_dirt",
|
||||
"minecraft:grass_block",
|
||||
"minecraft:grass_path",
|
||||
"minecraft:farmland",
|
||||
"minecraft:podzol",
|
||||
"minecraft:mycelium"
|
||||
]
|
||||
}
|
@ -2,13 +2,7 @@
|
||||
"values" : [
|
||||
"#minecraft:sand",
|
||||
"#slimefun:concrete_powders",
|
||||
"minecraft:dirt",
|
||||
"minecraft:coarse_dirt",
|
||||
"minecraft:grass_block",
|
||||
"minecraft:grass_path",
|
||||
"minecraft:farmland",
|
||||
"minecraft:podzol",
|
||||
"minecraft:mycelium",
|
||||
"#slimefun:dirt_variants",
|
||||
"minecraft:snow",
|
||||
"minecraft:snow_block",
|
||||
"minecraft:gravel",
|
||||
|
10
src/main/resources/tags/fortune_compatible_ores.json
Normal file
10
src/main/resources/tags/fortune_compatible_ores.json
Normal file
@ -0,0 +1,10 @@
|
||||
{
|
||||
"values" : [
|
||||
"minecraft:coal_ore",
|
||||
"minecraft:lapis_ore",
|
||||
"minecraft:diamond_ore",
|
||||
"minecraft:redstone_ore",
|
||||
"minecraft:emerald_ore",
|
||||
"minecraft:nether_quartz_ore"
|
||||
]
|
||||
}
|
@ -6,11 +6,6 @@
|
||||
},
|
||||
"minecraft:gold_ore",
|
||||
"minecraft:iron_ore",
|
||||
"minecraft:coal_ore",
|
||||
"minecraft:lapis_ore",
|
||||
"minecraft:diamond_ore",
|
||||
"minecraft:redstone_ore",
|
||||
"minecraft:emerald_ore",
|
||||
"minecraft:nether_quartz_ore"
|
||||
"#slimefun:fortune_compatible_ores"
|
||||
]
|
||||
}
|
||||
|
12
src/main/resources/tags/pressure_plates.json
Normal file
12
src/main/resources/tags/pressure_plates.json
Normal file
@ -0,0 +1,12 @@
|
||||
{
|
||||
"values" : [
|
||||
"#minecraft:wooden_pressure_plates",
|
||||
"minecraft:stone_pressure_plate",
|
||||
"minecraft:light_weighted_pressure_plate",
|
||||
"minecraft:heavy_weighted_pressure_plate",
|
||||
{
|
||||
"id" : "minecraft:polished_blackstone_pressure_plate",
|
||||
"required" : false
|
||||
}
|
||||
]
|
||||
}
|
@ -1,11 +1,8 @@
|
||||
{
|
||||
"values" : [
|
||||
"#minecraft:saplings",
|
||||
"#minecraft:wooden_pressure_plates",
|
||||
"#slimefun:torches",
|
||||
"minecraft:stone_pressure_plate",
|
||||
"minecraft:light_weighted_pressure_plate",
|
||||
"minecraft:heavy_weighted_pressure_plate",
|
||||
"#slimefun:pressure_plates",
|
||||
"minecraft:cake"
|
||||
]
|
||||
}
|
||||
|
10
src/main/resources/tags/tall_flowers.json
Normal file
10
src/main/resources/tags/tall_flowers.json
Normal file
@ -0,0 +1,10 @@
|
||||
{
|
||||
"values" : [
|
||||
"minecraft:lilac",
|
||||
"minecraft:rose_bush",
|
||||
"minecraft:peony",
|
||||
"minecraft:tall_grass",
|
||||
"minecraft:large_fern",
|
||||
"minecraft:sunflower"
|
||||
]
|
||||
}
|
@ -63,6 +63,7 @@ class TestSlimefunTags {
|
||||
|
||||
// Inclusion through a Slimefun Tag
|
||||
Assertions.assertTrue(SlimefunTag.SENSITIVE_MATERIALS.isTagged(Material.TORCH));
|
||||
Assertions.assertTrue(SlimefunTag.SENSITIVE_MATERIALS.isTagged(Material.OAK_PRESSURE_PLATE));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -11,10 +11,10 @@ class TestMinecraftVersion {
|
||||
@Test
|
||||
@DisplayName("Test if Minecraft versions match themselves")
|
||||
void testMatches() {
|
||||
Assertions.assertTrue(MinecraftVersion.MINECRAFT_1_13.matches("v1_13_R1"));
|
||||
Assertions.assertTrue(MinecraftVersion.MINECRAFT_1_14.matches("v1_14_R2"));
|
||||
Assertions.assertTrue(MinecraftVersion.MINECRAFT_1_15.matches("v1_15_R1"));
|
||||
|
||||
Assertions.assertFalse(MinecraftVersion.MINECRAFT_1_13.matches("v1_14_R2"));
|
||||
Assertions.assertFalse(MinecraftVersion.MINECRAFT_1_15.matches("v1_14_R2"));
|
||||
Assertions.assertFalse(MinecraftVersion.MINECRAFT_1_14.matches("1.14.x"));
|
||||
Assertions.assertThrows(IllegalArgumentException.class, () -> MinecraftVersion.MINECRAFT_1_14.matches(null));
|
||||
}
|
||||
@ -22,18 +22,18 @@ class TestMinecraftVersion {
|
||||
@Test
|
||||
@DisplayName("Test if Minecraft versions are ordered correctly (#atLeast)")
|
||||
void testAtLeast() {
|
||||
Assertions.assertTrue(MinecraftVersion.MINECRAFT_1_15.isAtLeast(MinecraftVersion.MINECRAFT_1_13));
|
||||
Assertions.assertTrue(MinecraftVersion.MINECRAFT_1_16.isAtLeast(MinecraftVersion.MINECRAFT_1_14));
|
||||
Assertions.assertTrue(MinecraftVersion.MINECRAFT_1_15.isAtLeast(MinecraftVersion.MINECRAFT_1_14));
|
||||
Assertions.assertTrue(MinecraftVersion.MINECRAFT_1_15.isAtLeast(MinecraftVersion.MINECRAFT_1_15));
|
||||
|
||||
Assertions.assertFalse(MinecraftVersion.MINECRAFT_1_13.isAtLeast(MinecraftVersion.MINECRAFT_1_14));
|
||||
Assertions.assertFalse(MinecraftVersion.MINECRAFT_1_15.isAtLeast(MinecraftVersion.MINECRAFT_1_16));
|
||||
}
|
||||
|
||||
@Test
|
||||
@DisplayName("Test correct behaviour for MinecraftVersion.UNKNOWN.isAtleast(...)")
|
||||
void testAtLeastUnknown() {
|
||||
// Unknown should always fall back to false
|
||||
Assertions.assertFalse(MinecraftVersion.UNKNOWN.isAtLeast(MinecraftVersion.MINECRAFT_1_13));
|
||||
Assertions.assertFalse(MinecraftVersion.UNKNOWN.isAtLeast(MinecraftVersion.MINECRAFT_1_14));
|
||||
Assertions.assertFalse(MinecraftVersion.UNKNOWN.isAtLeast(MinecraftVersion.MINECRAFT_1_15));
|
||||
|
||||
Assertions.assertThrows(IllegalArgumentException.class, () -> MinecraftVersion.MINECRAFT_1_14.isAtLeast(null));
|
||||
@ -42,19 +42,18 @@ class TestMinecraftVersion {
|
||||
@Test
|
||||
@DisplayName("Test if Minecraft versions are ordered correctly (#isBefore)")
|
||||
void testIsBefore() {
|
||||
Assertions.assertTrue(MinecraftVersion.MINECRAFT_1_13.isBefore(MinecraftVersion.MINECRAFT_1_14));
|
||||
Assertions.assertTrue(MinecraftVersion.MINECRAFT_1_13.isBefore(MinecraftVersion.MINECRAFT_1_15));
|
||||
Assertions.assertTrue(MinecraftVersion.MINECRAFT_1_14.isBefore(MinecraftVersion.MINECRAFT_1_15));
|
||||
Assertions.assertTrue(MinecraftVersion.MINECRAFT_1_14.isBefore(MinecraftVersion.MINECRAFT_1_16));
|
||||
|
||||
Assertions.assertFalse(MinecraftVersion.MINECRAFT_1_15.isBefore(MinecraftVersion.MINECRAFT_1_15));
|
||||
Assertions.assertFalse(MinecraftVersion.MINECRAFT_1_15.isBefore(MinecraftVersion.MINECRAFT_1_13));
|
||||
Assertions.assertFalse(MinecraftVersion.MINECRAFT_1_15.isBefore(MinecraftVersion.MINECRAFT_1_14));
|
||||
}
|
||||
|
||||
@Test
|
||||
@DisplayName("Test correct behaviour for MinecraftVersion.UNKNOWN.isBefore(...)")
|
||||
void testIsBeforeUnknown() {
|
||||
// Unknown should always fall back to true
|
||||
Assertions.assertTrue(MinecraftVersion.UNKNOWN.isBefore(MinecraftVersion.MINECRAFT_1_13));
|
||||
Assertions.assertTrue(MinecraftVersion.UNKNOWN.isBefore(MinecraftVersion.MINECRAFT_1_14));
|
||||
Assertions.assertTrue(MinecraftVersion.UNKNOWN.isBefore(MinecraftVersion.MINECRAFT_1_15));
|
||||
|
||||
Assertions.assertThrows(IllegalArgumentException.class, () -> MinecraftVersion.MINECRAFT_1_14.isBefore(null));
|
||||
|
Loading…
Reference in New Issue
Block a user