mirror of
https://github.com/MinecraftForge/MinecraftForge.git
synced 2026-11-17 19:15:32 +00:00
Add redirects to PotionEffect to respect registry replacement (#5213)
This commit is contained in:
1 parent
06f67f7696
commit
f19fed0853
5 files changed
+63
-3
No files matched your search
@@ -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");
|
||||
}
|
||||
}
|
||||
+1
@@ -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);
|
||||
|
||||
Reference in new issue
Block a user