Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
NichtStudioCode committed Nov 16, 2024
1 parent a137356 commit b74386d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ private val BREED_LIMIT by BREEDER.config.entry<Int>("breed_limit")
private val MIN_RANGE = BREEDER.config.entry<Int>("range", "min")
private val MAX_RANGE = BREEDER.config.entry<Int>("range", "max")
private val DEFAULT_RANGE by BREEDER.config.entry<Int>("range", "default")
private val FEED_BABIES by BREEDER.config.entry<Boolean>("feed_babies")

private val FOOD_MATERIALS = setOf(
Tag.ITEMS_PIGLIN_FOOD, Tag.ITEMS_FOX_FOOD, Tag.ITEMS_COW_FOOD, Tag.ITEMS_GOAT_FOOD, Tag.ITEMS_SHEEP_FOOD,
Expand Down Expand Up @@ -111,6 +112,9 @@ class Breeder(pos: BlockPos, blockState: NovaBlockState, data: Compound) : Netwo
for ((index, item) in inventory.items.withIndex()) {
if (item == null) continue

if (!FEED_BABIES && !animal.isAdult)
continue

fakePlayer.setItemInHand(InteractionHand.MAIN_HAND, item.unwrap())
val result = animal.nmsEntity.interact(fakePlayer, InteractionHand.MAIN_HAND)
if (result.consumesAction()) {
Expand Down
1 change: 1 addition & 0 deletions machines/src/main/resources/configs/breeder.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ energy_per_tick: 10
energy_per_breed: 100
idle_time: 200
breed_limit: 5
feed_babies: false

range:
min: 1
Expand Down

0 comments on commit b74386d

Please sign in to comment.