Giter Club home page Giter Club logo

Comments (11)

doc-bok avatar doc-bok commented on August 17, 2024

Proposed Solution 1:

Fertility

  • Becomes fertilised if butterfly of same species within 3 blocks.
  • Can only lay egg if fertilised.
  • Becomes unfertilised after egg laid.
  • Binary so can only hold one egg at a time.
  • Should reduce egg laying, but allow players to breed them by creating an enclosure.

Problem:

  • Players could still overwhelm servers with breeding enclosures.

Modifications:

  • Could be counteracted by having a maximum number of eggs laid by each butterfly (1-2)
  • Having a chunk limit would also prevent players from being able to overwhelm servers.

from butterflies.

doc-bok avatar doc-bok commented on August 17, 2024

Proposed Solution 2:

More Predators

  • Introduce more things that can kill butterflies
  • Passive Mobs: Bat, Cat, Frog, Ocelot, Parrot
  • Neutral Mobs: Cave Spider, Fox, Spider, Wolf
  • Hostile Mobs: Witch, Zombie, Zombie Villager

Problem:

  • There likely won't be enough predators to keep their numbers down

from butterflies.

doc-bok avatar doc-bok commented on August 17, 2024

Proposed Solution 3:

KISS

  • Each butterfly can only lay 1 or 2 eggs in its lifetime.

Problems:

  • If its only one then their numbers will naturally go down over time.
  • If its two then they will still grow exponentially.

Modifications:

  • Could make it one by default, but (e.g.) 1 out of 16 could lay 2 eggs.

from butterflies.

doc-bok avatar doc-bok commented on August 17, 2024

Proposed Solution 4;

Chunk Limit

  • Limit the number of butterflies per chunk.
  • If there are 16 butterflies in a chunk, no more eggs can be laid in that chunk.

Problems:

  • Should mitigate the issue, but may not be enough.

from butterflies.

doc-bok avatar doc-bok commented on August 17, 2024

Proposed Solution 5:

All of the Above

  • Basically do all of the things.

from butterflies.

CRose91 avatar CRose91 commented on August 17, 2024

Tox here, did a bit of testing as I mentioned over on Curseforge, and I have some data for you.

First off, I like the solutions you came up with.
Second, the data I have from my testing shows that the reason that my server was ultimately overrun with thousands of butterflies in a small area in a very short amount of time, was due to Minecrafts difficulty mechanics.

Your butterflies having short life spans ultimately keeps their numbers down currently, which is why only a handful had been seen on my server while adventuring / testing. The second that my testers and I switched the difficulty over to peaceful, the butterflies no longer had their "short lifespans" and the numbers greatly rose in a very short amount of time.
Butterflies were not dying off, and continued to lay eggs. Those eggs hatched into more butterflies, which continued to not die off and also laid eggs. So on and so forth.

As a test and temporary solution, I set up a series of command blocks to run kill commands at a 5000 block area for a few of the butterfly varieties that had been overrunning my "home area", alongside their caterpillar and chrysalis stages. The problem with this is, its a very temporary solution as the eggs of said butterflies are not considered entities, and therefor any eggs remain, which continues the cycle of hatching, not dying, laying more eggs, and so forth.

Continuing my testing, I switched the difficulty back to easy or higher, and rather than my command blocks killing off hundreds/ thousands, its now killing less than 10-20 consistently, which means the difficulty setting being set higher than peaceful is managing the butterfly numbers.

In conclusion, its not feasible to use the mod in its current state on servers, so long as the difficulty is set on peaceful for any extended period of time as the numbers are in multiples of however many eggs each butterfly can currently lay. Even set to two eggs per life cycle for example, being set on peaceful the butterflies would still be in multiples of 2. It would just take a little more time for the numbers to reach the thousands. If the difficulty is set to easy or higher, it seems to be fine.

Edit: Also, my trees look like swiss cheese now. :c

from butterflies.

doc-bok avatar doc-bok commented on August 17, 2024

Wow, thanks for doing all that testing! So it actually seems that the real fix is to ensure that butterflies "die" even on peaceful, or at least don't multiply. I always assumed that peaceful only affected players - I'm surprised it affects mobs as well.

from butterflies.

doc-bok avatar doc-bok commented on August 17, 2024

Okay, so I'm not having any luck testing this locally. I can get the butterflies to die in peaceful mode locally, both with client only and client/server. Could you be doing anything else or using another mod that might affect this?

From digging into the code the things that could prevent them from dying would include the following:

  • Damage being prevented (doubtful since the code effectively gives a /kill command, which is what you were doing)
  • Them being set to persistent - this usually only happens if a player catches and releases a butterfly, or if they are spawned using Creative Mode spawn eggs. It isn't passed on, so any eggs they lay wouldn't spawn persistent entities.
  • Them not being allowed to age - if this was the case then animals like cows and sheep also wouldn't be aging

from butterflies.

CRose91 avatar CRose91 commented on August 17, 2024

Not a problem, as a coder/ creator myself, I enjoy troubleshooting and testing as it allows me to further my knowledge, which is handy for future projects.
It seems the way minecraft was coded, the constant health regen that is in effect with the peaceful difficulty is simply for entities in general, which would include both players and mobs. However if them dying off is a result of a kill command similar to what I was using rather than slowly losing health over time, than that constant health regen from peaceful shouldnt have an effect.
I just assumed that since it only happened -after- my server was switched to peaceful, and switching it back to other difficulties resulted in a more normalized amount of them, than difficulty level played a role. And it still might be playing a role in some way, but with your local testing yielding different results, than as you thought there must be something that I am doing differently, or perhaps another mod I am using playing a role.

I will do some more testing and go through my mods and see if any of them would have any role whatsoever in the butterflies behaviors. I don't think there is, but never know. Ill test other animals as well, however I don't believe aging plays a role here, due to the shear numbers while in peaceful and I was also having to use the kill commands on both the Caterpillar and Chrysalis forms as well. If aging played a role, than the vicious infinite cycle of butteflies laying eggs and becoming new butterflies to lay more essentially multiplying the numbers constantly wouldn't be a factor. Something, somewhere, was preventing the death of butterflies, and as mentioned I had assumed it to be the changing of difficulty to peaceful.

Not sure about persistence, as the two testers I have don't have access to creative mode, only me, I haven't touched changing gamemodes myself, therefore nothing would have been spawned via creative spawn eggs. They don't have access to creative because the testing we are currently doing is more so along the lines of making sure that the mods chosen for my modpack, are playing nice with one another, and from my experience, that is completely different with local and server.

As mentioned, I will continue testing and doing a little research into mods that might be affecting the butterflies.

from butterflies.

doc-bok avatar doc-bok commented on August 17, 2024

Okay, I've been playing a bit more with the mod recently, and I'm noticing that if the conditions are right, the butterflies will multiply very quickly. I have a small area (around a chunk or 2) that has well over a few dozen butterflies right now. I don't think the game being in Peaceful has any effect on this - it's not that they don't die, just that too many spawn. I'm going to implement the ideas here - I think the chunk limit in particular will help keep things under control.

I'm also going to look at adding some configuration for this as well, so that servers can modify exactly how often butterflies spawn/spread, or even disable it entirely.

from butterflies.

doc-bok avatar doc-bok commented on August 17, 2024

Proposed Solution 6:

Butterfly Movement

  • Butterflies seem to stay in the area they spawn, which exacerbates them spawning new butterflies if leaves happen to be nearby
  • Look at the movement code and see if they can be made to explore the world a bit more

from butterflies.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.