mirror of
https://github.com/StarWishsama/Slimefun4.git
synced 2024-09-19 19:25:48 +00:00
Added Reinforced Cloth
This commit is contained in:
parent
74cf035709
commit
b01254eb9d
@ -42,6 +42,9 @@
|
||||
* Added runtime deprecation warnings for ItemHandlers and Attributes used by Addons
|
||||
* Added a proper lag profiler
|
||||
* Added per-plugin lag info to /sf timings
|
||||
* Added Reinforced Cloth
|
||||
* Added Bee protection to Hazmat Suit
|
||||
* Added Enchantment Rune
|
||||
|
||||
#### Changes
|
||||
* Coolant Cells now last twice as long
|
||||
@ -63,6 +66,7 @@
|
||||
* Cargo timings will now be attributed to the corresponding node and not the Cargo manager
|
||||
* Thunderstorms now count as night time for Solar Generators
|
||||
* Fixed an issue with moving androids getting stuck
|
||||
* Changed recipe of Hazmat Suits
|
||||
|
||||
#### Fixes
|
||||
* Fixed #2005
|
||||
|
@ -32,7 +32,7 @@ import io.github.thebusybiscuit.cscorelib2.chat.ChatColors;
|
||||
import io.github.thebusybiscuit.cscorelib2.config.Config;
|
||||
import io.github.thebusybiscuit.slimefun4.api.gps.Waypoint;
|
||||
import io.github.thebusybiscuit.slimefun4.api.items.HashedArmorpiece;
|
||||
import io.github.thebusybiscuit.slimefun4.core.attributes.CustomProtection;
|
||||
import io.github.thebusybiscuit.slimefun4.core.attributes.ProtectiveArmor;
|
||||
import io.github.thebusybiscuit.slimefun4.core.attributes.ProtectionType;
|
||||
import io.github.thebusybiscuit.slimefun4.core.guide.GuideHistory;
|
||||
import io.github.thebusybiscuit.slimefun4.core.researching.Research;
|
||||
@ -453,26 +453,30 @@ public final class PlayerProfile {
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isProtected(ProtectionType type) {
|
||||
public boolean hasFullProtectionAgainst(ProtectionType type) {
|
||||
int armorCount = 0;
|
||||
|
||||
NamespacedKey setId = null;
|
||||
for (HashedArmorpiece armor : armor) {
|
||||
Optional<SlimefunArmorPiece> armorPiece = armor.getItem();
|
||||
if (!armorPiece.isPresent()) return false;
|
||||
for (HashedArmorpiece armorpiece : armor) {
|
||||
Optional<SlimefunArmorPiece> armorPiece = armorpiece.getItem();
|
||||
|
||||
if (armorPiece.get() instanceof CustomProtection) {
|
||||
CustomProtection protectedArmor = (CustomProtection) armorPiece.get();
|
||||
if (!armorPiece.isPresent()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (armorPiece.get() instanceof ProtectiveArmor) {
|
||||
ProtectiveArmor protectedArmor = (ProtectiveArmor) armorPiece.get();
|
||||
|
||||
if (setId == null && protectedArmor.isFullSetRequired()) {
|
||||
setId = protectedArmor.getSetId();
|
||||
setId = protectedArmor.getArmorSetId();
|
||||
}
|
||||
|
||||
for (ProtectionType protectionType : protectedArmor.getProtectionTypes()) {
|
||||
if (protectionType == type) {
|
||||
if (setId == null) {
|
||||
return true;
|
||||
} else if (setId.equals(protectedArmor.getSetId())) {
|
||||
}
|
||||
else if (setId.equals(protectedArmor.getArmorSetId())) {
|
||||
armorCount++;
|
||||
}
|
||||
}
|
||||
|
@ -1,17 +1,26 @@
|
||||
package io.github.thebusybiscuit.slimefun4.core.attributes;
|
||||
|
||||
import org.bukkit.entity.Bee;
|
||||
|
||||
/**
|
||||
* Represents the {@link ProtectionType} that a {@link CustomProtection}
|
||||
* Represents the {@link ProtectionType} that a {@link ProtectiveArmor}
|
||||
* prevents the damage from.
|
||||
*
|
||||
* @author Linox
|
||||
*
|
||||
* @see CustomProtection
|
||||
* @see ProtectiveArmor
|
||||
*
|
||||
*/
|
||||
public enum ProtectionType {
|
||||
|
||||
/**
|
||||
* This damage type represents damage inflicted by {@link Radioactive} materials.
|
||||
*/
|
||||
RADIATION,
|
||||
|
||||
/**
|
||||
* This damage type represents damage caused by a {@link Bee}
|
||||
*/
|
||||
BEES;
|
||||
|
||||
}
|
||||
|
@ -2,7 +2,6 @@ package io.github.thebusybiscuit.slimefun4.core.attributes;
|
||||
|
||||
import org.bukkit.NamespacedKey;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.entity.EntityDamageEvent;
|
||||
|
||||
import io.github.thebusybiscuit.slimefun4.implementation.items.armor.HazmatArmorPiece;
|
||||
import io.github.thebusybiscuit.slimefun4.implementation.items.armor.SlimefunArmorPiece;
|
||||
@ -22,7 +21,7 @@ import io.github.thebusybiscuit.slimefun4.implementation.items.armor.SlimefunArm
|
||||
* @see ItemAttribute
|
||||
*
|
||||
*/
|
||||
public interface CustomProtection extends ItemAttribute {
|
||||
public interface ProtectiveArmor extends ItemAttribute {
|
||||
|
||||
/**
|
||||
* This returns which {@link ProtectionType} damages this {@link ItemAttribute}
|
||||
@ -45,5 +44,5 @@ public interface CustomProtection extends ItemAttribute {
|
||||
*
|
||||
* @return The set {@link NamespacedKey}, <code>null</code> if none is found.
|
||||
*/
|
||||
NamespacedKey getSetId();
|
||||
NamespacedKey getArmorSetId();
|
||||
}
|
@ -1,6 +1,6 @@
|
||||
package io.github.thebusybiscuit.slimefun4.implementation;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@ -13,7 +13,6 @@ import org.bukkit.inventory.meta.ItemMeta;
|
||||
import org.bukkit.potion.PotionEffect;
|
||||
import org.bukkit.potion.PotionEffectType;
|
||||
|
||||
import io.github.thebusybiscuit.cscorelib2.chat.ChatColors;
|
||||
import io.github.thebusybiscuit.slimefun4.api.MinecraftVersion;
|
||||
import io.github.thebusybiscuit.slimefun4.core.attributes.MachineTier;
|
||||
import io.github.thebusybiscuit.slimefun4.core.attributes.MachineType;
|
||||
@ -46,12 +45,13 @@ public final class SlimefunItems {
|
||||
public static final SlimefunItemStack INFERNAL_BONEMEAL = new SlimefunItemStack("INFERNAL_BONEMEAL", Material.BONE_MEAL, "&4Infernal Bonemeal", "", "&cSpeeds up the Growth of", "&cNether Warts as well");
|
||||
|
||||
/* Gadgets */
|
||||
public static final SlimefunItemStack GOLD_PAN = new SlimefunItemStack("GOLD_PAN", Material.BOWL, "&6Gold Pan", "&a&oCan get you all kinds of Goodies...", "", "&7&eRight Click&7 to pan various Stuff out of Gravel");
|
||||
public static final SlimefunItemStack NETHER_GOLD_PAN = new SlimefunItemStack("NETHER_GOLD_PAN", Material.BOWL, "&4Nether Gold Pan", "", "&7&eRight Click&7 to pan various stuff out of Soul Sand");
|
||||
public static final SlimefunItemStack GOLD_PAN = new SlimefunItemStack("GOLD_PAN", Material.BOWL, "&6Gold Pan", "", "&eRight Click&7 to collect resources", "&7from Gravel");
|
||||
public static final SlimefunItemStack NETHER_GOLD_PAN = new SlimefunItemStack("NETHER_GOLD_PAN", Material.BOWL, "&4Nether Gold Pan", "", "&eRight Click&7 to collect resources", "&7from Soul Sand");
|
||||
public static final SlimefunItemStack PARACHUTE = new SlimefunItemStack("PARACHUTE", Material.LEATHER_CHESTPLATE, Color.WHITE, "&f&lParachute", "", LoreBuilder.CROUCH_TO_USE);
|
||||
public static final SlimefunItemStack GRAPPLING_HOOK = new SlimefunItemStack("GRAPPLING_HOOK", Material.LEAD, "&6Grappling Hook", "", LoreBuilder.RIGHT_CLICK_TO_USE);
|
||||
public static final SlimefunItemStack SOLAR_HELMET = new SlimefunItemStack("SOLAR_HELMET", Material.IRON_HELMET, "&bSolar Helmet", "", "&a&oCharges held Items and Armor");
|
||||
public static final SlimefunItemStack CLOTH = new SlimefunItemStack("CLOTH", Material.PAPER, "&bCloth");
|
||||
public static final SlimefunItemStack REINFORCED_CLOTH = new SlimefunItemStack("REINFORCED_CLOTH", Material.PAPER, "&bReinforced Cloth", "", "&fThis cloth has been reinforced", "&fwith &bLead &fto protect against", "&fradioactive substances");
|
||||
public static final SlimefunItemStack TIN_CAN = new SlimefunItemStack("CAN", HeadTexture.TIN_CAN, "&fTin Can");
|
||||
public static final SlimefunItemStack NIGHT_VISION_GOGGLES = new SlimefunItemStack("NIGHT_VISION_GOGGLES", Material.LEATHER_HELMET, Color.BLACK, "&aNight Vision Goggles", "", "&9+ Night Vision");
|
||||
public static final SlimefunItemStack FARMER_SHOES = new SlimefunItemStack("FARMER_SHOES", Material.LEATHER_BOOTS, Color.YELLOW, "&eFarmer Shoes", "", "&6&oPrevents you from trampling your Crops");
|
||||
@ -248,10 +248,36 @@ public final class SlimefunItems {
|
||||
public static final SlimefunItemStack REINFORCED_ALLOY_LEGGINGS = new SlimefunItemStack("REINFORCED_ALLOY_LEGGINGS", Material.IRON_LEGGINGS, "&bReinforced Leggings");
|
||||
public static final SlimefunItemStack REINFORCED_ALLOY_BOOTS = new SlimefunItemStack("REINFORCED_ALLOY_BOOTS", Material.IRON_BOOTS, "&bReinforced Boots");
|
||||
|
||||
public static final SlimefunItemStack SCUBA_HELMET = new SlimefunItemStack("SCUBA_HELMET", Material.LEATHER_HELMET, Color.ORANGE, "&cScuba Helmet", "", "&bAllows you to breathe Underwater", "&4&oPart of Hazmat Suit");
|
||||
public static final SlimefunItemStack HAZMAT_CHESTPLATE = new SlimefunItemStack("HAZMAT_CHESTPLATE", Material.LEATHER_CHESTPLATE, Color.ORANGE, "&cHazmat Suit", "", "&bAllows you to walk through Fire", "&4&oPart of Hazmat Suit");
|
||||
public static final SlimefunItemStack HAZMAT_LEGGINGS = new SlimefunItemStack("HAZMAT_LEGGINGS", Material.LEATHER_LEGGINGS, Color.ORANGE, "&cHazmat Suit Leggings", "", "&4&oPart of Hazmat Suit");
|
||||
public static final SlimefunItemStack RUBBER_BOOTS = new SlimefunItemStack("RUBBER_BOOTS", Material.LEATHER_BOOTS, Color.BLACK, "&cRubber Boots", "", "&4&oPart of Hazmat Suit");
|
||||
private static final List<String> hazmatLore = new ArrayList<>();
|
||||
|
||||
static {
|
||||
hazmatLore.add("");
|
||||
hazmatLore.add("&4Full set effects:");
|
||||
hazmatLore.add("&c- Radioation immunity");
|
||||
|
||||
if (SlimefunPlugin.getMinecraftVersion().isAtLeast(MinecraftVersion.MINECRAFT_1_15)) {
|
||||
hazmatLore.add("&c- Bee Sting protection");
|
||||
}
|
||||
}
|
||||
|
||||
public static final SlimefunItemStack SCUBA_HELMET = new SlimefunItemStack("SCUBA_HELMET", Material.LEATHER_HELMET, Color.ORANGE, "&cScuba Helmet", "", "&7Allows you to breathe underwater");
|
||||
public static final SlimefunItemStack HAZMAT_CHESTPLATE = new SlimefunItemStack("HAZMAT_CHESTPLATE", Material.LEATHER_CHESTPLATE, Color.ORANGE, "&cHazmat Suit", "", "&7Allows you to walk through fire and lava");
|
||||
public static final SlimefunItemStack HAZMAT_LEGGINGS = new SlimefunItemStack("HAZMAT_LEGGINGS", Material.LEATHER_LEGGINGS, Color.ORANGE, "&cHazmat Suit Leggings", hazmatLore.toArray(new String[0]));
|
||||
public static final SlimefunItemStack HAZMAT_BOOTS = new SlimefunItemStack("RUBBER_BOOTS", Material.LEATHER_BOOTS, Color.BLACK, "&cHazmat Boots", hazmatLore.toArray(new String[0]));
|
||||
|
||||
static {
|
||||
ItemMeta helmetMeta = SCUBA_HELMET.getItemMeta();
|
||||
List<String> helmetLore = helmetMeta.getLore();
|
||||
helmetLore.addAll(hazmatLore);
|
||||
helmetMeta.setLore(helmetLore);
|
||||
SCUBA_HELMET.setItemMeta(helmetMeta);
|
||||
|
||||
ItemMeta chestplateMeta = HAZMAT_CHESTPLATE.getItemMeta();
|
||||
List<String> chestplateLore = chestplateMeta.getLore();
|
||||
chestplateLore.addAll(hazmatLore);
|
||||
chestplateMeta.setLore(chestplateLore);
|
||||
HAZMAT_CHESTPLATE.setItemMeta(chestplateMeta);
|
||||
}
|
||||
|
||||
public static final SlimefunItemStack GILDED_IRON_HELMET = new SlimefunItemStack("GILDED_IRON_HELMET", Material.GOLDEN_HELMET, "&6Gilded Iron Helmet");
|
||||
public static final SlimefunItemStack GILDED_IRON_CHESTPLATE = new SlimefunItemStack("GILDED_IRON_CHESTPLATE", Material.GOLDEN_CHESTPLATE, "&6Gilded Iron Chestplate");
|
||||
@ -298,40 +324,6 @@ public final class SlimefunItems {
|
||||
REINFORCED_ALLOY_LEGGINGS.addUnsafeEnchantments(reinforced);
|
||||
REINFORCED_ALLOY_BOOTS.addUnsafeEnchantments(reinforced);
|
||||
|
||||
if (SlimefunPlugin.getMinecraftVersion().isAtLeast(MinecraftVersion.MINECRAFT_1_15)) {
|
||||
ItemMeta scubaHelmetMeta = SCUBA_HELMET.getItemMeta();
|
||||
List<String> scubaHelmetMetaLore = scubaHelmetMeta.getLore();
|
||||
scubaHelmetMetaLore.addAll(Arrays.asList("",
|
||||
ChatColors.color( "&7Equip the full set for:"),
|
||||
ChatColors.color( "&7+Bee Protection")));
|
||||
scubaHelmetMeta.setLore(scubaHelmetMetaLore);
|
||||
SCUBA_HELMET.setItemMeta(scubaHelmetMeta);
|
||||
|
||||
ItemMeta hazmatChestplateItemMeta = HAZMAT_CHESTPLATE.getItemMeta();
|
||||
List<String> hazmatChestplateItemMetaLore = hazmatChestplateItemMeta.getLore();
|
||||
hazmatChestplateItemMetaLore.addAll(Arrays.asList("",
|
||||
ChatColors.color( "&7Equip the full set for:"),
|
||||
ChatColors.color( "&7+Bee Protection")));
|
||||
hazmatChestplateItemMeta.setLore(hazmatChestplateItemMetaLore);
|
||||
HAZMAT_CHESTPLATE.setItemMeta(hazmatChestplateItemMeta);
|
||||
|
||||
ItemMeta hazmatLeggingsItemMeta = HAZMAT_LEGGINGS.getItemMeta();
|
||||
List<String> hazmatLeggingsItemMetaLore = hazmatLeggingsItemMeta.getLore();
|
||||
hazmatLeggingsItemMetaLore.addAll(Arrays.asList("",
|
||||
ChatColors.color( "&7Equip the full set for:"),
|
||||
ChatColors.color( "&7+Bee Protection")));
|
||||
hazmatLeggingsItemMeta.setLore(hazmatLeggingsItemMetaLore);
|
||||
HAZMAT_LEGGINGS.setItemMeta(hazmatLeggingsItemMeta);
|
||||
|
||||
ItemMeta rubberBootsItemMeta = RUBBER_BOOTS.getItemMeta();
|
||||
List<String> rubberBootsItemMetaLore = rubberBootsItemMeta.getLore();
|
||||
rubberBootsItemMetaLore.addAll(Arrays.asList("",
|
||||
ChatColors.color( "&7Equip the full set for:"),
|
||||
ChatColors.color( "&7+Bee Protection")));
|
||||
rubberBootsItemMeta.setLore(rubberBootsItemMetaLore);
|
||||
RUBBER_BOOTS.setItemMeta(rubberBootsItemMeta);
|
||||
}
|
||||
|
||||
Map<Enchantment, Integer> gilded = new HashMap<>();
|
||||
gilded.put(Enchantment.DURABILITY, 6);
|
||||
gilded.put(Enchantment.PROTECTION_ENVIRONMENTAL, 8);
|
||||
|
@ -4,7 +4,7 @@ import org.bukkit.NamespacedKey;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.potion.PotionEffect;
|
||||
|
||||
import io.github.thebusybiscuit.slimefun4.core.attributes.CustomProtection;
|
||||
import io.github.thebusybiscuit.slimefun4.core.attributes.ProtectiveArmor;
|
||||
import io.github.thebusybiscuit.slimefun4.core.attributes.ProtectionType;
|
||||
import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin;
|
||||
import me.mrCookieSlime.Slimefun.Lists.RecipeType;
|
||||
@ -13,24 +13,24 @@ import me.mrCookieSlime.Slimefun.api.SlimefunItemStack;
|
||||
|
||||
/**
|
||||
* Represents 1 {@link SlimefunArmorPiece} of the Hazmat armor set.
|
||||
* One of the very few utilisations of {@link CustomProtection}.
|
||||
* One of the very few utilisations of {@link ProtectiveArmor}.
|
||||
*
|
||||
* @author Linox
|
||||
*
|
||||
* @see SlimefunArmorPiece
|
||||
* @see CustomProtection
|
||||
* @see ProtectiveArmor
|
||||
*
|
||||
*/
|
||||
public class HazmatArmorPiece extends SlimefunArmorPiece implements CustomProtection {
|
||||
public class HazmatArmorPiece extends SlimefunArmorPiece implements ProtectiveArmor {
|
||||
|
||||
private final NamespacedKey setId;
|
||||
private final NamespacedKey namespacedKey;
|
||||
private final ProtectionType[] types;
|
||||
|
||||
public HazmatArmorPiece(Category category, SlimefunItemStack item, RecipeType recipeType, ItemStack[] recipe, PotionEffect[] effects) {
|
||||
super(category, item, recipeType, recipe, effects);
|
||||
|
||||
types = new ProtectionType[] { ProtectionType.BEES, ProtectionType.RADIATION };
|
||||
setId = new NamespacedKey(SlimefunPlugin.instance, "hazmat_suit");
|
||||
namespacedKey = new NamespacedKey(SlimefunPlugin.instance, "hazmat_suit");
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -44,7 +44,7 @@ public class HazmatArmorPiece extends SlimefunArmorPiece implements CustomProtec
|
||||
}
|
||||
|
||||
@Override
|
||||
public NamespacedKey getSetId() {
|
||||
return setId;
|
||||
public NamespacedKey getArmorSetId() {
|
||||
return namespacedKey;
|
||||
}
|
||||
}
|
||||
|
@ -3,7 +3,6 @@ package io.github.thebusybiscuit.slimefun4.implementation.items.magical;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.EnumMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
@ -20,12 +19,12 @@ import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.player.PlayerDropItemEvent;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import io.github.thebusybiscuit.slimefun4.core.handlers.ItemDropHandler;
|
||||
import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin;
|
||||
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.ItemDropHandler;
|
||||
import me.mrCookieSlime.Slimefun.SlimefunPlugin;
|
||||
import me.mrCookieSlime.Slimefun.api.Slimefun;
|
||||
import me.mrCookieSlime.Slimefun.api.SlimefunItemStack;
|
||||
|
||||
@ -49,10 +48,17 @@ public class EnchantmentRune extends SimpleSlimefunItem<ItemDropHandler> {
|
||||
|
||||
for (Material mat : Material.values()) {
|
||||
List<Enchantment> enchantments = new ArrayList<>();
|
||||
|
||||
for (Enchantment enchantment : Enchantment.values()) {
|
||||
if (enchantment == Enchantment.BINDING_CURSE || enchantment == Enchantment.VANISHING_CURSE) continue;
|
||||
if (enchantment.canEnchantItem(new ItemStack(mat))) enchantments.add(enchantment);
|
||||
if (enchantment == Enchantment.BINDING_CURSE || enchantment == Enchantment.VANISHING_CURSE) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (enchantment.canEnchantItem(new ItemStack(mat))) {
|
||||
enchantments.add(enchantment);
|
||||
}
|
||||
}
|
||||
|
||||
applicableEnchantments.put(mat, enchantments);
|
||||
}
|
||||
}
|
||||
@ -66,15 +72,16 @@ public class EnchantmentRune extends SimpleSlimefunItem<ItemDropHandler> {
|
||||
return true;
|
||||
}
|
||||
|
||||
Slimefun.runSync(() -> activate(p, e, item), 20L);
|
||||
Slimefun.runSync(() -> addRandomEnchantment(p, e, item), 20L);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
};
|
||||
}
|
||||
|
||||
private void activate(Player p, PlayerDropItemEvent e, Item item) {
|
||||
private void addRandomEnchantment(Player p, PlayerDropItemEvent e, Item item) {
|
||||
// Being sure the entity is still valid and not picked up or whatsoever.
|
||||
if (!item.isValid()) {
|
||||
return;
|
||||
@ -89,32 +96,36 @@ public class EnchantmentRune extends SimpleSlimefunItem<ItemDropHandler> {
|
||||
ItemStack target = entity.getItemStack();
|
||||
|
||||
List<Enchantment> applicableEnchantmentList = applicableEnchantments.get(target.getType());
|
||||
|
||||
if (applicableEnchantmentList == null) {
|
||||
SlimefunPlugin.getLocal().sendMessage(p, "messages.enchantment-rune.fail", true);
|
||||
SlimefunPlugin.getLocalization().sendMessage(p, "messages.enchantment-rune.fail", true);
|
||||
return;
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
applicableEnchantmentList = new ArrayList<>(applicableEnchantmentList);
|
||||
}
|
||||
|
||||
// Removing the enchantments that the item already has from enchantmentSet
|
||||
for (Enchantment itemEnchantment : target.getEnchantments().keySet()) {
|
||||
for (Enchantment applicableEnchantment : applicableEnchantmentList) {
|
||||
if (applicableEnchantment == itemEnchantment || applicableEnchantment.conflictsWith(itemEnchantment)) {
|
||||
applicableEnchantmentList.remove(applicableEnchantment);
|
||||
for (Enchantment enchantment : target.getEnchantments().keySet()) {
|
||||
for (Enchantment possibleEnchantment : applicableEnchantmentList) {
|
||||
if (possibleEnchantment == enchantment || possibleEnchantment.conflictsWith(enchantment)) {
|
||||
applicableEnchantmentList.remove(possibleEnchantment);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (applicableEnchantmentList.isEmpty()) {
|
||||
SlimefunPlugin.getLocal().sendMessage(p, "messages.enchantment-rune.no-enchantment", true);
|
||||
SlimefunPlugin.getLocalization().sendMessage(p, "messages.enchantment-rune.no-enchantment", true);
|
||||
return;
|
||||
}
|
||||
|
||||
Enchantment enchantment = applicableEnchantmentList.get(ThreadLocalRandom.current().nextInt(applicableEnchantmentList.size()));
|
||||
int level = 1;
|
||||
|
||||
if (enchantment.getMaxLevel() != 1) {
|
||||
level = ThreadLocalRandom.current().nextInt(enchantment.getMaxLevel()) + 1;
|
||||
}
|
||||
|
||||
target.addEnchantment(enchantment, level);
|
||||
|
||||
if (target.getAmount() == 1) {
|
||||
@ -134,11 +145,12 @@ public class EnchantmentRune extends SimpleSlimefunItem<ItemDropHandler> {
|
||||
item.remove();
|
||||
l.getWorld().dropItemNaturally(l, target);
|
||||
|
||||
SlimefunPlugin.getLocal().sendMessage(p, "messages.enchantment-rune.success", true);
|
||||
SlimefunPlugin.getLocalization().sendMessage(p, "messages.enchantment-rune.success", true);
|
||||
}
|
||||
}, 10L);
|
||||
} else {
|
||||
SlimefunPlugin.getLocal().sendMessage(p, "messages.enchantment-rune.fail", true);
|
||||
}
|
||||
else {
|
||||
SlimefunPlugin.getLocalization().sendMessage(p, "messages.enchantment-rune.fail", true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -13,7 +13,6 @@ import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import io.github.thebusybiscuit.slimefun4.core.attributes.Soulbound;
|
||||
import io.github.thebusybiscuit.slimefun4.core.handlers.ItemDropHandler;
|
||||
import io.github.thebusybiscuit.slimefun4.implementation.SlimefunItems;
|
||||
import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin;
|
||||
import io.github.thebusybiscuit.slimefun4.utils.SlimefunUtils;
|
||||
import me.mrCookieSlime.Slimefun.Lists.RecipeType;
|
||||
|
@ -15,7 +15,7 @@ import io.github.thebusybiscuit.slimefun4.core.attributes.ProtectionType;
|
||||
import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin;
|
||||
|
||||
/**
|
||||
* The listener for Hazmat Suit's {@link Bee} sting protection.
|
||||
* The {@link Listener} for Hazmat Suit's {@link Bee} sting protection.
|
||||
* Only applied if the whole set is worn.
|
||||
*
|
||||
* @author Linox
|
||||
@ -30,19 +30,21 @@ public class BeeListener implements Listener {
|
||||
@EventHandler
|
||||
public void onDamage(EntityDamageByEntityEvent e) {
|
||||
if (e.getDamager() instanceof Bee && e.getEntity() instanceof Player) {
|
||||
|
||||
Player p = (Player) e.getEntity();
|
||||
Optional<PlayerProfile> optional = PlayerProfile.find(p);
|
||||
|
||||
if (!optional.isPresent()) {
|
||||
PlayerProfile.request(p);
|
||||
return;
|
||||
}
|
||||
|
||||
PlayerProfile profile = optional.get();
|
||||
if (profile.isProtected(ProtectionType.BEES)) {
|
||||
|
||||
if (profile.hasFullProtectionAgainst(ProtectionType.BEES)) {
|
||||
for (ItemStack armor : p.getInventory().getArmorContents()) {
|
||||
ItemUtils.damageItem(armor, 1, false);
|
||||
}
|
||||
|
||||
e.setDamage(0D);
|
||||
}
|
||||
}
|
||||
|
@ -104,7 +104,7 @@ public final class ResearchSetup {
|
||||
register("whirlwind_talisman", 75, "Talisman of the Whirlwind", 19, SlimefunItems.TALISMAN_WHIRLWIND);
|
||||
register("wizard_talisman", 76, "Talisman of the Wizard", 22, SlimefunItems.TALISMAN_WIZARD);
|
||||
register("lumber_axe", 77, "Lumber Axe", 21, SlimefunItems.LUMBER_AXE);
|
||||
register("hazmat_suit", 79, "Hazmat Suit", 21, SlimefunItems.SCUBA_HELMET, SlimefunItems.HAZMAT_CHESTPLATE, SlimefunItems.HAZMAT_LEGGINGS, SlimefunItems.RUBBER_BOOTS);
|
||||
register("hazmat_suit", 79, "Hazmat Suit", 21, SlimefunItems.SCUBA_HELMET, SlimefunItems.HAZMAT_CHESTPLATE, SlimefunItems.HAZMAT_LEGGINGS, SlimefunItems.HAZMAT_BOOTS);
|
||||
register("uranium", 80, "Radioactive", 30, SlimefunItems.TINY_URANIUM, SlimefunItems.SMALL_URANIUM, SlimefunItems.URANIUM);
|
||||
register("crushed_ore", 81, "Ore Purification", 25, SlimefunItems.CRUSHED_ORE, SlimefunItems.PULVERIZED_ORE, SlimefunItems.PURE_ORE_CLUSTER);
|
||||
register("redstone_alloy", 84, "Redstone Alloy", 16, SlimefunItems.REDSTONE_ALLOY);
|
||||
@ -268,6 +268,7 @@ public final class ResearchSetup {
|
||||
register("magical_zombie_pills", 257, "De-Zombification", 22, SlimefunItems.MAGICAL_ZOMBIE_PILLS);
|
||||
register("auto_brewer", 258, "Industrial Brewery", 30, SlimefunItems.AUTO_BREWER);
|
||||
register("enchantment_rune", 259, "Ancient Enchanting", 24, SlimefunItems.MAGICAL_GLASS, SlimefunItems.ENCHANTMENT_RUNE);
|
||||
register("lead_clothing", 260, "Lead Clothing", 30, SlimefunItems.REINFORCED_CLOTH);
|
||||
}
|
||||
|
||||
private static void register(String key, int id, String name, int defaultCost, ItemStack... items) {
|
||||
|
@ -909,22 +909,26 @@ public final class SlimefunItemSetup {
|
||||
SlimefunItems.GILDED_IRON_HELMET, SlimefunItems.GILDED_IRON_CHESTPLATE, SlimefunItems.GILDED_IRON_LEGGINGS, SlimefunItems.GILDED_IRON_BOOTS
|
||||
}, "GILDED_IRON", false, plugin);
|
||||
|
||||
new SlimefunItem(categories.technicalComponents, SlimefunItems.REINFORCED_CLOTH, RecipeType.ENHANCED_CRAFTING_TABLE,
|
||||
new ItemStack[] {null, SlimefunItems.CLOTH, null, SlimefunItems.CLOTH, SlimefunItems.LEAD_INGOT, SlimefunItems.CLOTH, null, SlimefunItems.CLOTH, null}, new SlimefunItemStack(SlimefunItems.REINFORCED_CLOTH, 2))
|
||||
.register(plugin);
|
||||
|
||||
new HazmatArmorPiece(categories.armor, SlimefunItems.SCUBA_HELMET, RecipeType.ARMOR_FORGE,
|
||||
new ItemStack[] {new ItemStack(Material.ORANGE_WOOL), new ItemStack(Material.ORANGE_WOOL), new ItemStack(Material.ORANGE_WOOL), new ItemStack(Material.BLACK_WOOL), new ItemStack(Material.GLASS_PANE), new ItemStack(Material.BLACK_WOOL), null, null, null},
|
||||
new ItemStack[] {new ItemStack(Material.ORANGE_WOOL), SlimefunItems.REINFORCED_CLOTH, new ItemStack(Material.ORANGE_WOOL), SlimefunItems.REINFORCED_CLOTH, new ItemStack(Material.GLASS_PANE), SlimefunItems.REINFORCED_CLOTH, null, null, null},
|
||||
new PotionEffect[] {new PotionEffect(PotionEffectType.WATER_BREATHING, 300, 1)})
|
||||
.register(plugin);
|
||||
|
||||
new HazmatArmorPiece(categories.armor, SlimefunItems.HAZMAT_CHESTPLATE, RecipeType.ARMOR_FORGE,
|
||||
new ItemStack[] {new ItemStack(Material.ORANGE_WOOL), null, new ItemStack(Material.ORANGE_WOOL), new ItemStack(Material.ORANGE_WOOL), new ItemStack(Material.ORANGE_WOOL), new ItemStack(Material.ORANGE_WOOL), new ItemStack(Material.BLACK_WOOL), new ItemStack(Material.BLACK_WOOL), new ItemStack(Material.BLACK_WOOL)},
|
||||
new ItemStack[] {new ItemStack(Material.ORANGE_WOOL), null, new ItemStack(Material.ORANGE_WOOL), SlimefunItems.REINFORCED_CLOTH, SlimefunItems.REINFORCED_CLOTH, SlimefunItems.REINFORCED_CLOTH, new ItemStack(Material.BLACK_WOOL), SlimefunItems.REINFORCED_CLOTH, new ItemStack(Material.BLACK_WOOL)},
|
||||
new PotionEffect[] {new PotionEffect(PotionEffectType.FIRE_RESISTANCE, 300, 1)})
|
||||
.register(plugin);
|
||||
|
||||
new HazmatArmorPiece(categories.armor, SlimefunItems.HAZMAT_LEGGINGS, RecipeType.ARMOR_FORGE,
|
||||
new ItemStack[] {new ItemStack(Material.BLACK_WOOL), new ItemStack(Material.BLACK_WOOL), new ItemStack(Material.BLACK_WOOL), new ItemStack(Material.ORANGE_WOOL), null, new ItemStack(Material.ORANGE_WOOL), new ItemStack(Material.ORANGE_WOOL), null, new ItemStack(Material.ORANGE_WOOL)}, null)
|
||||
new ItemStack[] {new ItemStack(Material.BLACK_WOOL), SlimefunItems.REINFORCED_CLOTH, new ItemStack(Material.BLACK_WOOL), SlimefunItems.REINFORCED_CLOTH, null, SlimefunItems.REINFORCED_CLOTH, SlimefunItems.REINFORCED_CLOTH, null, SlimefunItems.REINFORCED_CLOTH}, new PotionEffect[0])
|
||||
.register(plugin);
|
||||
|
||||
new HazmatArmorPiece(categories.armor, SlimefunItems.RUBBER_BOOTS, RecipeType.ARMOR_FORGE,
|
||||
new ItemStack[] {null, null, null, new ItemStack(Material.BLACK_WOOL), null, new ItemStack(Material.BLACK_WOOL), new ItemStack(Material.BLACK_WOOL), null, new ItemStack(Material.BLACK_WOOL)}, null)
|
||||
new HazmatArmorPiece(categories.armor, SlimefunItems.HAZMAT_BOOTS, RecipeType.ARMOR_FORGE,
|
||||
new ItemStack[] {SlimefunItems.REINFORCED_CLOTH, null, SlimefunItems.REINFORCED_CLOTH, SlimefunItems.REINFORCED_CLOTH, null, SlimefunItems.REINFORCED_CLOTH, new ItemStack(Material.BLACK_WOOL), null, new ItemStack(Material.BLACK_WOOL)}, new PotionEffect[0])
|
||||
.register(plugin);
|
||||
|
||||
new SlimefunItem(categories.misc, SlimefunItems.CRUSHED_ORE, RecipeType.ORE_CRUSHER,
|
||||
|
@ -76,6 +76,7 @@ public class ArmorTask implements Runnable {
|
||||
|
||||
if (armorpiece.hasDiverged(item)) {
|
||||
SlimefunItem sfItem = SlimefunItem.getByItem(item);
|
||||
|
||||
if (!(sfItem instanceof SlimefunArmorPiece) || !Slimefun.hasUnlocked(p, sfItem, true)) {
|
||||
sfItem = null;
|
||||
}
|
||||
@ -121,7 +122,7 @@ public class ArmorTask implements Runnable {
|
||||
}
|
||||
|
||||
private void checkForRadiation(Player p, PlayerProfile profile) {
|
||||
if (!profile.isProtected(ProtectionType.RADIATION)) {
|
||||
if (!profile.hasFullProtectionAgainst(ProtectionType.RADIATION)) {
|
||||
for (ItemStack item : p.getInventory()) {
|
||||
if (checkAndApplyRadiation(p, item)) {
|
||||
break;
|
||||
|
@ -150,7 +150,7 @@ public final class SlimefunItems {
|
||||
public static final SlimefunItemStack SCUBA_HELMET = io.github.thebusybiscuit.slimefun4.implementation.SlimefunItems.SCUBA_HELMET;
|
||||
public static final SlimefunItemStack HAZMATSUIT_CHESTPLATE = io.github.thebusybiscuit.slimefun4.implementation.SlimefunItems.HAZMAT_CHESTPLATE;
|
||||
public static final SlimefunItemStack HAZMATSUIT_LEGGINGS = io.github.thebusybiscuit.slimefun4.implementation.SlimefunItems.HAZMAT_LEGGINGS;
|
||||
public static final SlimefunItemStack RUBBER_BOOTS = io.github.thebusybiscuit.slimefun4.implementation.SlimefunItems.RUBBER_BOOTS;
|
||||
public static final SlimefunItemStack RUBBER_BOOTS = io.github.thebusybiscuit.slimefun4.implementation.SlimefunItems.HAZMAT_BOOTS;
|
||||
public static final SlimefunItemStack GILDED_IRON_HELMET = io.github.thebusybiscuit.slimefun4.implementation.SlimefunItems.GILDED_IRON_HELMET;
|
||||
public static final SlimefunItemStack GILDED_IRON_CHESTPLATE = io.github.thebusybiscuit.slimefun4.implementation.SlimefunItems.GILDED_IRON_CHESTPLATE;
|
||||
public static final SlimefunItemStack GILDED_IRON_LEGGINGS = io.github.thebusybiscuit.slimefun4.implementation.SlimefunItems.GILDED_IRON_LEGGINGS;
|
||||
|
Loading…
Reference in New Issue
Block a user