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. reverse your if statement. All you're doing is asking if the book has Mending, Unbreaking, or Fortune, and allowing the whole book to go through. You need to ask if it contains an enchantment that is not one of those.
  2. try new ModelResourceLocation(item.getRegistryName, lookup.variantnames()); although you may have to reconfigure your json files.
  3. This took me oh so long to find. /** * Allow or forbid the specific book/item combination as an anvil enchant * * @param stack The item * @param book The book * @return if the enchantment is allowed */ public boolean isBookEnchantable(ItemStack stack, ItemStack book) { return true; } By which I mean I opened up the Item class and searched for "Enchantment" and it was the first result.
  4. Storing the information and syncing with the client. getEntityData() is not a good use for what you are doing.
  5. new ModelResourceLocation(Reference.RESOURCE.RESOURCE_PREFIX + name + lookup.variantnames()[i], "inventory"); You know... items have a getRegistryName() method... new ModelResourceLocation(item.getRegistryName + lookup.variantnames()[i], "inventory");
  6. "the mod author"? What mod? If you mean Forge, then yes, Forge is allowed to do it because it's making things public for modders. It's part of Forge's patches. Anyway, this is good reflection: 1) https://github.com/Draco18s/HarderStuff/blob/master/src/main/java/com/draco18s/wildlife/WildlifeEventHandler.java#L136 2) https://github.com/Draco18s/HarderStuff/blob/master/src/main/java/com/draco18s/wildlife/WildlifeBase.java#L330-L331 3) https://github.com/Draco18s/HarderStuff/blob/master/src/main/java/com/draco18s/wildlife/WildlifeEventHandler.java#L1149 Mind, it could be better (I can't find any of my reflection stuff in 1.10 right now). But that should give you an idea. 1) Declare a field 2) Set it to something, and do that once.* 3) Use it a lot *This is where I could do better. I have it set to look for the SRG name, then in the error handling look for the MCP name. I could instead use ReflectionHelper. ReflectionHelper will do a lot for you, it's a great class.
  7. Notice that his tutorial doesn't display the sword or have a GUI of any kind.
  8. Baaasically all of this: https://github.com/Draco18s/ReasonableRealism/blob/master/src/main/java/com/draco18s/ores/entities/TileEntityPackager.java#L212-L227
  9. Not if you do it right. Get the field or method once and save a reference to it. The rest is pretty darn fast.
  10. Do not make core mods. You do not need Access Transformers: use reflection.
  11. The client is crashing: [20:26:03] [Client thread/INFO] [sTDOUT]: [com.daeruin.primalcraft.tileentity.PrimalTileEntity:readFromNBT:120]: tileEntity numSlots before reading from NBT: 4 [20:26:03] [Client thread/INFO] [sTDOUT]: [com.daeruin.primalcraft.tileentity.PrimalTileEntity:readFromNBT:121]: NBT numSlots before reading from NBT: 0 It does not appear that you are syncing your TE correctly.
  12. Did you have one placed in the world before you wrote the "save the number of slots" code?
  13. .equals() won't work on ItemStacks either, by the way. You need to use ItemStack.areStacksEqual() Or compare the item/metadata directly.
  14. Isn't this problem solved by disabling the loading screen?
  15. Do what I said in the bulleted list Don't do any of it, do what diesiben07 said.
  16. "Mess" you mean "mess."
  17. Just so you know: You can't "make Andesite have ore as metadata" because Andesite is already a metadata variant of Smooth Stone. So you're going to need to make your own custom block and texture it appropriately. You have two options: Option 1: Create an overlay texture that is transparent except for the ore bits, use a block model that has two layers, the base layer (andesite, etc.) and the overlay (coal, etc.) Option 2: Create an overlay texture that is transparent except for the ore bits, then use a custom TextureAtlasSprite class to smoosh this overlay onto a copy of the base texture (andesite, etc). I did something like this in 1.7.10, if you're interested. This method took in the block-to-replace (andesite, etc) and created a new block: https://github.com/Draco18s/HarderStuff/blob/master/src/main/java/com/draco18s/hazards/StoneRegistry.java#L49 This method handled the loading and combining of two textures: https://github.com/Draco18s/HarderStuff/blob/master/src/main/java/com/draco18s/hardlib/client/TextureAtlasDynamic.java#L53
  18. I haven't done anything with chunk generation and noise, so I can't really help you there.
  19. No. Your capability exists serverside, this is where you make ALL CHANGES. When a change is made you send a packet to the client to update the display.
  20. Probably because the sapling grow event still completes and replaces your block with a tree. (You need to cancel the event)
  21. Also wrap your booleans. By having them unwrapped it does this: if (world.getBiomeGenForCoords(new BlockPos(x, 30, z)).equals(Biomes.ICE_MOUNTAINS)... "Hmm, is it ice mountains? Yes, yes it is. This whole statement evaluates to true." And bypasses your random call. https://en.wikipedia.org/wiki/Order_of_operations#Programming_languages A || B && C ≡ A || (B && C)
  22. No, when you access 36, you access 36. The problem is, arrays are zero-indexed. Yes, it's the 37th item, but that's a different numbering system.

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.