Repackage NMS

By: md_5 <git@md-5.net>
This commit is contained in:
CraftBukkit/Spigot
2021-03-16 09:00:00 +11:00
parent 18496e998f
commit 9da047989c
968 changed files with 5448 additions and 5050 deletions

View File

@@ -1,11 +1,12 @@
--- a/net/minecraft/server/ContainerEnchantTable.java
+++ b/net/minecraft/server/ContainerEnchantTable.java
@@ -3,6 +3,20 @@
import java.util.List;
import java.util.Random;
--- a/net/minecraft/world/inventory/ContainerEnchantTable.java
+++ b/net/minecraft/world/inventory/ContainerEnchantTable.java
@@ -20,6 +20,21 @@
import net.minecraft.world.item.enchantment.WeightedRandomEnchant;
import net.minecraft.world.level.block.Blocks;
+// CraftBukkit start
+import java.util.Map;
+import net.minecraft.world.item.enchantment.Enchantment;
+import org.bukkit.Location;
+import org.bukkit.NamespacedKey;
+import org.bukkit.craftbukkit.inventory.CraftInventoryEnchanting;
@@ -21,7 +22,7 @@
public class ContainerEnchantTable extends Container {
private final IInventory enchantSlots;
@@ -12,6 +26,10 @@
@@ -29,6 +44,10 @@
public final int[] costs;
public final int[] enchantments;
public final int[] levels;
@@ -32,7 +33,7 @@
public ContainerEnchantTable(int i, PlayerInventory playerinventory) {
this(i, playerinventory, ContainerAccess.a);
@@ -25,6 +43,13 @@
@@ -42,6 +61,13 @@
super.update();
ContainerEnchantTable.this.a((IInventory) this);
}
@@ -46,7 +47,7 @@
};
this.h = new Random();
this.i = ContainerProperty.a();
@@ -72,6 +97,9 @@
@@ -89,6 +115,9 @@
this.a(ContainerProperty.a(this.levels, 0));
this.a(ContainerProperty.a(this.levels, 1));
this.a(ContainerProperty.a(this.levels, 2));
@@ -56,7 +57,7 @@
}
@Override
@@ -79,7 +107,7 @@
@@ -96,7 +125,7 @@
if (iinventory == this.enchantSlots) {
ItemStack itemstack = iinventory.getItem(0);
@@ -65,7 +66,7 @@
this.containerAccess.a((world, blockposition) -> {
int i = 0;
@@ -135,12 +163,47 @@
@@ -152,12 +181,47 @@
if (list != null && !list.isEmpty()) {
WeightedRandomEnchant weightedrandomenchant = (WeightedRandomEnchant) list.get(this.h.nextInt(list.size()));
@@ -114,7 +115,7 @@
this.c();
});
} else {
@@ -167,9 +230,24 @@
@@ -184,9 +248,24 @@
ItemStack itemstack2 = itemstack;
List<WeightedRandomEnchant> list = this.a(itemstack, i, this.costs[i]);
@@ -141,7 +142,7 @@
if (flag) {
itemstack2 = new ItemStack(Items.ENCHANTED_BOOK);
@@ -182,16 +260,29 @@
@@ -199,16 +278,29 @@
this.enchantSlots.setItem(0, itemstack2);
}
@@ -177,7 +178,7 @@
if (!entityhuman.abilities.canInstantlyBuild) {
itemstack1.subtract(j);
if (itemstack1.isEmpty()) {
@@ -238,6 +329,7 @@
@@ -255,6 +347,7 @@
@Override
public boolean canUse(EntityHuman entityhuman) {
@@ -185,7 +186,7 @@
return a(this.containerAccess, entityhuman, Blocks.ENCHANTING_TABLE);
}
@@ -289,4 +381,17 @@
@@ -306,4 +399,17 @@
return itemstack;
}