Content: Slate Blackcurrant Watermelon Strawberry Orange Banana Apple Emerald Chocolate Marble
Background: Slate Blackcurrant Watermelon Strawberry Orange Banana Apple Emerald Chocolate Marble
Pattern: Blank Waves Notes Sharp Wood Rockface Leather Honey Vertical Triangles
Welcome to TerraFirmaCraft Forums

Register now to gain access to all of our features. Once registered and logged in, you will be able to contribute to this site by submitting your own content or replying to existing content. You'll be able to customize your profile, receive reputation points as a reward for submitting content, while also communicating with other members via your own private inbox, plus much more! This message will be removed once you have signed in.

  • Announcements

    • Crysyn

      Only help if you can be helpful

      Hey All, A topic has come up of late in the IRC channel in regards to the general feel of the forums and the community that supports them. Things have progressed further than I would have liked with out this being addressed more publicly because I would much rather have snubbed this out sooner rather than later.. but I have been busy. Here is the general rule I would like people to follow: Wheaton's Law "Don't be a dick." Those of you from the IRC channel know that this is the only rule I ask people in there to follow and we generally have a good and lively time chatting about all manner of things. This is basic rule that just about everyone understands and I am going to expand it to the forums from here moving forward. If you can not help people in a helpful and polite manner then I simply ask you to stop. Now I generally take a back seat to moderating the forums as I like to participate in the suggestions forum fairly heavily at times and would rather do so as a forums user than a moderator. But I am also fairly well known for being the person who constantly puts their foot down and so I am stepping up and doing so on here. If you find yourself unable to respond to a message politely then I ask that you do not respond. This mostly focuses on the increasing level of hostility found within the Suggestion forum as well as the Server forum. I do not care if this is the 30th some odd time you have seen someone make the same suggestion. Or even if the new post on an older topic is one entry above the old one. I expect the members of this forum to respond politely to the user, new or old, and point to the older topic if it applies and even go the extra step to suggest they either add in new information or to summarize the outcome of the previous discussion based upon the new post's entry into it. That is what we are here for, that is why I close most topics instead of deleting them, so that they can be found and referenced down the road. The next topic is the slew of derailment attempts I have seen as of late. If you want to have fun and joke around that is what the off topic forum is for and pretty much anything goes there. I do not expect to read a suggestion thread and have to go through 3 pages of image memes people have shot back and forth. Quite simply this is a waste of my time to read and then have to clean up. Now for the summary. I am going to start taking a more active role, especially in policing the suggestion forum, and handing out warn levels to people whom I see doing this. These will be indiscriminate and applied not to just the first person who derails or is impolite on a topic or response, but to everyone whom follows the lead of that person. As I do not like doing things with out giving you all warning this post shall serve as that warning. If you have a desire to bring this topic up with me then I invite you to do so on the IRC channel. Lets raise the level of quality and grow the community. Let us not descend into the quality often found on the minecraft or league of legend forums. There is simply no need for that here. Be passionate about things, just do not be abusive.
    • Kittychanley

      Offline Servers

      Recently I've seen a few server listings showing up on the first page of the Servers forum that have been closed for an extended period of time, but have recently gotten a reply from a new member who didn't realize the server is offline. To help prevent this from happening in the future, it would be greatly appreciated if you could use the report function on the original post of any servers that have been confirmed as offline, so that the topic may be locked. If you are the admin of a server and plan on taking the server offline, please use the report function on the original post of your topic to let the TFC Staff know that the topic should be locked. If you are the admin of a server that has a locked topic, and would wish to bring the server back online, please use the report function on the original post of the topic to let the TFC Staff know that the topic should be unlocked. As always, please remember to follow rule #3 of the servers forum and update your topic title to contain the version of TFC that the server is currently running. You can do so by editing the OP, and then clicking on "Use Full Editor."
TaeoG

Adding Anvil Recipes

7 posts in this topic

As I understand it, AnvilRecipes when instantiated have a crafting value that is set pseudo-randomly . It appears you send the seed information to the client when a player logs into the server, which sets up the Anvil Manager clientside to produce the same crafting values given the same recipe inputs.

 

By my reckoning, this should allow someone adding recipes using the same AnvilManager to have working recipes in multiplayer, as long as they register those recipes AFTER the SetupWorld() method has been called clientside. Is there a good way to do this? Is there a particular one time event that is guaranteed to trigger sometime afterward world setup, or is it possible that you could trigger an event that an addon creator could look for?

Edited by Kittychanley
Moved to addon discussion
0

Share this post


Link to post
Share on other sites

I know your anvil works a bit differently, but you could try just using the standard anvil manager and require the recipes to use your anvil.

Edited by Powerman913717
0

Share this post


Link to post
Share on other sites

Have you looked at how merchants and decorations addons implemented this? They add anvil recipes. They are open source and may give some insight.

1

Share this post


Link to post
Share on other sites

I was just poking around in the Decorations mod, I think I've got it sorted out.

 

For the record, as I'm sure others will have the same question, this is what seems to be a solid implementation:

 

1. Implement your own InitClientWorldPacket class, make sure it extends AbstractPacket. You can call it whatever you want. obviously.

2. In the packet's handleClientSide(EntityPlayer) method, call your anvil recipe register method, whatever it might be. Have a static boolean stored somewhere to check whether this has been done already, otherwise you'll end up with a bunch of copies of your recipes in the manager.

3. In your mod during the initialization phase, call TerraFirmaCraft.packetPipeline.registerPacket(), passing it your new packet

4. ???

5. PROFIT!

 

 

I'm going to test it now, I'll edit this post if I'm missing something.

 

EDIT: I was missing something fairly obvious.

 

4. a)Create a class to track the player that listens for a PlayerLoggedInEvent, and register it in your main mod file

    b)on PlayerLoggedInEvent, instantiate your new packet and send it through the pipeline using

TerraFirmaCraft.packetPipeline.sendTo(pkt, (EntityPlayerMP) event.player);
Edited by TaeoG
0

Share this post


Link to post
Share on other sites

Yep, after testing it this implementation works quite well. You still need to clear the recipes out and reset the "already registered" tag when moving from server to server or from single player to multiplayer, but restarting your client will do that in a pinch.

0

Share this post


Link to post
Share on other sites

Instead of using a world load event and network packets i used this:

@EventHandlerpublic void serverStarted(FMLServerStartedEvent e){    Recipes.loadAnvilRecipes();}

 

The problem is timing.

The anvil manager needs the world super-seed to randomize the recipes, so using this code in the main mod class seems to work.

0

Share this post


Link to post
Share on other sites

does the FMLServerStartedEvent get called clientside?

0

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now