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. I unno. Does your code run now?
  2. if(harvest_enabled) { do_stuff(); } not while(harvest_enabled) { do_stuff(); } Yes, I realized that you want to "do stuff while harvest is enabled" but "while" has a different meaning in code. It means "do this thing over and over again until the condition is false, even if that means hogging the CPU and doing nothing else until the universe experiences heat death." What you need to do is press the key and stop doing anything else the rest of this tick. Then you count ticks. Then when the counter is big enough, release the key. If it helps, write out what you want to do as a Finite State Machine.
  3. You did something wrong, because you didn't do this: Please do the latter, do not use BlockContainer.
  4. *Defeats the whole purpose. DO NOT USE A LOOP ANYWHERE IN YOUR CODE. The tick event handler IS the loop.
  5. Bingo. @EventHandler public void onTick(TickEvent event) { //a tick happened //increment counter pressTime++; }
  6. Dude. Seriously. All of that code runs in a single tick. It doesn't actually "wait" (even if real-time it takes it four seconds). That's why the game appears to freeze. In order for you to perform an operation over time you need to count ticks. Open up TileEntityFurnace and look at the burnTime variable. Look at what it does.
  7. You need to override and implement getUpdateTag
  8. "GUI" and "NBT" should never be used in the same sentence. And GUIs don't contain Inventory items, they display Inventory items. TL;DR: You're doing everything wrong. Block -> creates TileEntity TileEntity -> contains Items Container -> wraps around TileEntity GuiContainer -> displays Container
  9. You can't use a while loop to check passage of time. They explicitly do not exit (forcing thread halt) until their conditions are met, in this case, the release of the pressed key.
  10. I can't tell from the code snippet. There may be also something else they did that I can't see.
  11. You can't store information in the Block class, you must store it elsewhere (TileEntity, Player Capability, etc.)
  12. This is basically wrong. For onCollide to work, the block needs to be smaller than a full cube, that's it. I don't know why his code isn't working though.
  13. if(NullPointer) { GoTo $Location; CheckForPossibleNullObjects(); Debug(); }
  14. You won't be ABLE to get it to work without switching.
  15. OreDictionary.getName(stack) iirc. I don't have a working environment at the moment, but there IS a method to get all the names a given stack is registered as.
  16. Or check % 23999 .
  17. Actually, world#getWorldTime() is not %24000, TheMasterGabriel is incorrect about that (or rather, his assumption based off a particular piece of lying Javadoc). If you trace its usage you will find that it is not moduloed anywhere in the code, and in fact is used to track the current world time (cough, as expected, cough) and (IIRC) is used to calculate the current moon phase. World#getTotalWorldTime() on the other hand, returns the realtime the world has existed, meaning that if you sleep, the timer is not incremented respective to world#getWorldTime() .
  18. There are three methods that are important. If you do a search in BlockFurnace for where it uses the PropertyDirection, you'll find what you need. We are not here to GIVE you code, we're here to HELP you code.
  19. Yeah, you've done NONE of the things required for a block to have blockstates. Congrats, you have a PropertyDirection static enum. You never use it.
  20. Show your Block class.
  21. Please use strongly typed lists.
  22. Quick note: Your fake light block should return true for all checks that ask if the block is Air. Otherwise you'll get some funky behavior with other mods. e.g. a while back Computer Craft turtles would bump into the light columns produced by...I think it was Atomic Stryker's Dynamic Lights mod: the floodlights would point downwards and produce a column of fake light blocks until it encountered another block. Those blocks did not detect as "air" or anything else that the turtle could path through, so it would get stuck on it.
  23. I'm away from my dev space, but if you know how to register the burn time for an item, use your IDE to Find All References and you should be able to find where the vanilla items are set.

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.