Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Draco18s

Members
  • Joined

  • Last visited

Everything posted by Draco18s

  1. Its only still there for compatibility on things that haven't been updated to the new style yet. The method you're using takes in a metadata value, not a blockstate, thus is out of date.
  2. 1) Does your ItemWrapper properly compare item stacks in equals and generate a hashcode? 2) Does your furnace try to pull a result from your hashmap?
  3. I'd use the armor item's onArmorTick method. That way you're not having to check the player's inventory all the time, even when they're not wearing armor.
  4. Pretty much. e.g. List<OutputWrapper> list = new ArrayList<OutputWrapper>(); list.add(new OutputWrapper(1, Items.APPLE)); //apple because why not list.add(new OutputWrapper(0.2, Items.GOLD_NUGGET)); //arbitrary this.addSmeltingMulti(Items.BONE, list); That would mean that when you smelted a bone, you'd always get an apple and 20% of the time you'd get a gold nugget. You'd probably want to limit your secondaries to a maximum of your total output slots (e.g. if you have 3 output slots, have no more than 3 output items per input item). This is assuming that your random is based on floats. If you do integers, you may have to refactor to match your desired design goal (e.g. if you always roll rand.nextInt(100) then you pass in "20" as your 20%).
  5. You don't need the Tuple. You want something like this: private Map<ItemWrapper, List<OutputWrapper>> smeltmulti = new HashMap(); Then this: public class OutputWrapper{ public final float chance; public final ItemStack item; public OutputWrapper(float c, ItemStack i) { chance = c; item = i; } }
  6. Ah, cool. I'll try and remember that. I'm done doing my manipulation, and everything works the way I want, but there was a lot of poking around in the dark.
  7. Well, there's two problems, still: 1) ItemStacks don't work as keys properly (do not override equals or hashcode) so you'd have to iterate over the map manually (furnace recipes does this) or you can create a wrapper class (like I did for blocks; BlockWrapper , as I needed more information than ever a IBlockState would hold, specifically a wildcard value) 2) Array is the wrong type. You want List<ItemStack> but that doesn't handle your random chance values. You'll want another wrapper, storing the probability and the item.
  8. You'll want a custom class that holds your outputs and their probabilities, and you just need to store that in a HashMap<ItemStack,Outputs> I do something like that here: https://github.com/Draco18s/ReasonableRealism/blob/master/src/main/java/com/draco18s/flowers/FlowerDataHandler.java#L34 Tuple is just a generic class that wraps around two or more datatypes as a relationship. I probably should use a custom class for it, but I was thinking more in terms of the map from blocks -> flowers
  9. The other thing that I had trouble with, was being able to see the JSON equivalent of what I was doing. That is, I couldn't figure out how to write my changes to a file. I'm sure there's a way, I just couldn't figure out how.
  10. They're super easy. http://mcforge.readthedocs.io/en/latest/networking/
  11. That is "save to disk" not "send packets" it's right there in the name. "Packets."
  12. Good odds that your ModBlocks.CRATE object is null at the time you create the recipe, so the item it's trying to render is null and it crashes.
  13. So I shoved a test event handler for this event into my project (because seriously, it shouldn't be that hard) and.... Nothing. The Forge event bus does not see my handler so my code is never executed. I can't figure out why. This is irrelevant. If the getter returns a copy, then doing this makes no difference. If it doesn't, then this makes no difference. It's not a "new instance" when you store a reference in a variable.
  14. By the way, you've misspelled "weight"
  15. Let's look at what Config.getFloat does Float.parseFloat(prop.getString()) < minValue ? minValue : (Float.parseFloat(prop.getString()) > maxValue ? maxValue : Float.parseFloat(prop.getString())); Oh, hey, its just parsing a string.
  16. And how would you do that differently? Use an number-based ID? I don't have an alternative. I don't know. But I can still not like it.
  17. (Imports aren't actually compiled in, they're syntatic sugar. Using fully qualified names instead won't fix the problem, whereas importing a class that isn't used, won't)
  18. The config class does it for you. Same thing with all the config options. If they aren't there, you provide a default value.
  19. From existing loot tables. Ok. Subscribe to the LootTableLoadEvent. And then do magic. And by magic, I mean I figured most of this out by trial and error and a single existing post on the forums. https://github.com/Draco18s/ReasonableRealism/blob/master/src/main/java/com/draco18s/farming/FarmingEventHandler.java#L285 with references to https://github.com/Draco18s/ReasonableRealism/blob/master/src/main/java/com/draco18s/hardlib/util/LootUtils.java If anyone else has any advice on how to do this better, I'm all ears. My biggest complaint/issue with the loot table system is that in order to detect a given loot table, I need to compare strings.
  20. It works like this: Rather than getting a value from the config file, get a Property. The property then contains both get and set methods.
  21. Again, you can totally do that, and the code I linked does something similar.
  22. What are you trying to do? Create your own loot table, or modify an existing loot table?

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.