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:
@@ -5,4 +5,5 @@ public net.minecraft.world.entity.Entity updateInWaterStateAndDoWaterCurrentPush
|
|||||||
public net.minecraft.world.entity.LivingEntity canGlide()Z
|
public net.minecraft.world.entity.LivingEntity canGlide()Z
|
||||||
public net.minecraft.world.entity.monster.Shulker MAX_SCALE
|
public net.minecraft.world.entity.monster.Shulker MAX_SCALE
|
||||||
public net.minecraft.world.entity.player.Player canGlide()Z
|
public net.minecraft.world.entity.player.Player canGlide()Z
|
||||||
|
public net.minecraft.world.level.block.entity.FuelValues values
|
||||||
public-f net.minecraft.world.entity.EntityType dimensions
|
public-f net.minecraft.world.entity.EntityType dimensions
|
||||||
|
|||||||
@@ -1,60 +0,0 @@
|
|||||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
||||||
From: DoctaEnkoda <bierquejason@gmail.com>
|
|
||||||
Date: Mon, 9 Aug 2021 13:22:03 +0200
|
|
||||||
Subject: [PATCH] Added the ability to add combustible items
|
|
||||||
|
|
||||||
|
|
||||||
diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java
|
|
||||||
index cd6c712a2ad92f73c7ce8f4ada8b810fcba00ba3..79528ad4408eac53754ccc810445970e263a1a32 100644
|
|
||||||
--- a/src/main/java/org/bukkit/Bukkit.java
|
|
||||||
+++ b/src/main/java/org/bukkit/Bukkit.java
|
|
||||||
@@ -2987,5 +2987,24 @@ public final class Bukkit {
|
|
||||||
public static boolean isLagging() {
|
|
||||||
return server.isLagging();
|
|
||||||
}
|
|
||||||
+
|
|
||||||
+ /**
|
|
||||||
+ * Add an Item as fuel for furnaces
|
|
||||||
+ *
|
|
||||||
+ * @param material The material that will be the fuel
|
|
||||||
+ * @param burnTime The time (in ticks) this item will burn for
|
|
||||||
+ */
|
|
||||||
+ public static void addFuel(@NotNull Material material, int burnTime) {
|
|
||||||
+ server.addFuel(material, burnTime);
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ /**
|
|
||||||
+ * Remove an item as fuel for furnaces
|
|
||||||
+ *
|
|
||||||
+ * @param material The material that will no longer be a fuel
|
|
||||||
+ */
|
|
||||||
+ public static void removeFuel(@NotNull Material material) {
|
|
||||||
+ server.removeFuel(material);
|
|
||||||
+ }
|
|
||||||
// Purpur end
|
|
||||||
}
|
|
||||||
diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java
|
|
||||||
index 788702d1c5be00a78a0438e267fe5fca9985e4ce..c1523229138d5d07569c8e564cf27b8276cca153 100644
|
|
||||||
--- a/src/main/java/org/bukkit/Server.java
|
|
||||||
+++ b/src/main/java/org/bukkit/Server.java
|
|
||||||
@@ -2634,5 +2634,20 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
|
|
||||||
* @return True if lagging
|
|
||||||
*/
|
|
||||||
boolean isLagging();
|
|
||||||
+
|
|
||||||
+ /**
|
|
||||||
+ * Add an Item as fuel for furnaces
|
|
||||||
+ *
|
|
||||||
+ * @param material The material that will be the fuel
|
|
||||||
+ * @param burnTime The time (in ticks) this item will burn for
|
|
||||||
+ */
|
|
||||||
+ public void addFuel(@NotNull Material material, int burnTime);
|
|
||||||
+
|
|
||||||
+ /**
|
|
||||||
+ * Remove an item as fuel for furnaces
|
|
||||||
+ *
|
|
||||||
+ * @param material The material that will no longer be a fuel
|
|
||||||
+ */
|
|
||||||
+ public void removeFuel(@NotNull Material material);
|
|
||||||
// Purpur end
|
|
||||||
}
|
|
||||||
@@ -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");
|
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
--- a/src/main/java/org/bukkit/Bukkit.java
|
--- a/src/main/java/org/bukkit/Bukkit.java
|
||||||
+++ b/src/main/java/org/bukkit/Bukkit.java
|
+++ b/src/main/java/org/bukkit/Bukkit.java
|
||||||
@@ -2968,4 +_,26 @@
|
@@ -2968,4 +_,47 @@
|
||||||
public static Server.Spigot spigot() {
|
public static Server.Spigot spigot() {
|
||||||
return server.spigot();
|
return server.spigot();
|
||||||
}
|
}
|
||||||
@@ -26,4 +26,25 @@
|
|||||||
+ return server.isLagging();
|
+ return server.isLagging();
|
||||||
+ }
|
+ }
|
||||||
+ // Purpur end - Lagging threshold
|
+ // Purpur end - Lagging threshold
|
||||||
|
+
|
||||||
|
+ // Purpur start - Added the ability to add combustible items
|
||||||
|
+ /**
|
||||||
|
+ * Add an Item as fuel for furnaces
|
||||||
|
+ *
|
||||||
|
+ * @param material The material that will be the fuel
|
||||||
|
+ * @param burnTime The time (in ticks) this item will burn for
|
||||||
|
+ */
|
||||||
|
+ public static void addFuel(@NotNull Material material, int burnTime) {
|
||||||
|
+ server.addFuel(material, burnTime);
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ /**
|
||||||
|
+ * Remove an item as fuel for furnaces
|
||||||
|
+ *
|
||||||
|
+ * @param material The material that will no longer be a fuel
|
||||||
|
+ */
|
||||||
|
+ public static void removeFuel(@NotNull Material material) {
|
||||||
|
+ server.removeFuel(material);
|
||||||
|
+ }
|
||||||
|
+ // Purpur end - Added the ability to add combustible items
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
--- a/src/main/java/org/bukkit/Server.java
|
--- a/src/main/java/org/bukkit/Server.java
|
||||||
+++ b/src/main/java/org/bukkit/Server.java
|
+++ b/src/main/java/org/bukkit/Server.java
|
||||||
@@ -2607,4 +_,22 @@
|
@@ -2607,4 +_,39 @@
|
||||||
*/
|
*/
|
||||||
void allowPausing(@NotNull org.bukkit.plugin.Plugin plugin, boolean value);
|
void allowPausing(@NotNull org.bukkit.plugin.Plugin plugin, boolean value);
|
||||||
// Paper end - API to check if the server is sleeping
|
// Paper end - API to check if the server is sleeping
|
||||||
@@ -22,4 +22,21 @@
|
|||||||
+ */
|
+ */
|
||||||
+ boolean isLagging();
|
+ boolean isLagging();
|
||||||
+ // Purpur end - Lagging threshold
|
+ // Purpur end - Lagging threshold
|
||||||
|
+
|
||||||
|
+ // Purpur start - Added the ability to add combustible items
|
||||||
|
+ /**
|
||||||
|
+ * Add an Item as fuel for furnaces
|
||||||
|
+ *
|
||||||
|
+ * @param material The material that will be the fuel
|
||||||
|
+ * @param burnTime The time (in ticks) this item will burn for
|
||||||
|
+ */
|
||||||
|
+ public void addFuel(@NotNull Material material, int burnTime);
|
||||||
|
+
|
||||||
|
+ /**
|
||||||
|
+ * Remove an item as fuel for furnaces
|
||||||
|
+ *
|
||||||
|
+ * @param material The material that will no longer be a fuel
|
||||||
|
+ */
|
||||||
|
+ public void removeFuel(@NotNull Material material);
|
||||||
|
+ // Purpur end - Added the ability to add combustible items
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,17 @@
|
|||||||
|
--- a/net/minecraft/world/inventory/AbstractFurnaceMenu.java
|
||||||
|
+++ b/net/minecraft/world/inventory/AbstractFurnaceMenu.java
|
||||||
|
@@ -121,7 +_,13 @@
|
||||||
|
} else if (index != 1 && index != 0) {
|
||||||
|
if (this.canSmelt(item)) {
|
||||||
|
if (!this.moveItemStackTo(item, 0, 1, false)) {
|
||||||
|
- return ItemStack.EMPTY;
|
||||||
|
+ // Purpur start - Added the ability to add combustible items
|
||||||
|
+ if (this.isFuel(item)) {
|
||||||
|
+ if (!this.moveItemStackTo(item, 1, 2, false)) {
|
||||||
|
+ return ItemStack.EMPTY;
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+ // Purpur end - Added the ability to add combustible items
|
||||||
|
}
|
||||||
|
} else if (this.isFuel(item)) {
|
||||||
|
if (!this.moveItemStackTo(item, 1, 2, false)) {
|
||||||
@@ -24,6 +24,29 @@
|
|||||||
this.overrideAllCommandBlockCommands = this.commandsConfiguration.getStringList("command-block-overrides").contains("*");
|
this.overrideAllCommandBlockCommands = this.commandsConfiguration.getStringList("command-block-overrides").contains("*");
|
||||||
this.ignoreVanillaPermissions = this.commandsConfiguration.getBoolean("ignore-vanilla-permissions");
|
this.ignoreVanillaPermissions = this.commandsConfiguration.getBoolean("ignore-vanilla-permissions");
|
||||||
|
|
||||||
|
@@ -1645,6 +_,22 @@
|
||||||
|
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");
|
||||||
@@ -3049,6 +_,18 @@
|
@@ -3049,6 +_,18 @@
|
||||||
return CraftServer.this.console.paperConfigurations.createLegacyObject(CraftServer.this.console);
|
return CraftServer.this.console.paperConfigurations.createLegacyObject(CraftServer.this.console);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user