mirror of
https://github.com/Dreeam-qwq/Gale.git
synced 2025-12-22 16:29:26 +00:00
Upstream has released updates that appear to apply and compile correctly Paper Changes: PaperMC/Paper@41bc31b Update paperweight to 1.7.3 (#11445) PaperMC/Paper@e17eb6b Improve entity effect API (#11444) PaperMC/Paper@7b03141 Add startingBrewTime (#11406) PaperMC/Paper@355b1cb Add API for explosions to damage the explosion cause (#11180) PaperMC/Paper@6d7a438 Call bucket events for cauldrons (#7486)
69 lines
3.2 KiB
Diff
69 lines
3.2 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: Martijn Muijsers <martijnmuijsers@live.nl>
|
|
Date: Fri, 23 Dec 2022 16:42:04 +0100
|
|
Subject: [PATCH] Fix MC-26304
|
|
|
|
License: GPL-3.0 (https://www.gnu.org/licenses/gpl-3.0.html)
|
|
Gale - https://galemc.org
|
|
|
|
This patch is based on the following patch:
|
|
"Fix brewing stands resetting their brewTime when being unloaded"
|
|
By: etil2jz <81570777+etil2jz@users.noreply.github.com>
|
|
As part of: Mirai (https://github.com/etil2jz/Mirai)
|
|
Licensed under: GPL-3.0 (https://www.gnu.org/licenses/gpl-3.0.html)
|
|
|
|
diff --git a/src/main/java/net/minecraft/world/level/block/entity/BrewingStandBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/BrewingStandBlockEntity.java
|
|
index 0a93bacd62249bae1800ff306b8a7c765b0e5a8b..55873f24a9170626504af109352b04e8bf1352f9 100644
|
|
--- a/src/main/java/net/minecraft/world/level/block/entity/BrewingStandBlockEntity.java
|
|
+++ b/src/main/java/net/minecraft/world/level/block/entity/BrewingStandBlockEntity.java
|
|
@@ -47,6 +47,7 @@ public class BrewingStandBlockEntity extends BaseContainerBlockEntity implements
|
|
public static final int DATA_BREW_TIME = 0;
|
|
public static final int DATA_FUEL_USES = 1;
|
|
public static final int NUM_DATA_VALUES = 2;
|
|
+ private static final String[] INGREDIENT_NBT_KEYS = {"Gale.Ingredient", "Mirai.ingredient"}; // Gale - Mirai - fix MC-26304
|
|
private NonNullList<ItemStack> items;
|
|
public int brewTime;
|
|
public int recipeBrewTime = 400; // Paper - Add recipeBrewTime
|
|
@@ -313,6 +314,22 @@ public class BrewingStandBlockEntity extends BaseContainerBlockEntity implements
|
|
}
|
|
|
|
this.fuel = nbt.getByte("Fuel");
|
|
+ // Gale start - Mirai - fix MC-26304
|
|
+ if (this.ingredient == null || this.ingredient == Items.AIR) {
|
|
+ for (String nbtKey : INGREDIENT_NBT_KEYS) {
|
|
+ try {
|
|
+ if (nbt.contains(nbtKey)) {
|
|
+ this.ingredient = net.minecraft.core.registries.BuiltInRegistries.ITEM.get(net.minecraft.resources.ResourceLocation.parse(nbt.getString(nbtKey)));
|
|
+ if (this.ingredient != null && this.ingredient != Items.AIR) {
|
|
+ break;
|
|
+ }
|
|
+ }
|
|
+ } catch (Throwable ignored) {
|
|
+ // Cannot be helped
|
|
+ }
|
|
+ }
|
|
+ }
|
|
+ // Gale end - Mirai - fix MC-26304
|
|
}
|
|
|
|
@Override
|
|
@@ -321,6 +338,18 @@ public class BrewingStandBlockEntity extends BaseContainerBlockEntity implements
|
|
nbt.putShort("BrewTime", (short) this.brewTime);
|
|
ContainerHelper.saveAllItems(nbt, this.items, registryLookup);
|
|
nbt.putByte("Fuel", (byte) this.fuel);
|
|
+ // Gale start - Mirai - fix MC-26304
|
|
+ if (this.ingredient != null && this.ingredient != Items.AIR) {
|
|
+ try {
|
|
+ String value = net.minecraft.core.registries.BuiltInRegistries.ITEM.getKey(this.ingredient).toString();
|
|
+ for (String nbtKey : INGREDIENT_NBT_KEYS) {
|
|
+ nbt.putString(nbtKey, value);
|
|
+ }
|
|
+ } catch (Throwable ignored) {
|
|
+ // Cannot be helped
|
|
+ }
|
|
+ }
|
|
+ // Gale end - Mirai - fix MC-26304
|
|
}
|
|
|
|
@Override
|