@@ -1,10 +1,11 @@
|
||||
--- a/net/minecraft/world/item/ItemArmor.java
|
||||
+++ b/net/minecraft/world/item/ItemArmor.java
|
||||
@@ -27,6 +27,11 @@
|
||||
@@ -27,6 +27,12 @@
|
||||
import net.minecraft.world.level.block.BlockDispenser;
|
||||
import net.minecraft.world.phys.AxisAlignedBB;
|
||||
|
||||
+// CraftBukkit start
|
||||
+import org.bukkit.craftbukkit.block.CraftBlock;
|
||||
+import org.bukkit.craftbukkit.inventory.CraftItemStack;
|
||||
+import org.bukkit.event.block.BlockDispenseArmorEvent;
|
||||
+// CraftBukkit end
|
||||
@@ -12,13 +13,13 @@
|
||||
public class ItemArmor extends Item implements Equipable {
|
||||
|
||||
private static final EnumMap<ItemArmor.a, UUID> ARMOR_MODIFIER_UUID_PER_TYPE = (EnumMap) SystemUtils.make(new EnumMap(ItemArmor.a.class), (enummap) -> {
|
||||
@@ -58,8 +63,34 @@
|
||||
@@ -58,8 +64,34 @@
|
||||
EntityLiving entityliving = (EntityLiving) list.get(0);
|
||||
EnumItemSlot enumitemslot = EntityInsentient.getEquipmentSlotForItem(itemstack);
|
||||
ItemStack itemstack1 = itemstack.split(1);
|
||||
+ // CraftBukkit start
|
||||
+ World world = isourceblock.getLevel();
|
||||
+ org.bukkit.block.Block block = world.getWorld().getBlockAt(isourceblock.getPos().getX(), isourceblock.getPos().getY(), isourceblock.getPos().getZ());
|
||||
+ World world = sourceblock.level();
|
||||
+ org.bukkit.block.Block block = CraftBlock.at(world, sourceblock.pos());
|
||||
+ CraftItemStack craftItem = CraftItemStack.asCraftMirror(itemstack1);
|
||||
+
|
||||
+ BlockDispenseArmorEvent event = new BlockDispenseArmorEvent(block, craftItem.clone(), (org.bukkit.craftbukkit.entity.CraftLivingEntity) entityliving.getBukkitEntity());
|
||||
@@ -37,7 +38,7 @@
|
||||
+ ItemStack eventStack = CraftItemStack.asNMSCopy(event.getItem());
|
||||
+ IDispenseBehavior idispensebehavior = (IDispenseBehavior) BlockDispenser.DISPENSER_REGISTRY.get(eventStack.getItem());
|
||||
+ if (idispensebehavior != IDispenseBehavior.NOOP && idispensebehavior != ItemArmor.DISPENSE_ITEM_BEHAVIOR) {
|
||||
+ idispensebehavior.dispense(isourceblock, eventStack);
|
||||
+ idispensebehavior.dispense(sourceblock, eventStack);
|
||||
+ return true;
|
||||
+ }
|
||||
+ }
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/item/ItemBoneMeal.java
|
||||
+++ b/net/minecraft/world/item/ItemBoneMeal.java
|
||||
@@ -33,6 +33,12 @@
|
||||
@@ -34,6 +34,12 @@
|
||||
|
||||
@Override
|
||||
public EnumInteractionResult useOn(ItemActionContext itemactioncontext) {
|
||||
|
||||
@@ -17,12 +17,12 @@
|
||||
public class ItemBucket extends Item implements DispensibleContainerItem {
|
||||
|
||||
public final FluidType content;
|
||||
@@ -59,6 +69,17 @@
|
||||
iblockdata = world.getBlockState(blockposition);
|
||||
if (iblockdata.getBlock() instanceof IFluidSource) {
|
||||
IFluidSource ifluidsource = (IFluidSource) iblockdata.getBlock();
|
||||
@@ -61,6 +71,17 @@
|
||||
|
||||
if (block instanceof IFluidSource) {
|
||||
IFluidSource ifluidsource = (IFluidSource) block;
|
||||
+ // CraftBukkit start
|
||||
+ ItemStack dummyFluid = ifluidsource.pickupBlock(DummyGeneratorAccess.INSTANCE, blockposition, iblockdata);
|
||||
+ ItemStack dummyFluid = ifluidsource.pickupBlock(entityhuman, DummyGeneratorAccess.INSTANCE, blockposition, iblockdata);
|
||||
+ if (dummyFluid.isEmpty()) return InteractionResultWrapper.fail(itemstack); // Don't fire event if the bucket won't be filled.
|
||||
+ PlayerBucketFillEvent event = CraftEventFactory.callPlayerBucketFillEvent((WorldServer) world, entityhuman, blockposition, blockposition, movingobjectpositionblock.getDirection(), itemstack, dummyFluid.getItem(), enumhand);
|
||||
+
|
||||
@@ -32,10 +32,10 @@
|
||||
+ return InteractionResultWrapper.fail(itemstack);
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
ItemStack itemstack1 = ifluidsource.pickupBlock(world, blockposition, iblockdata);
|
||||
ItemStack itemstack1 = ifluidsource.pickupBlock(entityhuman, world, blockposition, iblockdata);
|
||||
|
||||
if (!itemstack1.isEmpty()) {
|
||||
@@ -67,7 +88,7 @@
|
||||
@@ -69,7 +90,7 @@
|
||||
entityhuman.playSound(soundeffect, 1.0F, 1.0F);
|
||||
});
|
||||
world.gameEvent((Entity) entityhuman, GameEvent.FLUID_PICKUP, blockposition);
|
||||
@@ -44,7 +44,7 @@
|
||||
|
||||
if (!world.isClientSide) {
|
||||
CriterionTriggers.FILLED_BUCKET.trigger((EntityPlayer) entityhuman, itemstack1);
|
||||
@@ -82,7 +103,7 @@
|
||||
@@ -84,7 +105,7 @@
|
||||
iblockdata = world.getBlockState(blockposition);
|
||||
BlockPosition blockposition2 = iblockdata.getBlock() instanceof IFluidContainer && this.content == FluidTypes.WATER ? blockposition : blockposition1;
|
||||
|
||||
@@ -53,7 +53,7 @@
|
||||
this.checkExtraContent(entityhuman, world, itemstack, blockposition2);
|
||||
if (entityhuman instanceof EntityPlayer) {
|
||||
CriterionTriggers.PLACED_BLOCK.trigger((EntityPlayer) entityhuman, blockposition2, itemstack);
|
||||
@@ -109,6 +130,12 @@
|
||||
@@ -111,6 +132,12 @@
|
||||
|
||||
@Override
|
||||
public boolean emptyContents(@Nullable EntityHuman entityhuman, World world, BlockPosition blockposition, @Nullable MovingObjectPositionBlock movingobjectpositionblock) {
|
||||
@@ -63,15 +63,15 @@
|
||||
+
|
||||
+ public boolean emptyContents(EntityHuman entityhuman, World world, BlockPosition blockposition, @Nullable MovingObjectPositionBlock movingobjectpositionblock, EnumDirection enumdirection, BlockPosition clicked, ItemStack itemstack, EnumHand enumhand) {
|
||||
+ // CraftBukkit end
|
||||
if (!(this.content instanceof FluidTypeFlowing)) {
|
||||
return false;
|
||||
} else {
|
||||
@@ -117,8 +144,18 @@
|
||||
boolean flag = iblockdata.canBeReplaced(this.content);
|
||||
boolean flag1 = iblockdata.isAir() || flag || block instanceof IFluidContainer && ((IFluidContainer) block).canPlaceLiquid(world, blockposition, iblockdata, this.content);
|
||||
FluidType fluidtype = this.content;
|
||||
|
||||
if (!(fluidtype instanceof FluidTypeFlowing)) {
|
||||
@@ -148,8 +175,18 @@
|
||||
|
||||
boolean flag2 = flag1;
|
||||
|
||||
+ // CraftBukkit start
|
||||
+ if (flag1 && entityhuman != null) {
|
||||
+ if (flag2 && entityhuman != null) {
|
||||
+ PlayerBucketEmptyEvent event = CraftEventFactory.callPlayerBucketEmptyEvent((WorldServer) world, entityhuman, blockposition, clicked, enumdirection, itemstack, enumhand);
|
||||
+ if (event.isCancelled()) {
|
||||
+ ((EntityPlayer) entityhuman).connection.send(new PacketPlayOutBlockChange(world, blockposition)); // SPIGOT-4238: needed when looking through entity
|
||||
@@ -80,7 +80,7 @@
|
||||
+ }
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
if (!flag1) {
|
||||
if (!flag2) {
|
||||
- return movingobjectpositionblock != null && this.emptyContents(entityhuman, world, movingobjectpositionblock.getBlockPos().relative(movingobjectpositionblock.getDirection()), (MovingObjectPositionBlock) null);
|
||||
+ return movingobjectpositionblock != null && this.emptyContents(entityhuman, world, movingobjectpositionblock.getBlockPos().relative(movingobjectpositionblock.getDirection()), (MovingObjectPositionBlock) null, enumdirection, clicked, itemstack, enumhand); // CraftBukkit
|
||||
} else if (world.dimensionType().ultraWarm() && this.content.is(TagsFluid.WATER)) {
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
--- a/net/minecraft/world/item/ItemMinecart.java
|
||||
+++ b/net/minecraft/world/item/ItemMinecart.java
|
||||
@@ -17,6 +17,11 @@
|
||||
import net.minecraft.world.level.block.state.properties.BlockPropertyTrackPosition;
|
||||
@@ -18,6 +18,12 @@
|
||||
import net.minecraft.world.level.gameevent.GameEvent;
|
||||
import net.minecraft.world.phys.Vec3D;
|
||||
|
||||
+// CraftBukkit start
|
||||
+import org.bukkit.craftbukkit.block.CraftBlock;
|
||||
+import org.bukkit.craftbukkit.inventory.CraftItemStack;
|
||||
+import org.bukkit.event.block.BlockDispenseEvent;
|
||||
+// CraftBukkit end
|
||||
@@ -12,7 +13,7 @@
|
||||
public class ItemMinecart extends Item {
|
||||
|
||||
private static final IDispenseBehavior DISPENSE_ITEM_BEHAVIOR = new DispenseBehaviorItem() {
|
||||
@@ -55,14 +60,43 @@
|
||||
@@ -57,14 +63,43 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,7 +21,7 @@
|
||||
+ // CraftBukkit start
|
||||
+ // EntityMinecartAbstract entityminecartabstract = EntityMinecartAbstract.createMinecart(worldserver, d0, d1 + d3, d2, ((ItemMinecart) itemstack.getItem()).type);
|
||||
+ ItemStack itemstack1 = itemstack.split(1);
|
||||
+ org.bukkit.block.Block block2 = worldserver.getWorld().getBlockAt(isourceblock.getPos().getX(), isourceblock.getPos().getY(), isourceblock.getPos().getZ());
|
||||
+ org.bukkit.block.Block block2 = CraftBlock.at(worldserver, sourceblock.pos());
|
||||
+ CraftItemStack craftItem = CraftItemStack.asCraftMirror(itemstack1);
|
||||
+
|
||||
+ BlockDispenseEvent event = new BlockDispenseEvent(block2, craftItem.clone(), new org.bukkit.util.Vector(d0, d1 + d3, d2));
|
||||
@@ -39,7 +40,7 @@
|
||||
+ ItemStack eventStack = CraftItemStack.asNMSCopy(event.getItem());
|
||||
+ IDispenseBehavior idispensebehavior = (IDispenseBehavior) BlockDispenser.DISPENSER_REGISTRY.get(eventStack.getItem());
|
||||
+ if (idispensebehavior != IDispenseBehavior.NOOP && idispensebehavior != this) {
|
||||
+ idispensebehavior.dispense(isourceblock, eventStack);
|
||||
+ idispensebehavior.dispense(sourceblock, eventStack);
|
||||
+ return itemstack;
|
||||
+ }
|
||||
+ }
|
||||
@@ -59,7 +60,7 @@
|
||||
return itemstack;
|
||||
}
|
||||
|
||||
@@ -104,7 +138,12 @@
|
||||
@@ -106,7 +141,12 @@
|
||||
entityminecartabstract.setCustomName(itemstack.getHoverName());
|
||||
}
|
||||
|
||||
|
||||
@@ -1,19 +0,0 @@
|
||||
--- a/net/minecraft/world/item/ItemSkullPlayer.java
|
||||
+++ b/net/minecraft/world/item/ItemSkullPlayer.java
|
||||
@@ -51,6 +51,16 @@
|
||||
TileEntitySkull.updateGameprofile(gameprofile, (gameprofile1) -> {
|
||||
nbttagcompound.put("SkullOwner", GameProfileSerializer.writeGameProfile(new NBTTagCompound(), gameprofile1));
|
||||
});
|
||||
+ // CraftBukkit start
|
||||
+ } else {
|
||||
+ net.minecraft.nbt.NBTTagList textures = nbttagcompound.getCompound("SkullOwner").getCompound("Properties").getList("textures", 10); // Safe due to method contracts
|
||||
+ for (int i = 0; i < textures.size(); i++) {
|
||||
+ if (textures.get(i) instanceof NBTTagCompound && !((NBTTagCompound) textures.get(i)).contains("Signature", 8) && ((NBTTagCompound) textures.get(i)).getString("Value").trim().isEmpty()) {
|
||||
+ nbttagcompound.remove("SkullOwner");
|
||||
+ break;
|
||||
+ }
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/item/ItemStack.java
|
||||
+++ b/net/minecraft/world/item/ItemStack.java
|
||||
@@ -76,6 +76,43 @@
|
||||
@@ -77,6 +77,43 @@
|
||||
import net.minecraft.world.level.block.state.pattern.ShapeDetectorBlock;
|
||||
import org.slf4j.Logger;
|
||||
|
||||
@@ -44,7 +44,7 @@
|
||||
public final class ItemStack {
|
||||
|
||||
public static final Codec<ItemStack> CODEC = RecordCodecBuilder.create((instance) -> {
|
||||
@@ -151,11 +188,24 @@
|
||||
@@ -152,11 +189,24 @@
|
||||
this.item = null;
|
||||
}
|
||||
|
||||
@@ -71,7 +71,7 @@
|
||||
this.getItem().verifyTagAfterLoad(this.tag);
|
||||
}
|
||||
|
||||
@@ -165,6 +215,11 @@
|
||||
@@ -166,6 +216,11 @@
|
||||
|
||||
}
|
||||
|
||||
@@ -83,7 +83,7 @@
|
||||
public static ItemStack of(NBTTagCompound nbttagcompound) {
|
||||
try {
|
||||
return new ItemStack(nbttagcompound);
|
||||
@@ -238,11 +293,190 @@
|
||||
@@ -243,11 +298,190 @@
|
||||
return EnumInteractionResult.PASS;
|
||||
} else {
|
||||
Item item = this.getItem();
|
||||
@@ -276,7 +276,7 @@
|
||||
|
||||
return enuminteractionresult;
|
||||
}
|
||||
@@ -323,6 +557,21 @@
|
||||
@@ -328,6 +562,21 @@
|
||||
}
|
||||
|
||||
i -= k;
|
||||
@@ -298,7 +298,7 @@
|
||||
if (i <= 0) {
|
||||
return false;
|
||||
}
|
||||
@@ -344,6 +593,11 @@
|
||||
@@ -349,6 +598,11 @@
|
||||
if (this.hurt(i, t0.getRandom(), t0 instanceof EntityPlayer ? (EntityPlayer) t0 : null)) {
|
||||
consumer.accept(t0);
|
||||
Item item = this.getItem();
|
||||
@@ -310,7 +310,7 @@
|
||||
|
||||
this.shrink(1);
|
||||
if (t0 instanceof EntityHuman) {
|
||||
@@ -492,6 +746,17 @@
|
||||
@@ -497,6 +751,17 @@
|
||||
return this.tag;
|
||||
}
|
||||
|
||||
@@ -328,20 +328,7 @@
|
||||
public NBTTagCompound getOrCreateTag() {
|
||||
if (this.tag == null) {
|
||||
this.setTag(new NBTTagCompound());
|
||||
@@ -862,6 +1127,12 @@
|
||||
}
|
||||
|
||||
public void setRepairCost(int i) {
|
||||
+ // CraftBukkit start - remove RepairCost tag when 0 (SPIGOT-3945)
|
||||
+ if (i == 0) {
|
||||
+ this.removeTagKey("RepairCost");
|
||||
+ return;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
this.getOrCreateTag().putInt("RepairCost", i);
|
||||
}
|
||||
|
||||
@@ -911,6 +1182,13 @@
|
||||
@@ -921,6 +1186,13 @@
|
||||
nbttaglist.add(nbttagcompound);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/item/crafting/CraftingManager.java
|
||||
+++ b/net/minecraft/world/item/crafting/CraftingManager.java
|
||||
@@ -34,11 +34,13 @@
|
||||
@@ -37,11 +37,13 @@
|
||||
import net.minecraft.world.level.World;
|
||||
import org.slf4j.Logger;
|
||||
|
||||
@@ -10,39 +10,39 @@
|
||||
|
||||
private static final Gson GSON = (new GsonBuilder()).setPrettyPrinting().disableHtmlEscaping().create();
|
||||
private static final Logger LOGGER = LogUtils.getLogger();
|
||||
- public Map<Recipes<?>, Map<MinecraftKey, IRecipe<?>>> recipes = ImmutableMap.of();
|
||||
+ public Map<Recipes<?>, Object2ObjectLinkedOpenHashMap<MinecraftKey, IRecipe<?>>> recipes = ImmutableMap.of(); // CraftBukkit
|
||||
private Map<MinecraftKey, IRecipe<?>> byName = ImmutableMap.of();
|
||||
- public Map<Recipes<?>, Map<MinecraftKey, RecipeHolder<?>>> recipes = ImmutableMap.of();
|
||||
+ public Map<Recipes<?>, Object2ObjectLinkedOpenHashMap<MinecraftKey, RecipeHolder<?>>> recipes = ImmutableMap.of(); // CraftBukkit
|
||||
private Map<MinecraftKey, RecipeHolder<?>> byName = ImmutableMap.of();
|
||||
private boolean hasErrors;
|
||||
|
||||
@@ -48,7 +50,12 @@
|
||||
@@ -51,7 +53,12 @@
|
||||
|
||||
protected void apply(Map<MinecraftKey, JsonElement> map, IResourceManager iresourcemanager, GameProfilerFiller gameprofilerfiller) {
|
||||
this.hasErrors = false;
|
||||
- Map<Recipes<?>, Builder<MinecraftKey, IRecipe<?>>> map1 = Maps.newHashMap();
|
||||
- Map<Recipes<?>, Builder<MinecraftKey, RecipeHolder<?>>> map1 = Maps.newHashMap();
|
||||
+ // CraftBukkit start - SPIGOT-5667 make sure all types are populated and mutable
|
||||
+ Map<Recipes<?>, Object2ObjectLinkedOpenHashMap<MinecraftKey, IRecipe<?>>> map1 = Maps.newHashMap();
|
||||
+ Map<Recipes<?>, Object2ObjectLinkedOpenHashMap<MinecraftKey, RecipeHolder<?>>> map1 = Maps.newHashMap();
|
||||
+ for (Recipes<?> recipeType : BuiltInRegistries.RECIPE_TYPE) {
|
||||
+ map1.put(recipeType, new Object2ObjectLinkedOpenHashMap<>());
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
Builder<MinecraftKey, IRecipe<?>> builder = ImmutableMap.builder();
|
||||
Builder<MinecraftKey, RecipeHolder<?>> builder = ImmutableMap.builder();
|
||||
Iterator iterator = map.entrySet().iterator();
|
||||
|
||||
@@ -59,8 +66,10 @@
|
||||
@@ -62,8 +69,10 @@
|
||||
try {
|
||||
IRecipe<?> irecipe = fromJson(minecraftkey, ChatDeserializer.convertToJsonObject((JsonElement) entry.getValue(), "top element"));
|
||||
RecipeHolder<?> recipeholder = fromJson(minecraftkey, ChatDeserializer.convertToJsonObject((JsonElement) entry.getValue(), "top element"));
|
||||
|
||||
- ((Builder) map1.computeIfAbsent(irecipe.getType(), (recipes) -> {
|
||||
- ((Builder) map1.computeIfAbsent(recipeholder.value().getType(), (recipes) -> {
|
||||
- return ImmutableMap.builder();
|
||||
+ // CraftBukkit start
|
||||
+ (map1.computeIfAbsent(irecipe.getType(), (recipes) -> {
|
||||
+ (map1.computeIfAbsent(recipeholder.value().getType(), (recipes) -> {
|
||||
+ return new Object2ObjectLinkedOpenHashMap<>();
|
||||
+ // CraftBukkit end
|
||||
})).put(minecraftkey, irecipe);
|
||||
builder.put(minecraftkey, irecipe);
|
||||
})).put(minecraftkey, recipeholder);
|
||||
builder.put(minecraftkey, recipeholder);
|
||||
} catch (IllegalArgumentException | JsonParseException jsonparseexception) {
|
||||
@@ -69,27 +78,44 @@
|
||||
@@ -72,20 +81,37 @@
|
||||
}
|
||||
|
||||
this.recipes = (Map) map1.entrySet().stream().collect(ImmutableMap.toImmutableMap(Entry::getKey, (entry1) -> {
|
||||
@@ -55,14 +55,14 @@
|
||||
}
|
||||
|
||||
+ // CraftBukkit start
|
||||
+ public void addRecipe(IRecipe<?> irecipe) {
|
||||
+ Object2ObjectLinkedOpenHashMap<MinecraftKey, IRecipe<?>> map = this.recipes.get(irecipe.getType()); // CraftBukkit
|
||||
+ public void addRecipe(RecipeHolder<?> irecipe) {
|
||||
+ Object2ObjectLinkedOpenHashMap<MinecraftKey, RecipeHolder<?>> map = this.recipes.get(irecipe.value().getType()); // CraftBukkit
|
||||
+
|
||||
+ if (byName.containsKey(irecipe.getId()) || map.containsKey(irecipe.getId())) {
|
||||
+ throw new IllegalStateException("Duplicate recipe ignored with ID " + irecipe.getId());
|
||||
+ if (byName.containsKey(irecipe.id()) || map.containsKey(irecipe.id())) {
|
||||
+ throw new IllegalStateException("Duplicate recipe ignored with ID " + irecipe.id());
|
||||
+ } else {
|
||||
+ map.putAndMoveToFirst(irecipe.getId(), irecipe); // CraftBukkit - SPIGOT-4638: last recipe gets priority
|
||||
+ byName.put(irecipe.getId(), irecipe);
|
||||
+ map.putAndMoveToFirst(irecipe.id(), irecipe); // CraftBukkit - SPIGOT-4638: last recipe gets priority
|
||||
+ byName.put(irecipe.id(), irecipe);
|
||||
+ }
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
@@ -71,69 +71,43 @@
|
||||
return this.hasErrors;
|
||||
}
|
||||
|
||||
public <C extends IInventory, T extends IRecipe<C>> Optional<T> getRecipeFor(Recipes<T> recipes, C c0, World world) {
|
||||
- return this.byType(recipes).values().stream().filter((irecipe) -> {
|
||||
public <C extends IInventory, T extends IRecipe<C>> Optional<RecipeHolder<T>> getRecipeFor(Recipes<T> recipes, C c0, World world) {
|
||||
- return this.byType(recipes).values().stream().filter((recipeholder) -> {
|
||||
+ // CraftBukkit start
|
||||
+ Optional<T> recipe = this.byType(recipes).values().stream().filter((irecipe) -> {
|
||||
return irecipe.matches(c0, world);
|
||||
+ Optional<RecipeHolder<T>> recipe = this.byType(recipes).values().stream().filter((recipeholder) -> {
|
||||
return recipeholder.value().matches(c0, world);
|
||||
}).findFirst();
|
||||
+ c0.setCurrentRecipe(recipe.orElse(null)); // CraftBukkit - Clear recipe when no recipe is found
|
||||
+ // CraftBukkit end
|
||||
+ return recipe;
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
|
||||
public <C extends IInventory, T extends IRecipe<C>> Optional<Pair<MinecraftKey, T>> getRecipeFor(Recipes<T> recipes, C c0, World world, @Nullable MinecraftKey minecraftkey) {
|
||||
Map<MinecraftKey, T> map = this.byType(recipes);
|
||||
|
||||
if (minecraftkey != null) {
|
||||
- T t0 = (IRecipe) map.get(minecraftkey);
|
||||
+ T t0 = map.get(minecraftkey); // CraftBukkit - decompile error
|
||||
|
||||
if (t0 != null && t0.matches(c0, world)) {
|
||||
return Optional.of(Pair.of(minecraftkey, t0));
|
||||
@@ -99,7 +125,7 @@
|
||||
return map.entrySet().stream().filter((entry) -> {
|
||||
return ((IRecipe) entry.getValue()).matches(c0, world);
|
||||
}).findFirst().map((entry) -> {
|
||||
- return Pair.of((MinecraftKey) entry.getKey(), (IRecipe) entry.getValue());
|
||||
+ return Pair.of((MinecraftKey) entry.getKey(), entry.getValue()); // CraftBukkit - decompile error
|
||||
});
|
||||
public <C extends IInventory, T extends IRecipe<C>> Optional<Pair<MinecraftKey, RecipeHolder<T>>> getRecipeFor(Recipes<T> recipes, C c0, World world, @Nullable MinecraftKey minecraftkey) {
|
||||
@@ -119,7 +145,7 @@
|
||||
}
|
||||
|
||||
@@ -116,7 +142,7 @@
|
||||
}
|
||||
|
||||
private <C extends IInventory, T extends IRecipe<C>> Map<MinecraftKey, T> byType(Recipes<T> recipes) {
|
||||
private <C extends IInventory, T extends IRecipe<C>> Map<MinecraftKey, RecipeHolder<T>> byType(Recipes<T> recipes) {
|
||||
- return (Map) this.recipes.getOrDefault(recipes, Collections.emptyMap());
|
||||
+ return (Map) this.recipes.getOrDefault(recipes, new Object2ObjectLinkedOpenHashMap<>()); // CraftBukkit
|
||||
}
|
||||
|
||||
public <C extends IInventory, T extends IRecipe<C>> NonNullList<ItemStack> getRemainingItemsFor(Recipes<T> recipes, C c0, World world) {
|
||||
@@ -136,7 +162,7 @@
|
||||
}
|
||||
@@ -166,12 +192,12 @@
|
||||
|
||||
public Optional<? extends IRecipe<?>> byKey(MinecraftKey minecraftkey) {
|
||||
- return Optional.ofNullable((IRecipe) this.byName.get(minecraftkey));
|
||||
+ return Optional.ofNullable(this.byName.get(minecraftkey)); // CraftBukkit - decompile error
|
||||
}
|
||||
|
||||
public Collection<IRecipe<?>> getRecipes() {
|
||||
@@ -161,12 +187,12 @@
|
||||
|
||||
public void replaceRecipes(Iterable<IRecipe<?>> iterable) {
|
||||
public void replaceRecipes(Iterable<RecipeHolder<?>> iterable) {
|
||||
this.hasErrors = false;
|
||||
- Map<Recipes<?>, Map<MinecraftKey, IRecipe<?>>> map = Maps.newHashMap();
|
||||
+ Map<Recipes<?>, Object2ObjectLinkedOpenHashMap<MinecraftKey, IRecipe<?>>> map = Maps.newHashMap(); // CraftBukkit
|
||||
Builder<MinecraftKey, IRecipe<?>> builder = ImmutableMap.builder();
|
||||
- Map<Recipes<?>, Map<MinecraftKey, RecipeHolder<?>>> map = Maps.newHashMap();
|
||||
+ Map<Recipes<?>, Object2ObjectLinkedOpenHashMap<MinecraftKey, RecipeHolder<?>>> map = Maps.newHashMap(); // CraftBukkit
|
||||
Builder<MinecraftKey, RecipeHolder<?>> builder = ImmutableMap.builder();
|
||||
|
||||
iterable.forEach((irecipe) -> {
|
||||
Map<MinecraftKey, IRecipe<?>> map1 = (Map) map.computeIfAbsent(irecipe.getType(), (recipes) -> {
|
||||
iterable.forEach((recipeholder) -> {
|
||||
Map<MinecraftKey, RecipeHolder<?>> map1 = (Map) map.computeIfAbsent(recipeholder.value().getType(), (recipes) -> {
|
||||
- return Maps.newHashMap();
|
||||
+ return new Object2ObjectLinkedOpenHashMap<>(); // CraftBukkit
|
||||
});
|
||||
MinecraftKey minecraftkey = irecipe.getId();
|
||||
IRecipe<?> irecipe1 = (IRecipe) map1.put(minecraftkey, irecipe);
|
||||
@@ -177,8 +203,28 @@
|
||||
MinecraftKey minecraftkey = recipeholder.id();
|
||||
RecipeHolder<?> recipeholder1 = (RecipeHolder) map1.put(minecraftkey, recipeholder);
|
||||
@@ -182,8 +208,28 @@
|
||||
}
|
||||
});
|
||||
this.recipes = ImmutableMap.copyOf(map);
|
||||
@@ -143,7 +117,7 @@
|
||||
+
|
||||
+ // CraftBukkit start
|
||||
+ public boolean removeRecipe(MinecraftKey mcKey) {
|
||||
+ for (Object2ObjectLinkedOpenHashMap<MinecraftKey, IRecipe<?>> recipes : recipes.values()) {
|
||||
+ for (Object2ObjectLinkedOpenHashMap<MinecraftKey, RecipeHolder<?>> recipes : recipes.values()) {
|
||||
+ recipes.remove(mcKey);
|
||||
+ }
|
||||
+
|
||||
@@ -163,12 +137,3 @@
|
||||
|
||||
public static <C extends IInventory, T extends IRecipe<C>> CraftingManager.a<C, T> createCheck(final Recipes<T> recipes) {
|
||||
return new CraftingManager.a<C, T>() {
|
||||
@@ -194,7 +240,7 @@
|
||||
Pair<MinecraftKey, T> pair = (Pair) optional.get();
|
||||
|
||||
this.lastRecipe = (MinecraftKey) pair.getFirst();
|
||||
- return Optional.of((IRecipe) pair.getSecond());
|
||||
+ return Optional.of(pair.getSecond()); // CraftBukkit - decompile error
|
||||
} else {
|
||||
return Optional.empty();
|
||||
}
|
||||
|
||||
@@ -1,31 +1,31 @@
|
||||
--- a/net/minecraft/world/item/crafting/FurnaceRecipe.java
|
||||
+++ b/net/minecraft/world/item/crafting/FurnaceRecipe.java
|
||||
@@ -4,6 +4,14 @@
|
||||
@@ -3,6 +3,14 @@
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraft.world.level.block.Blocks;
|
||||
|
||||
+// CraftBukkit start
|
||||
+import org.bukkit.NamespacedKey;
|
||||
+import org.bukkit.craftbukkit.inventory.CraftFurnaceRecipe;
|
||||
+import org.bukkit.craftbukkit.inventory.CraftItemStack;
|
||||
+import org.bukkit.craftbukkit.inventory.CraftRecipe;
|
||||
+import org.bukkit.craftbukkit.util.CraftNamespacedKey;
|
||||
+import org.bukkit.inventory.Recipe;
|
||||
+// CraftBukkit end
|
||||
+
|
||||
public class FurnaceRecipe extends RecipeCooking {
|
||||
|
||||
public FurnaceRecipe(MinecraftKey minecraftkey, String s, CookingBookCategory cookingbookcategory, RecipeItemStack recipeitemstack, ItemStack itemstack, float f, int i) {
|
||||
@@ -19,4 +27,17 @@
|
||||
public FurnaceRecipe(String s, CookingBookCategory cookingbookcategory, RecipeItemStack recipeitemstack, ItemStack itemstack, float f, int i) {
|
||||
@@ -18,4 +26,17 @@
|
||||
public RecipeSerializer<?> getSerializer() {
|
||||
return RecipeSerializer.SMELTING_RECIPE;
|
||||
}
|
||||
+
|
||||
+ // CraftBukkit start
|
||||
+ @Override
|
||||
+ public Recipe toBukkitRecipe() {
|
||||
+ public Recipe toBukkitRecipe(NamespacedKey id) {
|
||||
+ CraftItemStack result = CraftItemStack.asCraftMirror(this.result);
|
||||
+
|
||||
+ CraftFurnaceRecipe recipe = new CraftFurnaceRecipe(CraftNamespacedKey.fromMinecraft(this.id), result, CraftRecipe.toBukkit(this.ingredient), this.experience, this.cookingTime);
|
||||
+ CraftFurnaceRecipe recipe = new CraftFurnaceRecipe(id, result, CraftRecipe.toBukkit(this.ingredient), this.experience, this.cookingTime);
|
||||
+ recipe.setGroup(this.group);
|
||||
+ recipe.setCategory(CraftRecipe.getCategory(this.category()));
|
||||
+
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
--- a/net/minecraft/world/item/crafting/IRecipe.java
|
||||
+++ b/net/minecraft/world/item/crafting/IRecipe.java
|
||||
@@ -66,4 +66,6 @@
|
||||
@@ -63,4 +63,6 @@
|
||||
return recipeitemstack.getItems().length == 0;
|
||||
});
|
||||
}
|
||||
+
|
||||
+ org.bukkit.inventory.Recipe toBukkitRecipe(); // CraftBukkit
|
||||
+ org.bukkit.inventory.Recipe toBukkitRecipe(org.bukkit.NamespacedKey id); // CraftBukkit
|
||||
}
|
||||
|
||||
@@ -1,14 +1,26 @@
|
||||
--- a/net/minecraft/world/item/crafting/IRecipeComplex.java
|
||||
+++ b/net/minecraft/world/item/crafting/IRecipeComplex.java
|
||||
@@ -33,4 +33,11 @@
|
||||
@@ -3,6 +3,11 @@
|
||||
import net.minecraft.core.IRegistryCustom;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
|
||||
+// CraftBukkit start
|
||||
+import org.bukkit.NamespacedKey;
|
||||
+import org.bukkit.inventory.Recipe;
|
||||
+// CraftBukkit end
|
||||
+
|
||||
public abstract class IRecipeComplex implements RecipeCrafting {
|
||||
|
||||
private final CraftingBookCategory category;
|
||||
@@ -25,4 +30,11 @@
|
||||
public CraftingBookCategory category() {
|
||||
return this.category;
|
||||
}
|
||||
+
|
||||
+ // CraftBukkit start
|
||||
+ @Override
|
||||
+ public org.bukkit.inventory.Recipe toBukkitRecipe() {
|
||||
+ return new org.bukkit.craftbukkit.inventory.CraftComplexRecipe(this);
|
||||
+ public Recipe toBukkitRecipe(NamespacedKey id) {
|
||||
+ return new org.bukkit.craftbukkit.inventory.CraftComplexRecipe(id, this);
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
|
||||
@@ -1,31 +1,31 @@
|
||||
--- a/net/minecraft/world/item/crafting/RecipeBlasting.java
|
||||
+++ b/net/minecraft/world/item/crafting/RecipeBlasting.java
|
||||
@@ -4,6 +4,14 @@
|
||||
@@ -3,6 +3,14 @@
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraft.world.level.block.Blocks;
|
||||
|
||||
+// CraftBukkit start
|
||||
+import org.bukkit.NamespacedKey;
|
||||
+import org.bukkit.craftbukkit.inventory.CraftBlastingRecipe;
|
||||
+import org.bukkit.craftbukkit.inventory.CraftItemStack;
|
||||
+import org.bukkit.craftbukkit.inventory.CraftRecipe;
|
||||
+import org.bukkit.craftbukkit.util.CraftNamespacedKey;
|
||||
+import org.bukkit.inventory.Recipe;
|
||||
+// CraftBukkit end
|
||||
+
|
||||
public class RecipeBlasting extends RecipeCooking {
|
||||
|
||||
public RecipeBlasting(MinecraftKey minecraftkey, String s, CookingBookCategory cookingbookcategory, RecipeItemStack recipeitemstack, ItemStack itemstack, float f, int i) {
|
||||
@@ -19,4 +27,17 @@
|
||||
public RecipeBlasting(String s, CookingBookCategory cookingbookcategory, RecipeItemStack recipeitemstack, ItemStack itemstack, float f, int i) {
|
||||
@@ -18,4 +26,17 @@
|
||||
public RecipeSerializer<?> getSerializer() {
|
||||
return RecipeSerializer.BLASTING_RECIPE;
|
||||
}
|
||||
+
|
||||
+ // CraftBukkit start
|
||||
+ @Override
|
||||
+ public Recipe toBukkitRecipe() {
|
||||
+ public Recipe toBukkitRecipe(NamespacedKey id) {
|
||||
+ CraftItemStack result = CraftItemStack.asCraftMirror(this.result);
|
||||
+
|
||||
+ CraftBlastingRecipe recipe = new CraftBlastingRecipe(CraftNamespacedKey.fromMinecraft(this.id), result, CraftRecipe.toBukkit(this.ingredient), this.experience, this.cookingTime);
|
||||
+ CraftBlastingRecipe recipe = new CraftBlastingRecipe(id, result, CraftRecipe.toBukkit(this.ingredient), this.experience, this.cookingTime);
|
||||
+ recipe.setGroup(this.group);
|
||||
+ recipe.setCategory(CraftRecipe.getCategory(this.category()));
|
||||
+
|
||||
|
||||
@@ -1,31 +1,31 @@
|
||||
--- a/net/minecraft/world/item/crafting/RecipeCampfire.java
|
||||
+++ b/net/minecraft/world/item/crafting/RecipeCampfire.java
|
||||
@@ -4,6 +4,14 @@
|
||||
@@ -3,6 +3,14 @@
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraft.world.level.block.Blocks;
|
||||
|
||||
+// CraftBukkit start
|
||||
+import org.bukkit.NamespacedKey;
|
||||
+import org.bukkit.craftbukkit.inventory.CraftCampfireRecipe;
|
||||
+import org.bukkit.craftbukkit.inventory.CraftItemStack;
|
||||
+import org.bukkit.craftbukkit.inventory.CraftRecipe;
|
||||
+import org.bukkit.craftbukkit.util.CraftNamespacedKey;
|
||||
+import org.bukkit.inventory.Recipe;
|
||||
+// CraftBukkit end
|
||||
+
|
||||
public class RecipeCampfire extends RecipeCooking {
|
||||
|
||||
public RecipeCampfire(MinecraftKey minecraftkey, String s, CookingBookCategory cookingbookcategory, RecipeItemStack recipeitemstack, ItemStack itemstack, float f, int i) {
|
||||
@@ -19,4 +27,17 @@
|
||||
public RecipeCampfire(String s, CookingBookCategory cookingbookcategory, RecipeItemStack recipeitemstack, ItemStack itemstack, float f, int i) {
|
||||
@@ -18,4 +26,17 @@
|
||||
public RecipeSerializer<?> getSerializer() {
|
||||
return RecipeSerializer.CAMPFIRE_COOKING_RECIPE;
|
||||
}
|
||||
+
|
||||
+ // CraftBukkit start
|
||||
+ @Override
|
||||
+ public Recipe toBukkitRecipe() {
|
||||
+ public Recipe toBukkitRecipe(NamespacedKey id) {
|
||||
+ CraftItemStack result = CraftItemStack.asCraftMirror(this.result);
|
||||
+
|
||||
+ CraftCampfireRecipe recipe = new CraftCampfireRecipe(CraftNamespacedKey.fromMinecraft(this.id), result, CraftRecipe.toBukkit(this.ingredient), this.experience, this.cookingTime);
|
||||
+ CraftCampfireRecipe recipe = new CraftCampfireRecipe(id, result, CraftRecipe.toBukkit(this.ingredient), this.experience, this.cookingTime);
|
||||
+ recipe.setGroup(this.group);
|
||||
+ recipe.setCategory(CraftRecipe.getCategory(this.category()));
|
||||
+
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
--- a/net/minecraft/world/item/crafting/RecipeHolder.java
|
||||
+++ b/net/minecraft/world/item/crafting/RecipeHolder.java
|
||||
@@ -2,7 +2,16 @@
|
||||
|
||||
import net.minecraft.resources.MinecraftKey;
|
||||
|
||||
-public record RecipeHolder<T extends IRecipe<?>> (MinecraftKey id, T value) {
|
||||
+// CraftBukkit start
|
||||
+import org.bukkit.craftbukkit.util.CraftNamespacedKey;
|
||||
+import org.bukkit.inventory.Recipe;
|
||||
+
|
||||
+public record RecipeHolder<T extends IRecipe<?>>(MinecraftKey id, T value) {
|
||||
+
|
||||
+ public final Recipe toBukkitRecipe() {
|
||||
+ return this.value.toBukkitRecipe(CraftNamespacedKey.fromMinecraft(this.id));
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
|
||||
public boolean equals(Object object) {
|
||||
if (this == object) {
|
||||
@@ -5,10 +5,10 @@
|
||||
@Nullable
|
||||
private IntList stackingIds;
|
||||
+ public boolean exact; // CraftBukkit
|
||||
public static final Codec<RecipeItemStack> CODEC = codec(true);
|
||||
public static final Codec<RecipeItemStack> CODEC_NONEMPTY = codec(false);
|
||||
|
||||
public RecipeItemStack(Stream<? extends RecipeItemStack.Provider> stream) {
|
||||
this.values = (RecipeItemStack.Provider[]) stream.toArray((i) -> {
|
||||
@@ -69,6 +70,15 @@
|
||||
@@ -75,6 +76,15 @@
|
||||
for (int j = 0; j < i; ++j) {
|
||||
ItemStack itemstack1 = aitemstack[j];
|
||||
|
||||
|
||||
@@ -1,31 +1,31 @@
|
||||
--- a/net/minecraft/world/item/crafting/RecipeSmoking.java
|
||||
+++ b/net/minecraft/world/item/crafting/RecipeSmoking.java
|
||||
@@ -4,6 +4,14 @@
|
||||
@@ -3,6 +3,14 @@
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraft.world.level.block.Blocks;
|
||||
|
||||
+// CraftBukkit start
|
||||
+import org.bukkit.NamespacedKey;
|
||||
+import org.bukkit.craftbukkit.inventory.CraftItemStack;
|
||||
+import org.bukkit.craftbukkit.inventory.CraftRecipe;
|
||||
+import org.bukkit.craftbukkit.inventory.CraftSmokingRecipe;
|
||||
+import org.bukkit.craftbukkit.util.CraftNamespacedKey;
|
||||
+import org.bukkit.inventory.Recipe;
|
||||
+// CraftBukkit end
|
||||
+
|
||||
public class RecipeSmoking extends RecipeCooking {
|
||||
|
||||
public RecipeSmoking(MinecraftKey minecraftkey, String s, CookingBookCategory cookingbookcategory, RecipeItemStack recipeitemstack, ItemStack itemstack, float f, int i) {
|
||||
@@ -19,4 +27,17 @@
|
||||
public RecipeSmoking(String s, CookingBookCategory cookingbookcategory, RecipeItemStack recipeitemstack, ItemStack itemstack, float f, int i) {
|
||||
@@ -18,4 +26,17 @@
|
||||
public RecipeSerializer<?> getSerializer() {
|
||||
return RecipeSerializer.SMOKING_RECIPE;
|
||||
}
|
||||
+
|
||||
+ // CraftBukkit start
|
||||
+ @Override
|
||||
+ public Recipe toBukkitRecipe() {
|
||||
+ public Recipe toBukkitRecipe(NamespacedKey id) {
|
||||
+ CraftItemStack result = CraftItemStack.asCraftMirror(this.result);
|
||||
+
|
||||
+ CraftSmokingRecipe recipe = new CraftSmokingRecipe(CraftNamespacedKey.fromMinecraft(this.id), result, CraftRecipe.toBukkit(this.ingredient), this.experience, this.cookingTime);
|
||||
+ CraftSmokingRecipe recipe = new CraftSmokingRecipe(id, result, CraftRecipe.toBukkit(this.ingredient), this.experience, this.cookingTime);
|
||||
+ recipe.setGroup(this.group);
|
||||
+ recipe.setCategory(CraftRecipe.getCategory(this.category()));
|
||||
+
|
||||
|
||||
@@ -1,31 +1,31 @@
|
||||
--- a/net/minecraft/world/item/crafting/RecipeStonecutting.java
|
||||
+++ b/net/minecraft/world/item/crafting/RecipeStonecutting.java
|
||||
@@ -6,6 +6,14 @@
|
||||
@@ -5,6 +5,14 @@
|
||||
import net.minecraft.world.level.World;
|
||||
import net.minecraft.world.level.block.Blocks;
|
||||
|
||||
+// CraftBukkit start
|
||||
+import org.bukkit.NamespacedKey;
|
||||
+import org.bukkit.craftbukkit.inventory.CraftItemStack;
|
||||
+import org.bukkit.craftbukkit.inventory.CraftRecipe;
|
||||
+import org.bukkit.craftbukkit.inventory.CraftStonecuttingRecipe;
|
||||
+import org.bukkit.craftbukkit.util.CraftNamespacedKey;
|
||||
+import org.bukkit.inventory.Recipe;
|
||||
+// CraftBukkit end
|
||||
+
|
||||
public class RecipeStonecutting extends RecipeSingleItem {
|
||||
|
||||
public RecipeStonecutting(MinecraftKey minecraftkey, String s, RecipeItemStack recipeitemstack, ItemStack itemstack) {
|
||||
@@ -21,4 +29,16 @@
|
||||
public RecipeStonecutting(String s, RecipeItemStack recipeitemstack, ItemStack itemstack) {
|
||||
@@ -20,4 +28,16 @@
|
||||
public ItemStack getToastSymbol() {
|
||||
return new ItemStack(Blocks.STONECUTTER);
|
||||
}
|
||||
+
|
||||
+ // CraftBukkit start
|
||||
+ @Override
|
||||
+ public Recipe toBukkitRecipe() {
|
||||
+ public Recipe toBukkitRecipe(NamespacedKey id) {
|
||||
+ CraftItemStack result = CraftItemStack.asCraftMirror(this.result);
|
||||
+
|
||||
+ CraftStonecuttingRecipe recipe = new CraftStonecuttingRecipe(CraftNamespacedKey.fromMinecraft(this.id), result, CraftRecipe.toBukkit(this.ingredient));
|
||||
+ CraftStonecuttingRecipe recipe = new CraftStonecuttingRecipe(id, result, CraftRecipe.toBukkit(this.ingredient));
|
||||
+ recipe.setGroup(this.group);
|
||||
+
|
||||
+ return recipe;
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
--- a/net/minecraft/world/item/crafting/ShapedRecipes.java
|
||||
+++ b/net/minecraft/world/item/crafting/ShapedRecipes.java
|
||||
@@ -24,6 +24,13 @@
|
||||
import net.minecraft.world.item.Items;
|
||||
@@ -18,6 +18,14 @@
|
||||
import net.minecraft.world.level.World;
|
||||
import org.apache.commons.lang3.NotImplementedException;
|
||||
|
||||
+// CraftBukkit start
|
||||
+import org.bukkit.NamespacedKey;
|
||||
+import org.bukkit.craftbukkit.inventory.CraftItemStack;
|
||||
+import org.bukkit.craftbukkit.inventory.CraftRecipe;
|
||||
+import org.bukkit.craftbukkit.inventory.CraftShapedRecipe;
|
||||
@@ -14,14 +15,15 @@
|
||||
public class ShapedRecipes implements RecipeCrafting {
|
||||
|
||||
final int width;
|
||||
@@ -50,6 +57,67 @@
|
||||
this(minecraftkey, s, craftingbookcategory, i, j, nonnulllist, itemstack, true);
|
||||
@@ -42,6 +50,68 @@
|
||||
this(s, craftingbookcategory, i, j, nonnulllist, itemstack, true);
|
||||
}
|
||||
|
||||
+ // CraftBukkit start
|
||||
+ public org.bukkit.inventory.ShapedRecipe toBukkitRecipe() {
|
||||
+ @Override
|
||||
+ public org.bukkit.inventory.ShapedRecipe toBukkitRecipe(NamespacedKey id) {
|
||||
+ CraftItemStack result = CraftItemStack.asCraftMirror(this.result);
|
||||
+ CraftShapedRecipe recipe = new CraftShapedRecipe(result, this);
|
||||
+ CraftShapedRecipe recipe = new CraftShapedRecipe(id, result, this);
|
||||
+ recipe.setGroup(this.group);
|
||||
+ recipe.setCategory(CraftRecipe.getCategory(this.category()));
|
||||
+
|
||||
@@ -80,5 +82,5 @@
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
@Override
|
||||
public MinecraftKey getId() {
|
||||
return this.id;
|
||||
public RecipeSerializer<?> getSerializer() {
|
||||
return RecipeSerializer.SHAPED_RECIPE;
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
--- a/net/minecraft/world/item/crafting/ShapelessRecipes.java
|
||||
+++ b/net/minecraft/world/item/crafting/ShapelessRecipes.java
|
||||
@@ -15,6 +15,12 @@
|
||||
@@ -14,6 +14,13 @@
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraft.world.level.World;
|
||||
|
||||
+// CraftBukkit start
|
||||
+import org.bukkit.NamespacedKey;
|
||||
+import org.bukkit.craftbukkit.inventory.CraftItemStack;
|
||||
+import org.bukkit.craftbukkit.inventory.CraftRecipe;
|
||||
+import org.bukkit.craftbukkit.inventory.CraftShapelessRecipe;
|
||||
@@ -12,16 +13,17 @@
|
||||
+
|
||||
public class ShapelessRecipes implements RecipeCrafting {
|
||||
|
||||
private final MinecraftKey id;
|
||||
@@ -31,6 +37,21 @@
|
||||
final String group;
|
||||
@@ -28,6 +35,22 @@
|
||||
this.ingredients = nonnulllist;
|
||||
}
|
||||
|
||||
+ // CraftBukkit start
|
||||
+ @SuppressWarnings("unchecked")
|
||||
+ public org.bukkit.inventory.ShapelessRecipe toBukkitRecipe() {
|
||||
+ @Override
|
||||
+ public org.bukkit.inventory.ShapelessRecipe toBukkitRecipe(NamespacedKey id) {
|
||||
+ CraftItemStack result = CraftItemStack.asCraftMirror(this.result);
|
||||
+ CraftShapelessRecipe recipe = new CraftShapelessRecipe(result, this);
|
||||
+ CraftShapelessRecipe recipe = new CraftShapelessRecipe(id, result, this);
|
||||
+ recipe.setGroup(this.group);
|
||||
+ recipe.setCategory(CraftRecipe.getCategory(this.category()));
|
||||
+
|
||||
@@ -33,5 +35,5 @@
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
@Override
|
||||
public MinecraftKey getId() {
|
||||
return this.id;
|
||||
public RecipeSerializer<?> getSerializer() {
|
||||
return RecipeSerializer.SHAPELESS_RECIPE;
|
||||
|
||||
@@ -1,30 +1,30 @@
|
||||
--- a/net/minecraft/world/item/crafting/SmithingTransformRecipe.java
|
||||
+++ b/net/minecraft/world/item/crafting/SmithingTransformRecipe.java
|
||||
@@ -11,6 +11,14 @@
|
||||
@@ -10,6 +10,14 @@
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraft.world.level.World;
|
||||
|
||||
+// CraftBukkit start
|
||||
+import org.bukkit.NamespacedKey;
|
||||
+import org.bukkit.craftbukkit.inventory.CraftItemStack;
|
||||
+import org.bukkit.craftbukkit.inventory.CraftRecipe;
|
||||
+import org.bukkit.craftbukkit.inventory.CraftSmithingTransformRecipe;
|
||||
+import org.bukkit.craftbukkit.util.CraftNamespacedKey;
|
||||
+import org.bukkit.inventory.Recipe;
|
||||
+// CraftBukkit end
|
||||
+
|
||||
public class SmithingTransformRecipe implements SmithingRecipe {
|
||||
|
||||
private final MinecraftKey id;
|
||||
@@ -79,6 +87,17 @@
|
||||
final RecipeItemStack template;
|
||||
@@ -71,6 +79,17 @@
|
||||
return Stream.of(this.template, this.base, this.addition).anyMatch(RecipeItemStack::isEmpty);
|
||||
}
|
||||
|
||||
+ // CraftBukkit start
|
||||
+ @Override
|
||||
+ public Recipe toBukkitRecipe() {
|
||||
+ public Recipe toBukkitRecipe(NamespacedKey id) {
|
||||
+ CraftItemStack result = CraftItemStack.asCraftMirror(this.result);
|
||||
+
|
||||
+ CraftSmithingTransformRecipe recipe = new CraftSmithingTransformRecipe(CraftNamespacedKey.fromMinecraft(this.id), result, CraftRecipe.toBukkit(this.template), CraftRecipe.toBukkit(this.base), CraftRecipe.toBukkit(this.addition));
|
||||
+ CraftSmithingTransformRecipe recipe = new CraftSmithingTransformRecipe(id, result, CraftRecipe.toBukkit(this.template), CraftRecipe.toBukkit(this.base), CraftRecipe.toBukkit(this.addition));
|
||||
+
|
||||
+ return recipe;
|
||||
+ }
|
||||
@@ -32,4 +32,4 @@
|
||||
+
|
||||
public static class a implements RecipeSerializer<SmithingTransformRecipe> {
|
||||
|
||||
public a() {}
|
||||
private static final Codec<SmithingTransformRecipe> CODEC = RecordCodecBuilder.create((instance) -> {
|
||||
|
||||
@@ -1,30 +1,30 @@
|
||||
--- a/net/minecraft/world/item/crafting/SmithingTrimRecipe.java
|
||||
+++ b/net/minecraft/world/item/crafting/SmithingTrimRecipe.java
|
||||
@@ -19,6 +19,13 @@
|
||||
@@ -18,6 +18,13 @@
|
||||
import net.minecraft.world.item.armortrim.TrimPatterns;
|
||||
import net.minecraft.world.level.World;
|
||||
|
||||
+// CraftBukkit start
|
||||
+import org.bukkit.NamespacedKey;
|
||||
+import org.bukkit.craftbukkit.inventory.CraftRecipe;
|
||||
+import org.bukkit.craftbukkit.inventory.CraftSmithingTrimRecipe;
|
||||
+import org.bukkit.craftbukkit.util.CraftNamespacedKey;
|
||||
+import org.bukkit.inventory.Recipe;
|
||||
+// CraftBukkit end
|
||||
+
|
||||
public class SmithingTrimRecipe implements SmithingRecipe {
|
||||
|
||||
private final MinecraftKey id;
|
||||
@@ -115,6 +122,13 @@
|
||||
final RecipeItemStack template;
|
||||
@@ -107,6 +114,13 @@
|
||||
return Stream.of(this.template, this.base, this.addition).anyMatch(RecipeItemStack::isEmpty);
|
||||
}
|
||||
|
||||
+ // CraftBukkit start
|
||||
+ @Override
|
||||
+ public Recipe toBukkitRecipe() {
|
||||
+ return new CraftSmithingTrimRecipe(CraftNamespacedKey.fromMinecraft(this.id), CraftRecipe.toBukkit(this.template), CraftRecipe.toBukkit(this.base), CraftRecipe.toBukkit(this.addition));
|
||||
+ public Recipe toBukkitRecipe(NamespacedKey id) {
|
||||
+ return new CraftSmithingTrimRecipe(id, CraftRecipe.toBukkit(this.template), CraftRecipe.toBukkit(this.base), CraftRecipe.toBukkit(this.addition));
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
public static class a implements RecipeSerializer<SmithingTrimRecipe> {
|
||||
|
||||
public a() {}
|
||||
private static final Codec<SmithingTrimRecipe> CODEC = RecordCodecBuilder.create((instance) -> {
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
|
||||
public MerchantRecipe(NBTTagCompound nbttagcompound) {
|
||||
this.rewardExp = true;
|
||||
@@ -81,6 +99,7 @@
|
||||
@@ -96,6 +114,7 @@
|
||||
return ItemStack.EMPTY;
|
||||
} else {
|
||||
int i = this.baseCostA.getCount();
|
||||
@@ -40,7 +40,7 @@
|
||||
int j = Math.max(0, MathHelper.floor((float) (i * this.demand) * this.priceMultiplier));
|
||||
|
||||
return this.baseCostA.copyWithCount(MathHelper.clamp(i + j + this.specialPriceDiff, 1, this.baseCostA.getItem().getMaxStackSize()));
|
||||
@@ -201,7 +220,11 @@
|
||||
@@ -216,7 +235,11 @@
|
||||
if (!this.satisfiedBy(itemstack, itemstack1)) {
|
||||
return false;
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user