Help with potion effects on swords

Started by KodiKodi on Wed, 05/24/2017 - 07:27

Topic category: Help with MCreator modding

Last seen on 06:27, 16. Mar 2019
Joined Feb 2017
User points:

Statistics:

  • Comments:
  • Forum topics:
  • Modifications:
  • Wiki pages:
Help with potion effects on swords
Fri, 06/23/2017 - 11:51 (edited)

I'm new to all this modding stuff and I'm trying to figure out how to make it so when I hit a player or mob that it makes them withered for 10 seconds could someone code it for me? thanks!

 

 

package mod.mcreator;

import net.minecraftforge.common.util.EnumHelper;

import net.minecraft.world.World;
import net.minecraft.item.ItemSword;
import net.minecraft.item.ItemStack;
import net.minecraft.item.Item;

import java.util.Set;
import java.util.Random;
import java.util.HashMap;

import cpw.mods.fml.common.registry.GameRegistry;
import cpw.mods.fml.common.event.FMLServerStartingEvent;
import cpw.mods.fml.common.event.FMLPreInitializationEvent;

public class mcreator_grayDay {

    public mcreator_grayDay() {
    }

    public static Item block;
    public static Object instance;

    public void load() {
        ItemStack stack = new ItemStack(block, 1);
        GameRegistry.addRecipe(stack,
                new Object[]{"X1X", "345", "X7X", Character.valueOf('1'), new ItemStack(mcreator_kodisSoul.block, 1), Character.valueOf('3'),
                        new ItemStack(mcreator_mojellosSoul.block, 1), Character.valueOf('4'), new ItemStack(mcreator_fallenGodSword.block, 1),
                        Character.valueOf('5'), new ItemStack(mcreator_mrTreepsSoul.block, 1), Character.valueOf('7'),
                        new ItemStack(mcreator_mrMethsSoul.block, 1),});
    }

    public void generateNether(World world, Random random, int chunkX, int chunkZ) {
    }

    public void generateSurface(World world, Random random, int chunkX, int chunkZ) {
    }

    public int addFuel(ItemStack fuel) {
        return 0;
    }

    public void serverLoad(FMLServerStartingEvent event) {
    }

    public void preInit(FMLPreInitializationEvent event) {
    }

    public void registerRenderers() {
    }

    static {
        Item.ToolMaterial enumt = EnumHelper.addToolMaterial("GRAYDAY", 1, 1000, 5F, 8, 5);
        block = (Item) (new ItemSword(enumt) {
            public Set<String> getToolClasses(ItemStack stack) {
                HashMap<String, Integer> ret = new HashMap<String, Integer>();
                ret.put("sword", 1);
                return ret.keySet();
            }
        }).setUnlocalizedName("GrayDay").setTextureName("GrayDay");
        Item.itemRegistry.addObject(536, "GrayDay", block);

    }

}

Edited by KodiKodi on Fri, 06/23/2017 - 11:51