mirror of
https://github.com/PurpurMC/Purpur.git
synced 2026-02-17 08:27:43 +01:00
fully remove obsolete allowUnsafeEnchants config option
This commit is contained in:
@@ -27,7 +27,7 @@ index 99695e38b6a10c3cffda6e453f9f0619c7406cc0..2283f69607cb769545c85bcae940ac95
|
||||
i++;
|
||||
} else if (targets.size() == 1) {
|
||||
diff --git a/src/main/java/net/minecraft/world/inventory/AnvilMenu.java b/src/main/java/net/minecraft/world/inventory/AnvilMenu.java
|
||||
index 3cdadb7028de83d3c2a939ba883061171137a620..5089974b4f46aa5f8b26218ba77209bf7d6e03e1 100644
|
||||
index 3cdadb7028de83d3c2a939ba883061171137a620..e3c74f30eabfcbeef43a7a8096191e4bf4349c9a 100644
|
||||
--- a/src/main/java/net/minecraft/world/inventory/AnvilMenu.java
|
||||
+++ b/src/main/java/net/minecraft/world/inventory/AnvilMenu.java
|
||||
@@ -231,7 +231,10 @@ public class AnvilMenu extends ItemCombinerMenu {
|
||||
@@ -36,7 +36,7 @@ index 3cdadb7028de83d3c2a939ba883061171137a620..5089974b4f46aa5f8b26218ba77209bf
|
||||
Enchantment enchantment = (Enchantment) holder.value();
|
||||
- boolean flag3 = enchantment.canEnchant(itemstack);
|
||||
+ // Purpur start - Config to allow unsafe enchants
|
||||
+ boolean flag3 = this.canDoUnsafeEnchants || (org.purpurmc.purpur.PurpurConfig.allowUnsafeEnchants && org.purpurmc.purpur.PurpurConfig.allowInapplicableEnchants) || enchantment.canEnchant(itemstack); // whether the enchantment can be applied on specific item type
|
||||
+ boolean flag3 = this.canDoUnsafeEnchants || org.purpurmc.purpur.PurpurConfig.allowInapplicableEnchants || enchantment.canEnchant(itemstack); // whether the enchantment can be applied on specific item type
|
||||
+ boolean flag4 = true; // whether two incompatible enchantments can be applied on a single item
|
||||
+ // Purpur end - Config to allow unsafe enchants
|
||||
|
||||
@@ -47,7 +47,7 @@ index 3cdadb7028de83d3c2a939ba883061171137a620..5089974b4f46aa5f8b26218ba77209bf
|
||||
|
||||
if (!holder1.equals(holder) && !Enchantment.areCompatible(holder, holder1)) {
|
||||
- flag3 = this.canDoUnsafeEnchants; // Purpur - Anvil API
|
||||
+ flag4 = this.canDoUnsafeEnchants || (org.purpurmc.purpur.PurpurConfig.allowUnsafeEnchants && org.purpurmc.purpur.PurpurConfig.allowIncompatibleEnchants); // Purpur - Anvil API // Purpur - flag3 -> flag4 - Config to allow unsafe enchants
|
||||
+ flag4 = this.canDoUnsafeEnchants || org.purpurmc.purpur.PurpurConfig.allowIncompatibleEnchants; // Purpur - Anvil API // Purpur - flag3 -> flag4 - Config to allow unsafe enchants
|
||||
+ // Purpur start - Config to allow unsafe enchants
|
||||
+ if (!flag4 && org.purpurmc.purpur.PurpurConfig.replaceIncompatibleEnchants) {
|
||||
+ iterator1.remove(); // replace current enchant with the incompatible one trying to be applied
|
||||
@@ -64,7 +64,7 @@ index 3cdadb7028de83d3c2a939ba883061171137a620..5089974b4f46aa5f8b26218ba77209bf
|
||||
} else {
|
||||
flag1 = true;
|
||||
- if (i2 > enchantment.getMaxLevel()) {
|
||||
+ if ((!org.purpurmc.purpur.PurpurConfig.allowUnsafeEnchants || !org.purpurmc.purpur.PurpurConfig.allowHigherEnchantsLevels) && i2 > enchantment.getMaxLevel()) { // Purpur - Config to allow unsafe enchants
|
||||
+ if (!org.purpurmc.purpur.PurpurConfig.allowHigherEnchantsLevels && i2 > enchantment.getMaxLevel()) { // Purpur - Config to allow unsafe enchants
|
||||
i2 = enchantment.getMaxLevel();
|
||||
}
|
||||
|
||||
@@ -73,7 +73,7 @@ index 3cdadb7028de83d3c2a939ba883061171137a620..5089974b4f46aa5f8b26218ba77209bf
|
||||
|
||||
// Purpur start - Anvil API
|
||||
- if (this.canDoUnsafeEnchants && itemstack1 != ItemStack.EMPTY) {
|
||||
+ if ((this.canDoUnsafeEnchants || org.purpurmc.purpur.PurpurConfig.allowUnsafeEnchants) && itemstack1 != ItemStack.EMPTY) { // Purpur - Config to allow unsafe enchants
|
||||
+ if ((this.canDoUnsafeEnchants || org.purpurmc.purpur.PurpurConfig.allowInapplicableEnchants || org.purpurmc.purpur.PurpurConfig.allowIncompatibleEnchants) && itemstack1 != ItemStack.EMPTY) { // Purpur - Config to allow unsafe enchants
|
||||
((ServerPlayer) this.player).connection.send(new ClientboundContainerSetSlotPacket(this.containerId, this.incrementStateId(), 2, itemstack1));
|
||||
((ServerPlayer) this.player).connection.send(new ClientboundContainerSetDataPacket(this.containerId, 0, this.cost.get()));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user