Jump to content

[1.7.2] Want to make a book for my mod's information ingame


Budboy33

Recommended Posts

I need help making a book item for my mod's information, like items and recipes and such, and none of the mods that add a book item like this are open source.

 

This is what I have so far:

 

package com.budboy.am.item;

 

import com.budboy.am.creativetab.CreativeTab;

import net.minecraft.item.Item;

 

public class ItemMagicBook extends ItemWritableBook {

 

        public ItemMagicBook() {

                maxStackSize = 1;

                setCreativeTab(CreativeTab.magicTab);

                setUnlocalizedName("magicBook");

                setTextureName("am:magicBook");

        }

}

Link to comment
Share on other sites

So I tried to make a gui with the Containers and GUIs tutorial on the wiki, but it says it's out of date...

 

Here's the current code for my book:

 

package com.budboy.am.item;

 

import com.budboy.am.creativetab.CreativeTab;

import com.budboy.am.gui.GuiIDs;

import com.budboy.am.main.AncientMagicMain;

 

import net.minecraft.entity.player.EntityPlayer;

import net.minecraft.item.Item;

import net.minecraft.item.ItemStack;

import net.minecraft.item.ItemWritableBook;

import net.minecraft.world.World;

 

public class ItemMagicBook extends ItemWritableBook {

 

@Override

    public boolean onItemUse(ItemStack itemStack, EntityPlayer entityPlayer, World world, int x, int y, int z, int sideHit, float hitVecX, float hitVecY, float hitVecZ) {

 

        if (world.isRemote) {

            entityPlayer.openGui(AncientMagicMain.instance, GuiIDs.MagicBookGui, world, x, y, z);

        }

        return true;

    }

 

        public ItemMagicBook() {

                maxStackSize = 64;

                setCreativeTab(CreativeTab.magicTab);

                setUnlocalizedName("magicBook");

                setTextureName("am:magicBook");

        }

}

Link to comment
Share on other sites

I need help making a book item for my mod's information, like items and recipes and such, and none of the mods that add a book item like this are open source.

 

Tinkers Construct for 1.7.2

https://github.com/SlimeKnights/TinkersConstruct/blob/master/src/main/java/tconstruct/items/Manual.java

 

Been meaning to look at how it works myself, but got a bigger mod to finish first.

Link to comment
Share on other sites

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



×
×
  • Create New...

Important Information

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