mirror of
https://github.com/songoda/UltimateStacker.git
synced 2024-11-23 18:45:39 +01:00
Added the ability to disable reroll, fixed problem with sheep drops.
This commit is contained in:
parent
d7aef463d1
commit
3f67df4c17
@ -5,6 +5,7 @@ import com.songoda.lootables.Modify;
|
||||
import com.songoda.lootables.loot.*;
|
||||
import com.songoda.ultimatestacker.UltimateStacker;
|
||||
import com.songoda.ultimatestacker.utils.ServerVersion;
|
||||
import com.songoda.ultimatestacker.utils.settings.Setting;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.enchantments.Enchantment;
|
||||
import org.bukkit.entity.*;
|
||||
@ -39,7 +40,7 @@ public class LootablesManager {
|
||||
? entity.getKiller().getItemInHand().getEnchantmentLevel(Enchantment.LOOT_BONUS_MOBS)
|
||||
: 0;
|
||||
|
||||
int rerollChance = looting / (looting + 1);
|
||||
int rerollChance = Setting.REROLL.getBoolean() ? 100 * looting / (looting + 1) : 0;
|
||||
|
||||
for (Loot loot : lootable.getRegisteredLoot())
|
||||
toDrop.addAll(runLoot(entity, loot, rerollChance, looting));
|
||||
@ -52,9 +53,7 @@ public class LootablesManager {
|
||||
if (entity.getType() == EntityType.SHEEP) {
|
||||
modify = (Loot loot2) -> {
|
||||
Material material = loot2.getMaterial();
|
||||
if (material == (instance.isServerVersionAtLeast(com.songoda.lootables.utils.ServerVersion.V1_13)
|
||||
? Material.WHITE_WOOL : Material.valueOf("WOOL"))
|
||||
&& ((Sheep) entity).getColor() != null) {
|
||||
if (material.name().contains("WOOL") && ((Sheep) entity).getColor() != null) {
|
||||
if (((Sheep) entity).isSheared()) return null;
|
||||
if (instance.isServerVersionAtLeast(com.songoda.lootables.utils.ServerVersion.V1_13))
|
||||
loot2.setMaterial(Material.valueOf(((Sheep) entity).getColor() + "_WOOL"));
|
||||
@ -71,10 +70,10 @@ public class LootablesManager {
|
||||
Entity killerEntity = ((EntityDamageByEntityEvent) entity.getLastDamageCause()).getDamager();
|
||||
killer = killerEntity.getType();
|
||||
if (killerEntity instanceof Projectile) {
|
||||
Projectile projectile = (Projectile) killerEntity;
|
||||
if (projectile.getShooter() instanceof Entity) {
|
||||
killer = ((Entity) projectile.getShooter()).getType();
|
||||
}
|
||||
Projectile projectile = (Projectile) killerEntity;
|
||||
if (projectile.getShooter() instanceof Entity) {
|
||||
killer = ((Entity) projectile.getShooter()).getType();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -198,6 +197,10 @@ public class LootablesManager {
|
||||
new LootBuilder()
|
||||
.setMaterial(Material.GOLD_INGOT)
|
||||
.setChance(5)
|
||||
.addOnlyDropFors(EntityType.PLAYER).build(),
|
||||
new LootBuilder()
|
||||
.setMaterial(Material.TRIDENT)
|
||||
.setChance(1)
|
||||
.addOnlyDropFors(EntityType.PLAYER).build()));
|
||||
}
|
||||
|
||||
|
@ -49,9 +49,14 @@ public enum Setting {
|
||||
HOLOGRAMS_ON_LOOK_ENTITY("Entities.Only Show Holograms On Look", false,
|
||||
"Only show nametags above an entities head when looking directly at them."),
|
||||
|
||||
CUSTOM_DROPS("Entities.Custom Drops", true,
|
||||
CUSTOM_DROPS("Entities.Custom Drops.Enabled", true,
|
||||
"Should custom drops be enabled?"),
|
||||
|
||||
REROLL("Entities.Custom Drops.Reroll", true,
|
||||
"Increases chance of uncommon drops by making a second attempt to",
|
||||
"drop if the original attempt failed (Requires the looting enchantment).",
|
||||
"This is a default Minecraft mechanic."),
|
||||
|
||||
KILL_WHOLE_STACK_ON_DEATH("Entities.Kill Whole Stack On Death", false,
|
||||
"Should killing a stack of entities kill the whole stack or",
|
||||
"just one out of the stack? If you want only certain entities to be",
|
||||
|
@ -1,5 +1,5 @@
|
||||
#Generated by Maven
|
||||
#Sat Dec 08 20:46:16 CET 2018
|
||||
#Thu Aug 29 19:17:04 EDT 2019
|
||||
version=maven-version-number
|
||||
groupId=com.songoda
|
||||
artifactId=UltimateStacker
|
||||
|
Loading…
Reference in New Issue
Block a user