Patch PotionHelper to use registry delegates (#5142)
This commit is contained in:
parent
51910fe83b
commit
c1bb5cb250
|
@ -0,0 +1,65 @@
|
|||
--- a/net/minecraft/potion/PotionBrewing.java
|
||||
+++ b/net/minecraft/potion/PotionBrewing.java
|
||||
@@ -67,7 +67,7 @@
|
||||
|
||||
for(int j = field_185214_b.size(); i < j; ++i) {
|
||||
PotionBrewing.MixPredicate<Item> mixpredicate = field_185214_b.get(i);
|
||||
- if (mixpredicate.field_185198_a == item && mixpredicate.field_185199_b.test(p_185206_1_)) {
|
||||
+ if (mixpredicate.field_185198_a.get() == item && mixpredicate.field_185199_b.test(p_185206_1_)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -81,7 +81,7 @@
|
||||
|
||||
for(int j = field_185213_a.size(); i < j; ++i) {
|
||||
PotionBrewing.MixPredicate<PotionType> mixpredicate = field_185213_a.get(i);
|
||||
- if (mixpredicate.field_185198_a == potiontype && mixpredicate.field_185199_b.test(p_185209_1_)) {
|
||||
+ if (mixpredicate.field_185198_a.get() == potiontype && mixpredicate.field_185199_b.test(p_185209_1_)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -97,8 +97,8 @@
|
||||
|
||||
for(int j = field_185214_b.size(); i < j; ++i) {
|
||||
PotionBrewing.MixPredicate<Item> mixpredicate = field_185214_b.get(i);
|
||||
- if (mixpredicate.field_185198_a == item && mixpredicate.field_185199_b.test(p_185212_0_)) {
|
||||
- return PotionUtils.func_185188_a(new ItemStack((IItemProvider)mixpredicate.field_185200_c), potiontype);
|
||||
+ if (mixpredicate.field_185198_a.get() == item && mixpredicate.field_185199_b.test(p_185212_0_)) {
|
||||
+ return PotionUtils.func_185188_a(new ItemStack((IItemProvider)mixpredicate.field_185200_c.get()), potiontype);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -106,8 +106,8 @@
|
||||
|
||||
for(int k = field_185213_a.size(); i < k; ++i) {
|
||||
PotionBrewing.MixPredicate<PotionType> mixpredicate1 = field_185213_a.get(i);
|
||||
- if (mixpredicate1.field_185198_a == potiontype && mixpredicate1.field_185199_b.test(p_185212_0_)) {
|
||||
- return PotionUtils.func_185188_a(new ItemStack(item), (PotionType)mixpredicate1.field_185200_c);
|
||||
+ if (mixpredicate1.field_185198_a.get() == potiontype && mixpredicate1.field_185199_b.test(p_185212_0_)) {
|
||||
+ return PotionUtils.func_185188_a(new ItemStack(item), (PotionType)mixpredicate1.field_185200_c.get());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -200,15 +200,15 @@
|
||||
field_185213_a.add(new PotionBrewing.MixPredicate<PotionType>(p_193357_0_, Ingredient.func_199804_a(p_193357_1_), p_193357_2_));
|
||||
}
|
||||
|
||||
- static class MixPredicate<T> {
|
||||
- private final T field_185198_a;
|
||||
+ static class MixPredicate<T extends net.minecraftforge.registries.ForgeRegistryEntry<T>> {
|
||||
+ private final net.minecraftforge.registries.IRegistryDelegate<T> field_185198_a;
|
||||
private final Ingredient field_185199_b;
|
||||
- private final T field_185200_c;
|
||||
+ private final net.minecraftforge.registries.IRegistryDelegate<T> field_185200_c;
|
||||
|
||||
- public MixPredicate(T p_i47570_1_, Ingredient p_i47570_2_, T p_i47570_3_) {
|
||||
- this.field_185198_a = p_i47570_1_;
|
||||
- this.field_185199_b = p_i47570_2_;
|
||||
- this.field_185200_c = p_i47570_3_;
|
||||
+ public MixPredicate(T inputIn, Ingredient reagentIn, T outputIn) {
|
||||
+ this.field_185198_a = inputIn.delegate;
|
||||
+ this.field_185199_b = reagentIn;
|
||||
+ this.field_185200_c = outputIn.delegate;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -316,7 +316,6 @@ protected net.minecraft.client.gui.GuiOverlayDebug field_211537_g # rayTraceBloc
|
|||
protected net.minecraft.client.gui.GuiOverlayDebug field_211538_h # rayTraceFluid
|
||||
|
||||
# Expose vanilla brewing recipe system
|
||||
public net.minecraft.potion.PotionHelper$MixPredicate
|
||||
public net.minecraft.potion.PotionHelper func_193355_a(Lnet/minecraft/item/ItemPotion;Lnet/minecraft/item/Item;Lnet/minecraft/item/ItemPotion;)V # registerPotionItemConversion
|
||||
public net.minecraft.potion.PotionHelper func_193354_a(Lnet/minecraft/item/ItemPotion;)V # registerPotionItem
|
||||
public net.minecraft.potion.PotionHelper func_193357_a(Lnet/minecraft/potion/PotionType;Lnet/minecraft/item/Item;Lnet/minecraft/potion/PotionType;)V # registerPotionTypeConversion
|
||||
|
|
|
@ -66,6 +66,15 @@ public class RegistryOverrideTest
|
|||
);
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public static void registerPotionTypes(RegistryEvent.Register<PotionType> event)
|
||||
{
|
||||
if (ENABLED)
|
||||
{
|
||||
event.getRegistry().register(new PotionType().setRegistryName("minecraft:awkward"));
|
||||
}
|
||||
}
|
||||
|
||||
private static class BlockReplacement extends Block
|
||||
{
|
||||
AxisAlignedBB BB = FULL_BLOCK_AABB.contract(0.1, 0, 0.1);
|
||||
|
|
Loading…
Reference in New Issue