Hidding Effects

Started by LueLusten on

Topic category: Help with Minecraft modding (Java Edition)

Joined Nov 2016
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Hidding Effects

Hey where would I add this:

        
        @SideOnly(Side.CLIENT)
      @Override
         public boolean hasEffect(ItemStack stack)
         {
             return true;
         }

 

I want to hide all encharmnets from the tools in my tools, only way I have found to even add them is part of the recipe window so would I need 

to add this or another code to it to be able to hide the encharments ? thanks 

Joined Aug 2013
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Simply in your item class
Tue, 11/22/2016 - 21:30

Simply in your item class (etc. the class that extends Item) if it is item element , or if it is tool element find something like new ItemPickaxe(some_stuff_here){}; and put it to the two empty brackets.

Also in case that you want hide the enchantment ffect from the item, you should return false value

Joined Nov 2016
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
RE:Simply in your item class
Tue, 11/22/2016 - 22:29

@#1 Call me silly but where do I add that here?
 

Code:
[spoiler]

package mod.mcreator;

import net.minecraftforge.fml.common.registry.GameRegistry;
import net.minecraftforge.fml.common.event.FMLServerStartingEvent;
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
import net.minecraftforge.fml.common.event.FMLInitializationEvent;

import net.minecraft.world.World;
import net.minecraft.item.ItemStack;
import net.minecraft.init.Enchantments;

import java.util.Random;

public class mcreator_test {

    public mcreator_test() {
    }

    public static Object instance;

    public void load(FMLInitializationEvent event) {
        ItemStack recStack = new ItemStack(mcreator_babySoulSword.block, 1);

        recStack.addEnchantment(Enchantments.SHARPNESS, 10);
        recStack.addEnchantment(Enchantments.LOOTING, 10);
        recStack.addEnchantment(Enchantments.FLAME, 10);
        recStack.addEnchantment(Enchantments.UNBREAKING, 10);

        GameRegistry.addShapelessRecipe(recStack, new Object[]{mcreator_babySoulSword.block,});
    }

    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() {
    }
}

[/spoiler] 

 

would it be after? 
 recStack.addEnchantment

Also yes I know I need it to say false it was just air code at the time :)

Joined Aug 2013
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
You need it in the item's
Tue, 11/22/2016 - 23:09

You need it in the item's code , not recipe.

Joined Nov 2016
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Here is the item source
Tue, 11/22/2016 - 23:22

Here is the item source:
[spoiler]

package mod.mcreator;

import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.common.registry.GameRegistry;
import net.minecraftforge.fml.common.event.FMLServerStartingEvent;
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
import net.minecraftforge.fml.common.event.FMLInitializationEvent;
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 net.minecraft.init.Items;
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
import net.minecraft.client.Minecraft;

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

public class mcreator_babySoulSword {

    public mcreator_babySoulSword() {
    }

    public static Item block;
    public static Object instance;

    public void load(FMLInitializationEvent event) {
        ItemStack stack = new ItemStack(block, 1);
        if (event.getSide() == Side.CLIENT)
            Minecraft.getMinecraft().getRenderItem().getItemModelMesher()
                    .register(block, 0, new ModelResourceLocation("TestEnvironmentMod:BabySoulSword", "inventory"));

        GameRegistry.addRecipe(stack, new Object[]{"012", "345", "678", Character.valueOf('0'), Items.BLAZE_ROD, Character.valueOf('1'),
                mcreator_babySoulClay.block, Character.valueOf('2'), mcreator_babySoulSwordBlade.block, Character.valueOf('3'),
                mcreator_babySoulClay.block, Character.valueOf('4'), mcreator_babySoulSwordGuard.block, Character.valueOf('5'),
                mcreator_babySoulMud.block, Character.valueOf('6'), mcreator_babySoulSwordHilt.block, Character.valueOf('7'),
                mcreator_babySoulMud.block, Character.valueOf('8'), Items.BLAZE_ROD,});
    }

    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("BABYSOULSWORD", 3, 2500, 30F, 24, 64);
        block = (Item) (new ItemSword(enumt) {
            public Set<String> getToolClasses(ItemStack stack) {
                HashMap<String, Integer> ret = new HashMap<String, Integer>();
                ret.put("sword", 3);
                return ret.keySet();
            }
        }).setUnlocalizedName("BabySoulSword");
        GameRegistry.registerItem(block, "BabySoulSword");
        block.setCreativeTab(mcreator_wittlesTab.tab);

    }

}

[/spoiler]

Joined Nov 2016
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
RE:HideFlags=3
Wed, 11/23/2016 - 19:27

@#4 That is a json command flag that is not going to help in this code.