Civcraft / RealisticBiomes

Do not open issues here; open them on the maintained fork @ DevotedMC
https://github.com/DevotedMC/RealisticBiomes
7 stars 14 forks source link

getRate() rewrite (squashed for Max) #45

Closed ProgrammerDan closed 9 years ago

ProgrammerDan commented 9 years ago

Five squashed commits. Rebased against current master and merged.

The first commit's message is:

getRate() rewrite

This is the 2nd commit message:

Cleanup of unused stuff

Cleaned up and removed unused stuff for water irrigation and greenhouse_ignore_biome. Also changed getRate, so persistent plants dont use the base rate multiplier anymore (as intended)

This is the 3rd commit message:

Added additional checks for improved performance.

This is the 4th commit message:

Reworked getRate again and removed getBaseRate

This is the 5th commit message:

getRate rework

CivcraftBot commented 9 years ago

Can one of the admins verify this patch? Type 'ok to test' to test.

ProgrammerDan commented 9 years ago

@WildWeazel @ttk2 squashed for @Maxopoly , otherwise unchanged.

WildWeazel commented 9 years ago

ok to test

ttk2 commented 9 years ago

nice, I assume we want to put this in testing then?

benjajaja commented 9 years ago

Yes please El 1/8/2015 1:28 p. m., "ttk2" notifications@github.com escribió:

nice, I assume we want to put this in testing then?

— Reply to this email directly or view it on GitHub https://github.com/Civcraft/RealisticBiomes/pull/45#issuecomment-126904056 .

ttk2 commented 9 years ago

on civtest, write up a testing post and crosspost it to the sub.

ttk2 commented 9 years ago

so no one wants a testing post for this?

ProgrammerDan commented 9 years ago

@Maxopoly I know you're super busy already, but mind carrying this over the line on the testing post? Thanks

Maxopoly commented 9 years ago

I found a bug while reading again over it, I'll make a pullrequest to fix that first and then write a testing post tomorrow

if (isGreenhouseEnabled && block.getLightFromBlocks() == (MAX_LIGHT_INTENSITY - 1)) {
            for( Vector vec : adjacentBlocks ) {
                Material mat = block.getLocation().add(vec).getBlock().getType();
                if( mat == Material.GLOWSTONE || mat == Material.REDSTONE_LAMP_ON ) {
                    rate *= greenhouseRate;
                    break;
                }
            }
        }
        else {
            int sunlightIntensity;
            if (block.getType().isTransparent()) {
                sunlightIntensity = block.getLightFromSky();
            } else {
                sunlightIntensity = block.getRelative(BlockFace.UP).getLightFromSky();
            }
            // apply multiplier if the sunlight is not at maximum
            if (sunlightIntensity < MAX_LIGHT_INTENSITY) {
                rate *= notFullSunlightMultiplier;
                if (needsSunlight) {
                    rate *= Math.pow((sunlightIntensity / MAX_LIGHT_INTENSITY), 3.0);
                }
            }
        }

If green house is enabled and the block somehow gets a lightlevel of maximum-1, it can pass the glowstone check without actually having glowstone and without having the rate reduced by anything, because of light conditions.

Maxopoly commented 9 years ago

https://forum.civcraft.co/t/open-for-testing-realistic-biomes/815