Jump to content

[1.7.10] Custom enchanttable [SOLVED]


winnetrie

Recommended Posts

While the standard enchanttable doesn't recognize custom made bookshelfs due to the fact it only checks for the standard bookshelf and not the instanceof bookshelf block, i then thought let's make a custom enchanttable, copy over all the stuff and change the checking for the bookshelf into instanceof.

So i tested it and yeah it worked, the particles where showing up. So nice done i thought, but then when i clicked on the enchanttable no window( Gui) popped up where you can enchant stuff. I couldn't figure it out why that is.

Anyone can tell me why?

Link to comment
Share on other sites

I don't know about 1.7.10, as I'm using the newer and better 1.9, but the enchantment table only checks the bookshelf block for it's particles. For the power a block provides to a enchantment table, it checks

Block#getEnchantPowerBonus

.

 

BTW, if you didn't get it before, update. 1.7.10 is old and 1.9 has a recommended release.

Don't PM me with questions. They will be ignored! Make a thread on the appropriate board for support.

 

1.12 -> 1.13 primer by williewillus.

 

1.7.10 and older versions of Minecraft are no longer supported due to it's age! Update to the latest version for support.

 

http://www.howoldisminecraft1710.today/

Link to comment
Share on other sites

I don't know about 1.7.10, as I'm using the newer and better 1.9, but the enchantment table only checks the bookshelf block for it's particles. For the power a block provides to a enchantment table, it checks

Block#getEnchantPowerBonus

.

 

BTW, if you didn't get it before, update. 1.7.10 is old and 1.9 has a recommended release.

I wonder if you even read what i said? That wasn't helpfull at all! The problem is when clicking on the table i get no GUI like you normally should get!

As for the update to 1.9, well again i use 1.7.10 because i have no use for 1.9

There is a reason someone uses 1.7.10. I do not use 1.7.10 just for fun you know.

Link to comment
Share on other sites

ContainerEnchantment#canInteractWith

checks if the block at its position is

Blocks.enchanting_table

and the player is within 8 blocks of it, so it can't be used with your block.

 

You need to create your own

Container

that extends

ContainerEnchantment

and overrides

canInteractWith

to check for your block instead.

 

You also need to create your own

GuiContainer

class that renders like

GuiEnchantment

but uses your

Container

instead of

ContainerEnchantment

.

Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future.

Link to comment
Share on other sites

Thank you!

Something isn't still clear.

in this:

public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int p_149727_6_, float p_149727_7_, float p_149727_8_, float p_149727_9_)
    {
        if (world.isRemote)
        {
            return true;
        }
        else
        {
            TileEntityEnchantmentTable tileentityenchantmenttable = (TileEntityEnchantmentTable)world.getTileEntity(x, y, z);
            player.displayGUIEnchantment(x, y, z, tileentityenchantmenttable.func_145921_b() ? tileentityenchantmenttable.func_145919_a() : null);
            return true;
        }
    }

what/how do i place in there to get mine gui?

i have made a gui class called TemGuiEnchanttable.class

Also do i have to register the gui and container somewhere? I really have no clue!

 

Link to comment
Share on other sites

I don't know about 1.7.10, as I'm using the newer and better 1.9, but the enchantment table only checks the bookshelf block for it's particles. For the power a block provides to a enchantment table, it checks

Block#getEnchantPowerBonus

.

 

BTW, if you didn't get it before, update. 1.7.10 is old and 1.9 has a recommended release.

I wonder if you even read what i said? That wasn't helpfull at all! The problem is when clicking on the table i get no GUI like you normally should get!

As for the update to 1.9, well again i use 1.7.10 because i have no use for 1.9

There is a reason someone uses 1.7.10. I do not use 1.7.10 just for fun you know.

Whoa, calm down. I was implying that you don't have to make a custom enchantment table for custom bookshelfs, the vanilla enchantment table works with them (in 1.9...).

 

I do not use 1.7.10 just for fun you know.

Then why do you use it? Are you being forced to? By what?

 

You have to use an

IGuiHandler

for custom GUIs. There are tutorials online.

Don't PM me with questions. They will be ignored! Make a thread on the appropriate board for support.

 

1.12 -> 1.13 primer by williewillus.

 

1.7.10 and older versions of Minecraft are no longer supported due to it's age! Update to the latest version for support.

 

http://www.howoldisminecraft1710.today/

Link to comment
Share on other sites

 

Whoa, calm down. I was implying that you don't have to make a custom enchantment table for custom bookshelfs, the vanilla enchantment table works with them (in 1.9...).

I'm totally calm, i only had the impression you were just saying something random, srry for that.

 

Then why do you use it? Are you being forced to? By what?

 

It is because the reason i started modding. I want to make a public server with my mod. As far as i know to have a good working server you need several plugins. There is the problem, 'plugins' do not work with forge alone, so i use cauldron wich supports forge and bukkit/spigot. Cauldron has been stuck on mc version 1.7.10 and it won't get updates to 1.9.

Now you would ask why i need plugins. I need stuff like anti griefing (a good 1 is griefprevention). As far as i know there isn't any good antigrief mod made for forge.

Making a public server without any server utilities and without any good antigrief, well i guess you got the point.

I would prefer to use 1.9, because it is newer, updated, more support and i bet much better too.

You could say, create your own antigrief mod and all the other stuff, but this is all too advanced for me right now.

I'm already happy what i have created now (see signature  :P )!

 

You have to use an

IGuiHandler

for custom GUIs. There are tutorials online.

thank you, but i guess Choonster was faster hehe.

Link to comment
Share on other sites

You have to use an

IGuiHandler

for custom GUIs. There are tutorials online.

thank you, but i guess Choonster was faster hehe.

 

What larsgerrits said still applies to my post: Once you've created your own GUI, you need to use the

IGuiHandler

system to open it.

Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future.

Link to comment
Share on other sites

Thanks to both of you. It is working now.  ;D

I also did the same with the workbench and that's working too.

Now i have a working enchanttable that supports my custom bookshelfs!!  :P

 

Maybe 1 last thing. Is there a way to show the enchant by it's name instead of those gibberisch letters?

Link to comment
Share on other sites

You'd have to do that in the GUI, and search for where it renders those strings. I don't have a 1.7.10 workspace, and enchantment tables have changed in 1.8/1.9, sou I wouldn't be of much help here.

Don't PM me with questions. They will be ignored! Make a thread on the appropriate board for support.

 

1.12 -> 1.13 primer by williewillus.

 

1.7.10 and older versions of Minecraft are no longer supported due to it's age! Update to the latest version for support.

 

http://www.howoldisminecraft1710.today/

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.