Hidding Effects

Started by LueLusten on Tue, 11/22/2016 - 19:52

Topic category: Help with modding (Java Edition)

Last seen on 22:52, 27. Oct 2017
Joined Nov 2016
User points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • MCreator plugins:
  • Comments:
Hidding Effects
Tue, 11/22/2016 - 19:52

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 

Last seen on 00:21, 11. Aug 2019
Joined Aug 2013
User points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • 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

Last seen on 22:52, 27. Oct 2017
Joined Nov 2016
User points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • 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 :)

Last seen on 00:21, 11. Aug 2019
Joined Aug 2013
User points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • 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.

Last seen on 22:52, 27. Oct 2017
Joined Nov 2016
User points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • 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]

Last seen on 17:24, 15. Mar 2017
Joined Oct 2016
User points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • MCreator plugins:
  • Comments:
HideFlags=3
Wed, 11/23/2016 - 16:39

HideFlags=3

Last seen on 22:52, 27. Oct 2017
Joined Nov 2016
User points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • 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.