1
mirror of https://github.com/StarWishsama/Slimefun4.git synced 2024-09-19 19:25:48 +00:00
This commit is contained in:
TheBusyBiscuit 2021-03-31 18:30:04 +02:00
commit 61f0fa5d0d
7 changed files with 50 additions and 33 deletions

View File

@ -32,6 +32,7 @@
* Added Armor Forge Auto-Crafter
* Auto-Crafters can now be turned on and off
* Added Produce Collector to automate Milk and Mushroom Stew
* Added a new message when constructing a Multiblock successfully
* Block Placers can now place down cake
#### Changes
@ -53,6 +54,7 @@
* Fixed Auto-Crafters swallowing buckets when crafting cake
* Fixed Multimeter not working on Auto-Crafters
* Fixed #2650
* Fixed Slimefun items applying damage to items with an `unbreakable` tag
## Release Candidate 21 (14 Mar 2021)
https://thebusybiscuit.github.io/builds/TheBusyBiscuit/Slimefun4/stable/#21

View File

@ -347,7 +347,7 @@
<dependency>
<groupId>com.github.seeseemelk</groupId>
<artifactId>MockBukkit-v1.16</artifactId>
<version>0.32.1</version>
<version>0.32.2</version>
<scope>test</scope>
<exclusions>
@ -420,7 +420,7 @@
<dependency>
<groupId>com.gmail.nossr50.mcMMO</groupId>
<artifactId>mcMMO</artifactId>
<version>2.1.182</version>
<version>2.1.183</version>
<scope>provided</scope>
<exclusions>

View File

@ -3,7 +3,6 @@ package io.github.thebusybiscuit.slimefun4.core.attributes;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.enchantments.Enchantment;
import org.bukkit.entity.Player;
@ -47,7 +46,7 @@ public interface DamageableItem extends ItemAttribute {
* The {@link ItemStack} to damage
*/
default void damageItem(@Nonnull Player p, @Nullable ItemStack item) {
if (isDamageable() && item != null && item.getType() != Material.AIR && item.getAmount() > 0) {
if (isDamageable() && item != null && !item.getType().isAir() && item.getAmount() > 0) {
int unbreakingLevel = item.getEnchantmentLevel(Enchantment.DURABILITY);
if (unbreakingLevel > 0 && Math.random() * 100 <= (60 + Math.floorDiv(40, (unbreakingLevel + 1)))) {
@ -55,14 +54,17 @@ public interface DamageableItem extends ItemAttribute {
}
ItemMeta meta = item.getItemMeta();
Damageable damageable = (Damageable) meta;
if (damageable.getDamage() >= item.getType().getMaxDurability()) {
p.playSound(p.getEyeLocation(), Sound.ENTITY_ITEM_BREAK, 1, 1);
item.setAmount(0);
} else {
damageable.setDamage(damageable.getDamage() + 1);
item.setItemMeta(meta);
if (!meta.isUnbreakable()) {
Damageable damageable = (Damageable) meta;
if (damageable.getDamage() >= item.getType().getMaxDurability()) {
p.playSound(p.getEyeLocation(), Sound.ENTITY_ITEM_BREAK, 1, 1);
item.setAmount(0);
} else {
damageable.setDamage(damageable.getDamage() + 1);
item.setItemMeta(meta);
}
}
}
}

View File

@ -51,7 +51,11 @@ public class ArmorForge extends AbstractCraftingTable {
}
}
SlimefunPlugin.getLocalization().sendMessage(p, "machines.pattern-not-found", true);
if (inv.isEmpty()) {
SlimefunPlugin.getLocalization().sendMessage(p, "machines.inventory-empty", true);
} else {
SlimefunPlugin.getLocalization().sendMessage(p, "machines.pattern-not-found", true);
}
}
}

View File

@ -50,7 +50,11 @@ public class EnhancedCraftingTable extends AbstractCraftingTable {
}
}
SlimefunPlugin.getLocalization().sendMessage(p, "machines.pattern-not-found", true);
if (inv.isEmpty()) {
SlimefunPlugin.getLocalization().sendMessage(p, "machines.inventory-empty", true);
} else {
SlimefunPlugin.getLocalization().sendMessage(p, "machines.pattern-not-found", true);
}
}
}

View File

@ -57,7 +57,11 @@ public class MagicWorkbench extends AbstractCraftingTable {
}
}
SlimefunPlugin.getLocalization().sendMessage(p, "machines.pattern-not-found", true);
if (inv.isEmpty()) {
SlimefunPlugin.getLocalization().sendMessage(p, "machines.inventory-empty", true);
} else {
SlimefunPlugin.getLocalization().sendMessage(p, "machines.pattern-not-found", true);
}
}
}

View File

@ -38,7 +38,7 @@ placeholderapi:
guide:
locked: 'LOCKED'
work-in-progress: 'This feature is not fully finished yet!'
locked-category:
- 'To unlock this category you will'
- 'need to unlock all items from the'
@ -64,11 +64,11 @@ guide:
cheat:
no-multiblocks: '&4You cannot cheat in Multiblocks, you have to build them!'
pages:
previous: 'Previous page'
next: 'Next page'
back:
title: 'Back'
guide: 'Go back to the Slimefun Guide'
@ -86,11 +86,11 @@ guide:
- '&7the language in which Slimefun'
- '&7will be presented to you. Items'
- '&7cannot be translated for now.'
translations:
name: '&aIs something missing?'
lore: 'Click to add your own translation'
title:
main: 'Slimefun Guide'
settings: 'Settings & Info'
@ -101,7 +101,7 @@ guide:
bugs: 'Bug Reports'
source: 'Source Code'
versions: 'Installed versions'
credits:
commit: 'Commit'
commits: 'Commits'
@ -193,17 +193,17 @@ messages:
fail: '&cYou cannot enchant this item.'
no-enchantment: '&cCouldn''t find any applicable enchantment for this item.'
success: '&aYou have successfully applied a random applicable enchantment to this item.'
research:
start: '&7The Ancient Spirits whisper mysterious words into your ear!'
progress: '&7You start to wonder about &b%research% &e(%progress%)'
tape-measure:
no-anchor: '&cYou need to set an anchor before you can start to measure!'
wrong-world: '&cYour anchor seems to be in a different world!'
distance: '&7Measurement taken. &eDistance: %distance%'
anchor-set: '&aSuccessfully set the anchor:&e %anchor%'
climbing-pick:
dual-wielding: '&4You need to hold Climbing Picks in both hands to use them!'
wrong-material: '&cYou cannot climb this surface. Check your Slimefun Guide for more info!'
@ -217,7 +217,7 @@ messages:
no-iron-golem-heal: '&cThat is not an Iron Ingot. You cannot use this to heal Iron Golems!'
link-prompt: '&eClick here:'
diet-cookie: '&eYou are starting to feel very light...'
fortune-cookie:
- '&7Help me, I am trapped in a Fortune Cookie Factory!'
- '&7You will die tomorrow... by a Creeper'
@ -243,6 +243,7 @@ machines:
full-inventory: '&eSorry, my inventory is too full!'
in-use: '&cThis Block''s inventory is currently opened by a different Player.'
ignition-chamber-no-flint: '&cIgnition Chamber is missing Flint and Steel.'
inventory-empty: '&6You have successfully constructed this Multiblock. Proceed by placing items inside the dispenser and click me again to craft the item you want!'
ANCIENT_ALTAR:
not-enough-pedestals: '&4The Altar is not surrounded by the needed amount of Pedestals &c(%pedestals% / 8)'
@ -255,7 +256,7 @@ machines:
HOLOGRAM_PROJECTOR:
enter-text: '&7Please enter your desired Hologram Text into your Chat. &r(Color Codes are supported!)'
inventory-title: 'Hologram Editor'
ELEVATOR:
no-destinations: '&4No destinations found'
pick-a-floor: '&3- Pick a floor -'
@ -263,26 +264,26 @@ machines:
click-to-teleport: '&eClick &7to teleport to this floor:'
enter-name: '&7Please enter your desired floor name into your Chat. &r(Color Codes are supported!)'
named: '&2Successfully named this floor: &r%floor%'
TELEPORTER:
teleporting: '&3Teleporting...'
teleported: '&3Teleported!'
cancelled: '&4Teleportation cancelled!'
invulnerability: '&b&lYou have been given 30 seconds of Invulnerability!'
gui:
title: 'Your waypoints'
tooltip: 'Click to teleport'
time: 'Estimated time'
GPS_CONTROL_PANEL:
title: 'GPS - Control Panel'
transmitters: 'Transmitter Overview'
waypoints: 'Waypoint Overview'
CARGO_NODES:
must-be-placed: '&4Must be placed onto a chest or machine!'
INDUSTRIAL_MINER:
no-fuel: '&cYour Industrial Miner ran out of fuel! Put your fuel into the chest above.'
piston-facing: '&cYour Industrial Miner requires pistons to face upwards!'
@ -292,7 +293,7 @@ machines:
full-chest: '&cThe Chest of your Industrial Miner is full!'
no-permission: '&4You do not seem to have permission to operate an Industrial Miner here!'
finished: '&eYour Industrial Miner has finished! It obtained a total of %ores% ore(s)!'
anvil:
not-working: '&4You cannot use Slimefun items in an anvil!'
mcmmo-salvaging: '&4You cannot salvage Slimefun items!'
@ -338,12 +339,12 @@ inventory:
android:
started: '&7Your Android resumed running its script'
stopped: '&7Your Android has paused its script'
scripts:
already-uploaded: '&4This script has already been uploaded.'
editor: 'Script Editor'
too-long: '&cThe script is too long to edit!'
instructions:
START: '&2Start Script'
REPEAT: '&9Repeat Script'