Jump to content

Recommended Posts

Posted

Hi, I am having setting items in my creative tab using the tutorial on the wiki. I define my tab, then when I try to set it in my item class, it can't recognize it. Here is my mod file:

 

package NoctusRealm;

import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.ItemStack;
import net.minecraftforge.common.MinecraftForge;
import NoctusRealm.Items.ItemDragonSword;
import NoctusRealm.Items.Items;
import NoctusRealm.References.CommonProxy;
import NoctusRealm.References.ModInfo;
import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.Mod.EventHandler;
import cpw.mods.fml.common.SidedProxy;
import cpw.mods.fml.common.event.FMLInitializationEvent;
import cpw.mods.fml.common.event.FMLPostInitializationEvent;
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
import cpw.mods.fml.common.network.NetworkMod;

@Mod(modid = ModInfo.ID, name = ModInfo.NAME, version = ModInfo.VERSION)
@NetworkMod(channels = {ModInfo.CHANNEL}, clientSideRequired = true, serverSideRequired = true)

public class NoctusRealm {

public static CreativeTabs tabNoctusRealm = new CreativeTabs("NoctusRealm") {
        public ItemStack getIconItemStack() {
                return new ItemStack(Items.DragonSword, 1, 0);
        }
};

@SidedProxy(clientSide = ModInfo.PROXYLOCATION + ".ClientProxy", serverSide = ModInfo.PROXYLOCATION + ".CommonProxy")
public static CommonProxy proxy;

@EventHandler
public static void preInit(FMLPreInitializationEvent event) {

	proxy.initRenders();
	proxy.initSounds();
	Items.init();
	MinecraftForge.EVENT_BUS.register(new ItemDragonSword.DragonFallEvent());

}

@EventHandler
public static void init(FMLInitializationEvent event) {



}

@EventHandler
public static void postInit(FMLPostInitializationEvent event) {



}

}

 

And my item file

 

package NoctusRealm.Items;

import java.util.List;

import net.minecraft.client.renderer.texture.IconRegister;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.EnumToolMaterial;
import net.minecraft.item.ItemStack;
import net.minecraft.item.ItemSword;
import net.minecraft.util.MathHelper;
import net.minecraft.world.World;
import net.minecraftforge.event.ForgeSubscribe;
import net.minecraftforge.event.entity.living.LivingFallEvent;
import NoctusRealm.References.Names;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;

public class ItemDragonSword extends ItemSword {

public ItemDragonSword(int id, EnumToolMaterial material) {

	super(id, material);
	this.setUnlocalizedName(Names.DragonSwordUnlocalizedName);
	this.setCreativeTabs(NoctusRealm.tabNoctusRealm);

}

@Override
public ItemStack onItemRightClick(ItemStack itemStack, World world, EntityPlayer player) {

		double calculatedX = 5 * (double) (-MathHelper.sin(player.rotationYaw/ 180.0F * (float) Math.PI)* MathHelper.cos(player.rotationPitch / 180.0F* (float) Math.PI) * 0.4f);
		double calculatedZ = 5 * (double) (MathHelper.cos(player.rotationYaw	/ 180.0F * (float) Math.PI)* MathHelper.cos(player.rotationPitch / 180.0F* (float) Math.PI) * 0.4f);
		double calculatedY = 2.5 * (double) (-MathHelper.sin((player.rotationPitch)/ 180.0F * (float) Math.PI) * 0.4f);
		player.motionY = calculatedY;
		player.motionX = calculatedX;
		player.motionZ = calculatedZ;	

	return itemStack;

}

public static class DragonFallEvent
{
	@ForgeSubscribe
	public void fallEvent(LivingFallEvent event)
	{
		EntityLivingBase player =  event.entityLiving;

		ItemStack stack = player.getHeldItem();
		if(stack != null && stack.getItem() == Items.DragonSword)

			event.setCanceled(true);

	}

}

@Override
@SideOnly(Side.CLIENT)
public void registerIcons(IconRegister icon) {

	itemIcon = icon.registerIcon("nr" + ":" + "dragonsword");

}

public boolean hasEffect(ItemStack itemstack)
{
        return true;
}

@Override
    @SideOnly(Side.CLIENT)
    public void addInformation (ItemStack stack, EntityPlayer player, List list, boolean par4)
    {
        list.add("Two-Handed");
    }
}

 

I get the error under

 

this.setCreativeTabs(NoctusRealm.tabNoctusRealm);

Posted

When extending ItemSword you cannot assign CreativeTab. What you can do is extend Item and then copy ItemSword code to it (since ItemSword extends Item it will be the same). About this ,,you cannot" - I am not sure, but after 1h of going through code I cannot get it working too. Its probably bug or you need to find some special method to do it - I realy don't know but I know that there are many who can't get it working either.

  Quote

1.7.10 is no longer supported by forge, you are on your own.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • As a stay-at-home dad and a farmer in Kentucky, my primary focus has always been on nurturing my family and managing our land. When Bitcoin began to gain traction, I saw it as a potential opportunity to secure our financial future. With my wife encouragement, I decided to invest $10,000 from our savings into cryptocurrency. Over time, my investment flourished beyond my wildest dreams, eventually soaring to an astonishing $200,000. Just as I began to feel a sense of financial security, disaster struck. In a shocking act of betrayal fueled by jealousy, my wife hacked into my email and gained access to my Bitcoin wallet. The devastation I felt was overwhelming years of careful planning and smart investing were wiped out in an instant. I was left feeling helpless and uncertain, grappling with the fear that I might never recover what I had lost. In the midst of this turmoil, a close friend reached out to me and mentioned RAPID DIGITAL RECOVERY. Desperate for a solution but still holding onto a glimmer of hope, I contacted them, praying for a lifeline. Their team responded promptly, providing both reassurance and a clear plan of action. With remarkable expertise, they tracked down the digital footprints left by the theft and successfully recovered a substantial portion of my stolen funds. But their assistance didn’t end there. Understanding the vulnerability I felt after such a betrayal, they also offered invaluable advice on how to strengthen my digital security to prevent future breaches. Their support was not just technical; it was a source of empowerment that helped me regain my confidence and sense of control over my financial situation. While the betrayal was a painful lesson, it ultimately taught me resilience and the importance of safeguarding my assets. Thanks to RAPID DIGITAL RECOVERY, I didn’t just reclaim my lost Bitcoin; I also regained my peace of mind. This experience has transformed my perspective on both trust and security in the digital age. I now approach investments with a renewed sense of caution and awareness, ensuring that I protect not only my financial future but also my emotional well-being. The journey has been challenging, but it has also been a testament to my strength and determination to rise above adversity as I continue to balance my roles as a dad and a farmer.
    • Same issue without Oculus Flywheel Compat?
    • When i start my game with a shader active the game crashes with this Error: java.lang.NoSuchFieldError: TESSELATION_SHADERS Minecraft java 1.20.1 in forge 47.4.0 crash report in pastebin: https://pastebin.com/6xiwHqZW thanks in advance
    • If you are using AMD/ATI, update your drivers - get the drivers from their website - do not update via system
    • Not sure why this is happening, but I would love some help. The reason I restarted the server was because I was getting an error while trying to join regarding this "Internal Exception: io.netty.handler.codec.DecoderException: io.netty.handler.codec.EncoderException: java.io.IOException: Root tag must be a named compound tag" Im using ServerMiner if thats any help
  • Topics

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.