Jump to content

Rawket Sushi

Members
  • Posts

    16
  • Joined

  • Last visited

Rawket Sushi's Achievements

Tree Puncher

Tree Puncher (2/8)

0

Reputation

  1. Right I know that like NBT is used for reading and writing to disk, and I know that like either way I'm gonna need to do the logic(in fact that part I look forward to, I like doing that stuff), the thing I was struggling to understand is how to save that reference time without using NBT. (I mean I was struggling to understand it even with NBT but doing so without sounded like some kind of magic cuz I didn't realize you could do more with capabilities than just like in the moment stuff) However looking at that link you posted I think that will help a lot, I mean I need to like study it a bit to properly understand how to actually use it, but it makes it make more sense conceptually, like I kinda get how it's working a little more now. I will mess around with it and see how I do but I feel like that is going to be a good help so thank you!
  2. So I am using a capability for like doing the math as far as like "if the current time is greater than the saved time by x amount, then set heat value to y" but I figured I would need to have that base reference time saved in an nbt tag because I wasn't sure if I could actually have the item like save that reference time without it, cuz I also needed those two blocks to be able to reference it and one of them needs to be able to adjust it too since if it's referencing that saved time to determine this heat value, I want that block to, if it's holding the item, bump that time up closer or to present time depending on how long it's held in that block, so the closer that saved time is to the present time, the "hotter" the item is, and if the item is not in that block, the saved time isn't being bumped up, and so it gets cooler. I just thought I would need to use an nbt tag to save that reference time to accomplish that. But if there is a way to accomplish all of that in a capability then that might be preferable, just not sure how to do that. Side note kind- I'm also just realizing I did edit the post to be more specific(it was a very messy post at first) but forgot to put back in that part that I did already want to use NBT I just am struggling to like actually use it. So that's why I said I figured I would need to use NBT it's cuz I was trying that and was having a hard time and forgot to include that when ironically trying to make the post clearer.
  3. So what I'm going for is an item that can be heated up and cool down based on the world time that has been saved to it. Basically the world time would be saved upon creation and can be referenced by a custom item property to determine the items texture. I also want this value to be accessible and changeable by a couple blocks later on that will be used to hold this item. One of those blocks would update the stored time to be closer to the present. Depending on how much later the current time is in relation to the stored time an item property would be used to change the items texture and the texture of the previously mentioned blocks. My main question is how do I store the world time in a stack specific value that I can have referenced and changed?
  4. Oh neat, I think there is some stuff I need to figure out but I think I understand, enough to figure it out hopefully anyways. I'll give it a go and see how it goes.
  5. So I have a block class, that I intend to use as a base class for several other blocks. The block class is called a CoinPile. I have several blocks that will be different instances of that CoinPile. I have it set up so that a coin is used as a block item to get it started. I want to be able to right click with a coin stack in hand and add one coin to the pile per right click. And if I right click with an empty hand, it pops off one coin. If I punch the pile, it drops all of the coins in the pile as items. I do not know how to go about this. I had hoped there would be some way to make a dynamic loot table so that just based on a block state integer it would multiply the drop count by that integer, but I so far haven't figured out how to do that aside from having just 64 different loot drop conditions.
  6. I think I figured it out. Am I supposed to like fully remove it? Cuz I instead changed it to compileOnly and it works as intended. But does that properly simulate that mod just not being present? Like if I were to export this as is and load it into a proper game it would work the same?
  7. I did and it works fine when they're there. But I was trying to run it without that to see if it still worked cuz the whole point here is to make it so that the other mod doesn't need to be loaded for mine to still work, just in that case without the stuff relating to that other mod. Is there another way to test or do I just have to like fully compile/export the project to test that.
  8. Ok so I can't compile without the mods loaded because the PlonkCoinItem extends an item from that mod. It just tells me package does not exist. create method within the custom Item class looks like this public static Item create(Block pBlock, Item.Properties pProperties) { return new PlonkCoinItem(pBlock, pProperties); } if statement looks like this public static Item getCoinItem(Block pBlock, Item.Properties pProperties) { Item coinItem; if (ModList.get().isLoaded("thermal")) { coinItem = PlonkCoinItem.create(pBlock, pProperties); } else { coinItem = new Item(new Item.Properties()); } return coinItem; } registryobject looks like this public static final RegistryObject<Item> LEAD_COIN = THERMAL_ITEMS.register("lead_coin", () -> InitModItems.getCoinItem(PlonkBlocks.LEAD_COIN.get(), new Item.Properties())); I made "InitModItems" to hold the if statement just to test if that would help, I didn't expect it to but I still wanted to just give it a shot . But clearly I've done something wrong and idk what because I have no errors other than the mod package not existing.
  9. Alright so that's what I was thinking then, sorry I just misread something, ADHD makes reading retention hard. When you said the return type needs to be vanilla I thought you said that the thing that is returned needs to be vanilla. And I'm a beginner. I'm just trying to learn. We all gotta suck at something before we can be good at it. I did put effort in to learning the basics, now I'm just trying to get the experience so that I like actually know it know it, like so I can retain it long term so that I don't have to keep asking on forums and stuff, I only do so as a last resort cuz I don't wanna like rely on it. And I'm asking all these follow ups in an attempt to better understand this stuff.
  10. Well this item for example is a coin. In thermal foundation, when you right click it, it puts heads or tails in chat. That's pretty minor of a function but I want to know how to retain that while also making it so you can place it as a block that I'm creating to add to it, that way I know how to do it moving forward for more complex items as well. Right now my custom item containing three create method extends that coin item from thermal, but if the create method returns just a vanilla item idk if it'll retain the functionally it has with the thermal mod. I mean I'll prolly try it anyway just to see what happens but that's what I'm trying to do
  11. I know he said it needs to return an item, I didn't see that it needed to return a new vanilla class. I just saw that it needed to return an item. But that does make sense, I kinda thought that was a possibility, is why I mentioned that that at one point. Like I didn't just miss that possibility, I knew I might have to try it that way but I was just gonna cross that bridge when I got to it cuz that hadn't caused me issues yet so I wanted to just deal with what was giving me issues. But just to make sure, if I have it return a vanilla blockitem is it still going to have the other functionality that the original mod item has?
  12. Oh wait the if statement goes inside the registry object? So every registry object should have the if statement? If yes then that should solve everything I haven't been trying to give specific properties and stuff cuz I had the if statement not in the registry object and I was trying to make it useful to each but if I have to do it for each individually then I guess that aught to solve the whole issue. Also I wasn't creating a new instance of the custom item because the custom item extends a class from thermal foundation and does even stated that doing "new custom item" would crash cuz it's still going reference that unloaded class hence the .create however I think from what you're saying, I should return "new coinitem" and like just pass in the specific properties?
  13. Er well now I'm just having trouble figuring out how to register it. I keep running into the same issues. I think I must have made the "create" method incorrectly. And I'm not sure I'm registering the item correctly for this either. Basically I keep running into the create method not being allowed to be referenced from a static context, which I don't really understand cuz the method in which I call it is not static, nor is the create method itself. Unless the "itemImpl" or "coinItem" in my case can't be static, but if that isn't static then I can't use it to register the way it's set up because in order to register the IDE tells me to make it static. When I say I think I might have made the create method wrong, I mean the as it stands, it's really just public Item create() { return this; } cuz I didn't know what else to have it do. I have so far not seen that it causes any issues(other than the back and forth between one side of the issue wanting it to be static and the other not static) because ultimately it does come back to an item, albeit through several "extends" but it has had no issue taking it as a return. Unless this will also cause the same crash you were talking about which I can also see being a possibility but I haven't been able to get that far to find out for myself yet. I can't make the method static because when I do it gives me an error that "this" cannot be referenced from a static context. but then often I also end up seeing "create" cannot be referenced from a static context which again not sure what it means when the method containing the "create" call isn't static, nor is the "create" method itself. With the "if" statement, I have it setting the item to be either the mod item or just a normal item because if the other mod isn't loaded I don't need this item to do anything because it will be inaccessible. if (ModList.get().isLoaded("thermal")) { coinItem = PlonkCoinItem.create(); } else { coinItem = new Item(new Item.Properties()); } "coinItem" in this case is initialized in the class and then set here. and then finally there's the registry object public static final RegistryObject<Item> LEAD_COIN = THERMAL_ITEMS.register("lead_coin", () -> new coinItem(PlonkBlocks.LEAD_COIN.get(), new Item.Properties())); I can't put any of the properties in the if statement because I need to make several of these, but also the "new Item" has to have that part about Item.Properties or else I get an error and so I'm not even sure at this point if I'm registering it correctly either.
×
×
  • Create New...

Important Information

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