mirror of
https://github.com/PurpurMC/Purpur.git
synced 2026-02-17 16:37:43 +01:00
Added the ability to add combustible items
This commit is contained in:
@@ -1,65 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: DoctaEnkoda <bierquejason@gmail.com>
|
||||
Date: Mon, 9 Aug 2021 13:22:20 +0200
|
||||
Subject: [PATCH] Added the ability to add combustible items
|
||||
|
||||
|
||||
diff --git a/net/minecraft/world/inventory/AbstractFurnaceMenu.java b/net/minecraft/world/inventory/AbstractFurnaceMenu.java
|
||||
index 1240df9368855f836412b06cf564926a18bfe90d..248e2fb41df3cb1efc64921074a51a02419d8fbb 100644
|
||||
--- a/net/minecraft/world/inventory/AbstractFurnaceMenu.java
|
||||
+++ b/net/minecraft/world/inventory/AbstractFurnaceMenu.java
|
||||
@@ -114,7 +114,13 @@ public abstract class AbstractFurnaceMenu extends RecipeBookMenu {
|
||||
} else if (slot != 1 && slot != 0) {
|
||||
if (this.canSmelt(itemstack1)) {
|
||||
if (!this.moveItemStackTo(itemstack1, 0, 1, false)) {
|
||||
- return ItemStack.EMPTY;
|
||||
+ // Purpur start - Added the ability to add combustible items
|
||||
+ if (this.isFuel(itemstack1)) {
|
||||
+ if (!this.moveItemStackTo(itemstack1, 1, 2, false)) {
|
||||
+ return ItemStack.EMPTY;
|
||||
+ }
|
||||
+ }
|
||||
+ // Purpur end - Added the ability to add combustible items
|
||||
}
|
||||
} else if (this.isFuel(itemstack1)) {
|
||||
if (!this.moveItemStackTo(itemstack1, 1, 2, false)) {
|
||||
diff --git a/net/minecraft/world/level/block/entity/FuelValues.java b/net/minecraft/world/level/block/entity/FuelValues.java
|
||||
index 61ef08ac941b1e8988d001241780d3a1582f7a2d..6ceb938d6f6a4f2bc5b786c7af7bd291f7486340 100644
|
||||
--- a/net/minecraft/world/level/block/entity/FuelValues.java
|
||||
+++ b/net/minecraft/world/level/block/entity/FuelValues.java
|
||||
@@ -17,7 +17,7 @@ import net.minecraft.world.level.ItemLike;
|
||||
import net.minecraft.world.level.block.Blocks;
|
||||
|
||||
public class FuelValues {
|
||||
- private final Object2IntSortedMap<Item> values;
|
||||
+ public final Object2IntSortedMap<Item> values; // Purpur - private -> public - Added the ability to add combustible items
|
||||
|
||||
FuelValues(Object2IntSortedMap<Item> fuelValues) {
|
||||
this.values = fuelValues;
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
index 3b5225c3ba8e10df45df2fbf2305f8542b2f1f39..9aa6744ab3a19e1ecf32b4aa059b7f4c555f03ff 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
@@ -1629,6 +1629,22 @@ public final class CraftServer implements Server {
|
||||
return true;
|
||||
}
|
||||
|
||||
+ // Purpur start - Added the ability to add combustible items
|
||||
+ @Override
|
||||
+ public void addFuel(org.bukkit.Material material, int burnTime) {
|
||||
+ Preconditions.checkArgument(burnTime > 0, "BurnTime must be greater than 0");
|
||||
+
|
||||
+ net.minecraft.world.item.ItemStack itemStack = net.minecraft.world.item.ItemStack.fromBukkitCopy(new ItemStack(material));
|
||||
+ MinecraftServer.getServer().fuelValues().values.put(itemStack.getItem(), burnTime);
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void removeFuel(org.bukkit.Material material) {
|
||||
+ net.minecraft.world.item.ItemStack itemStack = net.minecraft.world.item.ItemStack.fromBukkitCopy(new ItemStack(material));
|
||||
+ MinecraftServer.getServer().fuelValues().values.keySet().removeIf(itemStack::is);
|
||||
+ }
|
||||
+ // Purpur end - Added the ability to add combustible items
|
||||
+
|
||||
@Override
|
||||
public List<Recipe> getRecipesFor(ItemStack result) {
|
||||
Preconditions.checkArgument(result != null, "ItemStack cannot be null");
|
||||
Reference in New Issue
Block a user