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. Your AABB is static, that won't work. Each TE needs to have its own AABB collection volume, or they will only pull items from the world origin
  2. You're attempting to spawn the recipe result before you've checked to make sure that there IS a result.
  3. In your TE: CauldronRecipes.getResult(myItems) In CauldronRecipes: public static ItemStack getResult(List<ItemStack> items) { foreach(ICauldronRecipe recipe in RECIPES) { if(recipe.matches(items)) { //do stuff } } }
  4. I use a library API reference. But your CauldronRecipes class can just contain a static reference to the list of ICauldronRecipe instances. https://github.com/Draco18s/ReasonableRealism/blob/1.12.1/src/main/java/com/draco18s/ores/entities/TileEntitySifter.java#L91
  5. I have a class like this for one of my "machines": https://github.com/Draco18s/ReasonableRealism/blob/1.12.1/src/main/java/com/draco18s/ores/recipes/OreProcessingRecipes.java (Actually, three machines)
  6. That's what CaudronRecipes is for. It should contain a list of all ICauldronRecipe instances.
  7. We still don't know how that information will be represented though. Technically metadata is already gone for blocks, but still exists as an implementation detail. That may still be true.
  8. The TE passes a list of item stacks (its contents) to the recipe's matches method. That method compares the contents as I originally described. Captured Drops should be stored in an ItemStackHandler inventory. 1. ItemStackHandler as any other inventory. Creating a list from this should not in any way require my help. It's basic Java 2. See above. 3. For each recipe, does it match, if so, get that recipe's output. You will already have a reference to the recipe in order to check matches, just use that same reference. 4. new EntityItem(...); entity.spawnInWorld(...) 5. If the recipe matches, remove its recipe inputs from the TE's inventory
  9. Post your current code and describe the problem that is still affecting you. I also recommend using the debugger.
  10. static wasn't an appropriate keyword anyway. You want the list to be per recipe.
  11. You use Block States. You need to create an Enum property. This is the best example I have, my ore block takes in the enum as a constructor parameter, so it makes it more difficult to follow. https://github.com/Draco18s/ReasonableRealism/blob/1.12.1/src/main/java/com/draco18s/ores/block/BlockMillstone.java#L42-L58 The enum used there is over here: https://github.com/Draco18s/ReasonableRealism/blob/1.12.1/src/main/java/com/draco18s/hardlib/api/blockproperties/ores/MillstoneOrientation.java but it's got a lot of extra information tied in. For ores though, you probably just need one more like this: https://github.com/Draco18s/ReasonableRealism/blob/1.12.1/src/main/java/com/draco18s/hardlib/api/blockproperties/ores/EnumOreType.java
  12. Well, you need to make sure that your matches method isn't modifying the recipe. You can do this by cloning the list that has items removed from it, and removing from the clone.
  13. GUIs don't store data. You need to store the data somewhere else.
  14. CauldronRecipe(List<Item> items, ItemStack output) See that list? You are currently throwing it in the garbage can. for (int i = 0; i < itemStacks.size(); i++) { for (ItemStack itemstack1 : itemStacks) { See these two loops? They iterate over the same items. They will always match. You need to get the first list (from the constructor) into the second loop.
  15. And how, pray tell, do you expect the list to be tracked? Why are you matching a list against itself? Why is your "list of recipes" also a recipe?
  16. You need to implement it yourself. There's a method available for this, go look at any other TE block.
  17. Why are you matching a list against itself? You HAVE a resultItem field! Not to mention that this list is unused and shouldn't be here anyway. This is a recipe class, it's only a template, you should create a new instance and pass it a list of items and result.
  18. Your TE's inventory capability. You probably don't even need it at all, unless you plan on doing NBT data items
  19. You know how recipes extend IRecipe and how there is a CraftingManager that knows about all the recipes that exist? You need to mimic that.
  20. Ok so 1) You need a list of recipes to check against 2) Your ICauldronRecipe interface does not contain any method for getting the result. 3) Your ICauldronRecipe is not a valid interface. Interfaces do not define methods, only declare them 4) You didn't post the crash
  21. If the recipe matches, get the recipe's output.
  22. Built in? No. Doable? Yes.
  23. Step 1: create a list. Step 2: populate it with the desired items to match against. Step 3: for each item in the block's contents (crafting grids are 3x3, your container will just be a list), do something. Step 4: for each item in the list created in steps 1 and 2, do something. Step 5: do the the items match? Step 6: if they do, remove from the list. Step 7: if they don't, return false, there's something extra. Step 8: the loops are complete, are there any items not found?
  24. You haven't even looked at the class, have you? Take a look at the matches method (link is a custom recipe, but its still shapeless). None of that code deals with JSON data files*, especially not matches. Look at what it does. Look at how it does it. Ask yourself, "is this methodology suitable for solving my problem?" *The code that deals with JSON files is actually ShapelessRecipe.Factory, which is a completely different class. It's just in the same file.

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.