Patch PotionHelper to use registry delegates (#5142)

This commit is contained in:
Ben Staddon authored and LexManos committed 2018-10-04 00:25:58 -07:00
1 parent 6337466735
commit 0fb8844623
3 files changed
+77 -1

No files matched your search

@@ -0,0 +1,67 @@
--- ../src-base/minecraft/net/minecraft/potion/PotionHelper.java
+++ ../src-work/minecraft/net/minecraft/potion/PotionHelper.java
@@ -88,7 +88,7 @@
{
PotionHelper.MixPredicate<Item> mixpredicate = (PotionHelper.MixPredicate)field_185214_b.get(i);
- if (mixpredicate.field_185198_a == item && mixpredicate.field_185199_b.apply(p_185206_1_))
+ if (mixpredicate.field_185198_a.get() == item && mixpredicate.field_185199_b.apply(p_185206_1_))
{
return true;
}
@@ -106,7 +106,7 @@
{
PotionHelper.MixPredicate<PotionType> mixpredicate = (PotionHelper.MixPredicate)field_185213_a.get(i);
- if (mixpredicate.field_185198_a == potiontype && mixpredicate.field_185199_b.apply(p_185209_1_))
+ if (mixpredicate.field_185198_a.get() == potiontype && mixpredicate.field_185199_b.apply(p_185209_1_))
{
return true;
}
@@ -127,9 +127,9 @@
{
PotionHelper.MixPredicate<Item> mixpredicate = (PotionHelper.MixPredicate)field_185214_b.get(i);
- if (mixpredicate.field_185198_a == item && mixpredicate.field_185199_b.apply(p_185212_0_))
+ if (mixpredicate.field_185198_a.get() == item && mixpredicate.field_185199_b.apply(p_185212_0_))
{
- return PotionUtils.func_185188_a(new ItemStack((Item)mixpredicate.field_185200_c), potiontype);
+ return PotionUtils.func_185188_a(new ItemStack((Item)mixpredicate.field_185200_c.get()), potiontype);
}
}
@@ -139,9 +139,9 @@
{
PotionHelper.MixPredicate<PotionType> mixpredicate1 = (PotionHelper.MixPredicate)field_185213_a.get(i);
- if (mixpredicate1.field_185198_a == potiontype && mixpredicate1.field_185199_b.apply(p_185212_0_))
+ if (mixpredicate1.field_185198_a.get() == potiontype && mixpredicate1.field_185199_b.apply(p_185212_0_))
{
- return PotionUtils.func_185188_a(new ItemStack(item), (PotionType)mixpredicate1.field_185200_c);
+ return PotionUtils.func_185188_a(new ItemStack(item), (PotionType)mixpredicate1.field_185200_c.get());
}
}
}
@@ -227,17 +227,17 @@
field_185213_a.add(new PotionHelper.MixPredicate(p_193356_0_, p_193356_1_, p_193356_2_));
}
- static class MixPredicate<T>
+ static class MixPredicate<T extends net.minecraftforge.registries.IForgeRegistryEntry.Impl<T>>
{
- final T field_185198_a;
+ final net.minecraftforge.registries.IRegistryDelegate<T> field_185198_a;
final Ingredient field_185199_b;
- final T field_185200_c;
+ 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_185198_a = p_i47570_1_.delegate;
this.field_185199_b = p_i47570_2_;
- this.field_185200_c = p_i47570_3_;
+ this.field_185200_c = p_i47570_3_.delegate;
}
}
}
-1
View File
@@ -291,7 +291,6 @@ public net.minecraft.nbt.NBTPrimitive
public net.minecraft.client.gui.GuiOverlayDebug func_181554_e()V # renderLagometer
# 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
@@ -26,6 +26,7 @@ import net.minecraft.block.state.IBlockState;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.potion.PotionType;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumHand;
import net.minecraft.util.math.AxisAlignedBB;
@@ -66,6 +67,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);