Add redirects to PotionEffect to respect registry replacement (#5213)
This commit is contained in:
parent
06f67f7696
commit
f19fed0853
5 changed files with 63 additions and 3 deletions
|
@ -17,7 +17,18 @@
|
|||
}
|
||||
|
||||
public boolean func_199308_a(PotionEffect p_199308_1_) {
|
||||
@@ -188,11 +191,12 @@
|
||||
@@ -88,6 +91,10 @@
|
||||
}
|
||||
|
||||
public Potion func_188419_a() {
|
||||
+ return this.getPotionRaw() == null ? null : this.getPotionRaw().delegate.get();
|
||||
+ }
|
||||
+
|
||||
+ private Potion getPotionRaw() {
|
||||
return this.field_188420_b;
|
||||
}
|
||||
|
||||
@@ -188,11 +195,12 @@
|
||||
p_82719_1_.func_74757_a("Ambient", this.func_82720_e());
|
||||
p_82719_1_.func_74757_a("ShowParticles", this.func_188418_e());
|
||||
p_82719_1_.func_74757_a("ShowIcon", this.func_205348_f());
|
||||
|
@ -31,7 +42,7 @@
|
|||
Potion potion = Potion.func_188412_a(i);
|
||||
if (potion == null) {
|
||||
return null;
|
||||
@@ -210,7 +214,7 @@
|
||||
@@ -210,7 +218,7 @@
|
||||
flag2 = p_82722_0_.func_74767_n("ShowIcon");
|
||||
}
|
||||
|
||||
|
@ -40,7 +51,7 @@
|
|||
}
|
||||
}
|
||||
|
||||
@@ -226,6 +230,67 @@
|
||||
@@ -226,6 +234,67 @@
|
||||
|
||||
public int compareTo(PotionEffect p_compareTo_1_) {
|
||||
int i = 32147;
|
||||
|
|
|
@ -33,6 +33,7 @@ import org.objectweb.asm.tree.MethodNode;
|
|||
|
||||
import cpw.mods.modlauncher.serviceapi.ILaunchPluginService;
|
||||
|
||||
@Deprecated // TODO as this only targets a single class, it can be moved to a JS coremod
|
||||
public abstract class FieldRedirectTransformer implements ILaunchPluginService
|
||||
{
|
||||
private final String clsName;
|
||||
|
|
|
@ -0,0 +1,29 @@
|
|||
/*
|
||||
* Minecraft Forge
|
||||
* Copyright (c) 2016-2018.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation version 2.1
|
||||
* of the License.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
package net.minecraftforge.common.asm;
|
||||
|
||||
@Deprecated
|
||||
public class PotionEffectTransformer extends FieldRedirectTransformer
|
||||
{
|
||||
public PotionEffectTransformer()
|
||||
{
|
||||
super("net.minecraft.potion.PotionEffect", "Lnet/minecraft/potion/Potion;", "getPotionRaw");
|
||||
}
|
||||
}
|
|
@ -2,3 +2,4 @@ net.minecraftforge.fml.loading.RuntimeDistCleaner
|
|||
net.minecraftforge.common.asm.RuntimeEnumExtender
|
||||
net.minecraftforge.common.asm.ObjectHolderDefinalize
|
||||
net.minecraftforge.common.asm.CapabilityInjectDefinalize
|
||||
net.minecraftforge.common.asm.PotionEffectTransformer
|
||||
|
|
|
@ -26,6 +26,8 @@ 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.Potion;
|
||||
import net.minecraft.potion.PotionType;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.EnumHand;
|
||||
import net.minecraft.util.math.AxisAlignedBB;
|
||||
|
@ -75,6 +77,22 @@ public class RegistryOverrideTest
|
|||
}
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public static void registerPotions(RegistryEvent.Register<Potion> event)
|
||||
{
|
||||
if (ENABLED)
|
||||
{
|
||||
event.getRegistry().register(new Potion(true, 0x00ffff)
|
||||
{
|
||||
{
|
||||
setPotionName("effect.poison");
|
||||
setIconIndex(6, 0);
|
||||
setEffectiveness(0.25D);
|
||||
}
|
||||
}.setRegistryName("minecraft:poison"));
|
||||
}
|
||||
}
|
||||
|
||||
private static class BlockReplacement extends Block
|
||||
{
|
||||
AxisAlignedBB BB = FULL_BLOCK_AABB.contract(0.1, 0, 0.1);
|
||||
|
|
Loading…
Reference in a new issue