Add redirects to PotionEffect to respect registry replacement (#5213)

This commit is contained in:
Ben Staddon authored and tterrag committed 2019-01-03 23:02:11 -05:00
1 parent d1478ca529
commit 4e11c95d0e
4 files changed
+62 -4

No files matched your search

@@ -0,0 +1,28 @@
/*
* 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.fml.common.asm.transformers;
public class PotionEffectTransformer extends FieldRedirectTransformer
{
public PotionEffectTransformer()
{
super("net.minecraft.potion.PotionEffect", "Lnet/minecraft/potion/Potion;", "getPotionRaw");
}
}
@@ -49,6 +49,7 @@ public class FMLDeobfTweaker implements ITweaker {
classLoader.registerTransformer("net.minecraftforge.fml.common.asm.transformers.ItemStackTransformer");
classLoader.registerTransformer("net.minecraftforge.fml.common.asm.transformers.ItemBlockTransformer");
classLoader.registerTransformer("net.minecraftforge.fml.common.asm.transformers.ItemBlockSpecialTransformer");
classLoader.registerTransformer("net.minecraftforge.fml.common.asm.transformers.PotionEffectTransformer");
try
{
FMLLog.log.debug("Validating minecraft");
@@ -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.Potion;
import net.minecraft.potion.PotionType;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumHand;
@@ -76,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);