Everything posted by Draco18s
-
[Solved] [1.10.2] Client-side tile entity not saving on quit
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.
-
Creating a crafting handler the exports multiple items
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?
-
[1.10.2] How to trample crops when wearing certain armor
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.
-
Creating a crafting handler the exports multiple items
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%).
-
Creating a crafting handler the exports multiple items
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; } }
-
Loot Table Primer
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.
-
Creating a crafting handler the exports multiple items
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.
-
Creating a crafting handler the exports multiple items
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
-
Loot Table Primer
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.
-
Capabilities 1.10 issue
They're super easy. http://mcforge.readthedocs.io/en/latest/networking/
-
Capabilities 1.10 issue
That is "save to disk" not "send packets" it's right there in the name. "Packets."
-
[SOLVED]Game Crashes When Hovering a Custom Block Recipe
Not pass it a null item.
-
[SOLVED]Game Crashes When Hovering a Custom Block Recipe
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.
-
[1.10.2][SOLVED] add tooltip for not mine items?
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.
-
[1.10.2][SOLVED] add tooltip for not mine items?
By the way, you've misspelled "weight"
-
[1.10.2][SOLVED] reading/creating/writing config for my mod??
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.
-
Loot Table Primer
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.
-
[1.10.2][SOLVED] reading/creating/writing config for my mod??
Show your code.
-
TileEntities that are not in World - Can I do this better?
That...sounds excessive.
-
[1.10.2] Add color to ItemBlock (IItemColor)
(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)
-
[1.10.2][SOLVED] reading/creating/writing config for my mod??
The config class does it for you. Same thing with all the config options. If they aren't there, you provide a default value.
-
Loot Table Primer
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.
-
[1.10.2][SOLVED] reading/creating/writing config for my mod??
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.
-
[1.10.2][SOLVED] reading/creating/writing config for my mod??
Again, you can totally do that, and the code I linked does something similar.
-
Loot Table Primer
What are you trying to do? Create your own loot table, or modify an existing loot table?
IPS spam blocked by CleanTalk.