other features

This commit is contained in:
gnembon committed 2019-05-22 15:21:07 -03:00
1 parent 39727cb524
commit b257e6f984
19 files changed
+501 -18

No files matched your search

@@ -0,0 +1,24 @@
package carpet.mixins;
import carpet.CarpetSettings;
import net.minecraft.world.gen.feature.KelpFeature;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Redirect;
import java.util.Random;
@Mixin(KelpFeature.class)
public class KelpFeatureMixin
{
@Redirect(method = "method_13460", at = @At(value = "INVOKE", target = "Ljava/util/Random;nextInt(I)I"))
private int getRandom(Random random, int bound)
{
if (bound==10)
return random.nextInt(bound);
int limit = CarpetSettings.getInt("kelpGenerationGrowLimit");
if (limit == 0)
return random.nextInt(bound);
return 25-limit+random.nextInt(Math.min(23,limit+1));
}
}