mirror of
https://github.com/PaperMC/Paper.git
synced 2025-01-05 18:27:17 +01:00
parent
77b8e4803a
commit
b9534e1c48
2 changed files with 32 additions and 8 deletions
|
@ -21,7 +21,7 @@
|
|||
public abstract class TileEntityFurnace extends TileEntityContainer implements IWorldInventory, RecipeHolder, AutoRecipeOutput {
|
||||
|
||||
protected static final int SLOT_INPUT = 0;
|
||||
@@ -182,6 +196,36 @@
|
||||
@@ -182,6 +196,40 @@
|
||||
return map;
|
||||
}
|
||||
|
||||
|
@ -53,12 +53,16 @@
|
|||
+ public void setMaxStackSize(int size) {
|
||||
+ maxStack = size;
|
||||
+ }
|
||||
+
|
||||
+ public Object2IntOpenHashMap<MinecraftKey> getRecipesUsed() {
|
||||
+ return this.recipesUsed; // PAIL private -> public
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
private static boolean isNeverAFurnaceFuel(Item item) {
|
||||
return TagsItem.NON_FLAMMABLE_WOOD.contains(item);
|
||||
}
|
||||
@@ -265,13 +309,24 @@
|
||||
@@ -265,13 +313,24 @@
|
||||
tileentityfurnace.cookingProgress = MathHelper.clamp(tileentityfurnace.cookingProgress - 2, (int) 0, tileentityfurnace.cookingTotalTime);
|
||||
}
|
||||
} else {
|
||||
|
@ -86,7 +90,7 @@
|
|||
flag1 = true;
|
||||
if (!itemstack.isEmpty()) {
|
||||
Item item = itemstack.getItem();
|
||||
@@ -287,11 +342,23 @@
|
||||
@@ -287,11 +346,23 @@
|
||||
}
|
||||
|
||||
if (tileentityfurnace.isLit() && canBurn(irecipe, tileentityfurnace.items, i)) {
|
||||
|
@ -111,7 +115,7 @@
|
|||
tileentityfurnace.setRecipeUsed(irecipe);
|
||||
}
|
||||
|
||||
@@ -330,17 +397,44 @@
|
||||
@@ -330,17 +401,44 @@
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -157,7 +161,7 @@
|
|||
|
||||
if (itemstack.is(Blocks.WET_SPONGE.asItem()) && !((ItemStack) nonnulllist.get(1)).isEmpty() && ((ItemStack) nonnulllist.get(1)).is(Items.BUCKET)) {
|
||||
nonnulllist.set(1, new ItemStack(Items.WATER_BUCKET));
|
||||
@@ -364,7 +458,7 @@
|
||||
@@ -364,7 +462,7 @@
|
||||
}
|
||||
|
||||
private static int getTotalCookTime(World world, Recipes<? extends RecipeCooking> recipes, IInventory iinventory) {
|
||||
|
@ -166,7 +170,7 @@
|
|||
}
|
||||
|
||||
public static boolean isFuel(ItemStack itemstack) {
|
||||
@@ -483,14 +577,20 @@
|
||||
@@ -483,14 +581,20 @@
|
||||
@Override
|
||||
public void awardUsedRecipes(EntityHuman entityhuman) {}
|
||||
|
||||
|
@ -189,7 +193,7 @@
|
|||
List<IRecipe<?>> list = Lists.newArrayList();
|
||||
ObjectIterator objectiterator = this.recipesUsed.object2IntEntrySet().iterator();
|
||||
|
||||
@@ -499,14 +599,14 @@
|
||||
@@ -499,14 +603,14 @@
|
||||
|
||||
worldserver.getRecipeManager().byKey((MinecraftKey) entry.getKey()).ifPresent((irecipe) -> {
|
||||
list.add(irecipe);
|
||||
|
@ -206,7 +210,7 @@
|
|||
int j = MathHelper.floor((float) i * f);
|
||||
float f1 = MathHelper.frac((float) i * f);
|
||||
|
||||
@@ -514,6 +614,17 @@
|
||||
@@ -514,6 +618,17 @@
|
||||
++j;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,11 +1,18 @@
|
|||
package org.bukkit.craftbukkit.block;
|
||||
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import java.util.Map;
|
||||
import net.minecraft.resources.MinecraftKey;
|
||||
import net.minecraft.world.level.block.BlockFurnace;
|
||||
import net.minecraft.world.level.block.entity.TileEntityFurnace;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.block.Furnace;
|
||||
import org.bukkit.craftbukkit.inventory.CraftInventoryFurnace;
|
||||
import org.bukkit.craftbukkit.util.CraftNamespacedKey;
|
||||
import org.bukkit.inventory.CookingRecipe;
|
||||
import org.bukkit.inventory.FurnaceInventory;
|
||||
import org.bukkit.inventory.Recipe;
|
||||
|
||||
public abstract class CraftFurnace<T extends TileEntityFurnace> extends CraftContainer<T> implements Furnace {
|
||||
|
||||
|
@ -58,4 +65,17 @@ public abstract class CraftFurnace<T extends TileEntityFurnace> extends CraftCon
|
|||
public void setCookTimeTotal(int cookTimeTotal) {
|
||||
this.getSnapshot().cookingTotalTime = cookTimeTotal;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<CookingRecipe<?>, Integer> getRecipesUsed() {
|
||||
ImmutableMap.Builder<CookingRecipe<?>, Integer> recipesUsed = ImmutableMap.builder();
|
||||
for (Map.Entry<MinecraftKey, Integer> entrySet : this.getSnapshot().getRecipesUsed().object2IntEntrySet()) {
|
||||
Recipe recipe = Bukkit.getRecipe(CraftNamespacedKey.fromMinecraft(entrySet.getKey()));
|
||||
if (recipe instanceof CookingRecipe<?> cookingRecipe) {
|
||||
recipesUsed.put(cookingRecipe, entrySet.getValue());
|
||||
}
|
||||
}
|
||||
|
||||
return recipesUsed.build();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue