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."
Kittychanley

API and Visibility

17 posts in this topic

I thought it might be a good idea to copy the section of the README regarding the API to this forum.

 

"The current policy for development of the API is that changes are only made at the request of addon authors who would like improved compatibility. It isn't possible for us to think of all the different things and addon would like to implement, so if you feel that the API is lacking a specific functionality, please let us know."

 
In addition to this, if there is anything without visibility in either the core mod or the API that you would like to be changed to protected or even public, please let us know. We're more than happy to change a modifier or add getters and setters so addon authors don't have to do ASM or reflection to implement something.
 
Feel free to either respond to this topic with a requested change, or create a pull request on GitHub for it. If you do the latter, please make sure you read the rest of the README so you understand the procedures regarding pull requests.
0

Share this post


Link to post
Share on other sites

I was wondering if a change could be made so that addon creators could access different bits of information regarding mobs, such as mob size, age, gender, maybe even strength to determine our mob drops. Currently all of this information is set to private within the mob classes, and is therefore inaccessible.

0

Share this post


Link to post
Share on other sites

There are getter and setter methods for all of those variables as of 79.26 which released over a week ago.

0

Share this post


Link to post
Share on other sites

First off, the amount of visibility in both the core mod and API is awesome. Furthermore, your amount of dedication to the community and this mod is quite impressive.

 

With that, I am interested in adding visibility to the maximum food consumption of a food item, which is currently hard-coded at 5. In addition, it would be nice to be able to add or remove food items that can be used for a specific animal. It is totally possible that there is a method that I have overlooked, but I have not seen anything that would allow this to be done. If this is something that you would be interested in approving, just say so and I will gladly make a pull request.

0

Share this post


Link to post
Share on other sites

Maximum food consumption is not hardcoded at 5. Case in point, you can eat an entire sandwich in one bite. You just need to have your food extend ItemMeal and override getEatAmount.

 

If you're talking about adding food to feed animals with and to tempt them with, you'll have to create your own animal class that extends ours and spawns instead of ours. The tempting is just an AI that you add to the animal, and isFood for feeding is also a public method.

0

Share this post


Link to post
Share on other sites

I will explain what I am attempting to do with my addon so you will get a better idea of what and why I want to be able to change these values. I am developing an addon that will expand the eating system to replicate what hunger overhaul and pam's harvestcraft have done with vanilla minecraft but in a manner that is consistent with TFC. To accomplish this, the mod requires players to eat a variety of types of foods rather than eating salads and sandwiches for every meal. I am attempting to reduce the amount a player can eat of a food based on the number of times that food is eaten and the random player's "pickiness" for foods. For example, a picky player can only eat a food item 3 times before they cannot eat it and must eat other food items. This is essentially the behavior that Hunger Overhaul implements, which I know Bioxx does not like but many others do and adds to an increased sense of role play. 

 

What I want to do is reduce the amount a player can eat of a particular TFC food item. Currently, every food item is subject to:

 

float eatAmount = Math.min(amount, 5);

or

float eatAmount = Math.min(weight - decay, 5f);

 

Which means either use 5 relative units of this item or whatever is left to replenish stomach levels and reduce weight of the item. Increasing or decreasing "5" in this has the respective result on the amount used and stomach levels filled. By making a variable and a setter function for this value, a TFC food item usage can be adjusted. I would gladly make a pull request for this or if it will not be consider for submission I will keep my addon as is which replaces all TFC food items with its own. I am avoiding addSubstitutionalias as it breaks MP servers and does not properly register IDs. 

 

Since I am replacing all foods, I have found that it prevents interactions with all animals. I'll admit that I am not as knowledgeable about the TFC mobs code as I am with the foods codes. But from what I can see, adding a dynamically allocated list to call for entity/food interaction would all me to add an item to that list. Again I will make a pull request if this is something that might be approved otherwise I will not make a pull request.

 

Other than these few things, I have found TFC to be highly visible and fairly easy to work with.

0

Share this post


Link to post
Share on other sites

I guess I'm confused here on how you would even access these variables. Where do you expect to call the setter to update the eat amount on the piece of food?

 

The exact same thing goes for animals. It is literally an AI assignment for what food you can hold to get them to follow you. 

 

https://github.com/Deadrik/TFCraft/blob/master/src/Common/com/bioxx/tfc/Entities/Mobs/EntityCowTFC.java#L84

 

And their isFood check is a vanilla method that is overwritten.

 

https://github.com/Deadrik/TFCraft/blob/master/src/Common/com/bioxx/tfc/Entities/Mobs/EntityCowTFC.java#L511

 

I'm really don't see where else in the code you would be able to access and edit that, as making it some sort of static list for each mob doesn't make much sense to me.

0

Share this post


Link to post
Share on other sites

Let me begin by saying that I would love a addon like that. This is something that I have requested many times as I do not find believable that the player is able to eat the same sandwich forever and ever and never get tired of the taste. It also should not be healthy.

Not a coder myself, but if the problem you are having is because modifying food makes it so is not interacting with animals, why not just leave raw grain the way it is now, so animals would be attracted to it   and eat it.

Just prevent the player from eating raw grains.

I think you would be able to achieve your goal like that.

This way you would only have to change or create new properties for cooked or baked grains.

0

Share this post


Link to post
Share on other sites

I figure that a mod like this would be useful in allowing increased difficulty and depth that is not appropriate in the base mod; so if a player wants a deeper detail to food this can be in addition to TFC. So this can appease those that want more food options like apple pie, pizza, lemonade, etc or a more intricate and demanding food system that is not nice to new players and take on the demands that some suggestions want that are simply not appropriate in the base TFC.

 

As for where these variables can be called: 

For food items, I know that the PlayerUseItemEvent works fairly good at manipulating the food item a player is eating, at least that is what I am currently using to manipulate eating events and it works fairly well.

 

As for the mobs, I'll probably use LivingSpawnEvent to add the variable before it is spawned.

 

I am quite certain that implementing food changes in this manner will work as that is what I am currently doing with the addon currently and for the mob method I think it will work but I haven't spent much time working on it until I get some indication of potentially considering pull requests for these ideas as I don't want to waste time on something that will certainly be rejected. Realistically, the only variable that I would need to be public is the max eat amount as I could leave all of the TFC items in place and not need to replace them with my own. But I think having a method of adding food to tempt/feed animals might also prove handy.

 

If you think you might consider adding this feature, just say so and I will code it, test it and submit a pull request; If not, I will not waste any more time on the issue and continue to code my addon.

0

Share this post


Link to post
Share on other sites

You can work on a pull request for the max eat amount, which means you won't need to edit the mob feeding, but since the tempt is an AI thing there's really nothing special you need for that bit.

0

Share this post


Link to post
Share on other sites

I know TFC has entered maintenance mode, so this will likely be ignored/denied. However, I would like to be able to get the value for the amount of gunpowder contained inside of an explosive barrel, the int gunpowder inside of EntityBarrel is private, I don't need to change or alter this variable, I just need to retrieve the value.

 

Thanks, :)

 

0

Share this post


Link to post
Share on other sites

Just to make sure, you do realize that EntityBarrel is a barrel that is already lit and is about to explode, right?

Edit: Also, origBarrel is public, and that itemstack has NBT data on it for the original barrel tile entity's contents, which would include the stacks of gunpowder.

Edited by Kittychanley
0

Share this post


Link to post
Share on other sites
1 hour ago, Kittychanley said:

Just to make sure, you do realize that EntityBarrel is a barrel that is already lit and is about to explode, right?

Edit: Also, origBarrel is public, and that itemstack has NBT data on it for the original barrel tile entity's contents, which would include the stacks of gunpowder.

1
 

Yes, I know that is the exploding one, working on a compatibility add-on thing of sorts. I'll look into that other barrel, thanks, Kitty. :)

Edit: I can't seem to find the tag to call, I tried "gunpowder" just as a guess but that's returning zero so it's most likely not the right one. Sorry if I missing something obvious, but I looked through both TEBarrel, BlockBarrel, and EntityBarrel and I don't see where the value is being assigned to origBarrel.

Edited by Powerman913717
0

Share this post


Link to post
Share on other sites

There is no "gunpowder" tag. It's the normal inventory tag and you use that to calculate the gunpowder count the exact same way we do.

0

Share this post


Link to post
Share on other sites
8 hours ago, Kittychanley said:

There is no "gunpowder" tag. It's the normal inventory tag and you use that to calculate the gunpowder count the exact same way we do.

Thanks Kitty, sorry I misunderstood you.

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