public override void OnItemHarvested(int x, int y, int z, int blockValue, ref BlockDropValue dropValue, ref int newBlockValue) { if (y > 80 && SubsystemWeather.IsPlaceFrozen(base.SubsystemTerrain.Terrain.GetSeasonalTemperature(x, z), y)) { dropValue.Value = Terrain.MakeBlockValue(62); } else { base.OnItemHarvested(x, y, z, blockValue, ref dropValue, ref newBlockValue); } }
public static int GenerateRandomPlantValue(Random random, int groundValue, int temperature, int humidity, int y) { switch (Terrain.ExtractContents(groundValue)) { case 2: case 8: if (humidity >= 6) { if (!(random.Float(0f, 1f) < (float)humidity / 60f)) { break; } int result = Terrain.MakeBlockValue(19, 0, TallGrassBlock.SetIsSmall(0, isSmall: false)); if (!SubsystemWeather.IsPlaceFrozen(temperature, y)) { float num = random.Float(0f, 1f); if (num < 0.04f) { result = Terrain.MakeBlockValue(20); } else if (num < 0.07f) { result = Terrain.MakeBlockValue(24); } else if (num < 0.09f) { result = Terrain.MakeBlockValue(25); } else if (num < 0.17f) { result = Terrain.MakeBlockValue(174, 0, RyeBlock.SetIsWild(RyeBlock.SetSize(0, 7), isWild: true)); } else if (num < 0.19f) { result = Terrain.MakeBlockValue(204, 0, CottonBlock.SetIsWild(CottonBlock.SetSize(0, 2), isWild: true)); } } return(result); } if (random.Float(0f, 1f) < 0.025f) { if (random.Float(0f, 1f) < 0.2f) { return(Terrain.MakeBlockValue(99, 0, 0)); } return(Terrain.MakeBlockValue(28, 0, 0)); } break; case 7: if (humidity < 8 && random.Float(0f, 1f) < 0.01f) { if (random.Float(0f, 1f) < 0.05f) { return(Terrain.MakeBlockValue(99, 0, 0)); } return(Terrain.MakeBlockValue(28, 0, 0)); } break; } return(0); }