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.

Featured Replies

Posted

Hi all. My next goal is to make a block that I can place in a field of crops.

It will periodically check the surrounding blocks for fully matured plants and harvest them.

It will collect the plants and the seed and also replant the soil.

 

I have no idea where to start here. I have a basic mod with working ore blocks and ingots.

I can use the ores to build recipes but once I have my custom AutoFarmer I don't know how to use timers or access surrounding blocks. Any tutorial suggestions or videos I should check out to help get started?

 

Also yes I have been googling the crap out of this topic for awhile to no avail.

 

Thanks

 

  • Author

Excellent thank you. Will research these now. Also funny thing. I thought I posted this in Modder Support so thank you for moving it.

 

Dave

since you're asking about automatic digger/drill/excavator/farmer, let me give you a piece of advice (even if you know it, it could be useful to others)...

 

there are right ways to do it and wrong ways to do it.

 

wrong ways... let's take gravel block for example (doesn't matter could have been something else)... one wrong thing to do is get a block instance from the world instance and ask the block "what do you drop?". now, when you read that, it doesn't sound wrong but it's wrong. the gravel block object would answer that it drops 1 gravel block and depending on a dice roll and the fortune level, zero or more flint items. but what if a player has a mod that replaces flint pieces with smaller flint chips as a drop? or a mod that adds copper pieces as a possible drop? or what if some mod wants to prevent breaking of blocks under some conditions? you are supposed to play nice with all of these cases.

 

right ways... one way to do it would be to invoke forge events (just as these calls are inserted into vanilla code) and if the event chain says that it's ok that you break a block, you take a list of items from it. another way would be to create a FakePlayer (yes, that's a thing) and tell it to break blocks at given coordinates, one by one. that way, you can give the FakePlayer an iron pickaxe if your machine has an iron drill, etc. and you get correct times for breaking block with whatever tool you gave him.

 

edit: to clarify, doesn't matter if it's a mining machine or a farming machine; same principle applies.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

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.