SPIGOT-6637: Revert "#874: Add FurnaceStartSmeltEvent"

This reverts commit 38faf28378.

By: md_5 <git@md-5.net>
This commit is contained in:
CraftBukkit/Spigot 2021-07-11 12:26:27 +10:00
parent cae78fadd8
commit 18a453f567

View file

@ -1,6 +1,6 @@
--- a/net/minecraft/world/level/block/entity/TileEntityFurnace.java
+++ b/net/minecraft/world/level/block/entity/TileEntityFurnace.java
@@ -43,6 +43,20 @@
@@ -43,6 +43,18 @@
import net.minecraft.world.level.block.state.IBlockData;
import net.minecraft.world.phys.Vec3D;
@ -14,14 +14,12 @@
+import org.bukkit.event.inventory.FurnaceBurnEvent;
+import org.bukkit.event.inventory.FurnaceExtractEvent;
+import org.bukkit.event.inventory.FurnaceSmeltEvent;
+import org.bukkit.event.inventory.FurnaceStartSmeltEvent;
+import org.bukkit.inventory.FurnaceRecipe;
+// CraftBukkit end
+
public abstract class TileEntityFurnace extends TileEntityContainer implements IWorldInventory, RecipeHolder, AutoRecipeOutput {
protected static final int SLOT_INPUT = 0;
@@ -182,6 +196,36 @@
@@ -182,6 +194,36 @@
return map;
}
@ -58,7 +56,7 @@
private static boolean b(Item item) {
return TagsItem.NON_FLAMMABLE_WOOD.isTagged(item);
}
@@ -266,13 +310,24 @@
@@ -266,13 +308,24 @@
tileentityfurnace.cookingProgress = MathHelper.clamp(tileentityfurnace.cookingProgress - 2, 0, tileentityfurnace.cookingTotalTime);
}
} else {
@ -86,23 +84,7 @@
flag1 = true;
if (!itemstack.isEmpty()) {
Item item = itemstack.getItem();
@@ -288,11 +343,23 @@
}
if (tileentityfurnace.isBurning() && canBurn(irecipe, tileentityfurnace.items, i)) {
+ // CraftBukkit start
+ if (irecipe != null && tileentityfurnace.cookingProgress == 0) {
+ CraftItemStack source = CraftItemStack.asCraftMirror(tileentityfurnace.items.get(0));
+ FurnaceRecipe recipe = (FurnaceRecipe) irecipe.toBukkitRecipe();
+
+ FurnaceStartSmeltEvent event = new FurnaceStartSmeltEvent(CraftBlock.at(world, blockposition), source, recipe);
+ world.getCraftServer().getPluginManager().callEvent(event);
+
+ tileentityfurnace.cookingTotalTime = event.getTotalCookTime();
+ }
+ // CraftBukkit end
+
++tileentityfurnace.cookingProgress;
@@ -292,7 +345,7 @@
if (tileentityfurnace.cookingProgress == tileentityfurnace.cookingTotalTime) {
tileentityfurnace.cookingProgress = 0;
tileentityfurnace.cookingTotalTime = getRecipeCookingTime(world, tileentityfurnace.recipeType, tileentityfurnace);
@ -111,7 +93,7 @@
tileentityfurnace.setRecipeUsed(irecipe);
}
@@ -331,17 +398,44 @@
@@ -331,17 +384,44 @@
}
}
@ -157,7 +139,7 @@
if (itemstack.a(Blocks.WET_SPONGE.getItem()) && !((ItemStack) nonnulllist.get(1)).isEmpty() && ((ItemStack) nonnulllist.get(1)).a(Items.BUCKET)) {
nonnulllist.set(1, new ItemStack(Items.WATER_BUCKET));
@@ -365,7 +459,7 @@
@@ -365,7 +445,7 @@
}
private static int getRecipeCookingTime(World world, Recipes<? extends RecipeCooking> recipes, IInventory iinventory) {
@ -166,7 +148,7 @@
}
public static boolean isFuel(ItemStack itemstack) {
@@ -484,14 +578,20 @@
@@ -484,14 +564,20 @@
@Override
public void awardUsedRecipes(EntityHuman entityhuman) {}
@ -189,7 +171,7 @@
List<IRecipe<?>> list = Lists.newArrayList();
ObjectIterator objectiterator = this.recipesUsed.object2IntEntrySet().iterator();
@@ -500,14 +600,14 @@
@@ -500,14 +586,14 @@
worldserver.getCraftingManager().getRecipe((MinecraftKey) entry.getKey()).ifPresent((irecipe) -> {
list.add(irecipe);
@ -206,7 +188,7 @@
int j = MathHelper.d((float) i * f);
float f1 = MathHelper.h((float) i * f);
@@ -515,6 +615,17 @@
@@ -515,6 +601,17 @@
++j;
}