How do I make: Chicken feeding bin

Started by pyloner cat on

Topic category: Help with modding (Java Edition)

Last seen on 00:21, 31. Jan 2024
Joined Sep 2019
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
How do I make: Chicken feeding bin

The thing is pretty simple, let me explain it

When right-clicked with seeds
Adds a seed to the bin.

Passive behavior
When it has seeds, chickens will come to it

When chicken is nearby
The chicken will eat from the bin, removing some seeds from the bin, and speeding up it's egg laying timer, but also putting eating from the bin on a cooldown. During that cooldown, chickens are no longer attracted to it, but will resume being attracted to it once the cooldown ends.

Last seen on 20:37, 26. Jul 2024
Joined May 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
This is a lot more…
Mon, 10/02/2023 - 11:04

This is a lot more complicated than it sounds, but not totally impossible. 

  • You'll need to either make multiple blockstates depending on how full the bin is, (if you want filling it to change it visually), or just make it a storage block.
  • For attracting chickens, you'll need to run an entity iterator that makes all chickens pathfind to the block within a certain radius, and then checks for chickens directly above or adjacent, (or within the block's hitbox if it's only partly solid), subtracting seeds from itself. I'm not sure whether the egg timer is NBT data; if it is, you can override it, but if it's hard coded, you won't be able to, and may just need to randomly drop some egg items when chickens eat.
  • To do the cooldown timer, you could program in a complicated NBT counter... or just give the chickens a passive effect like 'Unluck' whenever they eat from the bin, (passive, so the particles don't show), then have the entity iterator first check they don't have the effect. I unfortunately use this workaround way more than I should.

I'd recommend taking a look at Quark's github if you want some pointers, they have a pretty decent animal feeder system.

Last seen on 00:21, 31. Jan 2024
Joined Sep 2019
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Alright, thanks.
Sat, 10/07/2023 - 13:23

Alright, thanks.