mirror of
https://github.com/Sollace/Unicopia.git
synced 2024-11-30 16:28:00 +01:00
Fix enchantment occurances and remove the curse rank from clingy. Fixes #306
This commit is contained in:
parent
3b4639d5da
commit
7d59e1e0bf
2 changed files with 63 additions and 26 deletions
|
@ -59,7 +59,7 @@ public class SimpleEnchantment extends Enchantment {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public final boolean isAvailableForRandomSelection() {
|
public final boolean isAvailableForRandomSelection() {
|
||||||
return options.looted;
|
return options.table;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class Data {
|
public static class Data {
|
||||||
|
@ -77,8 +77,8 @@ public class SimpleEnchantment extends Enchantment {
|
||||||
public static class Options {
|
public static class Options {
|
||||||
private boolean cursed;
|
private boolean cursed;
|
||||||
private boolean treasured;
|
private boolean treasured;
|
||||||
private boolean traded = true;
|
private boolean traded;
|
||||||
private boolean looted = true;
|
private boolean table;
|
||||||
private Rarity rarity;
|
private Rarity rarity;
|
||||||
private int maxLevel = 1;
|
private int maxLevel = 1;
|
||||||
private EquipmentSlot[] slots;
|
private EquipmentSlot[] slots;
|
||||||
|
@ -102,6 +102,9 @@ public class SimpleEnchantment extends Enchantment {
|
||||||
this.target = target;
|
this.target = target;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the enchantment to apply to all items.
|
||||||
|
*/
|
||||||
public Options ignoreTarget() {
|
public Options ignoreTarget() {
|
||||||
allItems = true;
|
allItems = true;
|
||||||
return this;
|
return this;
|
||||||
|
@ -128,8 +131,7 @@ public class SimpleEnchantment extends Enchantment {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Treasure enchantments only generate in loot tables with high-value items or by trading with villagers.
|
* Whether this enchantment should be limited to high value trades or leveled up enchanting table offers.
|
||||||
* They do not appear in the enchanting table.
|
|
||||||
*/
|
*/
|
||||||
public Options treasure() {
|
public Options treasure() {
|
||||||
treasured = true;
|
treasured = true;
|
||||||
|
@ -137,25 +139,24 @@ public class SimpleEnchantment extends Enchantment {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Loot-Only enchantments do not appear in villager trades.
|
* Set whether this enchantment should appear in villager trades.
|
||||||
* They may still appear in loot table generation and can be found in the enchanting table.
|
|
||||||
*/
|
*/
|
||||||
public Options lootedOnly() {
|
public Options traded() {
|
||||||
traded = false;
|
this.traded = true;
|
||||||
looted = true;
|
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Trade-Only enchantments are excluded from loot table generation and do not appear in the enchanting table.
|
* Sets whether the enchantment should appear in enchanting table draws.
|
||||||
* They can only be found by trading with villagers.
|
|
||||||
*/
|
*/
|
||||||
public Options tradedOnly() {
|
public Options table() {
|
||||||
looted = false;
|
this.table = true;
|
||||||
traded = true;
|
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the maximum level for the enchantment.
|
||||||
|
*/
|
||||||
public Options maxLevel(int level) {
|
public Options maxLevel(int level) {
|
||||||
maxLevel = level;
|
maxLevel = level;
|
||||||
return this;
|
return this;
|
||||||
|
|
|
@ -24,18 +24,30 @@ public interface UEnchantments {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Makes a sound when there are interesting blocks in your area.
|
* Makes a sound when there are interesting blocks in your area.
|
||||||
|
*
|
||||||
|
* Appears in:
|
||||||
|
* - Trades
|
||||||
|
* - Enchanting Table
|
||||||
*/
|
*/
|
||||||
Enchantment GEM_FINDER = register("gem_finder", new GemFindingEnchantment(Options.create(EnchantmentTarget.DIGGER, UEnchantmentValidSlots.HANDS).rarity(Rarity.RARE).maxLevel(3).treasure()));
|
Enchantment GEM_FINDER = register("gem_finder", new GemFindingEnchantment(Options.create(EnchantmentTarget.DIGGER, UEnchantmentValidSlots.HANDS).rarity(Rarity.RARE).maxLevel(3).treasure().traded().table()));
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Protects against wall collisions and earth pony attacks!
|
* Protects against wall collisions and earth pony attacks!
|
||||||
|
*
|
||||||
|
* Appears in:
|
||||||
|
* - Trades
|
||||||
|
* - Enchanting Table
|
||||||
*/
|
*/
|
||||||
Enchantment PADDED = register("padded", new SimpleEnchantment(Options.armor().rarity(Rarity.UNCOMMON).maxLevel(3)));
|
Enchantment PADDED = register("padded", new SimpleEnchantment(Options.armor().rarity(Rarity.UNCOMMON).maxLevel(3).traded().table()));
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Heavy players move more slowly but are less likely to be flung around wildly.
|
* Heavy players move more slowly but are less likely to be flung around wildly.
|
||||||
|
*
|
||||||
|
* Appears in:
|
||||||
|
* - Trades
|
||||||
|
* - Enchanting Table
|
||||||
*/
|
*/
|
||||||
Enchantment HEAVY = register("heavy", new AttributedEnchantment(Options.armor().rarity(Rarity.RARE).maxLevel(4)))
|
Enchantment HEAVY = register("heavy", new AttributedEnchantment(Options.armor().rarity(Rarity.RARE).maxLevel(4).traded().table()))
|
||||||
.addModifier(EntityAttributes.GENERIC_MOVEMENT_SPEED, (user, level) -> {
|
.addModifier(EntityAttributes.GENERIC_MOVEMENT_SPEED, (user, level) -> {
|
||||||
return new EntityAttributeModifier(UUID.fromString("a3d5a94f-4c40-48f6-a343-558502a13e10"), "Heavyness", (1 - level/(float)10) - 1, Operation.MULTIPLY_TOTAL);
|
return new EntityAttributeModifier(UUID.fromString("a3d5a94f-4c40-48f6-a343-558502a13e10"), "Heavyness", (1 - level/(float)10) - 1, Operation.MULTIPLY_TOTAL);
|
||||||
});
|
});
|
||||||
|
@ -44,13 +56,20 @@ public interface UEnchantments {
|
||||||
* It's dangerous to go alone, take this!
|
* It's dangerous to go alone, take this!
|
||||||
*
|
*
|
||||||
* Weapons will become stronger the more allies you have around.
|
* Weapons will become stronger the more allies you have around.
|
||||||
|
*
|
||||||
|
* Appears in:
|
||||||
|
* - Trades
|
||||||
|
* - Enchanting Table
|
||||||
*/
|
*/
|
||||||
Enchantment HERDS = register("herds", new CollaboratorEnchantment(Options.create(EnchantmentTarget.WEAPON, EquipmentSlot.MAINHAND).rarity(Rarity.RARE).maxLevel(3)));
|
Enchantment HERDS = register("herds", new CollaboratorEnchantment(Options.create(EnchantmentTarget.WEAPON, EquipmentSlot.MAINHAND).rarity(Rarity.RARE).maxLevel(3).treasure().traded().table()));
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Alters gravity
|
* Alters gravity
|
||||||
|
*
|
||||||
|
* Appears in:
|
||||||
|
* - Trades
|
||||||
*/
|
*/
|
||||||
Enchantment REPULSION = register("repulsion", new AttributedEnchantment(Options.create(EnchantmentTarget.ARMOR_FEET, EquipmentSlot.FEET).rarity(Rarity.VERY_RARE).maxLevel(3)))
|
Enchantment REPULSION = register("repulsion", new AttributedEnchantment(Options.create(EnchantmentTarget.ARMOR_FEET, EquipmentSlot.FEET).rarity(Rarity.VERY_RARE).maxLevel(3).treasure().traded()))
|
||||||
.addModifier(UEntityAttributes.ENTITY_GRAVITY_MODIFIER, (user, level) -> {
|
.addModifier(UEntityAttributes.ENTITY_GRAVITY_MODIFIER, (user, level) -> {
|
||||||
return new EntityAttributeModifier(UUID.fromString("1734bbd6-1916-4124-b710-5450ea70fbdb"), "Anti Grav", (0.5F - (0.375 * (level - 1))) - 1, Operation.MULTIPLY_TOTAL);
|
return new EntityAttributeModifier(UUID.fromString("1734bbd6-1916-4124-b710-5450ea70fbdb"), "Anti Grav", (0.5F - (0.375 * (level - 1))) - 1, Operation.MULTIPLY_TOTAL);
|
||||||
});
|
});
|
||||||
|
@ -60,35 +79,52 @@ public interface UEnchantments {
|
||||||
*
|
*
|
||||||
* Mobs really want your candy. You'd better give it to them.
|
* Mobs really want your candy. You'd better give it to them.
|
||||||
*/
|
*/
|
||||||
Enchantment WANT_IT_NEED_IT = register("want_it_need_it", new WantItNeedItEnchantment(Options.allItems().rarity(Rarity.VERY_RARE).curse().treasure()));
|
Enchantment WANT_IT_NEED_IT = register("want_it_need_it", new WantItNeedItEnchantment(Options.allItems().rarity(Rarity.VERY_RARE).curse().treasure().traded()));
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Hahaha geddit?
|
* Hahaha geddit?
|
||||||
*
|
*
|
||||||
* Random things happen.
|
* Random things happen.
|
||||||
|
*
|
||||||
|
* Appears in:
|
||||||
|
* - Trades
|
||||||
*/
|
*/
|
||||||
PoisonedJokeEnchantment POISONED_JOKE = register("poisoned_joke", new PoisonedJokeEnchantment(Options.allItems().rarity(Rarity.VERY_RARE).curse().tradedOnly()));
|
PoisonedJokeEnchantment POISONED_JOKE = register("poisoned_joke", new PoisonedJokeEnchantment(Options.allItems().rarity(Rarity.VERY_RARE).curse().traded()));
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Who doesn't like a good freakout?
|
* Who doesn't like a good freakout?
|
||||||
|
*
|
||||||
|
* Appears in:
|
||||||
|
* - Trades
|
||||||
*/
|
*/
|
||||||
Enchantment STRESSED = register("stressed", new StressfulEnchantment(Options.allItems().rarity(Rarity.VERY_RARE).curse().treasure().maxLevel(3)));
|
Enchantment STRESSED = register("stressed", new StressfulEnchantment(Options.allItems().rarity(Rarity.VERY_RARE).curse().treasure().traded().maxLevel(3)));
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This item just wants to be held.
|
* This item just wants to be held.
|
||||||
|
*
|
||||||
|
* Appears in:
|
||||||
|
* - Trades
|
||||||
|
* - Enchanting Table
|
||||||
*/
|
*/
|
||||||
Enchantment CLINGY = register("clingy", new SimpleEnchantment(Options.allItems().rarity(Rarity.VERY_RARE).curse().maxLevel(6)));
|
Enchantment CLINGY = register("clingy", new SimpleEnchantment(Options.allItems().rarity(Rarity.VERY_RARE).maxLevel(6).traded().table().treasure()));
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Items with loyalty are kept after death.
|
* Items with loyalty are kept after death.
|
||||||
* Only works if they don't also have curse of binding.
|
* Only works if they don't also have curse of binding.
|
||||||
|
*
|
||||||
|
* Appears in:
|
||||||
|
* - Enchanting Table
|
||||||
*/
|
*/
|
||||||
Enchantment HEART_BOUND = register("heart_bound", new SimpleEnchantment(Options.create(EnchantmentTarget.VANISHABLE, UEnchantmentValidSlots.ANY).rarity(Rarity.UNCOMMON).maxLevel(5)));
|
Enchantment HEART_BOUND = register("heart_bound", new SimpleEnchantment(Options.create(EnchantmentTarget.VANISHABLE, UEnchantmentValidSlots.ANY).rarity(Rarity.UNCOMMON).maxLevel(5).treasure().table()));
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Consumes drops whilst mining and produces experience instead
|
* Consumes drops whilst mining and produces experience instead
|
||||||
|
*
|
||||||
|
* Appears in:
|
||||||
|
* - Trades
|
||||||
|
* - Enchanting Table
|
||||||
*/
|
*/
|
||||||
Enchantment CONSUMPTION = register("consumption", new ConsumptionEnchantment(Options.create(EnchantmentTarget.DIGGER, UEnchantmentValidSlots.HANDS).rarity(Rarity.VERY_RARE)));
|
Enchantment CONSUMPTION = register("consumption", new ConsumptionEnchantment(Options.create(EnchantmentTarget.DIGGER, UEnchantmentValidSlots.HANDS).rarity(Rarity.VERY_RARE).treasure().table().traded()));
|
||||||
|
|
||||||
static void bootstrap() { }
|
static void bootstrap() { }
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue