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

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

Announcements



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • I tried to play a mod for forge 1.20.2 and the mod didn't work, fix this please.
    • EntityRenders requires an EntityRenderProvider. This is what I have: @Mod.EventBusSubscriber(modid = MODID, bus = Mod.EventBusSubscriber.Bus.MOD, value = Dist.CLIENT) public static class ClientModEvents { @SubscribeEvent public static void clientSetup(FMLClientSetupEvent event) { EntityRenderers.register(HOSE.get(), new HoseEntityRenderFactory()); } private static class HoseEntityRenderFactory implements EntityRendererProvider<HoseEntity> { @Override public EntityRenderer<HoseEntity> create(Context context) { return new HoseEntityRenderer<>(context); } } } Replace HoseEntity with your own entity. If you're doing multiple try doing generics (though untested).
    • First off, I know should probably be able to debug this on my own, but this is my first mod, and I couldn't figure it out for multiple days now. What I'm trying to do, is to modify the default minecart by replacing it with a slightly different version, but I'm stuck 1 step before that, that being "cloning" the minecart as a separate Entity/Item. Here you can see a GitHub gist of all relevant files: https://gist.github.com/Kipama/cd39127e8891715a3006fa990ca7ff14 If there are files missing or access isn't working as intended, please let me know! In the Gist you can find the following files: -CustomMinecartEntity.java:        This file extends AbstractMinecart and is a clone of the vanilla minecart entity. I know I should override the minecart entity directly, but as this should work rn, I didn't change it yet. -CustomMinecartRenderer.java:  Basically vanilla MinecartRenderer with a Custom slapped on it, extends MinecraftRenderer. -ModEntities.java:                         This is where the new Entity gets added to the deferred register ENTITY_TYPES. -ModernMinecarts.java:               The main mod file. Relevant part is at the bottom, where I try to use onClientSetup to register the new Entity using EntityRenderers.register(). That last part is where my problem begins. When I try to register the new entity using EntityRenderers.register(ModEntities.CUSTOM_MINECART_ENTITY.get(), CustomMinecartRenderer::new); I get a syntax Error saying the provided and required types don't match. These are the required and provided types: ModEntities.CUSTOM_MINECART_ENTITY.get(): Required: EntityType<? extends T> Provided:EntityType<CustomMinecartEntity> CustomMinecartRenderer::new: Required: EntityRendererProvider<T> Provided:<method reference   So far I looked at 2 different Git repositories implementing custom entities, but haven't been able to figure out what I'm doing wrong. Any answers, suggestions and ridicules appreciated.
    • Yes, it is. I found out how to do it. (for Forge 1.20.1) Add this to main class constructor: // ... MinecraftForge.EVENT_BUS.<PlayerInteractEvent.EntityInteract>addListener(e -> { Player playerWhoUsed = e.getEntity(); ItemStack usedItemStack = e.getItemStack(); Entity entityThatWasClicked = e.getTarget(); if (usedItemStack.getItem() instanceof YourItem item) { // your code... e.setCancelled(true); // you can remove this if you want to continue interaction } } // ...
    • Hi there, I'm hoping to create a block that renders a fake skybox, blocking anything behind it. There are a couple of mods that already do this, but they are very outdated. One example: https://github.com/Elix-x/Skyblocks/ https://www.curseforge.com/minecraft/mc-mods/skyblocks I'm not familiar enough with rendering to be able to port it. Is there anyone who can point me in the right direction? Any help would be appreciated.
  • Topics

  • Who's Online (See full list)

    • There are no registered users currently online
×
×
  • Create New...

Important Information

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