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. It's a Java convention thing, that. Static values are in all upper case, class names are UpperCamelCast, variables and function names are lowerCamelCase. The BlockFoo and BlockBar and ItemBaz are an MCP naming convention, but one that I happen to like. After that, making method calls that invoke more method calls is just ridiculous. The only reason to do that is if the method actually adds something from its scope context (that isn't accessible outside it). For example, if I want to have items that define their model via NBT data I still want to register it as normal, but I need additional information from the class / class instance, so I have this method: https://github.com/Draco18s/ReasonableRealism/blob/1.12.1/src/main/java/com/draco18s/industry/item/ItemCastingMold.java#L89 Or this method, for custom IStateMapper implementations: https://github.com/Draco18s/ReasonableRealism/blob/1.12.1/src/main/java/com/draco18s/flowers/block/BlockOreFlower1.java#L160 And when I need those functions I can just cast to the interface. Or use generic covariance magic: https://github.com/Draco18s/ReasonableRealism/blob/1.12.1/src/main/java/com/draco18s/hardlib/client/ClientEasyRegistry.java#L75 The cast here is actually unnecessary due to said magic (block is of Type T which is defined as block a Block and an IBlockWithMapper): https://github.com/Draco18s/ReasonableRealism/blob/1.12.1/src/main/java/com/draco18s/hardlib/client/ClientEasyRegistry.java#L79
  2. This is very confusing: https://github.com/THEJean-Kevin/goblin/blob/master/src/main/java/com/mineaurion/tjk/goblin/block/ModBlock.java#L17 1) Class names should start with an upper case letter 2) You really should use the most general-case Type possible (e.g. Block mine0 = new Mine_Lv_0();) so that people reading your code can understand it better. 3) Then if you need to, you can cast (I don't like seeing createItemBlock() in a base block class that all your blocks extend, but it's not that terrible). 4) Even better, make your class names include the base class, e.g. BlockMine_Lv_0 Oh god this is disgusting: https://github.com/THEJean-Kevin/goblin/blob/master/src/main/java/com/mineaurion/tjk/goblin/block/ModBlock.java#L31 You take a client-side-only event, call a piece of code that is not marked Side Only, then just forward the method call to your Proxy. Just do Main.proxy.registerItemRenderer(Item.getItemFromBlock(mine0), 0, name); https://github.com/THEJean-Kevin/goblin/blob/master/src/main/java/com/mineaurion/tjk/goblin/proxy/clientProxy.java#L23 Use item.getRegistryName() instead of References.modid+":"+name
  3. Don't spawn items on the client. Only spawn them on the server.
  4. I don't understand your problem. What disappears?
  5. Well, the other half is a complex formula (the part inside max(...)) that means that the more damage you take at once, the less each point of armor counts. But yes. The maximum damage reduction you can get is 80% Also, hit points are a float, meaning you can (and will) take 0.01 damage in certain circumstances (death by a thousand tiny cuts).
  6. Well, yes, there is a maximum amount of damage reduction. That's what min(...) does.
  7. Set a breakpoint and run it in the debugger. Figure out what it's not doing that it should be.
  8. The damage formula is damage = damage * ( 1 - min( 20, max( defensePoints / 5, defensePoints - damage / ( 2 + toughness / 4 ) ) ) / 25 ). You can figure it out. Toughness is 0 for all types of (vanilla) armor except diamond (which has 2). Defense points is the number of armor displayed in the UI.
  9. If the iattributeinstance is null, then get the modifier from the iattributeinstance...
  10. BlockFlowerPot line 433. It says: /*============================FORGE START=====================================*/ And then some functions.
  11. The fact that the chest being not-empty causes the undesired behavior, we can look at your code and find that you have a conditional for exactly this case: if (!tileentityiubertable.isEmpty()) { Therefore, this code is responsible for dropping one of the two items. spawnAsEntity(worldIn, pos, itemstack); Oh, look, it does. However we know that this is also the version we want to drop therefore it must be something else that's causing the empty copy to drop. Hmm. Empty chest...wait, we get one of these when the chest is empty too! There must be a line that is probably responsible and outside that if-block. Getting a TE...no Casting a TE...no Only one other line: super.breakBlock(worldIn, pos, state); This must be responsible. Unfortunately as you did not include your whole class, I cannot be sure that the parent class is not just Block.
  12. TiC almost certainly uses multiple pieces to create their items. e.g. there's a wooden shaft, a metal blade, and a leather grip. So the item model is actually 3 models combined. They only register 3* images to get baked into models, then the item uses all three when created. Also, TiC is on GitHub: https://github.com/SlimeKnights/TinkersConstruct *Obviously there are more, the "3" in this context is the example three.
  13. Those are both ModelLoader tasks. Which bake models. Which you would still have to do. So yes.
  14. Assuming that getItem() returns the Item and not an ItemStack... if(event.crafting.getMetadata() == whatever) { }
  15. Idk

    Draco18s replied to ejer's topic in Modder Support
    int totalCoins = 0; totalCoins = totalCoins + coins; Wot
  16. You would still need to register each image so that it can be baked into a model.
  17. Removing a crafting table recipe is easy: Subscribe to the Register<IRecipe> event and (casting the event's registry to IForgeRegistryModifiable) simply remove the desired recipe from the registry via its ResourceLocation Fiddling with the anvil is harder.
  18. cps

    Draco18s replied to ejer's topic in Modder Support
    What version are you working with?
  19. cps

    Draco18s replied to ejer's topic in Modder Support
    Press F3 on your keyboard. Magically, Minecraft displays both of those things for you. That said, it doesn't display a "clicks per second" counter, but I don't even see the point of one. It's either going to read 0 (no clicks this second) or 1. MAYBE you'd get a 2 once in a while. Something something spam-clicking during combat something something completely pointless.
  20. Use the debugger.
  21. *cough* 0x00FF00

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.